* { box-sizing: border-box; }
body { font-family: system-ui, -apple-system, sans-serif; margin: 0; background: #eef2ff; color: #1e1b4b; font-size: 1.15rem; }
header { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .8rem 1rem; background: #4f46e5; }
header { flex-wrap: wrap; }
header nav { display: flex; gap: 1rem; }
header a { color: #fff; text-decoration: none; font-weight: 700; white-space: nowrap; }
.logo { display: inline-flex; align-items: center; gap: .5rem; }
.logo img { width: 2.5rem; height: 2.5rem; transform: rotate(-6deg); transition: transform .2s; }
.logo:hover img { transform: rotate(6deg) scale(1.08); }
.logo-text { font-family: ui-rounded, "Arial Rounded MT Bold", "Nunito", system-ui, sans-serif; font-weight: 900; font-size: 1.45rem; letter-spacing: .02em; text-shadow: 0 3px 0 #3a0ca3; }
.logo-text span:first-child { color: #ffd60a; }
.logo-text span:last-child { color: #fff; }
main { max-width: 34rem; margin: 0 auto; padding: 1rem; }
h1, h2 { margin: .4rem 0 .8rem; line-height: 1.2; }
.card { background: #fff; border-radius: 1rem; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 6px #0001; }
input, select, button { font: inherit; font-size: 1.2rem; padding: .85rem 1rem; width: 100%; border-radius: .8rem; margin: .3rem 0; min-height: 3.2rem; }
input, select { border: 2px solid #c7d2fe; background: #fff; }
button { border: 0; background: #4f46e5; color: #fff; font-weight: 700; cursor: pointer; }
button.alt { background: #e0e7ff; color: #312e81; }
button.good { background: #16a34a; }
button.bad { background: #dc2626; }
button:disabled { opacity: .5; }
.row { display: flex; gap: .5rem; }
.row > * { flex: 1; min-width: 0; }
.row > button { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-inline: .5rem; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.grid button { margin: 0; }
.code { font-size: 3rem; letter-spacing: .5rem; font-weight: 800; text-align: center; }
.big { font-size: 2.2rem; font-weight: 800; text-align: center; margin: .8rem 0; overflow-wrap: anywhere; }
.muted { color: #6366f1; font-size: 1rem; }
.center { text-align: center; }
ul.list { list-style: none; padding: 0; margin: 0; }
ul.list li { display: flex; justify-content: space-between; gap: .5rem; padding: .6rem 0; border-bottom: 1px solid #e0e7ff; overflow-wrap: anywhere; }
ul.list li:last-child { border-bottom: 0; }
.pill { background: #e0e7ff; border-radius: 1rem; padding: 0 .6rem; font-size: .95rem; white-space: nowrap; }
.timer { font-size: 1.6rem; font-weight: 800; text-align: center; }
.error { color: #b91c1c; text-align: center; min-height: 1.4rem; margin: 0 1rem 1rem; }
.rooms { display: grid; gap: .5rem; }
.room-row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; text-align: left; font-weight: 400; margin: 0; }
.room-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
button.small { white-space: nowrap; flex: none; width: auto; min-height: 2.4rem; padding: .2rem .8rem; margin: 0; font-size: 1rem; }
.who-list { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; }
.who-list button.small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.trivia-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.progress { height: .5rem; background: #e0e7ff; border-radius: 1rem; overflow: hidden; margin: .6rem 0 .4rem; }
.progress > div { height: 100%; background: #4f46e5; transition: width .3s; }
.grid button { overflow-wrap: anywhere; }
button.good:disabled, button.bad:disabled { opacity: 1; }
.trivia-top .timer, .quiz-result { flex-basis: 100%; text-align: center; }
.quiz-result { font-size: 1.3rem; font-weight: 800; }
.quiz-answer { margin: .6rem 0 0; }

/* Phones: the question and reveal phases fill the screen like a quiz app. */
@media (max-width: 600px) {
  .who-list button.small { min-height: 3rem; font-size: 1.1rem; padding: .4rem 1rem; }
  main { padding: .6rem; }
  .card { padding: .8rem; margin-bottom: .6rem; }
  body.quiz-on header, body.quiz-on .game-title { display: none; }
  body.quiz-on main { padding: 0; }
  body.quiz-on .quiz { display: flex; flex-direction: column; min-height: 100dvh; padding: max(.6rem, env(safe-area-inset-top)) max(.6rem, env(safe-area-inset-right)) max(.6rem, env(safe-area-inset-bottom)) max(.6rem, env(safe-area-inset-left)); gap: .6rem; }
  body.quiz-on .quiz > .card { flex: 1; display: flex; flex-direction: column; margin: 0; min-height: 0; }
  body.quiz-on .trivia-top { flex-wrap: nowrap; }
  body.quiz-on .trivia-top .muted { flex: 1; min-width: 0; font-size: .85rem; line-height: 1.2; }
  body.quiz-on .trivia-top .timer, body.quiz-on .quiz-result { flex-basis: auto; font-size: 1.15rem; white-space: nowrap; }
  body.quiz-on .progress { margin: .5rem 0; }
  body.quiz-on .quiz-q { font-size: 1.45rem; margin: .4rem 0 .8rem; overflow-wrap: anywhere; }
  body.quiz-on .quiz-answers { flex: 1; grid-auto-rows: 1fr; gap: .6rem; }
  body.quiz-on .quiz-answers button { min-height: 4.5rem; height: 100%; font-size: 1.15rem; line-height: 1.25; padding: .6rem; border-radius: 1rem; }
  body.quiz-on .quiz.long .quiz-q { font-size: 1.2rem; }
  body.quiz-on .quiz.long .quiz-answers button { font-size: 1rem; }
  body.quiz-on .quiz-answer { font-size: 1rem; }
  body.quiz-on .quiz-score { margin: .5rem 0 0; }
  body.quiz-on .quiz-next { margin: 0; min-height: 3.6rem; font-size: 1.3rem; position: sticky; bottom: max(.6rem, env(safe-area-inset-bottom)); }
  body.quiz-on .room-controls, body.quiz-on main > div > .row { padding: 0 .6rem; }
}

/* Forehead Guess: the turn fills the screen (landscape when held to the forehead). */
.fg-pass { font-size: 2rem; }
body.quiz-on header, body.quiz-on .game-title { display: none; }
body.quiz-on main:has(.fg) { max-width: none; padding: 0; }
.fg { display: flex; flex-direction: column; min-height: 100dvh; padding: max(.6rem, env(safe-area-inset-top)) max(.6rem, env(safe-area-inset-right)) max(.6rem, env(safe-area-inset-bottom)) max(.6rem, env(safe-area-inset-left)); }
.fg-card { flex: 1; display: flex; flex-direction: column; justify-content: center; margin: 0; text-align: center; transition: background .15s; }
.fg-card .trivia-top { flex-wrap: nowrap; align-items: center; }
.fg-card .trivia-top .muted { flex: 1; min-width: 0; }
.fg-card .trivia-top .timer, .fg-card .trivia-top .quiz-result { flex-basis: auto; white-space: nowrap; }
.fg-card.flash-got { background: #bbf7d0; }
.fg-card.flash-pass { background: #fed7aa; }
.fg-count { font-size: min(40vw, 40vh); font-weight: 900; line-height: 1; color: #4f46e5; }
.fg-emoji { font-size: min(18vw, 22vh); line-height: 1.1; margin-top: .5rem; }
.fg-word { flex: 1; display: flex; align-items: center; justify-content: center; font-size: clamp(2.2rem, min(11vw, 18vh), 7rem); font-weight: 900; line-height: 1.05; overflow-wrap: anywhere; margin: .4rem 0; }
.fg-buttons { gap: .6rem; }
.fg-buttons button { flex: 1; min-height: 4.5rem; font-size: 1.4rem; border-radius: 1rem; }
button.fg-skip { background: #f97316; }
.odd-card { text-align: center; }
.odd-card .big { margin: 1rem 0; }
.room-buttons { flex-wrap: wrap; }
.room-buttons > button { flex: 1 1 8rem; }

/* Color Dash: CSS-only cards, the table and the deal/play animations. */
.cd { position: relative; }
.cd-banner { position: sticky; top: 0; z-index: 3; margin: 0 0 .7rem; padding: .8rem 1rem; border-radius: 1rem; text-align: center; font-weight: 800; font-size: 1.15rem;
  background: #fff; color: #312e81; box-shadow: 0 4px 14px #4f46e522; overflow-wrap: anywhere; }
.cd-banner-go { background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; animation: cd-pulse 1.6s ease-in-out infinite; }
@keyframes cd-pulse { 50% { box-shadow: 0 4px 22px #7c3aed88; } }
.cd-card { --w: 4.6rem; position: relative; flex: none; width: var(--w); height: calc(var(--w) * 1.45); border-radius: .7rem; border: .22rem solid #fff; padding: 0; margin: 0; min-height: 0;
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 900; box-shadow: 0 3px 8px #0003; transition: transform .18s, filter .18s, box-shadow .18s; }
.cd-red { background: linear-gradient(150deg, #f87171, #dc2626); }
.cd-yellow { background: linear-gradient(150deg, #fde047, #eab308); }
.cd-green { background: linear-gradient(150deg, #4ade80, #16a34a); }
.cd-blue { background: linear-gradient(150deg, #60a5fa, #2563eb); }
.cd-wild { background: conic-gradient(#ef4444 0 25%, #facc15 0 50%, #22c55e 0 75%, #3b82f6 0); }
.cd-back { background: repeating-linear-gradient(45deg, #312e81 0 .35rem, #4338ca .35rem .7rem); }
.cd-oval { width: 78%; height: 62%; border-radius: 50%; background: #fff; transform: rotate(-28deg); display: flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 .15rem #0001; }
.cd-face { transform: rotate(28deg); font-size: calc(var(--w) * .42); line-height: 1; color: #1e1b4b; }
.cd-red .cd-face { color: #dc2626; } .cd-yellow .cd-face { color: #ca8a04; } .cd-green .cd-face { color: #16a34a; } .cd-blue .cd-face { color: #2563eb; }
.cd-wild .cd-face { background: conic-gradient(#ef4444 0 25%, #eab308 0 50%, #16a34a 0 75%, #2563eb 0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cd-back .cd-oval { background: #ffd60a; } .cd-back .cd-face { color: #312e81; font-size: calc(var(--w) * .3); letter-spacing: -.05em; }
.cd-corner { position: absolute; top: .2rem; left: .3rem; font-size: calc(var(--w) * .2); line-height: 1; text-shadow: 0 1px 0 #0004; }
.cd-br { top: auto; left: auto; bottom: .2rem; right: .3rem; transform: rotate(180deg); }
.cd-mini { --w: 1.6rem; border-width: .12rem; border-radius: .3rem; box-shadow: 0 1px 3px #0003; }
.cd-mini .cd-face { display: none; }
.cd-opponents { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-bottom: .6rem; }
.cd-opp { background: #fff; border-radius: .9rem; padding: .5rem .7rem; text-align: center; min-width: 6.5rem; max-width: 10rem; box-shadow: 0 2px 6px #0001; border: 2px solid transparent; }
.cd-opp.cd-turn { border-color: #7c3aed; box-shadow: 0 0 0 4px #7c3aed33; }
.cd-opp-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-opp-count { font-size: .9rem; color: #6366f1; }
.cd-fan { display: flex; justify-content: center; height: 2.5rem; }
.cd-fan .cd-mini + .cd-mini { margin-inline-start: -1.05rem; }
.cd-table { display: flex; align-items: center; justify-content: center; gap: 1.4rem; padding: 1.2rem .5rem; margin-bottom: .4rem; border-radius: 1.4rem;
  background: radial-gradient(circle at 50% 40%, #22c55e, #15803d); box-shadow: inset 0 0 0 .35rem #14532d55, 0 4px 14px #0002; }
.cd-table .cd-card { --w: 5.4rem; }
.cd-drawpile { position: relative; background: none; width: auto; padding: 0; margin: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.cd-drawpile:disabled { opacity: .85; }
.cd-drawpile .cd-card { box-shadow: .25rem .25rem 0 #1e1b4b55, .5rem .5rem 0 #1e1b4b33; }
.cd-drawlabel { font-size: .85rem; color: #fff; font-weight: 800; }
.cd-drawpile.cd-ok .cd-card { animation: cd-glow 1s ease-in-out infinite alternate; }
.cd-pile { position: relative; width: 5.4rem; height: calc(5.4rem * 1.45); }
.cd-pile .cd-card { position: absolute; inset: 0; }
.cd-pile .cd-under { transform: rotate(-12deg) translate(-.4rem, .2rem); filter: brightness(.85); }
.cd-pile .cd-card:last-child { transform: rotate(4deg); }
.cd-color { align-self: center; padding: .3rem .7rem; border-radius: 1rem; color: #fff; font-weight: 800; font-size: .95rem; border: 2px solid #fff; }
.cd-news { margin: .2rem 0 .5rem; }
.cd-hand { display: flex; flex-wrap: wrap; justify-content: center; gap: .9rem 0; padding-block: 1.2rem .6rem; padding-inline: 1.4rem .4rem; }
.cd-hand .cd-card { margin-inline-start: -1.4rem; }
.cd-v-6 .cd-face, .cd-v-9 .cd-face, .cd-v-6.cd-card > .cd-corner, .cd-v-9.cd-card > .cd-corner { text-decoration: underline; text-underline-offset: .12em; }
.cd-hand .cd-card:nth-child(odd) { rotate: -3deg; } .cd-hand .cd-card:nth-child(even) { rotate: 3deg; }
.cd-hand .cd-ok { cursor: pointer; transform: translateY(-.9rem); animation: cd-glow 1s ease-in-out infinite alternate; z-index: 1; }
.cd-hand .cd-ok:active { transform: translateY(-1.3rem) scale(1.05); }
.cd-hand .cd-dim { filter: grayscale(.6) brightness(.8); opacity: .65; }
@keyframes cd-glow { from { box-shadow: 0 0 0 .15rem #fde047, 0 6px 14px #0003; } to { box-shadow: 0 0 0 .3rem #fde047, 0 0 1.2rem .3rem #fde047aa; } }
.cd-hand .cd-deal { animation: cd-deal .5s cubic-bezier(.2, .9, .3, 1.2) both; }
.cd-hand .cd-ok.cd-deal { animation: cd-deal .5s cubic-bezier(.2, .9, .3, 1.2) both, cd-glow 1s ease-in-out .5s infinite alternate; }
@keyframes cd-deal { from { opacity: 0; translate: 0 -16rem; scale: .4; rotate: 25deg; } }
.cd-fly-up { animation: cd-fly-up .45s cubic-bezier(.2, .8, .3, 1) both; }
.cd-fly-down { animation: cd-fly-down .45s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes cd-fly-up { from { opacity: 0; translate: 0 14rem; scale: 1.3; rotate: -20deg; } }
@keyframes cd-fly-down { from { opacity: 0; translate: 0 -12rem; scale: .6; rotate: 20deg; } }
.cd-picker { position: fixed; inset: 0; z-index: 10; background: #1e1b4bcc; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.cd-picker .card { width: min(26rem, 100%); }
button.cd-pick { min-height: 4.5rem; font-size: 1.2rem; color: #fff; text-shadow: 0 1px 2px #0006; }
.cd-seats { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; }
.cd-seat { display: inline-flex; align-items: center; gap: .4rem; background: #e0e7ff; border-radius: 1rem; padding: .3rem .7rem .3rem .4rem; font-weight: 700; }
.cd-win { font-size: 4rem; text-align: center; animation: cd-bounce 1s ease-in-out infinite; }
@keyframes cd-bounce { 50% { transform: translateY(-.6rem) scale(1.08); } }
.cd-confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.cd-confetti i { position: absolute; top: -1rem; width: .6rem; height: 1rem; border-radius: .15rem; animation: cd-fall linear infinite; }
@keyframes cd-fall { to { transform: translateY(110vh) rotate(720deg); } }
@media (max-width: 400px) {
  .cd-hand .cd-card { --w: 4.1rem; }
  .cd-table { gap: .8rem; }
  .cd-table .cd-card, .cd-pile { --w: 4.8rem; width: 4.8rem; height: calc(4.8rem * 1.45); }
}
@media (prefers-reduced-motion: reduce) { .cd *, .cd-confetti i { animation: none !important; } }
