/* Play-screen family (Endless, Rush, Guess, Duel, Train, Party): Visual v3 glow glass.
   Calm chrome around the stage; glow lives in the cut, the pedestal and the end cards. Look comes from base.css primitives. */
.endless, .duel { gap: 8px; }
.play-heading { text-align: center; margin: 0; }
.play-stage-wrap { flex: 1; min-height: 260px; position: relative; margin: 0 -16px; } /* full-bleed: the aim line can reach the screen edges */
.play-stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* Calm one-line caption between two thin lines (duel instruction, tutorial). */
.play-cap { display: flex; align-items: center; gap: 12px; min-height: 22px; margin: 0; font-size: var(--fs-s); color: #D6CEF5; text-align: center; }
.play-cap > i { flex: 1; height: 1px; min-width: 8px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .28)); }
.play-cap > i:last-child { background: linear-gradient(270deg, transparent, rgba(255, 255, 255, .28)); }
.play-cap > span { flex: none; max-width: 88%; }
.play-cap[hidden] { display: none; }

/* The card sits below the stage (never over it), so the on-canvas readout stays visible. */
.play-card-slot:empty { display: none; }
.play-card { display: grid; gap: 12px; text-align: center; padding: 20px 16px; }
.play-card .pill-action, .play-card .btn-quiet { text-decoration: none; }
.play-card label { display: grid; gap: 8px; }
.play-card .title { margin: 0; }

.play-verdict { justify-self: center; }
.play-new-best {
  justify-self: center;
  color: var(--ink);
  background: linear-gradient(90deg, #FFE9A8, #FCD34D 60%, #FFB347);
  box-shadow: 0 0 18px rgba(252, 211, 77, .55);
  animation: play-pop 320ms cubic-bezier(.34, 1.56, .64, 1);
}
.play-new-best::before { display: none; }

/* Pause + quit sheets */
.pause-sheet { display: grid; gap: 12px; text-align: center; }
.pause-sheet .sheet-head { text-align: left; margin-bottom: 4px; }
.pause-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pause-row > * { min-width: 0; }
.pause-sheet .quiet { margin: 0; }

/* Glass fields (duel name, party names) */
.play-name {
  min-height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(178, 140, 255, .45);
  background: rgba(255, 255, 255, .07);
  box-shadow: 0 0 16px rgba(155, 107, 255, .16) inset;
  color: inherit;
  font: inherit;
  font-size: var(--fs-m);
  text-align: center;
  text-transform: none;
  letter-spacing: normal;
}
.play-name:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }

/* Duel result tiles */
.play-scores { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.play-tile { display: grid; gap: 4px; padding: 12px 8px; text-align: center; }
.play-tile .label { margin: 0; }
.play-tile.win { box-shadow: var(--glow-hot, 0 0 28px rgba(193, 59, 255, .45)), inset 0 1px 0 rgba(255, 255, 255, .14); }
.play-tile.win::before { background: var(--card-border-hot, var(--card-border)); }
.play-score { font-size: var(--fs-xl); }
.play-friend { color: var(--cool-a); text-shadow: 0 0 14px rgba(92, 225, 230, .5); }
.play-score.winner { color: var(--mint); text-shadow: 0 0 16px rgba(110, 231, 183, .55); animation: play-pop 320ms cubic-bezier(.34, 1.56, .64, 1); }
.play-verdict-line { margin: 0; font-size: var(--fs-l); font-weight: 800; }

@keyframes play-pop { from { transform: scale(.8); } to { transform: scale(1); } }

/* Endless: the card is an overlay on the stage area, so the layout never grows. */
.endless { position: relative; overflow: hidden; max-height: 100dvh; }
.endless .play-card-slot {
  position: absolute;
  left: calc(16px + env(safe-area-inset-left));
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 5;
  animation: play-slide-up 220ms ease-out;
}
.endless .play-card-slot:not(:empty)::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(8, 6, 20, 0) 25%, rgba(8, 6, 20, .78));
}
.play-card .play-row { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.play-actions { display: grid; gap: 12px; }
@keyframes play-slide-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-height: 700px) {
  .play-card { padding: 12px; gap: 8px; }
  .play-card .title { font-size: var(--fs-m); }
  .play-actions { gap: 8px; }
  .play-actions .pill-action { min-height: 48px; padding: 0 16px; }
}

/* Duel receiver intro card: sits in the bottom third, avatar above the challenge line. */
.duel-intro-slot { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 16px; }
.duel-intro { display: grid; place-items: center; }
.duel-intro .avatar { box-shadow: 0 0 0 3px rgba(178, 140, 255, .9), 0 0 0 6px rgba(193, 59, 255, .22), 0 0 26px rgba(193, 59, 255, .55); }
.duel .play-stage-wrap { min-height: 200px; }
.play-card .play-row > .btn-quiet { flex: 1 1 0; min-width: 0; padding: 0 12px; font-size: var(--fs-s); }
.duel-send { display: grid; gap: 8px; }
.duel-send .label { margin: 0; text-align: left; }
@media (max-height: 700px) {
  .duel .play-card { gap: 6px; }
  .duel .play-card .display { font-size: var(--fs-xl); line-height: 1.1; }
  .duel .play-stage-wrap { min-height: 150px; }
}

/* ---- HUD second row (Endless): score + combo inside the panel ---- */
.endless-stat { gap: 10px; flex-wrap: nowrap; white-space: nowrap; }
.endless-scorebox { display: inline-flex; align-items: baseline; gap: 6px; }
.endless-scorebox .label { margin: 0; font-size: var(--fs-xs); }
.endless-score, .endless-combo { font-variant-numeric: tabular-nums; }
.endless-score { font-size: var(--fs-s); font-weight: 800; color: var(--text); }
.endless-combo { font-size: var(--fs-xs); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--mint); }
.endless-combo[data-level="2"] { color: #FCD34D; }
.endless-combo[data-level="3"] { background: linear-gradient(90deg, #FF4F7B, #9B6BFF, #5CE1E6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.endless.fever .endless-combo { animation: play-pop 320ms cubic-bezier(.34, 1.56, .64, 1); }

/* FEVER: a thin neon frame, nothing pulses */
.endless.fever::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  border-radius: 24px;
  box-shadow: inset 0 0 0 1px rgba(255, 79, 123, .45), inset 0 0 14px rgba(155, 107, 255, .3);
}
.play-stage-wrap.shake { animation: play-shake 380ms ease-out; }
@keyframes play-shake {
  0%, 100% { transform: none; } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); } 80% { transform: translateX(3px); }
}
@media (prefers-reduced-motion: reduce) {
  .play-stage-wrap.shake, .endless.fever .endless-combo { animation: none; }
}

/* ---- End card (Endless, Rush, Guess, Train): glowing hero card, laurels around the number, wave band, one bright action ---- */
.end-card { gap: 8px; padding: 16px 16px 14px; text-align: center; overflow: hidden; }
.end-card > * { margin: 0; }
.end-label { letter-spacing: .24em; color: #E6D9FF; }
.end-scorerow { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 56px; }
.end-scorerow .gfx-laurel { flex: none; height: 56px; width: auto; }
.end-score { font-size: var(--fs-hero); line-height: 1; font-variant-numeric: tabular-nums; }
.end-score { font-size: var(--fs-score, var(--fs-hero)); }
.end-score.gold {
  background: linear-gradient(180deg, #FFF0B8, #FFC25A 55%, #FF8A3D);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.end-stats { font-size: var(--fs-s); }
.end-wave { display: block; margin: 0 -16px; height: 28px; }
.end-wave svg { height: 28px; }
.end-card .play-actions { position: relative; }
.endless-goal { font-size: var(--fs-s); font-weight: 700; color: var(--text); }
.endless-extra { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.endless-extra:not(:has(> :not([hidden]))) { display: none; }
.endless-extra > * { min-width: 0; min-height: 48px; }
.endless-extra > [hidden] { display: none; }
.endless-extra > :only-child { grid-column: 1 / -1; }
.endless .play-card.card { background-color: #130D31; }
.swipe-hint { margin: 0; font-size: var(--fs-xs); letter-spacing: .08em; opacity: .75; }
.swipe-card { touch-action: none; }
@media (max-height: 700px) {
  .end-card { gap: 6px; padding: 10px 12px 10px; }
  .end-scorerow { min-height: 40px; }
  .end-scorerow .gfx-laurel { height: 40px; }
  .end-score { font-size: var(--fs-xl); }
  .end-wave, .end-wave svg { height: 16px; }
  .end-wave { margin: -2px -12px; }
}

.endless-judge { margin: 0; text-align: center; font-size: var(--fs-s); color: var(--quiet, #A8A3C7); }

/* ---- Endless: bank or double (glass card, hot border for the stake) ---- */
.bank-card { gap: 8px; }
.bank-label { margin: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: #FCD34D; letter-spacing: .22em; font-size: var(--fs-xs); }
.bank-stake {
  justify-self: center; padding: 2px 18px; border-radius: 999px; font-size: var(--fs-xl); font-weight: 800; line-height: 1.2;
  font-variant-numeric: tabular-nums; color: #0E0B22; background: linear-gradient(90deg, #FCD34D, #FB923C);
  box-shadow: 0 0 22px rgba(252, 211, 77, .45);
}
.bank-rule { margin: 0; font-size: var(--fs-s); }
.double-stamp {
  position: absolute; left: 50%; top: 22%; z-index: 6; pointer-events: none; white-space: nowrap;
  font-size: var(--fs-xl); font-weight: 800; font-variant-numeric: tabular-nums; transform: translate(-50%, -50%);
}
.double-stamp.win { display: grid; justify-items: center; line-height: 1.05; }
.double-stamp.win b { font-size: var(--fs-xl); }
.double-stamp.win span { font-size: var(--fs-l); }
.double-stamp.win {
  color: #FCD34D; text-shadow: 0 0 18px rgba(252, 211, 77, .8), 0 0 40px rgba(251, 146, 60, .6);
  animation: stamp-win 1.4s cubic-bezier(.34, 1.56, .64, 1) forwards;
}
.double-stamp.lose { color: var(--t-miss, #F43F5E); text-shadow: 0 0 14px rgba(244, 63, 94, .6); display: flex; }
.double-stamp.lose i {
  font-style: normal; display: inline-block;
  animation: stamp-crumble 1.1s ease-in calc(.35s + var(--i) * 50ms) forwards;
}
@keyframes stamp-win {
  0% { transform: translate(-50%, -50%) scale(.4) rotate(-6deg); opacity: 0; }
  25% { transform: translate(-50%, -50%) scale(1.15) rotate(-3deg); opacity: 1; }
  80% { transform: translate(-50%, -64%) scale(1) rotate(-3deg); opacity: 1; }
  100% { transform: translate(-50%, -80%) scale(1) rotate(-3deg); opacity: 0; }
}
@keyframes stamp-crumble { to { transform: translateY(90px) rotate(var(--r)); opacity: 0; } }
.endless-score.gold-pop { color: #FCD34D; text-shadow: 0 0 12px rgba(252, 211, 77, .7); animation: play-pop 420ms cubic-bezier(.34, 1.56, .64, 1); display: inline-block; }
.endless-score.crumble { color: var(--t-miss, #F43F5E); animation: play-shake 380ms ease-out; display: inline-block; }
@media (prefers-reduced-motion: reduce) {
  .double-stamp.win, .double-stamp.lose i, .endless-score.gold-pop, .endless-score.crumble { animation: none; }
  .double-stamp { opacity: 1; }
}

/* ---- Endless: waves, warm-up, More sheet ---- */
.wave-banner {
  position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; text-align: center;
  background: rgba(10, 7, 32, .55); pointer-events: none; animation: wave-in var(--t-slow, 360ms) var(--e-out, ease-out) both;
}
.wave-card { display: grid; justify-items: center; gap: 4px; min-width: 240px; padding: 18px 28px 12px; overflow: hidden; background-color: #130D31; }
.wave-card .label { margin: 0; letter-spacing: .3em; font-size: var(--fs-s); color: var(--quiet, #A8A3C7); }
.wave-card b { font-size: var(--fs-xl); font-weight: 800; letter-spacing: .12em; background: var(--action-grad, linear-gradient(90deg, #FF9A5C, #FF4F7B)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wave-card b { background-image: linear-gradient(90deg, #FFB36B, #FF6AD5); }
.wave-band { display: block; width: calc(100% + 56px); margin: 4px -28px 0; height: 22px; }
.wave-band svg { height: 22px; }
.warmup-chip {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 4; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; background-color: #130D31;
  color: var(--mint, #6EE7B7); font-size: var(--fs-s); font-weight: 700; letter-spacing: .08em; animation: wave-chip var(--t-base, 220ms) var(--e-out, ease-out) both;
}
.more-sheet { display: grid; gap: 4px; }
.more-sheet .sec-card { padding-block: 0; }
.more-sheet .sec-row { min-height: 56px; }
@keyframes wave-in { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes wave-chip { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .wave-banner, .warmup-chip { animation: none; } }

/* ---- profile: Getting better ---- */
.prof-skill { display: grid; gap: 6px; padding: 12px 14px; border-radius: 16px; background: rgba(255, 255, 255, .06); box-shadow: 0 0 0 1px var(--glass-border) inset; }
.prof-skill .label { font-size: var(--fs-xs, 12px); }
.prof-skill-row { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--fs-s, 14px); }
.prof-skill-val { font-weight: 800; font-variant-numeric: tabular-nums; }
.prof-skill-val[data-dir="up"] { color: var(--mint); }
.prof-skill-val[data-dir="down"] { color: var(--t-miss); }

/* ---- profile: monthly header + stickers ---- */
.prof-calhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.prof-calhead .label { margin: 0; }
.prof-monthcount { font-size: var(--fs-xs, 12px); font-weight: 700; color: var(--mint, #6EE7B7); font-variant-numeric: tabular-nums; }
.prof-months { display: grid; gap: 6px; padding: 12px 14px; border-radius: 16px; background: rgba(255, 255, 255, .06); box-shadow: 0 0 0 1px var(--glass-border) inset; }
.prof-months .label { margin: 0; font-size: var(--fs-xs, 12px); }

/* profile stats: type tokens + icon alignment (overrides home.css sizes) */
.prof-sheet .prof-stats dd { font-size: var(--fs-m, 17px); }
.prof-sheet .prof-stats .label { font-size: var(--fs-xs, 12px); }
.prof-val { display: inline-flex; align-items: center; gap: 4px; }

/* ---- Train: end card ---- */
.card.tr-end { padding: 16px 16px 14px; text-align: center; }
.card.tr-end .tr-list { margin: 4px 0 0; text-align: left; }
.card.tr-end .tr-row { min-height: 28px; }
.card.tr-end .tr-avg { font-size: var(--fs-hero); line-height: 1; }
.card.tr-end .end-scorerow { margin: 0; }
.card.tr-end .tr-delta { font-size: var(--fs-s); }
@media (max-height: 700px) { .card.tr-end { padding: 10px 12px; gap: 4px; } .tr-end .tr-avg { font-size: var(--fs-xl); } .tr-end .tr-row { min-height: 22px; } }

/* ---- Tutorial (first launch + invite/duel entries): hero caption, calm stage ---- */
.tutorial .tut-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; }
.tutorial .tut-bar .chip-btn { font-size: var(--fs-s); }
.tutorial .tut-caption { margin: 4px 0 0; }
.tutorial .tut-note { margin: 0; min-height: 40px; display: grid; place-items: center; }
.tut-note:empty { visibility: hidden; }
.tut-note:not(:empty) { padding: 8px 16px; border-radius: 999px; background: var(--card-fill); box-shadow: var(--glow-card); justify-self: center; }

/* Duel: instruction as a calm caption under the HUD */
.duel-top { display: grid; gap: 4px; }
.duel-top:not(:has(> :not([hidden]))) { display: none; }
.duel-top .play-heading { font-size: var(--fs-l); font-weight: 800; }
.tutorial { gap: 8px; }
.tutorial .hero-head { flex: none; }
.tutorial .hero-orb { transform: scale(.75); margin: 0 0 0 0; }
.tutorial .hero-title { font-size: var(--fs-l); }
.tutorial .hero-sub { margin-top: 2px; }
.tutorial .tut-stage { margin: 0 -16px; }
.train-end { gap: 12px; height: 100dvh; min-height: 0; }
.train-end > .card { flex: none; }
.train-end .bottom-actions { gap: 12px; }
.train-mid { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; }
.train-end > .train-mid > .card { flex: none; }
.end-score:not(.gold) { background: linear-gradient(180deg, #FFF6E8, #FFD2B8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.end-card { --fs-endscore: var(--fs-score, var(--fs-hero)); }
@media (max-height: 700px) { .end-score { font-size: var(--fs-xl); } }
/* Play screens recover vertical px for the stage: tighter top padding under the mode row, smaller tutorial head */
.endless, .duel, .guess, .train-play, .party:has(> .hud) { padding-top: calc(8px + env(safe-area-inset-top)); }
.train-play { gap: 6px; }
.tutorial { padding-top: calc(4px + env(safe-area-inset-top)); }
.tutorial .tut-bar { min-height: 44px; }
.tutorial .hero-orb { width: 48px; height: 48px; margin: 0 8px 0 4px; transform: none; }
.tutorial .hero-orb > .orbit, .tutorial .hero-orb > svg.orbit { display: none; }
.train-play { gap: 2px; }
.train-play .hud { gap: 2px; }
