/* ==========================================================================
   Tune Tap — styles. Theme tokens and shared components come from
   shared/style.css.

   The menu, the falling tiles (a canvas), the keys, the guessing screens.
   ========================================================================== */

.tt { display: grid; gap: .9rem; max-width: 30rem; margin: 1rem auto; }
.tt[hidden] { display: none; }
.tt-note { text-align: center; font-size: .9rem; }
.tt-small { font-size: .82rem; text-align: center; }
.tt-center { justify-self: center; }
.tt-h2 { font-size: 1.2rem; text-align: center; }
.tt-title { font-size: clamp(1.6rem, 7vw, 2.1rem); text-align: center; }
.tt-step { font-weight: 900; text-align: center; }
.tt-big { font-size: 1.2rem; font-weight: 900; text-align: center; }
.tt-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.tt-next { text-align: center; }
.howto { max-width: 30rem; margin: 1.5rem auto 0; padding: .25rem 1rem; }
.howto summary { min-height: var(--tap); display: flex; align-items: center; font-weight: 800; cursor: pointer; }
.howto ol { display: grid; gap: .5rem; padding: 0 0 .8rem; padding-inline-start: 1.4rem; list-style: decimal; }

/* ---------- The menu ---------- */

.tt-menu { display: grid; gap: .7rem; }
.tt-art { display: flex; align-items: flex-end; justify-content: center; gap: .35rem; height: 5.5rem; }
.tt-art i { width: 1.6rem; height: var(--h); background: var(--c); border: 3px solid var(--line); border-radius: 8px 8px 10px 10px; box-shadow: 0 4px 0 var(--line); }
.tt-tagline { font-size: 1.05rem; font-weight: 700; text-align: center; }
.tt-settings { display: grid; gap: .5rem; }
.tt-setting { display: grid; gap: .4rem; }
.tt-setting[hidden] { display: none; }

/* ---------- Shared pieces ---------- */

.tt-top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.tt-top .clock { font-size: 1.8rem; font-weight: 900; }
.tt-board { display: grid; gap: .35rem; }
.tt-board__row { display: flex; align-items: center; gap: .55rem; min-height: 2.6rem; padding: .25rem .7rem; background: var(--surface); border: 2px solid var(--line); border-radius: 12px; }
.tt-board__row.is-you { box-shadow: 3px 3px 0 var(--sea); }
.tt-board__place { width: 1.4rem; text-align: center; }
.tt-board__who { flex: 1; min-width: 0; overflow: hidden; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.tt-board__plus { color: var(--olive); font-weight: 900; }
.tt-wait { display: grid; justify-items: center; gap: .4rem; padding: 1.4rem 1rem; text-align: center; }
.tt-wait__icon { font-size: 3rem; line-height: 1; }
.tt-wait__text { font-size: 1.2rem; font-weight: 900; }
.tt-clueshow { font-size: 1.4rem; }
.tt-reveal { display: grid; justify-items: center; gap: .25rem; padding: 1.2rem 1rem; text-align: center; background: var(--sun); color: var(--ink); }
.tt-reveal .muted { color: var(--ink); opacity: .7; }
.tt-reveal__name { font-size: clamp(1.4rem, 6vw, 1.9rem); font-weight: 900; line-height: 1.15; }

/* ---------- Tiles ---------- */

.tt-ready { display: grid; justify-items: center; gap: .4rem; padding: 1.4rem 1rem; text-align: center; }
.tt-ready__title { font-size: 1.6rem; font-weight: 900; }
.tt-ready__speed { font-weight: 800; color: var(--tomato); }
.tt-count { min-height: 4.5rem; font-size: 4rem; font-weight: 900; line-height: 1; }
.tt-stats { display: flex; align-items: baseline; justify-content: space-between; }
.tt-score { font-size: 2rem; font-variant-numeric: tabular-nums; }
.tt-combo { font-weight: 900; color: var(--sun); }
.tt-stage { position: relative; }
.tt-tiles { display: block; width: 100%; height: min(62vh, 34rem); background: #0b1922; border: 3px solid var(--line); border-radius: 18px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.tt-flash { position: absolute; inset-inline: 0; top: 40%; font-size: 1.8rem; font-weight: 900; text-align: center; color: #fff; text-shadow: 0 3px 0 #05090c; opacity: 0; pointer-events: none; }
.tt-flash.is-on { animation: tt-flash .5s ease-out; }
.tt-flash.is-perfect { color: #9fe07a; }
.tt-flash.is-good { color: #f2b632; }
.tt-flash.is-miss { color: #ff8a7a; }
@keyframes tt-flash { 0% { opacity: 1; transform: scale(.7); } 30% { opacity: 1; transform: scale(1.1); } 100% { opacity: 0; transform: translateY(-1.2rem); } }
.tt-donebox { position: absolute; inset-inline: 1rem; top: 30%; padding: 1rem; font-weight: 900; text-align: center; color: var(--ink); background: var(--sun); border: 3px solid var(--line); border-radius: 16px; box-shadow: 4px 4px 0 var(--line); }
.tt-livelist { display: grid; gap: .25rem; }
.tt-livelist li { display: flex; align-items: center; gap: .45rem; padding: .2rem .6rem; font-weight: 700; background: var(--surface-2); border-radius: 10px; }
.tt-livelist li.is-you { outline: 2px solid var(--sea); }
.tt-livelist bdi { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Guess: the song, the keys ---------- */

.tt-form { display: grid; gap: .5rem; padding: 1rem; }
.tt-clues { display: flex; flex-wrap: wrap; gap: .3rem; }
.tt-clue { min-width: 2.6rem; min-height: 2.6rem; padding: 0 .4rem; font: inherit; font-size: 1.3rem; background: var(--surface-2); border: 2px solid var(--line); border-radius: 10px; cursor: pointer; }
.tt-clue:first-child { font-size: .85rem; font-weight: 800; color: var(--text); }
.tt-clue.is-on { background: var(--sun); box-shadow: 0 0 0 3px var(--tomato); }
.tt-secret { display: grid; justify-items: center; gap: .1rem; padding: .8rem; text-align: center; color: var(--ink); background: var(--sun); }
.tt-secret small { font-size: .75rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.tt-secret b { font-size: 1.6rem; line-height: 1.1; }
html[lang="ar"] .tt-secret small { letter-spacing: normal; }
.tt-keys { direction: ltr; display: grid; grid-template-columns: repeat(11, 1fr); gap: 3px; height: 9.5rem; user-select: none; -webkit-user-select: none; touch-action: none; }
.tt-key {
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: .1rem;
  padding: 0 0 .45rem; font: inherit; color: #fff; background: var(--c);
  border: 2.5px solid var(--line); border-radius: 8px 8px 12px 12px; box-shadow: 0 5px 0 var(--line);
  cursor: pointer; touch-action: none;
}
.tt-key b { font-size: .95rem; }
.tt-key small { font-size: .62rem; opacity: .8; }
.tt-key.is-down { transform: translateY(4px); box-shadow: 0 1px 0 var(--line); filter: brightness(1.3); }
@media (pointer: coarse) { .tt-key small { display: none; } }
.tt-rollbox { min-height: 7rem; }
.tt-roll { display: flex; align-items: flex-end; gap: 2px; height: 7rem; padding: .5rem; overflow: hidden; background: #0b1922; border: 3px solid var(--line); border-radius: 14px; direction: ltr; }
.tt-roll i { flex: 1 1 0; min-width: 3px; max-width: 1.4rem; height: var(--h); background: #26394a; border-radius: 4px; }
.tt-roll i.is-lit { background: var(--c); }
.tt-roll i.is-now { outline: 3px solid #fff; }

/* ---------- Guess: guessing ---------- */

.tt-hintbox { display: flex; align-items: center; justify-content: center; gap: .6rem; flex-wrap: wrap; }
.tt-cluechip { font-size: 2rem; line-height: 1; }
.tt-hint { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem; }
.tt-hint span { display: grid; place-items: center; width: 1.45rem; height: 2.1rem; font-size: 1.3rem; font-weight: 900; text-transform: uppercase; border-bottom: 4px solid var(--text); }
.tt-hint span.is-shown { color: var(--tomato); border-color: var(--tomato); }
.tt-hint span.is-gap { width: .7rem; border: 0; }
.tt-hint.is-hidden span { width: auto; color: var(--muted); border: 0; }
.tt-artist { font-weight: 800; text-align: center; color: var(--sea); }
.tt-gform { display: grid; grid-template-columns: 1fr auto; gap: .5rem; }
.tt-tries { display: grid; gap: .3rem; }
.tt-tries li { display: flex; justify-content: space-between; gap: .5rem; padding: .35rem .7rem; font-weight: 700; background: var(--surface-2); border-radius: 10px; }
.tt-tries li.is-wrong b { color: var(--tomato); }
.tt-tries li.is-close { background: #f6dd9a; color: var(--ink); }
.tt-got { font-weight: 800; text-align: center; }
.tt-solved { display: grid; justify-items: center; gap: .3rem; padding: 1rem; text-align: center; color: var(--ink); background: #e3f1d6; animation: tt-pop .35s ease-out; }
:root[data-theme="dark"] .tt-solved { color: #f7ecd6; background: #2e4a23; }
.tt-solved__icon { font-size: 2.4rem; line-height: 1; }
.tt-solved b { font-size: 1.4rem; }
@keyframes tt-pop { from { transform: scale(.8); opacity: 0; } }
.tt-solvers { display: grid; gap: .35rem; }
.tt-solvers li { display: flex; align-items: center; gap: .5rem; padding: .35rem .7rem; font-weight: 800; background: var(--surface); border: 2px solid var(--line); border-radius: 12px; }
.tt-solvers li bdi { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-solvers li small { color: var(--muted); }
.tt-solvers li.is-ok { background: #e3f1d6; color: var(--ink); }
:root[data-theme="dark"] .tt-solvers li.is-ok { background: #2e4a23; color: #f7ecd6; }
.tt-solvers li.is-off { opacity: .55; }
.tt-solvers li.is-player { border-style: dashed; }

@media (prefers-reduced-motion: reduce) {
  .tt-flash.is-on, .tt-solved { animation: none; }
  .tt-flash.is-on { opacity: 1; }
}
