:root {
  --bg: #090d18;
  --bg-soft: #0f1628;
  --panel: #141d32;
  --panel-2: #1a2540;
  --panel-3: #222f4d;
  --text: #f7f9ff;
  --muted: #aebbd2;
  --subtle: #7f8da7;
  --line: rgba(255,255,255,.12);
  --line-strong: rgba(255,255,255,.22);
  --accent: #67d3ff;
  --accent-2: #8d7dff;
  --accent-ink: #071019;
  --good: #60dea0;
  --bad: #ff7b8d;
  --warning: #ffd16f;
  --shadow: 0 18px 48px rgba(0,0,0,.32);
  --radius: 20px;
  --radius-sm: 13px;
  --max-width: 760px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 10% -10%, rgba(103,211,255,.16), transparent 34rem),
    radial-gradient(circle at 100% 5%, rgba(141,125,255,.14), transparent 32rem),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-touch-callout: none; }
button { color: inherit; }
a { color: var(--accent); }

#app { min-height: 100dvh; }
.app-shell {
  width: min(100%, var(--max-width));
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px) 16px calc(env(safe-area-inset-bottom) + 28px);
}

.topbar {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  min-height: 52px;
  margin-bottom: 10px;
}
.topbar-title { text-align: center; font-weight: 800; letter-spacing: -.015em; }
.topbar-subtitle { display: block; margin-top: 2px; color: var(--muted); font-size: .78rem; font-weight: 600; }
.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(20,29,50,.78);
  cursor: pointer;
}
.icon-button:active { transform: scale(.96); }
.icon-button.placeholder { visibility: hidden; }

.hero { padding: 22px 2px 18px; }
.brand-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(103,211,255,.24), rgba(141,125,255,.22));
  box-shadow: var(--shadow);
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -.08em;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(2.1rem, 10vw, 4rem); line-height: .98; letter-spacing: -.055em; }
h2 { margin-bottom: 12px; font-size: 1.45rem; letter-spacing: -.025em; }
h3 { margin-bottom: 8px; font-size: 1.02rem; }
.lead { max-width: 35rem; color: var(--muted); font-size: 1.05rem; line-height: 1.55; }
.muted { color: var(--muted); }
.subtle { color: var(--subtle); }
.small { font-size: .84rem; }
.tiny { font-size: .74rem; }
.center { text-align: center; }

.stack { display: grid; gap: 12px; }
.stack-lg { display: grid; gap: 18px; }
.section { margin-top: 24px; }
.section-head { display: flex; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 10px; }
.section-head h2, .section-head h3 { margin-bottom: 0; }

.panel {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(165deg, rgba(26,37,64,.94), rgba(15,22,40,.96));
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
.panel.compact { padding: 13px 15px; }
.panel.good { border-color: rgba(96,222,160,.42); background: linear-gradient(165deg, rgba(42,95,76,.56), rgba(15,37,33,.92)); }
.panel.bad { border-color: rgba(255,123,141,.42); background: linear-gradient(165deg, rgba(105,45,61,.56), rgba(40,19,29,.92)); }
.panel.warning { border-color: rgba(255,209,111,.38); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.home-actions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.action-card {
  min-height: 126px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(20,29,50,.9);
  cursor: pointer;
}
.action-card.primary { background: linear-gradient(145deg, rgba(103,211,255,.92), rgba(141,125,255,.9)); color: var(--accent-ink); border-color: transparent; }
.action-card strong { font-size: 1.05rem; }
.action-card span { display: block; color: var(--muted); font-size: .82rem; line-height: 1.35; }
.action-card.primary span { color: rgba(7,16,25,.72); }
.action-icon { font-size: 1.7rem; font-weight: 850; }

.button-row { display: flex; gap: 10px; flex-wrap: wrap; }
.button-row > .button { flex: 1 1 150px; }
.button {
  min-height: 50px;
  padding: 12px 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: var(--panel-2);
  color: var(--text);
  font-weight: 780;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
}
.button.primary { border-color: transparent; background: linear-gradient(135deg, var(--accent), #a5e9ff); color: var(--accent-ink); }
.button.secondary { background: rgba(255,255,255,.07); }
.button.good { border-color: rgba(96,222,160,.35); background: rgba(96,222,160,.12); color: #bdffdc; }
.button.danger { border-color: rgba(255,123,141,.35); background: rgba(255,123,141,.1); color: #ffd0d6; }
.button.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.button.small-button { min-height: 38px; padding: 8px 12px; border-radius: 11px; font-size: .84rem; }
.button:disabled { opacity: .42; cursor: not-allowed; }
.button:not(:disabled):active { transform: translateY(1px) scale(.992); }
.full { width: 100%; }

label.field { display: grid; gap: 7px; }
.field-label { color: var(--muted); font-size: .8rem; font-weight: 750; }
input[type="text"], input[type="number"], input[type="search"], input[type="url"], select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  outline: none;
  background: rgba(7,12,24,.72);
  color: var(--text);
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(103,211,255,.13); }
input::placeholder, textarea::placeholder { color: #697994; }
.checkbox-row {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(7,12,24,.45);
  cursor: pointer;
}
.checkbox-row input { width: 20px; height: 20px; accent-color: var(--accent); }
.checkbox-row .checkbox-copy { flex: 1; }
.checkbox-row strong { display: block; font-size: .94rem; }
.checkbox-row span { display: block; margin-top: 2px; color: var(--muted); font-size: .76rem; }

.player-row { display: grid; grid-template-columns: 34px 1fr 42px; gap: 9px; align-items: center; }
.player-number { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--panel-3); color: var(--muted); font-size: .8rem; font-weight: 800; }

.pack-option { display: grid; grid-template-columns: 26px 1fr auto; gap: 11px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: rgba(7,12,24,.38); cursor: pointer; }
.pack-option input { width: 21px; height: 21px; margin-top: 2px; accent-color: var(--accent); }
.pack-option strong { display: block; margin-bottom: 4px; }
.pack-option p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.4; }
.badge { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.05); color: var(--muted); font-size: .72rem; font-weight: 800; white-space: nowrap; }
.badge.good { border-color: rgba(96,222,160,.35); color: #baffda; }
.badge.warning { border-color: rgba(255,209,111,.35); color: #ffe3a3; }

.metric-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.metric { padding: 11px 9px; border: 1px solid var(--line); border-radius: 13px; background: rgba(7,12,24,.38); text-align: center; }
.metric strong { display: block; font-size: 1.1rem; }
.metric span { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; }

.turn-banner { padding: 18px; text-align: center; }
.turn-kicker { color: var(--accent); font-size: .75rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.turn-name { margin: 4px 0 0; font-size: clamp(2rem, 11vw, 3.5rem); line-height: 1; letter-spacing: -.05em; }

.timeline { display: grid; gap: 7px; padding: 2px 0 8px; }
.timeline-card {
  position: relative;
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 13px;
  align-items: center;
  min-height: 82px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(31,43,72,.95), rgba(17,25,45,.96));
  overflow: hidden;
}
.timeline-card.highlight { border-color: var(--good); box-shadow: 0 0 0 2px rgba(96,222,160,.12); }
.timeline-card::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: linear-gradient(var(--accent), var(--accent-2)); opacity: .75; }
.year-tile { display: grid; place-items: center; min-height: 54px; border-radius: 13px; background: rgba(103,211,255,.12); color: var(--accent); font-size: 1.35rem; font-weight: 900; letter-spacing: -.03em; }
.song-copy { min-width: 0; }
.song-copy strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-copy span { display: block; margin-top: 4px; color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline-slot {
  min-height: 48px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(103,211,255,.34);
  border-radius: 14px;
  background: rgba(103,211,255,.05);
  color: #bdeeff;
  font-size: .78rem;
  font-weight: 780;
  text-align: center;
  cursor: pointer;
}
.timeline-slot.selected { border-style: solid; border-color: var(--accent); background: rgba(103,211,255,.18); box-shadow: 0 0 0 3px rgba(103,211,255,.1); }
.timeline-slot:active { transform: scale(.99); }

.privacy-shield {
  min-height: 54dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 18px;
  padding: 26px 18px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 20%, rgba(103,211,255,.15), transparent 20rem),
    #05070d;
  box-shadow: var(--shadow);
  text-align: center;
}
.mystery-disc {
  width: 142px;
  height: 142px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.2);
  background:
    radial-gradient(circle, #090d18 0 13%, rgba(103,211,255,.55) 14% 16%, #111a2d 17% 45%, #263453 46% 48%, #0d1425 49% 71%, #263453 72% 74%, #0c1220 75%);
  box-shadow: 0 20px 50px rgba(0,0,0,.45);
  color: var(--text);
  font-size: 2.8rem;
  font-weight: 950;
}
.privacy-shield h2 { margin-bottom: 3px; font-size: 1.7rem; }
.privacy-shield p { max-width: 30rem; margin: 0 auto; color: var(--muted); line-height: 1.5; }

.reveal-year { margin: 4px 0 8px; font-size: clamp(3.7rem, 20vw, 6.5rem); line-height: .9; letter-spacing: -.075em; font-weight: 950; }
.reveal-title { margin: 12px 0 3px; font-size: 1.5rem; letter-spacing: -.03em; }
.reveal-artist { color: var(--muted); font-size: 1.03rem; }
.result-mark { width: 60px; height: 60px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 50%; font-size: 1.8rem; font-weight: 950; }
.result-mark.good { background: rgba(96,222,160,.15); color: var(--good); border: 1px solid rgba(96,222,160,.4); }
.result-mark.bad { background: rgba(255,123,141,.14); color: var(--bad); border: 1px solid rgba(255,123,141,.4); }

.player-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 5px; scrollbar-width: none; }
.player-strip::-webkit-scrollbar { display: none; }
.player-chip { flex: 0 0 auto; min-width: 104px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 13px; background: rgba(7,12,24,.35); }
.player-chip.active { border-color: var(--accent); background: rgba(103,211,255,.11); }
.player-chip strong { display: block; max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .8rem; }
.player-chip span { color: var(--muted); font-size: .7rem; }

.library-card { display: grid; gap: 12px; }
.library-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.song-list { display: grid; gap: 7px; max-height: 55dvh; overflow-y: auto; padding-right: 2px; }
.song-row { display: grid; grid-template-columns: 56px 1fr 42px; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: rgba(7,12,24,.34); }
.song-row .year { color: var(--accent); font-weight: 900; }
.song-row strong, .song-row span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-row span { margin-top: 2px; color: var(--muted); font-size: .74rem; }

.step-list { counter-reset: steps; display: grid; gap: 14px; }
.step { position: relative; padding: 17px 17px 17px 58px; border: 1px solid var(--line); border-radius: 17px; background: rgba(20,29,50,.72); }
.step::before { counter-increment: steps; content: counter(steps); position: absolute; left: 16px; top: 15px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: rgba(103,211,255,.15); color: var(--accent); font-weight: 900; }
.step strong { display: block; margin-bottom: 4px; }
.step p { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }

.divider { height: 1px; margin: 17px 0; background: var(--line); }
.empty-state { padding: 32px 18px; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); }

.modal-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 14px 14px calc(env(safe-area-inset-bottom) + 14px);
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(8px);
}
.modal {
  width: min(100%, 600px);
  max-height: 88dvh;
  overflow-y: auto;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 25px;
  background: var(--bg-soft);
  box-shadow: var(--shadow);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { margin: 0; }

.toast-region { position: fixed; z-index: 100; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 22px); width: min(calc(100% - 28px), 520px); transform: translateX(-50%); pointer-events: none; }
.toast { padding: 13px 15px; border: 1px solid var(--line-strong); border-radius: 14px; background: rgba(15,22,40,.97); box-shadow: var(--shadow); color: var(--text); font-size: .86rem; text-align: center; animation: toast-in .2s ease-out; }
.toast.error { border-color: rgba(255,123,141,.45); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.no-scroll { overflow: hidden; }

@media (max-width: 520px) {
  .app-shell { padding-left: 13px; padding-right: 13px; }
  .home-actions { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(3,1fr); }
  .panel { padding: 15px; }
  .timeline-card { grid-template-columns: 62px 1fr; }
}
@media (max-width: 360px) {
  .home-actions { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
}
@media (display-mode: standalone) {
  .install-only { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.hidden { display: none !important; }
