/* Encore — "Stage Lights" v0.2 tokens and layout. Reference frame 390 × 844; fluid up to 430 wide. */
:root {
  --stage: #07070A; --white: #FFF7EC; --dim: rgba(255,247,236,.62); --dim2: rgba(255,247,236,.4);
  --rose: #FF3B5F; --rose-deep: #B8142F; --blue: #3D8BFF; --blue-deep: #1B4FB8; --gold: #FFC65E; --amber: #FFB347;
  --glass: rgba(10,10,14,.78); --line: rgba(255,255,255,.12);
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ph: calc(min(100vw, 430px) * 0.5625); /* expanded player height */
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #000; color: var(--white); font-family: 'Archivo', 'Helvetica Neue', Arial, sans-serif; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
body { display: flex; justify-content: center; background: radial-gradient(120% 80% at 50% 30%, #1a0c10 0%, #000 70%); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.app { position: relative; width: 100%; max-width: 430px; height: 100dvh; overflow: hidden; background: var(--stage); }
.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
.scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.25) 22%, rgba(0,0,0,.18) 45%, rgba(0,0,0,.42) 78%, rgba(0,0,0,.7) 100%); }
.scrim::after { content: ''; position: absolute; inset: 0; background: radial-gradient(120% 70% at 50% 45%, transparent 55%, rgba(0,0,0,.55) 100%); }

.disp { font-family: 'Anton', Impact, sans-serif; font-weight: 400; letter-spacing: .02em; line-height: .95; }
.serif { font-family: 'Instrument Serif', Georgia, serif; font-style: italic; }
.eye { font-stretch: 75%; font-weight: 600; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; }
.dim { color: var(--dim); } .rose { color: var(--rose); } .blue { color: var(--blue); } .gold { color: var(--gold); } .amber { color: var(--amber); }
.num { font-family: 'Anton', Impact, sans-serif; font-variant-numeric: tabular-nums; line-height: 1; }
.glowR { text-shadow: 0 0 10px rgba(255,59,95,.85), 0 0 28px rgba(255,59,95,.45), 0 2px 2px rgba(0,0,0,.8); }
.glowB { text-shadow: 0 0 10px rgba(61,139,255,.85), 0 0 28px rgba(61,139,255,.45), 0 2px 2px rgba(0,0,0,.8); }
.glowW { text-shadow: 0 0 8px rgba(255,247,236,.6), 0 2px 3px rgba(0,0,0,.9); }
.glowG { text-shadow: 0 0 12px rgba(255,198,94,.9), 0 0 36px rgba(255,150,40,.55), 0 2px 2px rgba(0,0,0,.9); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--rose); box-shadow: 0 0 8px var(--rose); margin-right: 6px; vertical-align: 1px; }

.screen { position: absolute; inset: 0; display: none; flex-direction: column; }
.on-home #home, .on-ready #ready, .on-play #play, .on-results #results, .on-error #error { display: flex; }

/* ---- the player: moved by body classes, never covered ---- */
#ytkeeper { position: absolute; z-index: 6; background: #000; display: none; overflow: hidden; }
#ytkeeper iframe { display: block; width: 100%; height: 100%; }
.bezel { position: absolute; z-index: 5; display: none; border-radius: 6px; background: linear-gradient(160deg, #2a2d33, #0b0c0f 55%, #1a1c21); box-shadow: 0 10px 30px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.08); }
.on-ready #ytkeeper, .on-play #ytkeeper { display: block; top: calc(var(--safe-top) + 8px); left: calc(50% - 100px); width: 200px; height: 200px; }
.on-ready .bezel, .on-play .bezel { display: block; top: calc(var(--safe-top) + 3px); left: calc(50% - 105px); width: 210px; height: 210px; }
.on-play.video-expanded #ytkeeper { top: calc(var(--safe-top) + 34px); left: 0; width: 100%; height: var(--ph); }
.on-play.video-expanded .bezel { display: none; }

/* ---- buttons ---- */
.primary { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 50px; border-radius: 25px; background: linear-gradient(180deg, #FF4D6D, #C4102F); box-shadow: 0 0 22px rgba(255,59,95,.55), 0 8px 20px rgba(0,0,0,.5); color: #fff; }
.primary .disp { font-size: 18px; letter-spacing: .06em; } .primary .sub { color: rgba(255,255,255,.75); }
.primary:active { transform: translateY(1px); filter: brightness(.95); }
.ghost { font-stretch: 75%; font-weight: 600; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--white); padding: 12px 18px; border-radius: 23px; border: 1px solid rgba(255,255,255,.22); background: rgba(10,10,14,.5); }
.ghost.small { padding: 9px 14px; } .ghost.tiny { padding: 6px 10px; font-size: 10px; letter-spacing: .12em; }

/* ---- HOME ---- */
#home { padding: calc(var(--safe-top) + 18px) 16px calc(var(--safe-bottom) + 16px); overflow-y: auto; }
.home-head { display: flex; justify-content: space-between; align-items: flex-start; }
.wordmark { font-family: 'Anton', Impact, sans-serif; font-size: 44px; letter-spacing: .02em; line-height: .95; text-shadow: 0 0 18px rgba(255,59,95,.55), 0 0 40px rgba(255,59,95,.25), 0 3px 3px rgba(0,0,0,.8); }
.tagline { font-family: 'Instrument Serif', Georgia, serif; font-style: italic; font-size: 17px; color: var(--dim); }
.hero { position: relative; margin-top: 26px; height: 232px; border-radius: 16px; overflow: hidden; box-shadow: 0 18px 44px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.1); }
.hero > img:first-child { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 58%; }
.hero-scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.05) 0%, rgba(0,0,0,.35) 45%, rgba(0,0,0,.88) 100%); }
.live-tag { position: absolute; left: 16px; top: 14px; color: var(--rose); }
.hero-gem { position: absolute; right: 14px; top: 10px; width: 54px; height: 54px; filter: drop-shadow(0 0 10px var(--rose)); }
.hero-body { position: absolute; left: 16px; right: 16px; bottom: 16px; }
.hero-title { font-family: 'Anton', Impact, sans-serif; font-size: 34px; line-height: .95; text-shadow: 0 0 8px rgba(255,247,236,.6), 0 2px 3px rgba(0,0,0,.9); }
.hero-body .primary { margin-top: 12px; height: 46px; }
.section-label { margin: 22px 0 10px; }
.card { position: relative; height: 112px; border-radius: 14px; overflow: hidden; box-shadow: 0 12px 30px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.08); }
.card > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 62%; }
.card.soon > img { filter: grayscale(.5) brightness(.6); }
.card-scrim { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.82) 0%, rgba(0,0,0,.55) 55%, rgba(0,0,0,.15) 100%); border-left: 3px solid var(--amber); }
.card-body { position: absolute; left: 16px; top: 14px; right: 14px; }
.card-title { font-family: 'Anton', Impact, sans-serif; font-size: 24px; line-height: .95; margin: 3px 0 6px; text-shadow: 0 0 8px rgba(255,247,236,.5); }
.card-tag { position: absolute; right: 14px; bottom: 12px; padding: 8px 12px; border-radius: 18px; border: 1px solid rgba(255,255,255,.2); }
.foot { margin-top: 22px; text-align: center; color: var(--dim2); }

/* ---- READY ---- */
#ready { padding: 0 16px calc(var(--safe-bottom) + 16px); }
.ready-top { height: calc(var(--safe-top) + 214px); flex: none; }
.monitor-caption { display: flex; justify-content: space-between; align-items: center; height: 22px; }
.ready-body { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; flex: 1; overflow-y: auto; }
.song-title { font-family: 'Anton', Impact, sans-serif; font-size: 26px; line-height: .95; text-shadow: 0 0 8px rgba(255,247,236,.5), 0 2px 3px rgba(0,0,0,.9); }
.song-title.small { font-size: 19px; }
.start-block { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; height: 118px; border-radius: 16px; background: linear-gradient(180deg, rgba(255,77,109,.95), rgba(196,16,47,.95)); box-shadow: 0 0 30px rgba(255,59,95,.5), 0 12px 30px rgba(0,0,0,.6); color: #fff; }
.start-block .disp { font-size: 30px; letter-spacing: .06em; } .start-block .eye { color: rgba(255,255,255,.8); }
.start-block[disabled] { background: rgba(30,30,36,.9); box-shadow: none; color: var(--dim); }
.calib-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.how { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.how-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border-radius: 12px; background: var(--glass); border: 1px solid var(--line); text-align: center; font-size: 11px; color: var(--dim); }
.how-item img { width: 40px; height: 40px; }
.hold-demo { display: block; width: 10px; height: 40px; border-radius: 6px; background: linear-gradient(180deg, #fff, var(--blue)); box-shadow: 0 0 12px var(--blue); }

/* ---- PLAY ---- */
#play { user-select: none; -webkit-user-select: none; }
.hud { position: absolute; top: calc(var(--safe-top) + 12px); width: 82px; z-index: 3; }
.hud-left { left: 16px; } .hud-right { right: 16px; text-align: right; }
.hud .num { font-size: 44px; margin-top: 2px; } .hud-right .num { font-size: 34px; margin-top: 8px; } .hud-right .num span { font-size: 18px; }
.hud .bar { margin-top: 6px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.14); overflow: hidden; }
.hud .bar div { width: 0; height: 100%; background: var(--rose); box-shadow: 0 0 8px var(--rose); transition: width .2s; }
.tiers { margin-top: 6px; font-stretch: 75%; font-weight: 600; font-size: 11px; letter-spacing: .2em; color: rgba(255,255,255,.28); }
.tiers span.on { color: var(--white); } .tiers span.on.g { color: var(--gold); } .tiers span.now { text-shadow: 0 0 8px currentColor; }
.play-caption { position: absolute; top: calc(var(--safe-top) + 214px); left: 16px; right: 16px; z-index: 3; }
.caption-buttons { display: flex; gap: 6px; }
.songstrip { margin-top: calc(var(--safe-top) + 240px); padding: 0 16px; flex: none; position: relative; z-index: 2; }
.strip-row { display: flex; justify-content: space-between; align-items: flex-end; }
.hud-inline { display: none; gap: 14px; text-align: right; } .hud-inline .num.small { font-size: 28px; }
.cells { display: flex; gap: 5px; margin-top: 8px; }
.cells i { flex: 1; height: 4px; border-radius: 2px; background: rgba(255,255,255,.12); display: block; }
.cells i.done { background: var(--rose); box-shadow: 0 0 8px var(--rose); } .cells i.now { background: var(--white); box-shadow: 0 0 8px var(--white); }
.cells i.clean { background: var(--gold); box-shadow: 0 0 8px var(--gold); } .cells i.slip { background: var(--rose); box-shadow: 0 0 8px var(--rose); }
.cells.big i { height: 6px; }
.notice { min-height: 18px; margin-top: 6px; text-align: center; font-size: 12.5px; color: var(--dim); }
.playfield { position: relative; flex: 1; overflow: hidden; touch-action: none; }
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.dots { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); display: flex; gap: 9px; align-items: center; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.35); transition: all .08s; }
.dots i.on { width: 9px; height: 9px; background: #fff; box-shadow: 0 0 8px #fff; }
.judge { position: absolute; width: 160px; margin-left: -80px; text-align: center; font-family: 'Anton', Impact, sans-serif; font-size: 28px; letter-spacing: .03em; opacity: 0; pointer-events: none; transform: translateY(6px); }
.judge.show { animation: judge .55s ease-out forwards; }
.judge.perfect { color: var(--gold); text-shadow: 0 0 12px rgba(255,198,94,.9), 0 0 36px rgba(255,150,40,.55), 0 2px 2px rgba(0,0,0,.9); }
.judge.good, .judge.miss, .judge.hold, .judge.early { color: var(--white); text-shadow: 0 0 8px rgba(255,247,236,.6), 0 2px 3px rgba(0,0,0,.9); }
.judge small { display: block; font-family: 'Archivo', sans-serif; font-stretch: 75%; font-weight: 600; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; margin-top: 2px; }
@keyframes judge { 0% { opacity: 0; transform: translateY(8px) scale(.9); } 15% { opacity: 1; transform: translateY(0) scale(1.05); } 70% { opacity: 1; transform: translateY(-4px) scale(1); } 100% { opacity: 0; transform: translateY(-12px); } }
.mode-label { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-bottom) + 18px); white-space: nowrap; text-shadow: 0 1px 3px #000; }
.countin { position: absolute; left: 0; right: 0; top: 24%; text-align: center; pointer-events: none; }
.countin .disp { font-size: 96px; color: var(--white); text-shadow: 0 0 20px rgba(255,247,236,.7), 0 4px 4px rgba(0,0,0,.9); }
.countin .eye { color: var(--white); text-shadow: 0 1px 3px #000; margin-top: 4px; }
.pause-panel { position: absolute; left: 16px; right: 16px; top: calc(var(--safe-top) + 260px); z-index: 8; padding: 22px 18px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(12px); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.pause-panel .disp { font-size: 30px; }
.pause-panel[hidden], .countin[hidden] { display: none; }
.pause-panel .primary .disp { font-size: 16px; }
/* expanded video variant */
.video-expanded .hud { display: none; }
.video-expanded .play-caption { top: calc(var(--safe-top) + 8px); }
.video-expanded .songstrip { margin-top: calc(var(--safe-top) + 34px + var(--ph) + 8px); }
.video-expanded .hud-inline { display: flex; }
.video-expanded .pause-panel { top: calc(var(--safe-top) + 34px + var(--ph) + 20px); }

/* ---- RESULTS ---- */
#results { padding: calc(var(--safe-top) + 14px) 16px calc(var(--safe-bottom) + 14px); align-items: stretch; overflow-y: auto; }
.burst-bg { position: absolute; left: -90px; top: -130px; width: 570px; height: 570px; mix-blend-mode: screen; opacity: .6; pointer-events: none; display: block; inset: auto; }
.r-song { text-align: center; }
.tier-word { font-family: 'Anton', Impact, sans-serif; font-size: 88px; text-align: center; letter-spacing: .04em; line-height: 1; margin-top: 6px; color: var(--gold); text-shadow: 0 0 24px rgba(255,198,94,.9), 0 0 70px rgba(255,150,40,.5), 0 4px 4px rgba(0,0,0,.9); }
.tier-word.silver { color: #E8ECF5; text-shadow: 0 0 24px rgba(220,230,255,.8), 0 4px 4px rgba(0,0,0,.9); }
.tier-word.bronze { color: #E0956A; text-shadow: 0 0 24px rgba(224,149,106,.8), 0 4px 4px rgba(0,0,0,.9); }
.tier-word.none { color: var(--white); font-size: 54px; text-shadow: 0 0 14px rgba(255,247,236,.5), 0 4px 4px rgba(0,0,0,.9); }
.tier-word.encore { color: var(--rose); text-shadow: 0 0 24px rgba(255,59,95,.9), 0 0 70px rgba(255,59,95,.5), 0 4px 4px rgba(0,0,0,.9); }
.r-line { text-align: center; font-size: 19px; margin: 8px 0 14px; text-shadow: 0 1px 4px #000; }
.stats { display: flex; justify-content: space-around; text-align: center; }
.stats .num { font-size: 30px; text-shadow: 0 0 12px rgba(255,247,236,.45), 0 2px 3px #000; } .stats .num.rose { text-shadow: 0 0 12px rgba(255,59,95,.6), 0 2px 3px #000; } .stats .num.blue { text-shadow: 0 0 12px rgba(61,139,255,.6), 0 2px 3px #000; }
.rule { height: 1px; background: var(--line); margin: 14px 0; }
.r-label { margin: 16px 0 8px; }
.next-card { display: flex; gap: 12px; align-items: center; margin: 16px 0; padding: 12px 14px; border-radius: 14px; background: rgba(10,10,14,.6); border: 1px solid var(--line); font-size: 13px; }
.next-card img { width: 36px; height: 36px; filter: drop-shadow(0 0 8px var(--rose)); }
.row { display: flex; gap: 10px; margin-top: 10px; } .row .ghost { flex: 1; text-align: center; }
#results .foot { margin-top: 14px; }

/* ---- ERROR ---- */
#error { padding: calc(var(--safe-top) + 120px) 24px; gap: 16px; text-align: center; align-items: center; }
.err-title { font-size: 30px; }

/* ---- SETTINGS SHEET ---- */
.sheet { position: absolute; inset: 0; z-index: 20; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; }
.sheet[hidden] { display: none; }
.sheet-body { width: 100%; padding: 22px 18px calc(var(--safe-bottom) + 18px); border-radius: 18px 18px 0 0; background: #0f0f14; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.sheet-body .disp { font-size: 24px; }
.row-setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; }
.row-setting input { width: 22px; height: 22px; accent-color: var(--rose); }
.nudge { display: flex; gap: 6px; }
