/* Home, Settings sheet, Tutorial, legal pages: neon glass. Builds on base.css primitives. */
:root {
  --neon-border: linear-gradient(135deg, rgba(178, 140, 255, .55), rgba(125, 243, 255, .35));
  --neon-glass: rgba(255, 255, 255, .06);
}
/* the older flat glass for the settings/profile sheets and the flag picker (cards, chips and buttons come from base.css) */
.set-sheet, .home-option, .flag-search {
  background: linear-gradient(rgba(24, 16, 58, .86), rgba(18, 12, 46, .86)) padding-box, var(--neon-border) border-box;
  border: 1px solid transparent;
}
.btn-link { background: none; color: var(--quiet); font-weight: 600; min-height: 48px; padding: 0 12px; text-decoration: underline; text-underline-offset: 3px; }

/* ---- Home v3: hero Daily, tiles, fidget, one pill ---- */
.home { height: 100dvh; min-height: 0; }
.home .topbar { flex: none; }
.home-body { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: flex-start; gap: 12px; padding-top: 8px; }
.home .bottom-actions { flex: none; margin-top: 0; padding: 12px 0 0; gap: 0; }
button.card { text-align: inherit; color: var(--text); width: 100%; }
.card:active { transform: scale(.985); }
.mode-tile {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; color: #FFB36B;
  background: rgba(255, 154, 92, .1); border: 1px solid rgba(255, 154, 92, .5); box-shadow: 0 0 14px rgba(255, 154, 92, .28), inset 0 0 10px rgba(255, 154, 92, .12);
}
.home .emoji { line-height: 1; }
.weird-chip { color: #B28CFF; border-color: rgba(178, 140, 255, .55); background: rgba(178, 140, 255, .14); font-size: var(--fs-xs); font-weight: 800; letter-spacing: .1em; min-height: 28px; }

/* the Daily as the hero (left aligned, as in the reference) */
.home-hero { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 10px; text-align: left; padding: 18px 20px; flex: none; }
.home-hero .card-label { letter-spacing: .2em; }
.home-hero .card-value { font-size: var(--fs-xl); line-height: 1.1; }
.home-hero .card-value span { display: block; }
.home-hero.loading { align-items: stretch; min-height: 200px; }
.home-hero.loading .skeleton { width: 100%; }
.home-hero.is-error { min-height: 120px; gap: 4px; }
.home-hero.is-error .card-value { font-size: var(--fs-l); }
.home-subtitle { font-style: italic; color: #D6CEF5; }
.home-next { font-variant-numeric: tabular-nums; text-transform: none; letter-spacing: 0; font-size: var(--fs-s); font-weight: 600; min-height: 32px; padding: 4px 14px 4px 10px; color: var(--text); }
.home-next svg { color: #D6CEF5; }
.home-slots { display: grid; grid-template-columns: repeat(5, 44px); gap: 10px; }
.slot { aspect-ratio: 1; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); }
.slot[data-state="current"] { border: 2px solid #fff; box-shadow: 0 0 12px rgba(255, 255, 255, .55); }
.slot[data-state="done"] { background: rgba(255, 255, 255, .5); border-color: transparent; }
.slot[data-tier] { background: var(--tier); box-shadow: 0 0 12px var(--tier), inset 0 0 0 1px rgba(255, 255, 255, .35); }
.home-slots.small { grid-template-columns: repeat(5, 16px); gap: 6px; }
.home-slots.small .slot { border-radius: 5px; }

/* after the Daily: the same hero card holds the score */
.hr-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.home-score { font-size: var(--fs-hero); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; text-shadow: 0 0 24px rgba(255, 154, 92, .5); }
.hr-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; flex: none; }
.home-recap:empty { display: none; }
.home-recap .recap-entry { min-height: 44px; padding: 0 16px; font-size: var(--fs-s); border-radius: 999px; }

/* tiles: 2 columns; 3 tiles = 2 + 1 wide; 4 = 2x2 */
.home-doors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; flex: none; }
.home-doors .door:last-child:nth-child(odd) { grid-column: 1 / -1; }
.door { --hue: 178, 140, 255; position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 96px; padding: 12px 14px; text-align: left; }
.door[data-hue="ember"] { --hue: 255, 154, 92; }
.door[data-hue="cyan"] { --hue: 125, 243, 255; }
.door-top { display: flex; align-items: flex-start; justify-content: space-between; width: 100%; }
.door-art { display: grid; place-items: center; width: 44px; height: 44px; filter: drop-shadow(0 0 10px rgba(var(--hue), .45)); }
.door-art > img, .door-art > svg { display: block; width: 100%; height: 100%; object-fit: contain; overflow: hidden; }
.door-chev { display: grid; place-items: center; width: 24px; height: 24px; color: #D6CEF5; }
.door-name { font-size: var(--fs-l); font-weight: 800; line-height: 1.2; }
.door-hint { max-width: 100%; min-height: 1.3em; line-height: 1.3; font-size: var(--fs-s); color: var(--quiet); white-space: nowrap; overflow: hidden; font-variant-numeric: tabular-nums; } /* no ellipsis: home.js picks a form that fits */
.door-stars { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 2px; font-size: var(--fs-s); font-weight: 700; color: #FCD34D; font-variant-numeric: tabular-nums; }
.door-stars b { font-weight: 700; white-space: nowrap; }
.home-bar { flex: 1; display: block; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.home-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--halve-a), var(--halve-b)); border-radius: inherit; }
.door-dot { position: absolute; top: 12px; right: 40px; width: 10px; height: 10px; border-radius: 50%; background: #FF4F7B; box-shadow: 0 0 8px #FF4F7B; }
.door-dot[hidden] { display: none; }

.chip-link { color: #7DF3FF; border-color: rgba(125, 243, 255, .35); min-height: 44px; min-width: 44px; justify-content: center; }
.home-option { flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 20px; border-radius: 20px; text-align: left; display: flex; min-height: 64px; }
.home-option span { font-weight: 400; font-size: var(--fs-s); }

/* the fidget owns whatever room is left above the pill (tall screens only; never created otherwise), framed by an orbit ring */
.home-fidget { flex: 1 1 0; min-height: 0; position: relative; }
.home-orbit { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); pointer-events: none; opacity: .85; }
.home-fidget-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
@keyframes fidget-pop { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }
.home-fidget-cv.pop { animation: fidget-pop var(--t-base) var(--e-back); }
.home-fidget.tiny { visibility: hidden; }

/* first render only: pill pop (the body .stagger comes from base.css) */
@keyframes pill-pop { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
.pill-action.pop-in { animation: pill-pop var(--t-slow) var(--e-back) both; animation-delay: 160ms; }
@media (prefers-reduced-motion: reduce) { .pill-action.pop-in, .home-fidget-cv.pop { animation: none; } }

/* short phones: tiles go horizontal (icon left), the hero tightens */
@media (max-height: 700px) {
  .home-body { gap: 10px; padding-top: 4px; }
  .home-hero { padding: 12px 16px; gap: 6px; }
  .home-hero .card-value { font-size: var(--fs-l); }
  .home-hero .card-value span { display: inline; }
  .home-hero > .home-slots { grid-template-columns: repeat(5, 36px); gap: 8px; }
  .home-score { font-size: var(--fs-xl); }
  .door { display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 8px; row-gap: 0; align-items: center; min-height: 64px; padding: 8px 12px; }
  .door-top { display: contents; }
  .door-art { grid-row: 1; grid-column: 1; width: 28px; height: 28px; }
  .door-chev { display: none; }
  .door-name { grid-column: 2; grid-row: 1; font-size: var(--fs-m); }
  .door-hint { grid-column: 1 / -1; grid-row: 2; }
  .door-stars { grid-column: 1 / -1; grid-row: 3; margin-top: 2px; }
  .door-dot { top: 8px; right: 10px; }
  .home .bottom-actions { padding-top: 8px; }
}
@media (min-height: 780px) { .home-body { gap: 16px; } }

/* ---- Sheets (settings, flag picker, challenge) ---- */
.set-sheet { max-height: 90dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; border-radius: 28px 28px 0 0; border-bottom: 0; }
.set-head { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; text-align: center; }
.set-list { display: flex; flex-direction: column; }
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 52px; width: 100%; padding: 0 4px; background: none; text-align: left;
  color: var(--text); text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.set-row .quiet { text-align: right; }
.set-row:disabled { opacity: .5; }
.set-danger { background: none; color: var(--t-miss); font-weight: 600; min-height: 48px; }
.set-danger.solid { background: var(--t-miss); color: #fff; border-radius: 999px; font-weight: 800; box-shadow: 0 0 20px rgba(244, 63, 94, .4); }
.set-version { text-align: center; font-size: var(--fs-xs); }
.switch { position: relative; width: 52px; height: 32px; border-radius: 16px; background: rgba(255, 255, 255, .14); transition: background .15s, box-shadow .15s; flex: none; pointer-events: none; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; }
.set-row[aria-checked="true"] .switch { background: linear-gradient(135deg, #7DF3FF, #9B6BFF); box-shadow: 0 0 14px rgba(125, 243, 255, .55); }
.set-row[aria-checked="true"] .switch::after { transform: translateX(20px); box-shadow: 0 0 8px rgba(255, 255, 255, .8); }
.flag-search { width: 100%; min-height: 48px; padding: 0 16px; border-radius: 999px; font: inherit; color: var(--text); }
.flag-list { overflow-y: auto; max-height: 50dvh; }

/* ---- Tutorial ---- */
.tutorial { height: 100dvh; }
.tutorial .topbar { display: grid; grid-template-columns: 1fr auto 1fr; text-align: center; }
.tutorial .topbar > :first-child { visibility: hidden; }
.tutorial .btn-link { justify-self: end; padding: 0; }
.tut-caption { text-align: center; font-weight: 800; font-size: var(--fs-l); text-shadow: 0 0 18px rgba(155, 107, 255, .6); }
.tut-stage { position: relative; flex: 1; min-height: 0; margin: 8px -16px; } /* full-bleed */
.tut-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.tut-note { text-align: center; min-height: 56px; font-weight: 600; }
.tut-swipe { position: absolute; width: 0; height: var(--d); pointer-events: none; }
.tut-trail {
  position: absolute; left: -1.5px; top: 0; width: 3px; height: 100%; transform-origin: top; opacity: 0;
  background: repeating-linear-gradient(180deg, #fff 0 10px, transparent 10px 18px); filter: drop-shadow(0 0 6px #7DF3FF);
  animation: tut-trail 2.4s ease-in-out infinite;
}
.tut-finger {
  position: absolute; left: -22px; top: -22px; width: 44px; height: 44px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 8px rgba(255, 255, 255, .18), 0 0 28px 8px rgba(255, 255, 255, .75), 0 0 48px 14px rgba(125, 243, 255, .45);
  animation: tut-finger 2.4s ease-in-out infinite;
}
@keyframes tut-trail { 0% { transform: scaleY(0); opacity: 1; } 70% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }
@keyframes tut-finger { 0% { transform: translateY(0); opacity: 0; } 8% { opacity: 1; } 70% { transform: translateY(var(--d)); opacity: 1; } 100% { transform: translateY(var(--d)); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tut-trail { transform: none; opacity: .6; } .tut-finger { transform: translateY(calc(var(--d) / 2)); opacity: 1; } }

/* ---- Legal pages (privacy.html, terms.html) ---- */
.legal { max-width: 640px; margin: 0 auto; padding: 24px 20px 64px; line-height: 1.6; }
.legal h1 { font-weight: 800; font-size: var(--fs-xl); margin: 16px 0 8px; text-shadow: 0 0 20px rgba(155, 107, 255, .5); }
.legal h2 { font-weight: 800; font-size: var(--fs-m); margin: 28px 0 8px; }
.legal p, .legal li { color: var(--text); margin-bottom: 8px; }
.legal ul { padding-left: 20px; }
.legal a { color: #7DF3FF; text-shadow: 0 0 10px rgba(125, 243, 255, .35); }
.legal .draft { padding: 12px 16px; border-radius: 12px; background: rgba(252, 211, 77, .14); border: 1px solid var(--t-good); color: var(--t-good); font-weight: 600; }
body:has(.legal) { height: auto; overscroll-behavior: auto; }

/* ---- Celebrations ---- */
.coin-fly { position: fixed; z-index: 70; top: 64px; right: 16px; font-weight: 800; font-size: var(--fs-m); color: #FCD34D; text-shadow: 0 0 12px rgba(252, 211, 77, .6); pointer-events: none; animation: coin-fly 1.2s ease-out forwards; }
@keyframes coin-fly { from { opacity: 0; transform: translateY(14px); } 15% { opacity: 1; } to { opacity: 0; transform: translateY(-26px); } }
.confetti { position: absolute; top: -10px; width: 8px; height: 12px; border-radius: 2px; pointer-events: none; animation: confetti-fall 1.8s ease-in forwards; }
@keyframes confetti-fall { to { transform: translate(var(--dx), 420px) rotate(540deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .coin-fly { animation-duration: .01s; animation-delay: .8s; } }
.prof-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.prof-stats dd { font-weight: 800; font-size: var(--fs-m); margin: 2px 0 0; font-variant-numeric: tabular-nums; }
.prof-stats .label { font-size: var(--fs-xs); }

/* ---- Arcade / Friends sheets: glossy icon tile, title + sub, BEST, chevron ---- */
.practice-sheet .practice-rows { gap: 10px; }
.practice-row { --hue: 178, 140, 255; display: flex; flex-direction: row; align-items: center; gap: 14px; padding: 8px 14px 8px 8px; min-height: 64px; width: 100%; text-align: left; border-radius: 20px; background: linear-gradient(160deg, rgba(var(--hue), .16), rgba(255, 255, 255, .04)); color: var(--text); }
.practice-row[data-hue="ember"] { --hue: 255, 154, 92; }
.practice-row[data-hue="cyan"] { --hue: 125, 243, 255; }
.practice-row[data-hue="magenta"] { --hue: 255, 139, 216; }
.practice-ico { flex: none; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; color: rgb(var(--hue)); background: linear-gradient(160deg, rgba(var(--hue), .35), rgba(var(--hue), .08)); border: 1px solid rgba(var(--hue), .55); box-shadow: 0 0 16px rgba(var(--hue), .45), inset 0 1px 0 rgba(255, 255, 255, .3); }
.practice-text { flex: 1; display: flex; flex-direction: column; min-width: 0; text-align: left; }
.practice-text strong { font-size: var(--fs-m); }
.practice-text .quiet { font-size: var(--fs-s); font-weight: 400; color: var(--quiet); }
.practice-best { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.practice-best .label { font-size: var(--fs-xs); }
.practice-best strong { font-size: var(--fs-m); }
.practice-chev { flex: none; display: grid; place-items: center; width: 24px; color: #D6CEF5; }

/* ---- /rival face-off ---- */
.rv-screen { gap: 12px; }
.rv-body { display: flex; flex-direction: column; gap: 12px; }
.rv-poster { padding: 14px 12px 16px; text-align: center; background: radial-gradient(120% 90% at 50% 0%, rgba(255, 79, 123, .22), transparent 60%), radial-gradient(80% 80% at 0% 100%, rgba(125, 243, 255, .12), transparent 60%), rgba(255, 255, 255, .06); }
.rv-ends { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.rv-clock { font-variant-numeric: tabular-nums; font-size: var(--fs-xs); letter-spacing: .06em; text-transform: uppercase; color: #A8A3C7; }
.rv-face { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 4px; }
.rv-fighter { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; opacity: .85; }
.rv-fighter.lead { opacity: 1; }
.rv-fighter.lead .avatar { box-shadow: 0 0 0 2px #FFD27A, 0 0 28px rgba(255, 210, 122, .7); }
.rv-fighter[data-side="me"] .avatar { outline: 2px solid rgba(255, 79, 123, .6); outline-offset: 2px; }
.rv-name { font-size: var(--fs-m); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-sub { font-size: var(--fs-xs); }
.rv-vs { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0 4px; }
.rv-score-big { font-size: var(--fs-hero); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; color: #A8A3C7; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.rv-score-big b { font-weight: 800; color: #F5F3FF; }
.rv-score-big b.lead { color: #FFD27A; text-shadow: 0 0 20px rgba(255, 210, 122, .7); }
.rv-days { padding: 10px 8px 12px; }
.rv-legend { display: flex; justify-content: space-between; padding: 0 4px 6px; }
.rv-legend .label { font-size: var(--fs-xs); }
.rv-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.rv-day { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; border-radius: 12px; background: rgba(255, 255, 255, .04); }
.rv-day[data-future="true"] { opacity: .35; }
.rv-dow { font-size: var(--fs-xs); letter-spacing: .1em; }
.rv-score { font-size: var(--fs-xs); font-weight: 700; font-variant-numeric: tabular-nums; padding: 3px 0; width: calc(100% - 6px); text-align: center; border-radius: 8px; color: var(--tier, #A8A3C7); }
.rv-score:not([data-tier]) { color: #A8A3C7; opacity: .6; }
.rv-score.win { background: color-mix(in srgb, var(--tier) 22%, transparent); box-shadow: 0 0 12px color-mix(in srgb, var(--tier) 55%, transparent), inset 0 0 0 1px var(--tier); }
.rv-last { text-align: center; font-weight: 700; margin: 0; }

/* ---- Rewards sheet ---- */
.rewards-sheet { display: flex; flex-direction: column; align-items: stretch; gap: 12px; overflow: hidden; max-height: 90dvh; }
.rewards-sheet > .card-label { text-align: center; }
.rw-hero { display: flex; align-items: center; justify-content: center; gap: 8px; }
.rw-total { font-size: var(--fs-hero); font-weight: 800; line-height: 1; color: #FCD34D; text-shadow: 0 0 24px rgba(252, 211, 77, .5); font-variant-numeric: tabular-nums; }
.rw-rank { display: flex; align-items: center; gap: 12px; justify-content: center; padding: 8px; border-radius: 20px; background: rgba(252, 211, 77, .1); border: 1px solid rgba(252, 211, 77, .4); }
.rw-rank-ico { filter: drop-shadow(0 0 16px rgba(252, 211, 77, .6)); display: inline-flex; }
.rw-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 0; scrollbar-width: none; }
.rw-row { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: var(--fs-s); }
.rw-ico { width: 28px; display: grid; place-items: center; flex: none; }
.rw-text { flex: 1; min-width: 0; font-weight: 600; }
.rw-coins { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; color: #FCD34D; font-variant-numeric: tabular-nums; }

/* mascot placeholder (until the fidget has drawn) + one-line sheet subtitle + highlighted first row */
.home-mascot { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: .9; }
.home-mascot svg { max-height: 100%; max-width: 70%; }
.practice-sheet .sh-sub { white-space: nowrap; font-size: var(--fs-s); }
.practice-sheet .sheet-head .sh-art { right: 28px; top: -10px; }
.practice-rows > .practice-row:first-child::before { background: var(--card-border-hot, var(--card-border)); }
