:root {
  --bg: #172447;
  --bg2: #0b1226;
  --panel: rgba(34, 50, 92, 0.78);
  --panel-solid: #22325c;
  --line: rgba(140, 165, 230, 0.24);
  --ink: #f6f2e7;
  --muted: #aab6d6;
  --card: #fdf7e6;
  --card-edge: #d8c79b;
  --card-ink: #1b2038;
  --gold: #fcb321;
  --gold-deep: #c97f00;
  --best: #ff6b4a;
  --best-deep: #c4391c;
  --best-ink: #3a0d02;
  --second: #2ec4b6;
  --second-deep: #14857b;
  --second-ink: #02302c;
  --bad: #ff5d73;
  --good: #7bd88f;
  --radius: 16px;
  --font: Fredoka, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg2);
  overflow-x: hidden; /* entrance animations scale past the edge for a moment */
}
body {
  margin: 0;
  color: var(--ink);
  font: 500 16px/1.4 var(--font);
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(60vmax 60vmax at 105% -10%, rgba(255, 107, 74, 0.2), transparent 60%),
    radial-gradient(55vmax 55vmax at -10% 20%, rgba(46, 196, 182, 0.18), transparent 60%),
    radial-gradient(70vmax 50vmax at 50% 115%, rgba(252, 179, 33, 0.12), transparent 60%),
    radial-gradient(rgba(255, 255, 255, 0.05) 1.2px, transparent 1.3px) 0 0 / 22px 22px,
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  background-attachment: fixed;
}
#app {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 12px calc(28px + env(safe-area-inset-bottom));
}
#fx {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 50;
}
h1,
h2,
h3 {
  margin: 0 0 8px;
  line-height: 1.15;
  font-weight: 700;
}
h1 {
  font-size: 2rem;
}
h2 {
  font-size: 1.1rem;
}
h3 {
  font-size: 0.95rem;
  margin-top: 16px;
}
p {
  margin: 0 0 10px;
}
.muted {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 400;
}
h2 .muted {
  margin-left: 6px;
}
.t-best {
  color: var(--best);
}
.t-second {
  color: var(--second);
}
.bad-text {
  color: var(--bad);
}
.spacer {
  flex: 1;
}
.grow {
  flex: 1;
  min-width: 0;
}

/* ---------- portraits ---------- */
.portrait {
  display: inline-block;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 2px 5px rgba(0, 0, 0, 0.35);
  vertical-align: middle;
  line-height: 0;
}
.portrait {
  position: relative;
}
.portrait svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.portrait.big {
  width: 68px;
  height: 68px;
  box-shadow: 0 0 0 3px #fff, 0 6px 16px rgba(0, 0, 0, 0.4);
}
.portrait.huge {
  width: 104px;
  height: 104px;
  box-shadow: 0 0 0 4px var(--gold), 0 0 34px rgba(252, 179, 33, 0.55), 0 8px 20px rgba(0, 0, 0, 0.45);
}
.picker {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin-top: 6px;
}
.pick-face {
  padding: 0;
  min-height: 0;
  aspect-ratio: 1;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  transition: transform 0.15s;
}
.pick-face .portrait {
  width: 100%;
  height: 100%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
  opacity: 0.72;
  transition: opacity 0.15s, box-shadow 0.15s;
}
.pick-face:hover {
  transform: translateY(-2px) scale(1.06);
}
.pick-face:hover .portrait {
  opacity: 1;
}
.pick-face.on {
  transform: scale(1.1);
}
.pick-face.on .portrait {
  opacity: 1;
  box-shadow: 0 0 0 3px var(--gold), 0 0 16px rgba(252, 179, 33, 0.7);
}
.who {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.who .portrait {
  width: 24px;
  height: 24px;
}

/* ---------- header ---------- */
.top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  flex-wrap: wrap;
}
.logo {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  background: linear-gradient(90deg, var(--gold), #ffd97a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}
.logo i {
  font-style: normal;
  font-size: 0.7em;
  margin: 0 3px;
  vertical-align: 0.15em;
  -webkit-text-fill-color: currentColor;
}
.logo i.t-best {
  color: var(--best);
}
.logo i.t-second {
  color: var(--second);
}
.code-pill {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 0.85rem;
}
.where {
  color: var(--muted);
  font-size: 0.8rem;
}
.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px 10px;
}
.timer.low {
  background: var(--bad);
  border-color: var(--bad);
  color: #2a0008;
  animation: pulse 1s infinite;
}

/* ---------- controls ---------- */
button,
select,
input,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  font-weight: 700;
  min-height: 44px;
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.primary {
  background: linear-gradient(180deg, #ffc94a, var(--gold));
  color: #2b1b00;
  box-shadow: 0 4px 0 var(--gold-deep), 0 8px 18px rgba(0, 0, 0, 0.3);
}
.primary.alt,
.primary.second {
  background: linear-gradient(180deg, #5fe0d3, var(--second));
  color: var(--second-ink);
  box-shadow: 0 4px 0 var(--second-deep), 0 8px 18px rgba(0, 0, 0, 0.3);
}
.primary.best {
  background: linear-gradient(180deg, #ff9279, var(--best));
  color: var(--best-ink);
  box-shadow: 0 4px 0 var(--best-deep), 0 8px 18px rgba(0, 0, 0, 0.3);
}
.primary:not(:disabled):hover {
  filter: brightness(1.06);
}
.primary:not(:disabled):active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}
.big {
  width: 100%;
  font-size: 1.15rem;
  padding: 14px 16px;
  overflow-wrap: anywhere;
}
.ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  border: 1px solid var(--line);
}
.ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}
.small {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
}
.file {
  display: inline-flex;
  align-items: center;
  border-radius: 12px;
  cursor: pointer;
}
input:not([type='checkbox']),
select,
textarea {
  width: 100%;
  background: rgba(8, 14, 32, 0.7);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 44px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:not([type='checkbox']):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(252, 179, 33, 0.25);
}
textarea {
  resize: vertical;
}
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
.field {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 10px;
}
.field > input,
.field > select,
.field > textarea {
  margin-top: 4px;
  font-size: 1rem;
}
.field.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  align-self: end;
  min-height: 44px;
}
.field.check input {
  width: 20px;
  height: 20px;
  accent-color: var(--gold);
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}
.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.notice {
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  animation: slide-in 0.25s both;
}
.notice.bad {
  border-color: var(--bad);
  color: #ffd9de;
  background: #4a1622;
  animation: shake 0.4s both;
}
.notice.warn {
  border-color: var(--gold);
}
.tag {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--gold);
  color: #2b1b00;
  border-radius: 6px;
  padding: 1px 6px;
  margin-left: 6px;
  font-weight: 700;
}
.tag.dim {
  background: rgba(255, 255, 255, 0.18);
  color: var(--ink);
}

/* ---------- home ---------- */
.home {
  padding-top: 4px;
}
.hero {
  text-align: center;
  margin-bottom: 14px;
}
.hero h1 {
  font-size: clamp(2.6rem, 12vw, 4rem);
  background: linear-gradient(180deg, #ffe08a, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.35));
  margin: 6px 0 8px;
}
.hero-cards {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 10px 0 4px;
}
.demo-card {
  width: 92px;
  aspect-ratio: 5 / 4;
  background: linear-gradient(180deg, #fffdf4, var(--card));
  color: var(--card-ink);
  border-radius: 12px;
  border-bottom: 5px solid var(--card-edge);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.4);
  animation: float 4s ease-in-out infinite;
}
.demo-card i {
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 0;
}
.demo-card b {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}
.demo-card.best {
  transform: rotate(-7deg);
  --tilt: -7deg;
}
.demo-card.best i {
  background: var(--best);
  color: var(--best-ink);
}
.demo-card.second {
  transform: rotate(7deg);
  --tilt: 7deg;
  animation-delay: -2s;
}
.demo-card.second i {
  background: var(--second);
  color: var(--second-ink);
}
.demo-clue {
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  text-shadow: 0 0 18px rgba(252, 179, 33, 0.8);
}
.lead {
  font-size: 1.05rem;
  font-weight: 400;
  margin-bottom: 4px;
}
.me-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.home-actions {
  display: grid;
  gap: 12px;
}
.code-input {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-weight: 700;
  font-size: 1.3rem !important;
  text-align: center;
}
.home .primary {
  width: 100%;
}

/* ---------- lobby ---------- */
.share {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.big-code {
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1;
  background: linear-gradient(180deg, #ffe08a, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.35));
}
.share-link {
  flex: 1;
  min-width: 180px;
}
.link {
  font-size: 0.85rem;
  font-weight: 400;
  overflow-wrap: anywhere;
  margin: 2px 0 6px;
}
.players,
.summary {
  list-style: none;
  margin: 0;
  padding: 0;
}
.players li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  animation: slide-in 0.3s both;
}
.players li:first-child {
  border-top: 0;
}
.players li .portrait {
  width: 38px;
  height: 38px;
}
.players li.away {
  opacity: 0.5;
}
.players .tag {
  margin-left: 0;
}
.players em {
  color: var(--muted);
  font-style: normal;
  font-weight: 400;
}
.pname {
  min-width: 0;
  overflow-wrap: anywhere;
}
.lobby .picker {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  animation: slide-in 0.25s both;
}
.summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 0.9rem;
}
.summary b {
  color: var(--ink);
  display: block;
}
.count {
  margin: 10px 0 0;
  font-size: 0.9rem;
}
.how ol {
  margin: 0;
  padding-left: 20px;
  font-size: 0.92rem;
  font-weight: 400;
}
.how li {
  margin-bottom: 4px;
}
.actions {
  display: grid;
  gap: 10px;
  text-align: center;
}

/* ---------- game ---------- */
.seats {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 12px 2px 8px;
  margin-bottom: 6px;
  scrollbar-width: thin;
}
.seat {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 11px 3px 3px;
  font-size: 0.82rem;
  white-space: nowrap;
}
.seat .portrait {
  width: 26px;
  height: 26px;
}
.seat.me {
  border-color: rgba(255, 255, 255, 0.8);
}
.seat.giver {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(252, 179, 33, 0.45);
}
.seat.away {
  opacity: 0.45;
}
.seat b {
  color: var(--gold);
}
.seat .role {
  font-size: 0.6rem;
  text-transform: uppercase;
  background: var(--gold);
  color: #2b1b00;
  border-radius: 5px;
  padding: 0 4px;
  font-weight: 700;
}
.seat .tick {
  color: var(--muted);
  font-weight: 700;
}
.seat .tick.in {
  color: var(--good);
  animation: pop-in 0.3s both;
}
.seat .gain {
  position: absolute;
  right: 4px;
  top: -9px;
  background: var(--good);
  color: #06280f;
  font-weight: 700;
  font-size: 0.72rem;
  border-radius: 999px;
  padding: 0 6px;
  animation: gain 0.6s 0.9s both;
}
.seat-name {
  max-width: 9ch;
  overflow: hidden;
  text-overflow: ellipsis;
}

.banner {
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
  animation: slide-in 0.3s both;
}
.banner-title {
  font-weight: 700;
  font-size: 1.08rem;
}
.banner-sub {
  font-size: 0.92rem;
  font-weight: 400;
  margin-top: 2px;
}
.banner.wait .banner-title::after {
  content: '';
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--gold);
  animation: pulse 1.1s infinite;
}
.banner.hunt {
  display: flex;
  align-items: center;
  gap: 12px;
}
.banner.hunt .banner-title {
  font-size: 1.35rem;
}
.hunt-mark {
  font-size: 2.6rem;
  line-height: 1;
  animation: wiggle 1.6s ease-in-out infinite;
}
.banner.hunt.best {
  background: linear-gradient(135deg, #ff8a6e, var(--best));
  color: var(--best-ink);
  border: 3px solid #fff;
  box-shadow: 0 0 26px rgba(255, 107, 74, 0.55);
}
.banner.hunt.second {
  background: linear-gradient(135deg, #58dccf, var(--second));
  color: var(--second-ink);
  border: 3px dashed #fff;
  box-shadow: 0 0 26px rgba(46, 196, 182, 0.55);
}
.pair {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.pill {
  border-radius: 10px;
  padding: 5px 10px;
  font-size: 0.85rem;
  font-weight: 600;
}
.pill b {
  text-transform: uppercase;
  font-size: 1rem;
  overflow-wrap: anywhere;
}
.pill.best {
  background: var(--best);
  color: var(--best-ink);
  border: 2px solid var(--best);
}
.pill.second {
  background: var(--second);
  color: var(--second-ink);
  border: 2px dashed var(--second-ink);
}
.clue {
  text-align: center;
  font-size: clamp(2rem, 10vw, 3.4rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.05;
  margin: 6px 0 12px;
  overflow-wrap: anywhere;
  color: #fff;
  text-shadow: 0 0 22px rgba(252, 179, 33, 0.75), 0 3px 0 rgba(0, 0, 0, 0.35);
  animation: stamp 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.clue.small {
  font-size: 1.8rem;
  margin: 0;
  text-align: left;
  animation: none;
}

.board-wrap {
  container-type: inline-size;
  margin-bottom: 22px;
}
.board {
  display: grid;
  gap: 1.2cqw;
  perspective: 900px;
}
.card {
  position: relative;
  aspect-ratio: 5 / 4;
  background: linear-gradient(180deg, #fffdf4 0%, var(--card) 100%);
  color: var(--card-ink);
  border: 0;
  border-radius: 1.8cqw;
  padding: 0.6cqw;
  min-height: 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 0.7cqw 0 var(--card-edge), 0 1.2cqw 1.6cqw rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.4s, filter 0.4s;
}
.board.cols-6 .card {
  aspect-ratio: 1 / 1;
}
button.card {
  cursor: pointer;
  font-weight: inherit;
}
@media (hover: hover) {
  button.card:hover {
    transform: translateY(-0.5cqw);
    box-shadow: 0 1.2cqw 0 var(--card-edge), 0 2cqw 2.4cqw rgba(0, 0, 0, 0.4);
  }
}
button.card:active {
  transform: translateY(0.5cqw);
  box-shadow: 0 0.2cqw 0 var(--card-edge);
}
.word {
  font-family: var(--font);
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.08;
  max-width: 100%;
}
.card.picked {
  outline: 0.9cqw solid var(--gold);
  outline-offset: -0.9cqw;
  background: #fff1b8;
  animation: bounce 0.35s both;
}
.card.locked {
  background: #ffe08a;
}
.card.locked::after {
  content: '✓';
  position: absolute;
  top: 2%;
  right: 5%;
  font-weight: 700;
  font-size: 3.4cqw;
  animation: pop-in 0.3s both;
}
.card.target.best {
  outline: 0.9cqw solid var(--best);
  outline-offset: -0.9cqw;
  background: #ffe1d8;
}
.card.target.second {
  outline: 0.9cqw dashed var(--second);
  outline-offset: -0.9cqw;
  background: #d5f5f1;
}
.badge {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  font-size: max(2.1cqw, 8px);
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.3cqw 0;
  line-height: 1.2;
  white-space: nowrap;
}
.badge.best {
  background: var(--best);
  color: var(--best-ink);
}
.badge.second {
  background: var(--second);
  color: var(--second-ink);
}
.card.target .word {
  margin-top: 2.4cqw;
}

/* dealing and replacing cards */
.board.deal .card {
  animation: deal 0.5s cubic-bezier(0.2, 1.2, 0.4, 1) both;
  animation-delay: calc(var(--i) * 28ms);
}
.card.fresh {
  animation: flip-in 0.8s both;
}

/* reveal */
.board.revealed .card.dim {
  opacity: 0.45;
  filter: saturate(0.6);
}
.board.revealed .card.wrong {
  opacity: 0.85;
}
.board.revealed .card.target.best {
  box-shadow: 0 0.7cqw 0 var(--best-deep), 0 0 4cqw rgba(255, 107, 74, 0.8);
}
.board.revealed .card.target.second {
  box-shadow: 0 0.7cqw 0 var(--second-deep), 0 0 4cqw rgba(46, 196, 182, 0.8);
}
.card.pop {
  animation: pop 0.7s both;
  z-index: 2;
}
.card.pop.second {
  animation-delay: 0.3s;
}
/* Guessers' portraits hang off the bottom edge of the card they picked, clear of the word. */
.board.revealed .card {
  overflow: visible;
}
.board.revealed .card:has(.chips) {
  z-index: 3;
}
.chips {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2.9cqw;
  display: flex;
  justify-content: center;
  padding: 0 0.6cqw;
}
.chip {
  position: relative;
  width: min(5.4cqw, 34px);
  height: min(5.4cqw, 34px);
  min-width: 15px;
  min-height: 15px;
  margin: 0 -0.5cqw;
  border-radius: 50%;
  flex: 0 1 auto;
}
.chip .portrait {
  width: 100%;
  height: 100%;
  box-shadow: none;
}
.chip.best {
  box-shadow: 0 0 0 0.45cqw var(--best);
}
.chip.second {
  outline: 0.45cqw dashed var(--second-deep);
}
.chip i {
  position: absolute;
  right: -18%;
  top: -22%;
  font-style: normal;
  font-size: max(2cqw, 8px);
  line-height: 1;
  color: var(--card-ink);
  text-shadow: 0 0 2px #fff, 0 0 2px #fff;
}
.chip:not(.right) {
  filter: grayscale(0.75);
  opacity: 0.8;
}
.board.animate .chip {
  animation: drop 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.action {
  min-height: 56px;
}
.clue-form {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.clue-form input {
  flex: 1;
  font-size: 1.2rem;
  font-weight: 600;
}
.locked-note {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  animation: slide-in 0.25s both;
}
.locked-note b {
  text-transform: uppercase;
}

/* ---------- results ---------- */
.results {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 12px;
  font-size: 0.92rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
}
.results th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 8px 8px 4px;
  font-weight: 600;
}
.results td {
  padding: 7px 8px;
  border-top: 1px solid var(--line);
  overflow-wrap: break-word;
}
.results td:nth-child(3) {
  text-transform: uppercase;
  font-weight: 700;
}
.results .pts {
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
}
.results tr.hit .pts {
  color: var(--good);
}
.results tr.miss td {
  color: var(--muted);
}
.results tr.miss .portrait {
  filter: grayscale(0.7);
}
.results tr.giver-row td {
  background: rgba(252, 179, 33, 0.14);
}
.results tr.giver-row .pts {
  color: var(--gold);
  font-size: 1.1rem;
}
.results tr.giver-row td:nth-child(3),
.final-table td:nth-child(3) {
  text-transform: none;
  font-weight: 500;
}
.entering .results tbody tr,
.final .results tbody tr {
  animation: slide-in 0.35s both;
  animation-delay: calc(0.25s + var(--i) * 0.09s);
}
.mini {
  border-radius: 6px;
  padding: 1px 6px;
  font-weight: 700;
  font-size: 0.78rem;
  white-space: nowrap;
}
.mini.best {
  background: var(--best);
  color: var(--best-ink);
}
.mini.second {
  background: var(--second);
  color: var(--second-ink);
  outline: 1px dashed var(--second-ink);
  outline-offset: -2px;
}

/* ---------- final ---------- */
.stage {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 26px 0 6px;
}
.champ {
  position: relative;
  animation: champ 0.7s cubic-bezier(0.2, 1.5, 0.4, 1) both, float 3.4s 0.7s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.15s), calc(0.7s + var(--i) * 0.3s);
}
.crown {
  position: absolute;
  top: -34px;
  left: 50%;
  transform: translateX(-50%) rotate(-8deg);
  font-size: 2.4rem;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 3px 0 var(--gold-deep), 0 0 18px rgba(252, 179, 33, 0.8);
  z-index: 1;
}
.final h1 {
  text-align: center;
  margin: 14px 0 16px;
  overflow-wrap: anywhere;
  background: linear-gradient(180deg, #ffe08a, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.35));
  animation: stamp 0.5s 0.3s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.final-table tr.winner td {
  background: rgba(252, 179, 33, 0.18);
}
.final-table tr.me td:nth-child(2) span span {
  text-decoration: underline;
}
.final-table .place {
  font-weight: 700;
  color: var(--gold);
  width: 1.5em;
}

/* ---------- motion ---------- */
@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}
@keyframes pop-in {
  from {
    transform: scale(0);
  }
  70% {
    transform: scale(1.3);
  }
}
@keyframes pulse {
  50% {
    opacity: 0.45;
    transform: scale(0.94);
  }
}
@keyframes shake {
  20%,
  60% {
    transform: translateX(-6px);
  }
  40%,
  80% {
    transform: translateX(6px);
  }
}
@keyframes wiggle {
  0%,
  100% {
    transform: rotate(-8deg) scale(1);
  }
  50% {
    transform: rotate(8deg) scale(1.12);
  }
}
@keyframes float {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -6px;
  }
}
@keyframes stamp {
  from {
    opacity: 0;
    transform: scale(1.5);
  }
}
@keyframes bounce {
  40% {
    transform: scale(1.08);
  }
}
@keyframes deal {
  from {
    opacity: 0;
    transform: translateY(-40px) rotate(-8deg) scale(0.7);
  }
}
@keyframes flip-in {
  0% {
    transform: rotateY(90deg) scale(0.9);
    filter: brightness(1.6);
  }
  60% {
    transform: rotateY(-12deg) scale(1.04);
  }
  100% {
    transform: none;
    filter: none;
  }
}
@keyframes pop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.16) rotate(-3deg);
  }
  70% {
    transform: scale(0.97) rotate(1deg);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes drop {
  from {
    transform: translateY(-160%) scale(1.4);
    opacity: 0;
  }
}
@keyframes gain {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.5);
  }
  60% {
    transform: translateY(-3px) scale(1.2);
  }
}
@keyframes champ {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.3);
  }
}
/* Effects switched off (the header toggle; off by default when the device asks for reduced motion). */
html.calm *,
html.calm *::before,
html.calm *::after {
  animation: none !important;
  transition: none !important;
}

@media (max-width: 520px) {
  .results {
    font-size: 0.84rem;
  }
  .results td,
  .results th {
    padding-left: 6px;
    padding-right: 6px;
  }
  .picker {
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
  }
  .demo-card {
    width: 78px;
  }
  .demo-clue {
    font-size: 1.2rem;
  }
}
@media (min-width: 620px) {
  .home-actions {
    grid-template-columns: 1fr 1fr;
  }
  .grid2 {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .summary {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
