/* TV layout. Designed on a 64 × 36 rem frame: at 1920×1080 one rem is 30px,
   and the whole frame scales with the window. Only tokens from tokens.css are used. */
html[data-role='host'] { font-size: min(1.5625vw, 2.7778vh); }

#tv {
  position: fixed; inset: 0; display: grid; place-items: center; overflow: hidden; overflow: clip;
  background: radial-gradient(120% 90% at 50% -10%, var(--sky-2), var(--sky-1) 48%, var(--sky-0));
}
#frame {
  position: relative; width: 64rem; height: 36rem;
  display: grid; grid-template-rows: 4.2rem minmax(0, 1fr) auto;
  padding: 1.1rem 1.8rem 0.9rem; gap: 0.5rem;
}

/* ── ambient sky ── */
#sky { position: absolute; inset: 0; pointer-events: none; }
#sky::before, #sky::after {
  content: ''; position: absolute; inset: -10%;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.9) 0 0.06rem, transparent 0.08rem),
    radial-gradient(circle, rgba(255, 255, 255, 0.6) 0 0.045rem, transparent 0.07rem),
    radial-gradient(circle, rgba(255, 255, 255, 0.75) 0 0.035rem, transparent 0.06rem);
  background-size: 11rem 9rem, 7rem 13rem, 5rem 6rem;
  background-position: 1rem 2rem, 4rem 6rem, 2rem 1rem;
  animation: sky-twinkle 6s ease-in-out infinite alternate;
}
#sky::after { background-size: 13rem 11rem, 9rem 7rem, 6rem 8rem; background-position: 6rem 4rem, 2rem 3rem, 5rem 5rem; animation-delay: -3s; animation-duration: 8s; }
.sky__shape {
  position: absolute; color: var(--accent); opacity: 0.13;
  transition: color 1.2s var(--e-out);
  animation: sky-drift var(--t, 40s) ease-in-out infinite alternate;
}
[data-theme='day'] #sky::before, [data-theme='day'] #sky::after { display: none; }
[data-theme='day'] .sky__shape { opacity: 0.18; }
@keyframes sky-twinkle { from { opacity: 0.35; } to { opacity: 0.85; } }

/* ── the room: each game dresses the backdrop with its texture and a few floating marks ── */
#room { position: absolute; inset: 0; pointer-events: none; overflow: hidden; overflow: clip; transition: background 900ms var(--e-out); }
#room .room__mark { position: absolute; color: var(--accent); opacity: 0; animation: sky-drift var(--t, 24s) ease-in-out infinite alternate, room-in 900ms var(--e-out) forwards; }
@keyframes room-in { to { opacity: 0.1; } }
#room .room__frame { position: absolute; width: 11rem; height: 12.5rem; border: 0.5rem solid color-mix(in srgb, var(--paper) 55%, transparent); border-bottom-width: 2.6rem; border-radius: 0.3rem; transform: rotate(var(--rot)); opacity: 0.1; animation: room-in 900ms var(--e-out) forwards; }
#room[data-game='whosaid'] { background: repeating-linear-gradient(180deg, transparent 0 2.3rem, color-mix(in srgb, var(--c-whosaid) 14%, transparent) 2.3rem 2.42rem); }
#room[data-game='mostlikely'] { background: radial-gradient(ellipse 28% 70% at 24% -10%, color-mix(in srgb, var(--c-mostlikely) 18%, transparent), transparent 70%), radial-gradient(ellipse 28% 70% at 76% -10%, color-mix(in srgb, var(--c-mostlikely) 18%, transparent), transparent 70%); }
#room[data-game='twotruths'] { background: repeating-linear-gradient(-45deg, transparent 0 1.6rem, color-mix(in srgb, var(--c-twotruths) 9%, transparent) 1.6rem 1.75rem); }
#room[data-game='howmuch'] { background: repeating-linear-gradient(90deg, transparent 0 3.95rem, color-mix(in srgb, var(--c-howmuch) 11%, transparent) 3.95rem 4rem), repeating-linear-gradient(180deg, transparent 0 3.95rem, color-mix(in srgb, var(--c-howmuch) 11%, transparent) 3.95rem 4rem); }
#room[data-game='photos'] { background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--c-photos) 7%, transparent), transparent 60%), repeating-radial-gradient(circle at 30% 70%, transparent 0 0.5rem, color-mix(in srgb, var(--c-photos) 4%, transparent) 0.5rem 0.55rem); }
#room[data-game='draw'] { background: linear-gradient(180deg, color-mix(in srgb, #0f3a2f 55%, transparent), transparent 75%); }
[data-theme='day'] #room[data-game='draw'] { background: linear-gradient(180deg, color-mix(in srgb, #9bc9a6 35%, transparent), transparent 75%); }
#room[data-game='draw'] .room__mark { color: var(--paper); }
@keyframes sky-drift {
  from { transform: translate3d(0, 0, 0) rotate(0deg); }
  to { transform: translate3d(var(--dx, 6rem), var(--dy, -4rem), 0) rotate(var(--rot, 40deg)); }
}

/* ── top bar ── */
#top { display: flex; align-items: center; justify-content: space-between; min-height: 0; position: relative; z-index: 3; }
#where { display: flex; align-items: center; gap: var(--s-3); }
#where .badge { font-size: var(--fs-2); }
#left { display: flex; align-items: center; gap: 0.6rem; }
#menu { min-height: 2rem; padding: 0 0.8rem; font-size: 0.75rem; opacity: 0.6; transition: opacity var(--d-fast); }
#menu:hover, #menu:focus-visible { opacity: 1; }
#menu[hidden] { display: none; }
#clock { position: relative; width: 4.2rem; height: 4.2rem; display: grid; place-items: center; }
#clock[hidden] { display: none; }
#clock svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.clock__track { fill: var(--surface); stroke: var(--surface-3); stroke-width: 9; }
.clock__arc { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; stroke-dasharray: 100; }
.clock__num { position: relative; font-size: var(--fs-3); }
#clock.is-urgent { animation: m-pulse 1s var(--e-out) infinite; }
#clock.is-urgent .clock__arc { stroke: var(--bad); }

/* ── stage ── */
#stage { position: relative; min-height: 0; }
#frame { overflow: visible; }
#sky { overflow: hidden; overflow: clip; }
#stage > .screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-4); text-align: center; }

/* ── tray: who has submitted ── */
#tray { display: flex; justify-content: center; align-items: flex-end; gap: 0.45rem; min-height: 3.9rem; padding-top: 0.9rem; position: relative; z-index: 3; }
#tray:empty { min-height: 0; padding: 0; }
.seat { position: relative; display: grid; justify-items: center; gap: 0.1rem; width: 3.1rem; }
.seat .avatar { --sz: 2.3rem; }
.seat__name { font-size: 0.62rem; font-weight: 700; color: var(--ink-2); max-width: 3.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat .points { position: absolute; top: -1.05rem; font-size: 0.72rem; z-index: 2; }

#progress { position: absolute; inset-inline: 0; bottom: 0; height: 0.2rem; }
#progress i { display: block; height: 100%; background: var(--accent); opacity: 0.55; transform-origin: right center; transform: scaleX(0); }

/* ── "phones!" banner ── */
#banner {
  position: absolute; z-index: 20; top: 38%; left: 50%;
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-4) var(--s-7);
  background: var(--accent); color: var(--ink-dark);
  border-radius: var(--r-l); box-shadow: var(--shadow-pop), var(--shadow-soft);
  font-family: var(--font-display); font-size: var(--fs-6); white-space: nowrap;
  animation: banner 1700ms var(--e-out) both;
}
#banner[hidden] { display: none; }
#banner i { animation: m-shake 420ms var(--e-out) 3; }
@keyframes banner {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5) rotate(-4deg); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1.06) rotate(1deg); }
  22%, 78% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
  100% { opacity: 0; transform: translate(-50%, -160%) scale(0.9); }
}

#pause {
  position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; align-content: center; gap: var(--s-4);
  background: color-mix(in srgb, var(--sky-0) 82%, transparent);
  animation: m-fade var(--d-med) var(--e-out) both;
}
#pause[hidden] { display: none; }

#toast {
  position: fixed; left: 50%; bottom: 2.4rem; transform: translateX(-50%); z-index: 41;
  padding: var(--s-2) var(--s-5); border-radius: var(--r-pill);
  background: var(--surface-3); font-size: 0.7rem; font-weight: 700;
  animation: m-rise var(--d-med) var(--e-out) both;
}
#toast[hidden] { display: none; }

/* ── logo ── */
.logo { position: relative; display: inline-flex; align-items: baseline; gap: 0.28em; font-family: var(--font-display); font-size: 5.6rem; line-height: 1.5; padding-inline: 0.2em; }
.logo span { display: inline-block; animation: logo-in 900ms var(--e-pop) both; }
.logo__a { color: var(--ink); text-shadow: 0 0.055em 0 var(--c-whosaid), 0 0.11em 0 var(--c-draw), 0 0.17em 0 var(--shade); }
.logo__b { color: var(--c-mostlikely); text-shadow: 0 0.055em 0 var(--c-brand), 0 0.11em 0 var(--c-whosaid), 0 0.17em 0 var(--shade); animation-delay: 260ms !important; }
.logo__moon { position: absolute; inset-inline-start: -0.35em; top: -0.08em; font-size: 0.42em; color: var(--c-mostlikely); animation: logo-moon 1200ms var(--e-pop) 620ms both, m-float 4s ease-in-out 1900ms infinite; }
.logo__dots { position: absolute; inset-inline: 0; bottom: 0.02em; display: flex; justify-content: center; gap: 0.12em; }
.logo__dots i { width: 0.13em; height: 0.13em; border-radius: 50%; animation: m-pop 500ms var(--e-pop) both; animation-delay: calc(800ms + var(--i) * 110ms); }
.logo--small { font-size: 2.2rem; }
@keyframes logo-in { 0% { opacity: 0; transform: translateY(-0.6em) rotate(-6deg) scale(0.6); } 100% { opacity: 1; transform: none; } }
@keyframes logo-moon { 0% { opacity: 0; transform: scale(0) rotate(-90deg); } 100% { opacity: 1; transform: none; } }

/* ── lobby ── */
.lobby { display: grid !important; grid-template-columns: 19rem minmax(0, 1fr); grid-template-rows: auto 1fr auto; gap: 0.9rem 1.6rem; align-items: stretch !important; justify-content: stretch !important; text-align: start !important; }
#stage > .lobby, #stage > .final { inset-block-start: -4.7rem; }
.lobby__brand { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; }
.lobby__mark { display: flex; align-items: flex-end; gap: 0.6rem; }
.lobby__dallah { width: 5.2rem; height: auto; color: var(--c-brand); opacity: 0.9; filter: drop-shadow(0 0.18rem 0 var(--shade)); margin-bottom: 0.9rem; animation-delay: 700ms; }
.lobby__side .sadu { width: 17rem; margin-top: 0.2rem; }
.final__brand .sadu { margin-top: 0.3rem; }
.lobby__side { display: grid; justify-items: center; gap: 0.2rem; }
.lobby__tag { font-size: var(--fs-1); color: var(--ink-2); font-weight: 700; }
.lobby__settings { margin-inline-start: auto; min-height: 2rem; font-size: 0.75rem; padding: 0 0.9rem; }
.lobby__join { display: grid; grid-template-rows: auto 1fr auto; justify-items: center; gap: 0.5rem; padding: 0.9rem; text-align: center; }
.lobby__join img { width: 10.6rem; height: 10.6rem; border-radius: var(--r-s); display: block; }
.lobby__realname { font-size: 0.72rem; font-weight: 800; color: var(--surface-3); }
.lobby__url { direction: ltr; font-weight: 800; font-size: 1.05rem; background: var(--ink-dark); color: var(--paper); padding: 0.2rem 0.8rem; border-radius: var(--r-pill); }
.lobby__players { display: flex; flex-direction: column; gap: 0.6rem; min-height: 0; }
.lobby__head { display: flex; align-items: center; gap: var(--s-3); }
.lobby__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; align-content: start; }
.lobby__grid .chip { position: relative; font-size: 0.9rem; min-width: 0; }
.lobby__grid .chip .avatar { --sz: 2.3rem; }
.lobby__empty { grid-column: 1 / -1; color: var(--ink-3); font-size: var(--fs-2); padding: 1.5rem 0; }
.kick { position: absolute; inset-inline-end: 0.3rem; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: var(--ink); color: var(--bad); font-size: 1.3rem; display: grid; place-items: center; opacity: 0; transition: opacity var(--d-fast); }
.chip:hover .kick { opacity: 1; }
.lobby__games { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.6rem; align-items: stretch; }
.gcard { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.35rem 0.6rem; align-items: center; padding: 0.55rem 0.7rem; transition: opacity var(--d-med), filter var(--d-med); }
.gcard.is-off { opacity: 0.45; filter: saturate(0.3); }
.gcard .medal { --sz: 2.2rem; cursor: pointer; }
.gcard__top { cursor: pointer; }
.gcard__name { font-family: var(--font-display); font-size: 1.05rem; line-height: 1.3; white-space: nowrap; }
.gcard__top { display: grid; min-width: 0; }
.gcard__est { font-weight: 800; font-size: 0.58rem; line-height: 1.35; color: var(--accent); }
.lobby__est { margin-inline-start: auto; font-size: 0.8rem; gap: 0.35rem; }
.lobby__est i { color: var(--c-mostlikely); font-size: 1.1em; }
.lobby__est + .lobby__settings { margin-inline-start: 0; }
.set__est { font-size: 0.75rem; margin-inline-start: auto; gap: 0.35rem; white-space: nowrap; }
.set__est[hidden] { display: none; }
.set__est i { color: var(--c-mostlikely); }

.gcard__row { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.3rem; font-size: 0.7rem; color: var(--ink-2); font-weight: 700; }
.gcard__row button { width: 1.35rem; height: 1.35rem; border-radius: 50%; background: var(--surface-3); color: var(--ink); font-size: 0.7rem; display: grid; place-items: center; }
.gcard__row button:hover { background: var(--accent); color: var(--ink-dark); }
.gcard__row .num { font-size: 1rem; min-width: 1.2rem; text-align: center; color: var(--ink); }
.gcard__row .sp { flex: 1; }
.lobby__start { font-size: 1.7rem; font-family: var(--font-display); font-weight: 400; min-height: 0; width: 13rem; height: 5.2rem; flex-direction: column; gap: 0; line-height: 1.3; }
.lobby__start small { font-family: var(--font-body); font-size: 0.62rem; font-weight: 700; }

/* ── intro ── */
.intro .medal { --sz: 8rem; border-radius: 30%; }
.intro__name { font-size: var(--fs-7); }
.intro__rules { display: grid; gap: var(--s-2); font-size: var(--fs-3); color: var(--ink-2); font-weight: 700; max-width: 46rem; }

/* ── question frame (shared by the three question games) ── */
.q { justify-content: flex-start !important; padding-top: 0.6rem; }
.q__kicker { font-size: var(--fs-2); color: var(--accent); font-weight: 800; min-height: 1.6em; }
.q__text { max-width: 54rem; transition: font-size var(--d-slow) var(--e-out), margin var(--d-slow) var(--e-out); margin-block: auto; text-wrap: balance; }
.q.is-compact .q__text { font-size: var(--fs-4) !important; margin-block: 0; }
.q__hint { font-size: var(--fs-2); color: var(--ink-2); font-weight: 700; min-height: 1.6em; }
.q__stage { width: 100%; flex: 1; min-height: 0; display: none; align-items: center; justify-content: center; gap: var(--s-6); position: relative; }
.q.is-compact .q__stage { display: flex; }
.q.is-compact .q__hint { display: none; }

.quote { position: relative; max-width: 46rem; padding: 1.4rem 2.4rem; margin-block: auto; transition: transform var(--d-slow) var(--e-out); }
.quote > i { position: absolute; top: -1.1rem; inset-inline-start: 1.2rem; font-size: 2.6rem; color: var(--accent); filter: drop-shadow(0 0.14rem 0 var(--shade)); }
.q.is-compact .quote { margin-block: 0; padding-block: 0.8rem; }
.q.is-compact .quote .display { font-size: var(--fs-4) !important; }
.q.is-compact .quote > i { font-size: 1.7rem; top: -0.8rem; inset-inline-start: -0.5rem; }
.quote > i { transition: font-size var(--d-slow) var(--e-out), top var(--d-slow) var(--e-out), inset-inline-start var(--d-slow) var(--e-out); }

.author { display: flex; align-items: center; gap: var(--s-5); text-align: start; }
.author .avatar { --sz: 9rem; }
.author__name { font-size: var(--fs-6); }
.author__stats { display: flex; gap: var(--s-3); align-items: center; font-size: var(--fs-2); font-weight: 700; color: var(--ink-2); }
.author__stats .points { font-size: var(--fs-2); }

/* mostlikely: bars made of voter avatars */
.bars { display: flex; align-items: flex-end; justify-content: center; gap: 1.1rem; height: 100%; padding-bottom: 0.2rem; }
.bar { display: grid; justify-items: center; gap: 0.25rem; }
.bar__count { font-size: var(--fs-3); }
.bar__stack { display: flex; flex-wrap: wrap-reverse; justify-content: center; align-content: flex-start; width: calc(var(--cols, 2) * 2rem + 0.5rem); gap: 0.1rem; padding: 0.25rem; background: var(--surface-2); border-radius: var(--r-m); box-shadow: inset 0 0.12rem 0 var(--line), var(--shadow-pop); min-height: 2.2rem; }
.bar__stack .avatar { --sz: 1.9rem; }
.bar.is-top .bar__stack { background: var(--accent); transition: box-shadow 600ms var(--e-out); }
.bar.is-glow .bar__stack { box-shadow: 0 0 0 0.2rem var(--accent), 0 0 2rem color-mix(in srgb, var(--accent) 65%, transparent); }
.bar__who { display: grid; justify-items: center; }
.bar__who .avatar { --sz: 3.4rem; }
.bar__who span { font-size: 0.9rem; font-weight: 800; max-width: 5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar__crown { font-size: 1.6rem; color: var(--accent); height: 1.6rem; filter: drop-shadow(0 0.12rem 0 var(--shade)); }
.titlecard { width: 17rem; display: grid; justify-items: center; gap: 0.3rem; padding: 1rem 1.2rem; transform-origin: center; }
.titlecard i { font-size: 2.6rem; }
.titlecard__title { font-size: var(--fs-3); line-height: 1.35; text-wrap: balance; }
.titlecard__name { font-weight: 800; font-size: var(--fs-2); }

/* howmuch: number line */
.nline { position: relative; width: 52rem; height: 100%; min-height: 13rem; }
.nline__track { position: absolute; inset-inline: 0; top: 62%; height: 0.5rem; border-radius: var(--r-pill); background: var(--surface-3); box-shadow: var(--shadow-pop); }
.nline__end { position: absolute; top: calc(62% + 1rem); font-size: 0.85rem; color: var(--ink-3); }
.nline__guess { position: absolute; top: 62%; display: grid; justify-items: center; transform: translate(-50%, -100%); padding-bottom: 0.35rem; }
.nline__guess > div { display: grid; justify-items: center; }
.nline__guess .avatar { --sz: 2.5rem; }
.nline__guess .num { font-size: 0.85rem; background: var(--surface-2); border-radius: var(--r-pill); padding: 0 0.45rem; margin-top: -0.2rem; position: relative; }
.nline__guess.is-win .num { background: var(--good); color: var(--ink-dark); }
.nline { transition: transform 900ms var(--e-out); }
.nline.is-done { transform: scale(1.08); }
.nline__guess > div { transition: transform 700ms var(--e-pop), opacity 700ms var(--e-out); }
.nline.is-done .nline__guess:not(.is-win) > div { opacity: 0.55; transform: scale(0.9); }
.nline.is-done .nline__guess.is-win > div { transform: scale(1.3); z-index: 4; }
.nline.is-done .nline__guess.is-win .avatar { box-shadow: 0 0 0 0.22rem var(--good), 0 0 1.8rem color-mix(in srgb, var(--good) 70%, transparent); border-radius: 50%; }
.nline__answer { position: absolute; top: calc(62% + 0.5rem); transform: translateX(-50%); display: grid; justify-items: center; z-index: 3; }
.nline__answer > div { display: grid; justify-items: center; }
.nline__pin { width: 0.3rem; height: 1.5rem; background: var(--accent); border-radius: var(--r-pill); margin-top: -1.4rem; }
.nline__answer .card { padding: 0.1rem 1.1rem; display: flex; align-items: baseline; gap: 0.4rem; white-space: nowrap; }
.nline__answer .num { font-size: var(--fs-5); }
.nline__answer small { font-weight: 800; font-size: 0.9rem; }
.subject { display: inline-flex; align-items: center; gap: var(--s-2); }

/* draw */
.draw { display: grid !important; grid-template-columns: 1fr 24rem 1fr; gap: 1.4rem; align-items: stretch !important; text-align: center; }
.draw__side { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-4); min-width: 0; position: relative; }
.draw__canvas { position: relative; align-self: center; width: 24rem; height: 24rem; padding: 0; overflow: hidden; }
.draw__canvas canvas { width: 100%; height: 100%; display: block; }
.draw__wait { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: var(--s-3); color: var(--ink-dark); }
.draw__wait i { font-size: 5rem; color: var(--accent); }
.artist { display: grid; justify-items: center; gap: 0.2rem; }
.artist .avatar { --sz: 5rem; }
.artist__name { font-size: var(--fs-4); }
.mask { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1.1rem; direction: rtl; }
.mask__word { display: flex; gap: 0.28rem; }
.mask__cell { width: 1.75rem; height: 2.3rem; display: grid; place-items: center; border-radius: 0.4rem; background: var(--surface-2); box-shadow: inset 0 -0.2rem 0 var(--accent); font-family: var(--font-display); font-size: 1.5rem; line-height: 1; }
.mask__cell.is-open { background: var(--accent); color: var(--ink-dark); box-shadow: var(--shadow-pop); animation: m-pop var(--d-slow) var(--e-pop) both; animation-delay: calc(var(--i, 0) * 50ms); }
.feed { display: flex; flex-direction: column-reverse; gap: 0.4rem; align-items: center; width: 100%; max-height: 100%; overflow: hidden; }
.feed .chip { font-size: 0.85rem; }
.feed .chip i { color: var(--good); font-size: 1.2rem; }
.bubble { position: absolute; bottom: 0; z-index: 4; max-width: 15rem; background: var(--paper); color: var(--ink-dark); box-shadow: var(--shadow-pop); font-size: 1rem; }
.bubble .chip__name { white-space: nowrap; }

/* scoreboard */
.board { justify-content: flex-start !important; }
.board__rows { position: relative; flex: 1; width: 100%; }
.row { position: absolute; top: 0; inset-inline-start: 0; height: 2.7rem; transition: transform 800ms var(--e-out); }
.row__card { display: flex; align-items: center; gap: 0.7rem; height: 100%; padding: 0 1rem 0 0.9rem; border-radius: var(--r-m); background: var(--surface); box-shadow: inset 0 0.12rem 0 var(--line), var(--shadow-pop); font-weight: 800; transition: background var(--d-slow) var(--e-out), box-shadow var(--d-slow) var(--e-out); }
.row .avatar { --sz: 2.2rem; }
.row__rank { width: 1.9rem; height: 1.9rem; flex: none; display: grid; place-items: center; border-radius: 50%; font-size: var(--fs-3); line-height: 1; color: var(--accent); transition: background var(--d-slow) var(--e-out), color var(--d-slow) var(--e-out); }
.row__name { flex: 1; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-2); }
.row__score { font-size: var(--fs-3); min-width: 3.2rem; text-align: end; }
.row .points { font-size: 0.85rem; }
/* the top three carry their podium colour: a tinted card, a ring and a filled rank */
.row.is-top1 { --top: var(--c-mostlikely); }
.row.is-top2 { --top: var(--c-draw); }
.row.is-top3 { --top: var(--c-whosaid); }
.row[class*='is-top'] .row__card { background: color-mix(in srgb, var(--top) 24%, var(--surface)); box-shadow: inset 0 0 0 0.14rem var(--top), var(--shadow-pop); }
.row[class*='is-top'] .row__rank { background: var(--top); color: var(--ink-dark); font-size: var(--fs-2); }
.row.is-top1 .row__card { background: color-mix(in srgb, var(--top) 38%, var(--surface)); }

/* final podium */
.final { justify-content: flex-start !important; gap: 0.5rem !important; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 1rem; height: 17rem; flex: none; }
.step { display: grid; justify-items: center; width: 11.5rem; }
.step .avatar { --sz: 4.6rem; }
.step__name { font-size: var(--fs-3); max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step__block { width: 100%; margin-top: 0.3rem; border-radius: var(--r-l) var(--r-l) 0 0; background: var(--surface-2); box-shadow: inset 0 0.12rem 0 var(--line); display: grid; align-content: start; justify-items: center; padding-top: 0.3rem; transform-origin: bottom; }
.step__place { font-size: var(--fs-4); line-height: 1.1; }
.step__score { font-size: var(--fs-2); line-height: 1.3; }
.step--1 .step__block { height: 6.6rem; background: var(--c-mostlikely); color: var(--ink-dark); }
.step--2 .step__block { height: 5.4rem; background: var(--c-draw); color: var(--ink-dark); }
.step--3 .step__block { height: 4.4rem; background: var(--c-whosaid); color: var(--ink-dark); }
.step--1 .avatar { --sz: 5.6rem; }
.step__crown { font-size: 2.2rem; color: var(--c-mostlikely); height: 2.2rem; filter: drop-shadow(0 0.14rem 0 var(--shade)); }
.is-hidden { visibility: hidden; }
.step.is-in .step__block { animation: step-rise 900ms var(--e-pop) both; }
.step.is-in .step__top { animation: m-drop 900ms var(--e-pop) 350ms both; }
@keyframes step-rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.final__main { flex: 1; min-height: 0; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 17.5rem; gap: 1.4rem; align-items: center; }
.final__stage { display: flex; flex-direction: column; align-items: center; gap: 0.7rem; min-width: 0; }
.final__btns { display: flex; gap: 0.7rem; }
.final__btns .btn { min-height: 2.4rem; font-size: 0.9rem; padding: 0 1.2rem; }
.awards { display: grid; gap: 0.45rem; align-content: center; }
.award { display: grid; grid-template-columns: auto 1fr; gap: 0 0.6rem; align-items: center; padding: 0.5rem 0.9rem; text-align: start; }
.award .medal { --sz: 2.5rem; grid-row: span 3; }
.award__title { font-size: 0.72rem; color: var(--accent); font-weight: 800; }
.award__who { font-size: 1rem; font-weight: 800; display: flex; align-items: center; gap: 0.3rem; }
.award__who .avatar { --sz: 1.5rem; }
.award__detail { font-size: 0.62rem; line-height: 1.35; color: var(--ink-2); font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rest { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.45rem; max-width: 40rem; }
.rest .chip { font-size: 0.8rem; gap: 0.45rem; }
.rest .chip .avatar { --sz: 1.7rem; }
.rest .num { color: var(--accent); }


.draw__zone { position: relative; flex: 1; width: 100%; min-height: 0; }
.draw__hint { font-size: var(--fs-2); color: var(--ink-2); font-weight: 700; }
.board__rows { margin-inline: auto; }
.denied { display: grid; place-items: center; gap: var(--s-4); }

/* dedication line under the wordmark */
.dedication { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; font-family: var(--font-display); font-size: var(--fs-3); line-height: 1.4; color: var(--ink); }
.dedication i { color: var(--bad); font-size: 0.85em; animation: m-pulse 1.6s var(--e-out) infinite; filter: drop-shadow(0 0.1rem 0 var(--shade)); }
.dedication--small { font-size: var(--fs-1); color: var(--ink-2); }
.final__brand { display: grid; justify-items: center; }
.final__brand .logo { line-height: 1.35; }

/* intro: the rules wait for the host */
.intro__go { margin-top: var(--s-3); font-family: var(--font-display); font-weight: 400; font-size: var(--fs-3); min-height: 3rem; padding: 0 2rem; }
.intro__go i { transform: scaleX(-1); font-size: 0.8em; }
.intro__hint { font-size: 0.7rem; color: var(--ink-3); font-weight: 700; direction: rtl; }

/* "next" — shown where the clock sits while the game holds for the host */
#next { min-height: 2.4rem; font-size: var(--fs-1); padding: 0 1.1rem; background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0.12rem 0 var(--line), var(--shadow-pop); opacity: 0.75; }
#next:hover { opacity: 1; }
#next.is-waiting { background: var(--accent); color: var(--ink-dark); box-shadow: var(--shadow-pop); opacity: 1; font-size: var(--fs-2); min-height: 2.6rem; animation: m-pulse 1.8s var(--e-out) infinite; }
#next[hidden] { display: none; }
#next i { font-size: 0.9em; }

/* menu + settings: quick controls on top, then one tab per game */
.overlay { position: absolute; inset: 0; z-index: 35; display: grid; place-items: center; background: color-mix(in srgb, var(--sky-0) 84%, transparent); animation: m-fade var(--d-med) var(--e-out) both; }
[data-game='none'] { --accent: var(--c-brand); }
.set { width: 60rem; height: 32.6rem; padding: 0.9rem 1.2rem; display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: 0.6rem; text-align: start; }
.set__head { display: flex; align-items: center; gap: 0.7rem; }
.set__head .medal { --sz: 2.4rem; }
.set__done { min-height: 2.2rem; padding: 0 1.4rem; font-size: 0.9rem; }
.set__body { display: grid; grid-template-columns: 13.5rem minmax(0, 1fr); gap: 0.9rem; min-height: 0; }
.set__nav { display: grid; gap: 0.3rem; align-content: start; }
.set__tab { display: flex; align-items: center; gap: 0.5rem; min-height: 2.45rem; padding: 0 0.6rem; border-radius: var(--r-m); background: var(--surface-2); box-shadow: inset 0 0.12rem 0 var(--line); font-size: 0.85rem; font-weight: 800; text-align: start; transition: background var(--d-fast), color var(--d-fast), opacity var(--d-fast); }
.set__tab:hover { background: var(--surface-3); }
.set__tab .medal { --sz: 1.6rem; box-shadow: none; }
.set__tab small { margin-inline-start: auto; font-size: 0.9rem; color: var(--ink-3); }
.set__tab.is-out { opacity: 0.5; }
.set__tab.is-out span { text-decoration: line-through; }
.set__tab.is-on { background: var(--accent); color: var(--ink-dark); box-shadow: var(--shadow-pop); opacity: 1; }
.set__tab.is-on .medal { background: var(--ink-dark); color: var(--accent); }
.set__tab.is-on small { color: var(--ink-dark); }
.set__pane { display: grid; gap: 0.32rem; align-content: start; min-height: 0; overflow-y: auto; padding: 0.1rem 0.1rem 0.4rem; }
.set__game { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.15rem; }
.set__game .medal { --sz: 2.6rem; }
.set__gname { flex: 1; min-width: 0; }
.set__gname .display { line-height: 1.2; }
.set__rule { font-size: 0.68rem; font-weight: 700; color: var(--ink-2); line-height: 1.35; }
.set__title { font-size: 0.75rem; font-weight: 800; color: var(--ink-3); margin-top: 0.3rem; }
.opt { display: flex; align-items: center; gap: 0.8rem; min-height: 2.45rem; padding: 0.2rem 0.8rem; border-radius: var(--r-m); background: var(--surface-2); box-shadow: inset 0 0.12rem 0 var(--line); transition: opacity var(--d-med); }
.opt__text { flex: 1; min-width: 0; }
.opt__label { font-size: 0.85rem; font-weight: 800; line-height: 1.3; }
.opt__note { font-size: 0.64rem; font-weight: 700; color: var(--ink-3); line-height: 1.3; }
.opt__note:empty { display: none; }
.opt__value { font-weight: 400; font-size: 1.05rem; color: var(--accent); }
.opt.is-idle { opacity: 0.45; }
.opt.is-locked > :last-child { opacity: 0.4; pointer-events: none; }
.set__step { display: flex; align-items: center; gap: 0.3rem; direction: ltr; }
.set__step button { width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--surface-3); color: var(--ink); font-size: 0.85rem; display: grid; place-items: center; }
.set__step button:hover { background: var(--accent); color: var(--ink-dark); }
.set__step .num { min-width: 2.2rem; text-align: center; font-size: 1.2rem; }
.set__step small { font-size: 0.7rem; color: var(--ink-3); font-weight: 800; margin-inline-start: -0.25rem; }
.set__step.is-changed .num { color: var(--accent); }
.set__seg { display: flex; gap: 0.3rem; }
.set__seg button { display: flex; align-items: center; gap: 0.35rem; min-height: 1.9rem; padding: 0 0.8rem; border-radius: var(--r-pill); background: var(--surface-3); color: var(--ink-2); font-size: 0.75rem; font-weight: 800; white-space: nowrap; transition: background var(--d-fast), color var(--d-fast); }
.set__seg button.is-on { background: var(--accent); color: var(--ink-dark); }
.set__foot { display: flex; margin-top: 0.4rem; }
.set__foot .menu__btn { padding: 0 1rem; }

/* كم تتوقع؟: the subject is choosing their question */
.hmc__who { display: grid; justify-items: center; gap: 0.3rem; }
.hmc__who .avatar { --sz: 9rem; }

/* whosaid: the floor goes to the author */
.story { display: grid; justify-items: center; gap: 0.2rem; padding: 0.9rem 1.6rem; }
.story i { font-size: 2.4rem; }
.story__title { font-size: var(--fs-3); line-height: 1.3; }
.story__sub { font-weight: 800; font-size: var(--fs-1); }
.set__switch { min-width: 4.6rem; min-height: 1.7rem; padding: 0 0.7rem; border-radius: var(--r-pill); background: var(--surface-3); color: var(--ink-2); font-size: 0.75rem; font-weight: 800; }
.set__switch.is-on { background: var(--accent); color: var(--ink-dark); }

/* reactions float up from the bottom of the screen */
#reacts { position: absolute; inset: 0; z-index: 15; pointer-events: none; overflow: hidden; overflow: clip; }
.react { position: absolute; bottom: 0.4rem; display: grid; justify-items: center; font-size: 2.6rem; filter: drop-shadow(0 0.16rem 0 var(--shade)); }
.react .avatar { --sz: 1.3rem; margin-top: -0.5rem; }

/* menu rows: quick controls and the ways to reset */
.menu__row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0.5rem; }
.menu__btn { display: flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 2.2rem; padding: 0 0.6rem; border-radius: var(--r-m); background: var(--surface-2); box-shadow: inset 0 0.12rem 0 var(--line), var(--shadow-pop); font-size: 0.78rem; font-weight: 800; transition: background var(--d-fast), opacity var(--d-fast); }
.menu__btn:hover { background: var(--surface-3); }
.menu__btn:disabled { opacity: 0.35; cursor: default; }
.menu__btn.is-armed { background: var(--bad); color: var(--ink); }
.menu__btn i { font-size: 1.05em; }
kbd { font-family: var(--font-body); font-size: 0.6rem; font-weight: 800; padding: 0.05rem 0.4rem; border-radius: 0.3rem; background: var(--sky-1); color: var(--ink-2); direction: ltr; }

/* fresh content left, per game */
.fresh__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.25rem; }
.fresh { display: flex; align-items: center; gap: 0.3rem; white-space: nowrap; padding: 0.18rem 0.4rem; border-radius: var(--r-m); background: var(--surface-2); box-shadow: inset 0 0.12rem 0 var(--line); font-size: 0.72rem; font-weight: 700; }
.fresh .medal { --sz: 1.2rem; box-shadow: none; }
.fresh b { margin-inline-start: auto; font-weight: 400; font-size: 0.8rem; color: var(--accent); direction: ltr; }
.lobby__fresh { font-size: 0.7rem; gap: 0.35rem; padding: 0.2rem 0.8rem; }
.lobby__fresh i { color: var(--c-howmuch); font-size: 1.1em; }
.lobby__fresh[hidden] { display: none; }

/* the picture of the night */
.keep { display: flex; align-items: center; gap: 2rem; }
.keep img { height: 32rem; border-radius: var(--r-m); box-shadow: var(--shadow-soft); display: block; }
.keep__side { width: 16rem; display: grid; gap: 0.8rem; justify-items: start; text-align: start; }
.keep__side p { font-size: 0.85rem; font-weight: 700; }
.keep__side .btn { width: 100%; min-height: 2.6rem; font-size: 0.95rem; text-decoration: none; }

.fresh__sessions { display: flex; align-items: center; gap: 0.4rem; font-size: 0.68rem; font-weight: 700; color: var(--ink-2); line-height: 1.35; }
.fresh__sessions i { color: var(--c-howmuch); font-size: 1rem; flex: none; }
.fresh { font-size: 0.58rem; }

/* حقيقتين وكذبة */
.truths { justify-content: flex-start !important; gap: 0.7rem !important; padding-top: 0.2rem; }
.truths__who { display: flex; align-items: center; gap: var(--s-4); text-align: start; }
.truths__who .avatar { --sz: 4.6rem; }
.truths__list { display: grid; gap: 0.6rem; width: 46rem; }
.truth { position: relative; display: flex; align-items: center; gap: 0.9rem; padding: 0.55rem 1rem; background: var(--paper); color: var(--ink-dark); text-align: start; transition: background var(--d-slow) var(--e-out), opacity var(--d-slow), transform var(--d-slow) var(--e-pop); }
.truth__n { flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--ink-dark); font-size: var(--fs-3); }
.truth__text { flex: 1; font-family: var(--font-display); font-size: var(--fs-3); line-height: 1.35; }
.truth__voters { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.1rem; max-width: 11rem; }
.truth__voters .avatar { --sz: 1.5rem; }
.truth__stamp { display: none; align-items: center; gap: 0.3rem; font-family: var(--font-display); font-size: var(--fs-2); padding: 0 0.7rem; border-radius: var(--r-pill); }
.truth.is-lie { background: var(--bad); color: var(--ink); transform: scale(1.03) rotate(-0.6deg); }
.truth.is-true { opacity: 0.75; }
.truth.is-lie .truth__stamp, .truth.is-true .truth__stamp { display: inline-flex; animation: m-pop var(--d-slow) var(--e-pop) both; }
.truth.is-lie .truth__stamp { background: var(--ink); color: var(--bad); }
.truth.is-true .truth__stamp { background: var(--good); color: var(--ink-dark); }
.truths__foot { display: flex; align-items: center; justify-content: center; gap: 1rem; min-height: 2.2rem; }
.story-pill { background: var(--accent); color: var(--ink-dark); font-family: var(--font-display); font-size: var(--fs-2); box-shadow: var(--shadow-pop); }

/* صورة مين؟ */
.pg { gap: 0.6rem !important; }
.pg__row { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; gap: 2.4rem; }
.pg__frame { padding: 0.6rem; transform: rotate(-1.2deg); overflow: hidden; }
.pg__frame.is-blur img { transition: filter 700ms var(--e-out); }
.pg__frame.is-blur.is-live img { transition: none; } /* the clock drives it frame by frame */
.pg__frame img { display: block; height: 18.5rem; width: auto; max-width: 31rem; object-fit: contain; border-radius: var(--r-s); transition: height var(--d-slow) var(--e-out), max-width var(--d-slow) var(--e-out); }
.pg.is-open .pg__frame img { height: 17rem; max-width: 25rem; }
.pg__side { display: grid; gap: 1rem; justify-items: start; }
.pg__side:empty { display: none; }

/* free-text setting (the dedication line) */
.set__text { min-width: 15rem; font: inherit; font-weight: 700; padding: 0.45rem 0.8rem; border-radius: 0.7rem; border: 2px solid color-mix(in srgb, var(--ink) 22%, transparent); background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.set__text::placeholder { color: var(--ink-2); opacity: 0.6; }
.set__text:focus { outline: none; border-color: var(--c-mostlikely); }

/* the room code next to the QR (online) */
.lobby__code { display: grid; justify-items: center; line-height: 1; margin-top: -0.2rem; }
.lobby__code small { font-size: 0.7rem; color: var(--ink-dark); opacity: 0.7; font-weight: 700; }
.lobby__code b { direction: ltr; font-size: 1.9rem; letter-spacing: 0.08em; color: var(--ink-dark); }
/* with a code under it the QR gives up a little room so the game cards keep their place */
.lobby__join:has(.lobby__code:not([hidden])) img { width: 9rem; height: 9rem; }
.dedication[hidden], .lobby__code[hidden] { display: none; }

/* night length: a slider that fits the round counts */
.fit { display: flex; align-items: center; gap: 0.6rem; margin: 0.1rem 0 0.4rem; font-weight: 800; font-size: 0.85rem; color: var(--ink-2); }
.fit > i { color: var(--c-mostlikely); font-size: 1.2rem; }
.fit__label { color: var(--ink); white-space: nowrap; }
.fit__range { flex: 1; min-width: 8rem; accent-color: var(--c-mostlikely); height: 1.6rem; }
.fit__val { min-width: 6.2rem; color: var(--ink); white-space: nowrap; }
.fit.is-manual .fit__val { color: var(--ink-2); }
.fit__reset { min-height: 1.8rem; font-size: 0.72rem; padding: 0 0.7rem; }
.fit.is-locked { opacity: 0.5; pointer-events: none; }
.opt .fit { margin: 0; min-width: 22rem; }
/* beta badge next to the wordmark */
.beta { align-self: flex-start; margin-top: 1.1rem; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.01em; padding: 0.18rem 0.65rem; border-radius: var(--r-pill); background: var(--c-mostlikely); color: var(--ink-dark); box-shadow: 0 0.14rem 0 var(--shade); white-space: nowrap; }
