:root {
  --cobalt: #2445db;
  --paper: #fffefa;
  --ink: #19265b;
  --coral: #ff806d;
  --lemon: #f4d96b;
  --muted: #606a8d;
  --line: #dce0ef;
  font-family: 'Trebuchet MS', Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  min-height: 100dvh
}

button,
input,
textarea {
  font: inherit
}

button,
a,
input,
textarea {
  -webkit-tap-highlight-color: transparent
}

button {
  border: 0;
  border-radius: 14px;
  min-height: 52px;
  padding: 14px 24px;
  background: var(--cobalt);
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s
}

button:hover {
  filter: brightness(.96)
}

button:active {
  transform: scale(.98)
}

button:disabled {
  cursor: default;
  opacity: .4;
  transform: none
}

a {
  color: inherit
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 4px
}

input,
textarea {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  color: var(--ink);
  background: white
}

textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.5
}

h1,
h2,
p {
  margin-top: 0
}

h1 {
  letter-spacing: -.055em;
  line-height: 1.04
}

p {
  line-height: 1.5
}

.brand {
  font-size: 30px;
  letter-spacing: -1.5px;
  font-weight: 900;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px
}

.brand-mark {
  color: var(--coral);
  transform: rotate(-18deg);
  display: inline-block
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 40px;
  gap: 20px
}

#connection {
  font-size: 13px;
  opacity: .75
}

footer {
  text-align: center;
  font-size: 13px;
  padding: 22px;
  color: var(--muted)
}

#error {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #9a2430;
  color: white;
  max-width: min(90vw, 600px);
  border-radius: 14px;
  padding: 18px 24px;
  z-index: 20;
  box-shadow: 0 5px 30px #0003
}

label {
  display: block;
  font-weight: 700;
  margin-bottom: 10px
}

.home {
  background: var(--cobalt);
  color: var(--paper);
  padding: 32px 6vw
}

.home-layout {
  max-width: 1500px;
  margin: 7vh auto;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 9vw;
  align-items: center
}

.home h1 {
  font-size: clamp(58px, 6.3vw, 108px);
  margin-bottom: 25px
}

.intro {
  font-size: 21px;
  opacity: .85
}

.home form {
  margin-top: 38px;
  max-width: 480px
}

.join-input {
  display: flex;
  gap: 10px
}

.join-input input {
  min-width: 0;
  font-size: 26px;
  letter-spacing: 8px
}

.join-input button {
  background: var(--coral);
  color: var(--ink);
  white-space: nowrap
}

.preview {
  transform: rotate(-5deg)
}

.preview>p {
  font-size: clamp(24px, 2.3vw, 38px);
  font-weight: bold;
  line-height: 1.2
}

.sample-strip {
  padding: 24px;
  background: var(--paper);
  color: var(--ink);
  margin: 12px 0;
  border-radius: 10px;
  font-size: 22px;
  box-shadow: 8px 8px 0 #19265b55
}

.sample-strip:nth-of-type(2) {
  margin-left: 28px
}

.sample-strip:nth-of-type(3) {
  margin-left: 56px
}

.sample-strip b {
  display: inline-block;
  width: 40px;
  color: var(--cobalt)
}

.preview .preview-caption {
  font-size: 17px;
  font-weight: normal;
  margin-top: 30px
}

.home footer {
  color: white;
  opacity: .65
}

.host {
  background: var(--cobalt);
  color: var(--paper)
}

.host .topbar {
  padding: 26px 4vw
}

.host .brand {
  font-size: 38px
}

.host #stage {
  min-height: calc(100dvh - 165px);
  padding: 2vh 5vw 3vh;
  display: flex;
  flex-direction: column;
  justify-content: center
}

.host footer {
  color: #ffffff99
}

.host h1 {
  font-size: clamp(54px, 5.7vw, 110px);
  margin-bottom: 28px
}

.host h2 {
  font-size: clamp(30px, 3vw, 56px);
  letter-spacing: -.035em
}

.host p {
  font-size: clamp(22px, 2vw, 34px)
}

.host button {
  background: var(--coral);
  color: var(--ink);
  font-size: 24px;
  padding: 19px 34px
}

.host .secondary {
  background: #ffffff20;
  color: white
}

.host .controls {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 30px
}

.lobby-layout {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 6vw;
  align-items: center
}

.room-code {
  font-size: clamp(84px, 10vw, 180px);
  font-weight: 900;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin: 16px 0 24px
}

.qr-row {
  display: flex;
  align-items: center;
  gap: 25px
}

.qr-row img {
  width: 190px;
  height: 190px;
  background: white;
  border: 12px solid white;
  border-radius: 16px
}

.qr-row p {
  font-size: 22px;
  overflow-wrap: anywhere;
  max-width: 420px
}

.players-cloud {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center
}

.player-chip {
  background: #ffffff18;
  padding: 15px 25px;
  border-radius: 9px;
  font-size: 30px;
  overflow-wrap: anywhere;
  max-width: 100%
}

.lobby-people {
  text-align: center
}

.lobby-people h2 {
  margin-top: 30px
}

.muted {
  opacity: .65
}

.waiting {
  text-align: center;
  margin: auto;
  max-width: 1100px
}

.waiting-symbol {
  font-size: 80px;
  margin-bottom: 18px;
  display: block
}

.rules-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 25px;
  margin: 35px 0
}

.rule {
  font-size: clamp(22px, 1.9vw, 34px);
  line-height: 1.3
}

.rule b {
  display: block;
  color: var(--lemon);
  font-size: 58px;
  margin-bottom: 18px
}

.host .statement {
  text-align: center;
  max-width: 1400px;
  margin: 0 auto
}

.host .statement h1 {
  font-size: clamp(54px, 6vw, 116px)
}

.round-label {
  text-align: center;
  opacity: .75;
  margin-bottom: 25px
}

.round-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 35px;
  margin: 26px 0
}

.timer {
  font-size: 64px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em
}

.timer.urgent {
  color: var(--coral)
}

.reveal-list,
.score-list {
  list-style: none;
  padding: 0;
  margin: 20px auto;
  width: min(850px, 100%)
}

.reveal-list li,
.score-list li {
  display: flex;
  align-items: center;
  gap: 24px;
  background: #ffffff14;
  border-radius: 10px;
  padding: 15px 25px;
  margin: 10px 0;
  font-size: clamp(23px, 2.5vw, 44px)
}

.rank-number {
  color: var(--lemon);
  font-weight: 900;
  min-width: 1.4em
}

.score-list .points {
  margin-left: auto;
  color: var(--lemon);
  white-space: nowrap
}

.reveal-list .new-reveal {
  background: var(--paper);
  color: var(--ink);
  animation: reveal .4s ease-out
}

.reveal-list .new-reveal .rank-number {
  color: var(--cobalt)
}

@keyframes reveal {
  from {
    transform: scale(.95)
  }

  to {
    transform: scale(1)
  }
}

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 18px;
  margin: 25px auto;
  max-width: 1100px;
  width: 100%
}

.podium-place {
  flex: 1;
  min-width: 0;
  text-align: center;
  background: #ffffff20;
  border-radius: 22px 22px 0 0;
  padding: 30px 15px
}

.podium-place.first {
  background: var(--lemon);
  color: var(--ink);
  min-height: 420px;
  order: 2
}

.podium-place.second {
  min-height: 340px;
  order: 1
}

.podium-place.third {
  min-height: 260px;
  order: 3
}

.podium-place h2 {
  overflow-wrap: anywhere;
  margin: 16px 0
}

.medal {
  font-size: 56px
}

.player #stage,
.submit #stage {
  max-width: 540px;
  margin: 0 auto;
  padding: 18px 20px 35px;
  min-height: calc(100dvh - 135px)
}

.player .topbar,
.submit .topbar {
  max-width: 580px;
  margin: auto;
  padding: 20px
}

.player h1,
.submit h1 {
  font-size: 40px
}

.player .waiting,
.submit .waiting {
  padding-top: 12vh
}

.player .waiting p,
.submit p {
  color: var(--muted);
  font-size: 18px
}

.form-panel {
  padding-top: 8vh
}

.form-panel h1 {
  font-size: 48px
}

.form-panel form {
  margin-top: 30px
}

.form-panel button {
  width: 100%;
  margin-top: 14px
}

.session-name {
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 20px
}

.ranking-header {
  position: sticky;
  top: 0;
  background: var(--paper);
  padding: 10px 0 14px;
  z-index: 3;
  border-bottom: 1px solid var(--line)
}

.ranking-header h1 {
  font-size: 27px;
  line-height: 1.15;
  margin: 8px 0 12px;
  letter-spacing: -.035em
}

.ranking-header .round-meta {
  justify-content: space-between;
  margin: 0;
  gap: 10px;
  font-size: 14px;
  color: var(--muted)
}

.ranking-header .timer {
  font-size: 24px;
  color: var(--cobalt)
}

.ranking-header .timer.urgent {
  color: #af3029
}

.choose-label {
  font-size: 22px;
  margin: 22px 0 14px
}

.remaining {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px
}

.name-button {
  background: #eef1ff;
  color: var(--ink);
  text-align: left;
  padding: 18px;
  overflow-wrap: anywhere;
  min-height: 64px
}

.selected {
  list-style: none;
  margin: 18px 0;
  padding: 0
}

.selected li {
  display: flex;
  align-items: center;
  gap: 10px;
  background: white;
  border: 2px solid var(--line);
  border-radius: 12px;
  margin: 8px 0;
  min-height: 64px;
  padding: 6px 8px
}

.selected .rank-number {
  color: var(--cobalt);
  font-size: 22px;
  min-width: 22px
}

.selected .name {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  overflow-wrap: anywhere;
  min-width: 0
}

.handle {
  touch-action: none;
  cursor: grab;
  background: transparent;
  color: var(--muted);
  padding: 0;
  min-width: 38px;
  min-height: 48px;
  font-size: 23px
}

.row-actions {
  display: flex
}

.row-actions button {
  padding: 0;
  min-width: 38px;
  min-height: 44px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 19px
}

.selected li.dragging {
  border-color: var(--cobalt);
  background: #eef1ff;
  box-shadow: 0 8px 24px #2445db20
}

.submit-ranking {
  width: 100%;
  margin-top: 22px
}

.hint {
  font-size: 14px;
  color: var(--muted);
  margin: 14px 0
}

.success-mark {
  display: inline-grid;
  place-items: center;
  background: var(--lemon);
  width: 95px;
  height: 95px;
  border-radius: 50%;
  font-size: 48px;
  margin-bottom: 30px
}

.own-score {
  font-size: 90px;
  font-weight: 900;
  color: var(--cobalt);
  line-height: 1;
  margin: 20px
}

.player .podium {
  gap: 7px
}

.player .podium-place {
  background: #eef1ff;
  padding: 18px 8px;
  min-height: 140px
}

.player .podium-place.first {
  background: var(--lemon);
  min-height: 220px
}

.player .podium-place.second {
  min-height: 175px
}

.player .podium-place h2 {
  font-size: 18px
}

.player .podium-place p {
  font-size: 15px
}

.player .medal {
  font-size: 30px
}

.player .score-list li {
  background: #eef1ff;
  font-size: 18px;
  padding: 14px
}

.player .score-list .rank-number,
.player .score-list .points {
  color: var(--cobalt)
}

.success-note {
  color: #246341;
  background: #e9f6e9;
  padding: 14px;
  border-radius: 10px;
  margin-top: 18px
}

button.fullscreen {
  font-size: 14px;
  padding: 10px 16px;
  min-height: 40px
}

.host-title {
  text-align: center
}

#game-footer {
  padding-bottom: max(20px, env(safe-area-inset-bottom))
}

@media(max-width:800px) {
  .home {
    padding: 24px
  }

  .home-layout {
    grid-template-columns: 1fr;
    margin: 45px auto;
    gap: 65px
  }

  .home h1 {
    font-size: 60px
  }

  .preview {
    max-width: 480px;
    transform: rotate(-3deg);
    margin: 0 12px
  }

  .sample-strip {
    font-size: 18px;
    padding: 20px
  }

  .home footer {
    margin-top: 35px
  }

  .host .topbar {
    padding: 20px
  }

  .host .brand {
    font-size: 28px
  }

  .host .lobby-layout {
    grid-template-columns: 1fr;
    gap: 30px;
    text-align: center
  }

  .qr-row {
    justify-content: center
  }

  .qr-row img {
    width: 130px;
    height: 130px
  }

  .qr-row p {
    font-size: 16px;
    text-align: left
  }

  .host h1 {
    font-size: 45px
  }

  .room-code {
    font-size: 76px
  }

  .host button {
    font-size: 18px;
    padding: 16px 22px
  }

  .host .player-chip {
    font-size: 20px
  }

  .rules-list {
    grid-template-columns: 1fr;
    text-align: left;
    gap: 18px;
    margin: 20px auto
  }

  .rule {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 23px
  }

  .rule b {
    font-size: 32px;
    margin: 0
  }

  .host .statement h1 {
    font-size: 45px
  }

  .host .timer {
    font-size: 44px
  }

  .podium-place.first {
    min-height: 230px
  }

  .podium-place.second {
    min-height: 190px
  }

  .podium-place.third {
    min-height: 150px
  }

  .host .podium h2 {
    font-size: 22px
  }

  .host .podium p {
    font-size: 18px
  }

  .host .medal {
    font-size: 40px
  }

  .host .controls {
    flex-wrap: wrap
  }

  .topbar {
    padding: 20px
  }

  .brand {
    font-size: 26px
  }
}

@media(prefers-reduced-motion:reduce) {

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important
  }
}

/* Longer submitted statements retain the timer and controls on the shared screen. */
h1 { overflow-wrap: anywhere; }
.host .statement-medium h1 { font-size: clamp(38px, 4vw, 76px); }
.host .statement-long h1 { font-size: clamp(32px, 3.2vw, 62px); }

.podium-place p { margin-bottom: 0; }

.host .discussion-view h1 { font-size: clamp(40px, 4vw, 72px); margin-bottom: 18px; }
.host .discussion-statement { font-size: clamp(22px, 2vw, 34px); max-width: 1100px; margin: 0 auto 14px; }
.host .discussion-score { font-size: 24px; color: var(--lemon); margin-bottom: 16px; }
.discussion-score span { margin: 0 14px; }
.discussion-ranking { border-collapse: collapse; width: 100%; max-width: 900px; margin: 0 auto; text-align: left; }
.discussion-ranking th { font-size: 18px; font-weight: normal; opacity: .8; padding: 8px 18px; }
.discussion-ranking td { padding: 10px 18px; border-bottom: 1px solid #ffffff30; font-size: 28px; }
.discussion-ranking td:first-child { overflow-wrap: anywhere; }
.discussion-ranking .rank-number { display: inline-block; margin-right: 14px; }
.discussion-ranking td:last-child { white-space: nowrap; }
.discussion-ranking .matched { background: #ffffff16; }
.match-label { font-size: 17px; margin-left: 18px; opacity: .75; }
.matched .match-label { opacity: 1; color: var(--lemon); }
.host .discussion-prompt { font-size: 22px; margin: 18px 0 0; }
.host .discussion-rules { font-size: 22px; opacity: .8; }
.player-discussion h1 { margin-bottom: 18px; }
.player-discussion h2 { font-size: 23px; line-height: 1.25; margin-top: 24px; }
.player .discussion-ranking th { font-size: 14px; padding: 10px 6px; }
.player .discussion-ranking td { font-size: 18px; padding: 13px 6px; border-bottom-color: var(--line); }
.player .discussion-ranking .rank-number { color: var(--cobalt); margin-right: 6px; }
.player .discussion-ranking .matched { background: #eef1ff; }
.player .match-label { display: block; margin: 4px 0 0; font-size: 13px; }
.player .matched .match-label { color: var(--cobalt); }
@media (max-width: 600px) {
  .host .discussion-ranking td { font-size: 20px; padding: 10px 6px; }
  .host .discussion-ranking th { font-size: 15px; padding: 8px 6px; }
  .host .match-label { display: block; margin: 4px 0 0; font-size: 14px; }
}
@media (max-height: 850px) and (min-width: 801px) {
  .host:has(.discussion-view) .topbar { padding-top: 14px; padding-bottom: 14px; }
  .host:has(.discussion-view) #stage { padding-top: 1vh; padding-bottom: 1vh; }
  .host .discussion-view h1 { font-size: 40px; margin-bottom: 10px; }
  .host .discussion-statement { font-size: 22px; margin-bottom: 8px; }
  .host .discussion-score { font-size: 20px; margin-bottom: 8px; }
  .host .discussion-ranking td { font-size: 22px; padding: 5px 18px; }
  .host .discussion-ranking th { font-size: 16px; padding: 6px 18px; }
  .host .discussion-prompt { font-size: 18px; margin-top: 12px; }
  .host:has(.discussion-view) .controls { margin-top: 16px; }
  .host:has(.discussion-view) .controls button { font-size: 20px; padding: 12px 24px; }
}

.host .score-list .player-score-link {
  background: transparent;
  color: inherit;
  font: inherit;
  min-height: 44px;
  padding: 0;
  text-align: left;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 7px;
  border-radius: 3px;
  overflow-wrap: anywhere;
}
.host .score-list .player-score-link:hover { color: var(--lemon); }
.host .score-discussion-hint { font-size: 20px; margin: 18px 0 0; opacity: .8; }
