* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root {
  color-scheme: light;
  /* Family deck: an exam paper on a manila desk. */
  --desk: #ece4d3;
  --paper: #fffef8;
  --ink: #1d2433;
  --soft: #5a6275;
  --red: #d6332a;
  --blue: #1f55b0;
  --line: #cfdcef;
  --hi: #ffe36e;
  --card: #ffffff;
  --card-ink: #1d2433;
  --edge: #c9bea6;
  --shadow: 0 2px 0 #d3c8b1, 0 10px 24px -14px rgb(40 30 10 / .45);
  --back: repeating-linear-gradient(45deg, #1f55b0 0 10px, #2a63c4 10px 20px);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}
body.night {
  color-scheme: dark;
  /* 18+ deck: the mamak after midnight. */
  --desk: #110d1b;
  --paper: #1c1630;
  --ink: #f6efff;
  --soft: #b8aed0;
  --red: #ff4fa3;
  --blue: #3ef0c4;
  --line: rgb(255 255 255 / .06);
  --hi: rgb(255 79 163 / .35);
  --card: #fbf6ff;
  --card-ink: #1a1328;
  --edge: #3a2f57;
  --shadow: 0 0 0 1px rgb(255 79 163 / .25), 0 12px 30px -12px rgb(0 0 0 / .8);
  --back: repeating-linear-gradient(-45deg, #ff4fa3 0 10px, #e23d8f 10px 20px);
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--desk);
  color: var(--ink);
  font: 1rem/1.5 "DM Sans", Arial, sans-serif;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  transition: background-color .5s ease, color .5s ease;
}
body.night {
  background: radial-gradient(1200px 600px at 80% -10%, rgb(255 79 163 / .16), transparent 60%), radial-gradient(900px 500px at -10% 30%, rgb(62 240 196 / .09), transparent 60%), var(--desk);
  background-attachment: fixed;
}
a { color: var(--blue); text-underline-offset: .18em; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:is(a, button, summary, input, textarea, label):focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
:is(h1, h2, #app, #sheet-text):focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: white; color: #000; padding: 8px; z-index: 9; }
.skip:focus { top: 8px; }
.wrap { width: min(100% - 32px, 720px); margin: auto; }
h1, h2, h3, p { margin: 0; }
.wordmark { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid currentColor; padding: 14px 0; }
.wordmark a { display: flex; align-items: center; min-height: 44px; font-weight: 700; color: var(--ink); text-decoration: none; }
.room-chip { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--edge); background: var(--paper); font-size: .85rem; }
.room-chip b { letter-spacing: .12em; }
.room-chip i { font-style: normal; font-weight: 700; color: var(--red); }
#loading { padding: 40px 0; }
.screen { padding: 22px 0 10px; animation: stage-in .45s var(--ease-out); }

/* ---------- home ---------- */
.hero { position: relative; padding: 8px 0 26px; }
.kicker { font-size: .78rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--red); }
.hero h1 { margin-top: 8px; font: 400 clamp(2.9rem, 12vw, 5.2rem)/.95 "DM Serif Text", Georgia, serif; letter-spacing: -.045em; }
.hero h1 span { display: inline-block; padding: 0 .12em; color: var(--blue); border-bottom: .07em dashed currentColor; font-style: italic; animation: wobble 6s var(--ease-out) infinite; }
@keyframes wobble { 0%, 85%, 100% { transform: none; } 90% { transform: rotate(-3deg) translateY(-3px); } 95% { transform: rotate(2deg); } }
.lede { max-width: 34em; margin-top: 14px; font-size: 1.06rem; color: var(--soft); }
.hero-sheet { margin-top: 22px; padding: 18px 20px 18px 34px; max-width: 520px; transform: rotate(-1.2deg); }
.hero-sheet p { font: 400 1.2rem/1.45 "DM Serif Text", Georgia, serif; }
.hero-fill { position: relative; display: inline-grid; vertical-align: bottom; font-weight: 400; }
.hero-fill span { grid-area: 1 / 1; color: var(--blue); font-style: italic; background: linear-gradient(transparent 58%, var(--hi) 58%); opacity: 0; animation: cycle 9s infinite; }
.hero-fill span:nth-child(2) { animation-delay: 3s; }
.hero-fill span:nth-child(3) { animation-delay: 6s; }
@keyframes cycle { 0% { opacity: 0; transform: translateY(8px); } 4%, 30% { opacity: 1; transform: none; } 34%, 100% { opacity: 0; transform: translateY(-8px); } }

.panel { background: var(--paper); border: 1px solid var(--edge); border-radius: 14px; padding: clamp(18px, 4.5vw, 30px); box-shadow: var(--shadow); margin-bottom: 18px; transition: background-color .5s ease, border-color .5s ease; }
.panel h2 { font: 400 1.6rem/1.15 "DM Serif Text", Georgia, serif; margin-bottom: 14px; }
fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font-weight: 700; margin-bottom: 8px; font-size: .92rem; }
.decks { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 10px; }
.deck { position: relative; display: block; cursor: pointer; }
.deck input, .goal input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.deck-face { display: grid; gap: 4px; min-height: 104px; padding: 16px; border-radius: 12px; border: 2px solid var(--edge); transition: transform .25s var(--spring), border-color .2s, box-shadow .2s; }
.deck b { font: 400 1.35rem/1.1 "DM Serif Text", Georgia, serif; }
.deck small { font-size: .9rem; opacity: .8; }
.deck.family .deck-face { background: repeating-linear-gradient(#fffef8 0 25px, #dfe8f5 25px 26px); color: #1d2433; border-left: 6px solid #d6332a; }
.deck.adult .deck-face { background: #1c1630; color: #f6efff; border-color: #3a2f57; }
.deck.adult em { font-style: normal; font-family: "DM Sans", Arial, sans-serif; font-weight: 700; font-size: .8rem; color: #1a1328; background: #ff4fa3; border-radius: 6px; padding: 2px 6px; vertical-align: 3px; box-shadow: 0 0 14px #ff4fa3; }
.deck input:checked + .deck-face { transform: translateY(-3px) rotate(-.6deg); border-color: var(--red); box-shadow: 0 8px 0 -3px var(--red); }
.deck input:focus-visible + .deck-face { outline: 3px solid var(--red); outline-offset: 3px; }
.age { margin: -6px 0 18px; padding: 12px 14px; border-radius: 10px; background: rgb(255 79 163 / .12); border: 1px solid rgb(255 79 163 / .45); font-size: .95rem; }
.age label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.age input { width: 22px; height: 22px; flex: none; margin-top: 1px; accent-color: var(--red); }
.goal { display: flex; flex-wrap: wrap; gap: 8px; }
.goal legend { width: 100%; }
.goal label { position: relative; flex: 1 1 0; min-width: 84px; }
.goal span { display: grid; place-items: center; min-height: 56px; border-radius: 10px; border: 2px solid var(--edge); font-weight: 700; font-size: 1.15rem; line-height: 1.1; transition: transform .2s var(--spring), background .2s, color .2s; }
.goal small { font-size: .72rem; font-weight: 400; opacity: .75; }
.goal.small span { min-height: 44px; }
.goal input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); transform: scale(1.03); }
.goal input:focus-visible + span { outline: 3px solid var(--red); outline-offset: 3px; }
.field { display: grid; gap: 6px; font-weight: 700; font-size: .92rem; margin-bottom: 16px; }
.field input, #code-input { min-height: 52px; padding: 10px 14px; border-radius: 10px; border: 2px solid var(--edge); background: var(--card); color: var(--card-ink); font-weight: 400; font-size: 1.05rem; }
.field input:focus, #code-input:focus { border-color: var(--blue); outline: none; }
button.primary, .as-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px; border-radius: 12px; border: 2px solid var(--ink); background: var(--ink); color: var(--paper); font-weight: 700; text-decoration: none; transition: transform .18s var(--spring), box-shadow .18s, opacity .2s; box-shadow: 0 4px 0 var(--red); }
button.primary:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--red); }
button.primary:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 var(--red); }
button.primary:disabled { opacity: .45; box-shadow: none; }
body.night button.primary, body.night .as-button { background: var(--red); border-color: var(--red); color: #1a1328; box-shadow: 0 4px 0 #9c2364, 0 0 22px rgb(255 79 163 / .35); }
.big { width: 100%; min-height: 56px; font-size: 1.08rem; }
.form-error { min-height: 1.4em; margin-top: 10px; color: var(--red); font-weight: 700; }
.form-error:empty { min-height: 0; margin: 0; }
.code-row { display: flex; gap: 8px; }
#code-input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .4em; font-weight: 700; text-align: center; font-size: 1.4rem; }
.code-row button, .ghost, .share { min-height: 48px; padding: 8px 16px; border-radius: 12px; border: 2px solid var(--ink); background: transparent; font-weight: 700; transition: transform .18s var(--spring), background .2s; }
.code-row button:hover, .ghost:not(:disabled):hover, .share:hover { transform: translateY(-2px); }
.ghost:disabled { opacity: .4; }
.ghost small { font-weight: 400; opacity: .7; }
.ghost.small { min-height: 40px; font-size: .88rem; }
.how summary { cursor: pointer; font: 400 1.3rem/1.2 "DM Serif Text", Georgia, serif; min-height: 32px; }
.how ol { padding-left: 1.3em; margin: 14px 0; }
.how li { margin-bottom: 6px; }
.how p { color: var(--soft); font-size: .93rem; }
.small { font-size: .9rem; color: var(--soft); margin-top: 10px; }
.link-button { display: block; margin: 18px auto 0; min-height: 44px; padding: 8px 12px; border: 0; background: none; color: var(--soft); text-decoration: underline; text-underline-offset: .2em; }

/* ---------- join, lobby ---------- */
.invite h1, #lobby-title { font: 400 clamp(2rem, 8vw, 2.8rem)/1.05 "DM Serif Text", Georgia, serif; margin: 6px 0 10px; }
#join-code-label { letter-spacing: .14em; color: var(--blue); }
.deck-badge { display: inline-block; margin-bottom: 10px; padding: 4px 10px; border-radius: 99px; font-weight: 700; font-size: .85rem; border: 1px solid var(--edge); }
.deck-badge.adult { background: #ff4fa3; color: #1a1328; border-color: #ff4fa3; }
#join-meta { margin-bottom: 18px; color: var(--soft); }
.age.warn { margin-top: 0; }
.code-tiles { display: flex; gap: clamp(6px, 2vw, 12px); margin: 8px 0 20px; }
.code-tiles b { display: grid; place-items: center; width: clamp(58px, 17vw, 84px); aspect-ratio: 4 / 5; border-radius: 12px; background: var(--card); color: var(--card-ink); border: 2px solid var(--ink); box-shadow: 0 5px 0 var(--red); font: 400 clamp(2.2rem, 10vw, 3.4rem)/1 "DM Serif Text", Georgia, serif; animation: tile-in .6s calc(var(--i) * 90ms) var(--spring) both; }
@keyframes tile-in { from { opacity: 0; transform: translateY(-24px) rotateX(80deg); } }
.invite-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.share { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.share svg { flex: none; }
.share.wa { background: #1fa855; border-color: #1fa855; color: #fff; }
.invite-url { width: 100%; margin-top: 10px; min-height: 44px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--edge); background: var(--card); color: var(--card-ink); }
.players-title { margin: 26px 0 10px; font: 700 .92rem/1.3 "DM Sans", Arial, sans-serif; }
.lobby-players, .dialog-players { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.lobby-players li, .dialog-players li { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 8px 6px 6px; border-radius: 12px; background: var(--card); color: var(--card-ink); border: 1px solid var(--edge); transition: opacity .3s; }
.lobby-players li.away, .dialog-players li.away { opacity: .55; }
.who { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.who small { font-weight: 400; color: #5a6275; }
.who .tag { display: inline-block; padding: 1px 7px; border-radius: 99px; background: #1d2433; color: #fff; font-size: .72rem; font-weight: 700; vertical-align: 1px; }
.kick { min-height: 40px; padding: 4px 12px; border-radius: 8px; border: 1px solid #c9bea6; background: transparent; color: #8a2b25; font-size: .85rem; }
.avatar { display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 50%; background: hsl(var(--h, 20) 80% 78%); color: hsl(var(--h, 20) 60% 20%); font-weight: 700; border: 2px solid rgb(0 0 0 / .12); }
.notice { padding: 10px 12px; border-radius: 10px; background: rgb(214 51 42 / .1); margin-bottom: 14px; }
#host-tools .goal { margin-bottom: 14px; }
.waiting { text-align: center; color: var(--soft); padding: 10px 0; }
.waiting::after, .dots b { animation: blink 1.4s infinite; }

/* ---------- table ---------- */
.scores { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.score { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 3px 10px 3px 3px; border-radius: 99px; background: var(--paper); border: 1px solid var(--edge); font-size: .88rem; transition: opacity .3s, transform .3s var(--spring), border-color .3s; }
.score .avatar { width: 32px; height: 32px; font-size: .85rem; }
.score .name { max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score .pts { min-width: 1.4em; text-align: center; font-size: 1rem; }
.score.away { opacity: .5; }
.score.me { border-color: var(--ink); }
.score.reader { border-color: var(--red); background: color-mix(in srgb, var(--red) 12%, var(--paper)); }
.score.reader::before { content: "Reader"; position: absolute; top: -9px; left: 34px; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff; font-size: .62rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
body.night .score.reader::before { color: #1a1328; }
.score.played .avatar::after { content: "✓"; position: absolute; transform: translate(12px, 11px); width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; background: #2c9a5a; color: #fff; font-size: .62rem; border: 2px solid var(--paper); }
.score.thinking .avatar { animation: think 1.6s ease-in-out infinite; }
@keyframes think { 50% { transform: translateY(-2px) rotate(-6deg); } }
.score.won { border-color: #f2b51b; box-shadow: 0 0 0 3px rgb(242 181 27 / .35); }

.sheet { position: relative; padding: 16px 18px 16px clamp(34px, 8vw, 52px); border-radius: 6px 6px 14px 14px; background-color: var(--paper); background-image: linear-gradient(90deg, transparent calc(clamp(34px, 8vw, 52px) - 12px), color-mix(in srgb, var(--red) 55%, transparent) calc(clamp(34px, 8vw, 52px) - 12px) calc(clamp(34px, 8vw, 52px) - 10px), transparent 0), repeating-linear-gradient(transparent 0 31px, var(--line) 31px 32px); box-shadow: var(--shadow); border: 1px solid var(--edge); scroll-margin-top: 12px; transition: background-color .5s; }
body.night .sheet { box-shadow: 0 0 0 1px rgb(62 240 196 / .25), 0 0 34px -6px rgb(62 240 196 / .35), 0 18px 40px -18px #000; }
.sheet header { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .8rem; font-weight: 700; color: var(--blue); letter-spacing: .05em; text-transform: uppercase; margin-bottom: 8px; }
#sheet-text { font: 400 clamp(1.35rem, 5.4vw, 1.95rem)/1.32 "DM Serif Text", Georgia, serif; letter-spacing: -.01em; overflow-wrap: anywhere; }
.sheet footer { margin-top: 12px; font-size: .85rem; color: var(--soft); }
.blank { display: inline-block; width: 4.2em; height: .95em; border-bottom: 3px solid var(--ink); vertical-align: -.08em; margin: 0 .08em; }
.blank.block, .fill.block { display: block; }
.blank.block { width: 6em; margin-top: 10px; }
.fill { color: var(--blue); font-style: italic; background: linear-gradient(transparent 60%, var(--hi) 60%); padding: 0 .1em; animation: ink .45s calc(var(--i, 0) * 90ms) var(--spring) both; }
.fill.block { margin-top: 8px; }
@keyframes ink { from { opacity: 0; transform: translateY(6px) scale(.96); filter: blur(2px); } }
.stage-title { margin: 18px 0 12px; min-height: 1.5em; font-weight: 700; text-align: center; }

/* Answer cards */
.hand { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(46%, 160px), 1fr)); gap: 10px; perspective: 900px; }
.card { position: relative; display: flex; align-items: flex-start; min-height: 118px; padding: 14px 14px 26px; border-radius: 12px; border: 2px solid transparent; background: var(--card); color: var(--card-ink); text-align: left; font-weight: 600; font-size: .98rem; line-height: 1.32; box-shadow: 0 1px 0 var(--edge), 0 8px 18px -12px rgb(0 0 0 / .5); transform: rotate(var(--tilt, 0)); transition: transform .25s var(--spring), box-shadow .25s, border-color .2s; animation: deal .55s calc(var(--i, 0) * 55ms) var(--spring) both; overflow-wrap: anywhere; -webkit-tap-highlight-color: transparent; }
.card::after { content: "Isi Tempat Kosong"; position: absolute; left: 14px; bottom: 8px; font-size: .58rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .35; }
.card:hover { transform: translateY(-3px) rotate(var(--tilt, 0)); }
.card.chosen { transform: translateY(-8px) rotate(0) scale(1.03); border-color: var(--blue); box-shadow: 0 14px 22px -10px rgb(0 0 0 / .45), 0 0 0 4px color-mix(in srgb, var(--blue) 25%, transparent); }
body.night .card.chosen { border-color: #3ef0c4; box-shadow: 0 0 0 4px rgb(62 240 196 / .3), 0 0 28px rgb(62 240 196 / .4); }
.order { position: absolute; top: -10px; right: -8px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--red); color: #fff; font-style: normal; font-weight: 700; font-size: .9rem; transform: scale(0); transition: transform .3s var(--spring); }
.card.chosen .order { transform: scale(1); }
@keyframes deal { from { opacity: 0; transform: translateY(46px) rotate(-10deg) scale(.9); } }
.lift { animation: lift .35s var(--spring); }
@keyframes lift { 40% { transform: translateY(-14px) rotate(-2deg) scale(1.06); } }
.card.custom { flex-direction: column; gap: 6px; padding: 10px; border: 2px dashed var(--blue); animation-name: pop; }
.card.custom textarea { width: 100%; flex: 1; min-height: 70px; resize: none; border: 0; background: transparent; color: var(--card-ink); font-weight: 600; line-height: 1.3; }
.card.custom textarea:focus { outline: none; }
.custom-foot { display: flex; gap: 6px; }
.custom-foot button { min-height: 36px; padding: 2px 10px; border-radius: 8px; border: 1px solid #c9bea6; background: #f3efe6; color: #1d2433; font-size: .85rem; font-weight: 700; }
.custom-foot .use { flex: 1; }
.card.custom::after { display: none; }
.send { margin-top: 16px; }
.hand-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }

/* Waiting pile */
.pile { position: relative; height: 128px; margin: 6px auto 8px; width: 120px; }
.facedown { position: absolute; inset: 10px 0 0; border-radius: 12px; background: var(--back); border: 3px solid var(--card); box-shadow: 0 6px 14px -8px #000; transform: translateX(calc(var(--i) * 7px - 14px)) rotate(var(--r)); }
.drop { animation: drop .5s var(--spring); }
@keyframes drop { from { opacity: 0; transform: translateY(-90px) rotate(25deg) scale(1.2); } }
.pending { list-style: none; padding: 0; margin: 0 auto; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.pending li { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 99px; background: var(--paper); border: 1px solid var(--edge); font-size: .9rem; }
.pending li.away { opacity: .55; }
.pending .avatar { width: 30px; height: 30px; font-size: .8rem; }
.dots { display: inline-flex; gap: 2px; vertical-align: 2px; }
.dots b { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.dots b:nth-child(2) { animation-delay: .2s; }
.dots b:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 100% { opacity: .2; } 40% { opacity: 1; } }
.host-skip { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }

/* Judging slips */
.slips { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(46%, 180px), 1fr)); gap: 12px; perspective: 1000px; }
.slip { position: relative; min-height: 140px; padding: 0; border: 0; background: none; color: inherit; text-align: left; animation: deal .55s calc(var(--i) * 80ms) var(--spring) both; -webkit-tap-highlight-color: transparent; }
.slip:disabled { cursor: default; }
.inner { position: relative; display: grid; height: 100%; min-height: inherit; transform-style: preserve-3d; transition: transform .7s var(--spring); transform: rotate(var(--r, 0)); }
.slip.revealed .inner { transform: rotateY(180deg) rotate(calc(var(--r, 0) * -1)); }
.back, .front { grid-area: 1 / 1; border-radius: 12px; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.back { display: grid; place-content: center; text-align: center; background: var(--back); color: #fff; border: 3px solid var(--card); box-shadow: 0 8px 18px -12px #000; }
.back b { font: 400 3rem/1 "DM Serif Text", Georgia, serif; }
.back small { font-weight: 700; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; }
.slip:not(:disabled):not(.revealed):hover .inner { transform: translateY(-4px) rotate(calc(var(--r, 0) - 1deg)); }
.front { display: grid; align-content: start; gap: 8px; padding: 14px; background: var(--card); color: var(--card-ink); font-weight: 600; line-height: 1.32; transform: rotateY(180deg); box-shadow: 0 1px 0 var(--edge), 0 8px 18px -12px rgb(0 0 0 / .5); border: 2px solid transparent; transition: border-color .2s, box-shadow .2s; overflow-wrap: anywhere; }
.front i { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 6px; border-radius: 50%; background: var(--card-ink); color: var(--card); font-style: normal; font-size: .72rem; vertical-align: 1px; }
.slip.picked .front { border-color: var(--red); box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 28%, transparent), 0 14px 24px -12px rgb(0 0 0 / .5); }
.slip.picked .inner { transform: rotateY(180deg) translateZ(20px) scale(1.04); }
#pick { margin-top: 16px; }

/* Result */
.winner { position: relative; display: grid; justify-items: center; gap: 10px; padding: 12px 0 6px; }
.slip.big { width: min(100%, 360px); min-height: 150px; animation: win .8s var(--spring) both; }
.slip.big .inner { transform: none; }
.slip.big .front { transform: none; font-size: 1.15rem; border-color: #f2b51b; box-shadow: 0 0 0 5px rgb(242 181 27 / .35), 0 20px 40px -16px rgb(0 0 0 / .6); }
@keyframes win { from { transform: scale(.6) rotate(-6deg); opacity: 0; } }
.stamp { position: absolute; top: -8px; right: max(0px, calc(50% - 200px)); font-size: .82rem; padding: 6px 12px; border: 3px double var(--red); border-radius: 8px; color: var(--red); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; transform: rotate(12deg); background: color-mix(in srgb, var(--paper) 70%, transparent); animation: stamp .5s .45s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes stamp { from { opacity: 0; transform: rotate(12deg) scale(2.6); } 60% { opacity: 1; } }
.by { display: inline-flex; align-items: center; gap: 8px; font-size: 1.1rem; animation: stage-in .5s .6s var(--ease-out) both; }
.others-title { margin: 18px 0 8px; font-weight: 700; font-size: .9rem; color: var(--soft); }
.others { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; }
.others li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--paper); border: 1px solid var(--edge); animation: stage-in .4s calc(.7s + var(--i) * 70ms) var(--ease-out) both; }
.others small { flex: none; color: var(--soft); font-weight: 700; }
.champion { text-align: center; padding: 8px 0 18px; margin-bottom: 10px; border-bottom: 1px dashed var(--edge); }
.champion h2 { font: 400 clamp(2.2rem, 9vw, 3.2rem)/1.05 "DM Serif Text", Georgia, serif; margin: 6px 0 14px; animation: win .8s var(--spring) both; }
.podium { list-style: none; padding: 0; margin: 0 auto 16px; max-width: 420px; display: grid; gap: 6px; counter-reset: rank; }
.podium li { counter-increment: rank; display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 8px; border-radius: 12px; background: var(--paper); border: 1px solid var(--edge); animation: rise .5s calc(.3s + var(--i) * 90ms) var(--spring) both; }
.podium li::before { content: counter(rank); width: 1.4em; font-weight: 700; color: var(--soft); }
.podium li:first-child { border-color: #f2b51b; box-shadow: 0 0 0 3px rgb(242 181 27 / .3); }
.podium span:not(.avatar) { flex: 1; text-align: left; font-weight: 600; }
.podium b { font-size: 1.2rem; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
#table-tools { margin-top: 10px; }

/* ---------- overlays ---------- */
.react-bar { position: fixed; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 5; display: flex; gap: 2px; padding: 5px; border-radius: 99px; background: var(--paper); border: 1px solid var(--edge); box-shadow: 0 10px 30px -12px rgb(0 0 0 / .55); transform: translateX(-50%); animation: bar-in .5s var(--spring) both; }
@keyframes bar-in { from { transform: translate(-50%, 80px); } }
.react-bar button { width: 46px; height: 46px; border-radius: 50%; border: 0; background: transparent; font-size: 1.45rem; line-height: 1; transition: transform .2s var(--spring), background .2s; }
.react-bar button:hover { transform: scale(1.18) translateY(-2px); background: color-mix(in srgb, var(--ink) 8%, transparent); }
#floaters { position: fixed; inset: 0; pointer-events: none; z-index: 6; overflow: hidden; }
.floater { position: absolute; bottom: 70px; display: grid; justify-items: center; font-size: 2.4rem; line-height: 1; animation: float 2.6s cubic-bezier(.2, .7, .3, 1) forwards; }
.floater small { margin-top: 2px; padding: 1px 7px; border-radius: 99px; background: var(--ink); color: var(--paper); font: 700 .66rem/1.5 "DM Sans", Arial, sans-serif; }
@keyframes float { 0% { opacity: 0; transform: translateY(20px) scale(.4); } 12% { opacity: 1; transform: translateY(-20px) scale(1.15); } 100% { opacity: 0; transform: translate(var(--drift), -55vh) scale(.9); } }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 7; }
.net { position: fixed; top: 0; left: 0; right: 0; z-index: 8; padding: 8px 16px; text-align: center; font-weight: 700; font-size: .9rem; background: #f2b51b; color: #1d2433; }
.toast { position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 8; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px; background: var(--ink); color: var(--paper); font-weight: 600; opacity: 0; pointer-events: none; transform: translate(-50%, 16px); transition: opacity .25s, transform .3s var(--spring); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
dialog { width: min(100% - 32px, 460px); padding: 22px; border-radius: 16px; border: 1px solid var(--edge); background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px -20px rgb(0 0 0 / .6); }
dialog[open] { animation: stage-in .35s var(--spring); }
dialog::backdrop { background: rgb(10 8 20 / .55); backdrop-filter: blur(2px); }
dialog h2 { font: 400 1.5rem/1.15 "DM Serif Text", Georgia, serif; }
dialog .code-tiles b { width: 54px; font-size: 2rem; }
.dialog-players { margin-top: 14px; max-height: 40vh; overflow: auto; }
.dialog-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dialog-foot .link-button { margin: 0; }
.foot { margin: 30px 0 10px; padding-top: 14px; border-top: 1px solid var(--edge); font-size: .88rem; color: var(--soft); display: grid; gap: 6px; }
.foot a { color: var(--ink); font-weight: 700; }

.pop { animation: pop .45s var(--spring); }
@keyframes pop { from { opacity: 0; transform: scale(.6); } }
.bump { display: inline-block; animation: bump .6s var(--spring); }
@keyframes bump { 30% { transform: scale(1.8); color: #f2b51b; } }
.stage-in { animation: stage-in .4s var(--ease-out); }
@keyframes stage-in { from { opacity: 0; transform: translateY(12px); } }
.deal-sheet { animation: deal-sheet .6s var(--spring); }
@keyframes deal-sheet { from { opacity: 0; transform: translateY(-30px) rotate(-2deg); } }

@media (min-width: 640px) {
  .hand { grid-template-columns: repeat(4, 1fr); }
  .card { min-height: 140px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .hero-fill span { opacity: 0; }
  .hero-fill span:first-child { opacity: 1; }
  .floater { animation: none; opacity: 1; transform: translateY(-40px); }
}
