/* tap-color · fullscreen fit — everything is scoped under html.pip-immersive, so the normal page is
   untouched. Sizes come from js/fullscreen-fit.js (--fs-w / --fs-h / --fs-side on the stage). */
html.pip-immersive .game-wrap.fs-fit { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; overflow-x: hidden; overflow-y: auto; }
html.pip-immersive .game-wrap.fs-fit > * { flex-shrink: 0; }
html.pip-immersive .game-wrap.fs-fit > * { max-width: 100%; }
html.pip-immersive .game-wrap.fs-fit #tc-play { width: var(--fs-w) !important; height: var(--fs-h) !important; max-width: none !important; max-height: none !important; margin: 0 !important; flex: none; }

html.pip-immersive .game-wrap.fs-fit > .hud { width: var(--fs-w); max-width: 100%; margin: 0; padding-top: 4px; padding-bottom: 4px; }
html.pip-immersive .game-wrap.fs-fit > [role="status"]:empty, html.pip-immersive .game-wrap.fs-fit > #status:empty { display: none; }
html.pip-immersive .game-wrap.fs-fit > [role="status"], html.pip-immersive .game-wrap.fs-fit > #status { margin: 0; min-height: 0; padding: 2px 8px; width: var(--fs-w); text-align: center; font-size: .85rem; }
html.pip-immersive .game-wrap.fs-fit #tc-play { display: flex; flex-direction: column; }
html.pip-immersive .game-wrap.fs-fit #tc-play #card-grid { flex: 1 1 auto; grid-auto-rows: 1fr; min-height: 0; }
html.pip-immersive .game-wrap.fs-fit > .tc-top, html.pip-immersive .game-wrap.fs-fit > .tc-time, html.pip-immersive .game-wrap.fs-fit > .tc-sub { width: var(--fs-w); max-width: 100%; }
/* wide: board left, HUD/controls right */
html.pip-immersive .game-wrap.fs-wide { display: grid; grid-template-columns: var(--fs-w) var(--fs-side); justify-content: center; align-content: center; column-gap: 16px; row-gap: 8px; grid-auto-rows: min-content; }
html.pip-immersive .game-wrap.fs-wide #tc-play { grid-column: 1; grid-row: 1 / span 12; align-self: center; }
html.pip-immersive .game-wrap.fs-wide > :not(#tc-play) { grid-column: 2; width: auto; margin: 0; }
html.pip-immersive .game-wrap.fs-wide > .hud { width: auto; }
html.pip-immersive .game-wrap.fs-wide .tc-tools, html.pip-immersive .game-wrap.fs-wide .tc-rehearsal, html.pip-immersive .game-wrap.fs-wide .tc-how { display: none !important; }

/* ---- pass 3 · full screen on phones ---- */
html.pip-immersive .game-wrap, html:fullscreen .game-wrap { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
html.pip-immersive .game-wrap > .tc-how, html.pip-immersive .game-wrap > .tc-rehearsal, html.pip-immersive .game-wrap > .tc-sr { display: none !important; }
html.pip-immersive #tc-labels { min-height: 44px; }
html.pip-immersive .game-wrap.fs-fit .tc-sw { aspect-ratio: auto; min-height: 44px; }
html.pip-immersive #tc-overlay { overflow-y: auto; padding: .6rem; }
html.pip-immersive .game-wrap.fs-fit .tc-tools { margin: 0; }
html.pip-immersive .game-wrap.fs-fit .tc-top { margin: 0; }
html.pip-immersive .game-wrap.fs-fit .tc-word { font-size: clamp(2rem, 9vh, 3.4rem); }
/* short stages (landscape phones): trim the start panel so Start stays on screen */
@media (max-height: 520px) {
  html.pip-immersive .tc-panel h2 { font-size: 1.05rem; margin-bottom: .2rem; }
  html.pip-immersive .tc-panel .tc-demo, html.pip-immersive #tc-start p:nth-of-type(2) { display: none; }
  html.pip-immersive .tc-panel p { font-size: .78rem; margin: .15rem 0; }
  html.pip-immersive #tc-go-score { font-size: 2rem; }
  html.pip-immersive #tc-go-stats { margin: .3rem 0; }
  html.pip-immersive .tc-panel .btn { margin-top: .35rem; min-height: 44px; padding: .5rem 1.2rem; }
}

/* ---- pass 3 · finish: depth, gloss, light ---- */
#tc-play { background: radial-gradient(120% 90% at 50% 0%, #fff 0%, #f1f5f9 70%, #e8eef5 100%); border-color: #dbe3ee; }
#tc-play.rule-ink { background: radial-gradient(120% 90% at 50% 0%, #e2e8f0 0%, #cbd5e1 100%); }
#tc-rule { box-shadow: 0 2px 0 rgba(185,28,28,.18), inset 0 1px 0 rgba(255,255,255,.6); transition: background .2s, color .2s, transform .2s; }
#tc-rule.is-ink { box-shadow: 0 2px 0 rgba(15,23,42,.35); transform: scale(1.04); }
.tc-sw { background-image: linear-gradient(180deg, rgba(255,255,255,.28) 0%, rgba(255,255,255,0) 46%, rgba(0,0,0,.14) 100%); background-color: var(--sw); box-shadow: 0 5px 0 rgba(15,23,42,.22), 0 10px 14px -6px rgba(15,23,42,.3), inset 0 2px 0 rgba(255,255,255,.35); transition: transform .08s, box-shadow .08s, filter .12s; }
.tc-sw:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(15,23,42,.22), inset 0 2px 0 rgba(255,255,255,.25); filter: brightness(1.06); }
.tc-sw.hit { animation: tcHit .22s; filter: brightness(1.15) saturate(1.1); }
#tc-fill { background: linear-gradient(90deg, #22c55e, #eab308 70%, #f97316); box-shadow: inset 0 2px 0 rgba(255,255,255,.35); }
#tc-fill.low { background: linear-gradient(90deg, #ef4444, #f97316); animation: tcPulse .6s ease-in-out infinite alternate; }
.tc-time { box-shadow: inset 0 1px 3px rgba(15,23,42,.18); }
#tc-play .tc-word { text-shadow: 0 2px 0 rgba(15,23,42,.12), 0 8px 18px rgba(15,23,42,.14); }
#tc-overlay { background: radial-gradient(100% 100% at 50% 20%, rgba(255,255,255,.97), rgba(226,232,240,.95)); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.tc-panel { max-width: 22rem; }
.tc-panel .btn { box-shadow: 0 3px 0 rgba(15,23,42,.22); }
.tc-panel .btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(15,23,42,.22); }
#tc-go-score { text-shadow: 0 3px 0 rgba(220,38,38,.15); animation: tcPop .35s ease-out; }
#tc-go-badge { box-shadow: 0 2px 0 #ca8a04; }
.tc-stat b { font-variant-numeric: tabular-nums; }
@keyframes tcPulse { from { opacity: 1; } to { opacity: .65; } }
@media (prefers-reduced-motion: reduce) { #tc-fill.low, #tc-go-score { animation: none; } .tc-sw, #tc-rule { transition: none; } }
