:root {
  color-scheme: dark;
  --bg: #0b1020;
  --card: rgba(17, 24, 39, 0.88);
  --card-strong: #111827;
  --line: rgba(255,255,255,0.12);
  --text: #f9fafb;
  --muted: #b7c0d1;
  --accent: #8b5cf6;
  --accent-2: #22c55e;
  --danger: #fb7185;
  --button-text: #f9fafb;
  --shadow: 0 24px 70px rgba(0,0,0,0.45);
}

body.theme-cream {
  color-scheme: light;
  --bg: #f3efe4;
  --card: rgba(255, 253, 247, 0.94);
  --card-strong: #17231d;
  --line: rgba(23,35,29,0.14);
  --text: #17231d;
  --muted: #68736c;
  --accent: #9a3248;
  --accent-2: #0f8b79;
  --danger: #9a6a1c;
  --button-text: #17231d;
  --shadow: 0 16px 45px rgba(39,34,24,0.16);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100%;
  padding-bottom: 150px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(139,92,246,0.42), transparent 34rem),
    radial-gradient(circle at bottom right, rgba(34,197,94,0.20), transparent 28rem),
    var(--bg);
  color: var(--text);
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
}

.hero {
  padding: 30px 4px 18px;
}
.eyebrow {
  margin: 0 0 10px;
  color: #c4b5fd;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}
h1 {
  margin: 0;
  font-size: clamp(2rem, 10vw, 4.4rem);
  line-height: 0.96;
  letter-spacing: -0.06em;
}
.subtitle {
  color: var(--muted);
  font-size: clamp(1.02rem, 3.8vw, 1.28rem);
  line-height: 1.5;
  margin: 16px 0 0;
}
.quick-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.10);
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
}
.pill.ghost { color: #d1fae5; }

.now-card, .section {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(17,24,39,0.94), rgba(15,23,42,0.88));
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 16px 0;
  backdrop-filter: blur(14px);
}
.label {
  color: var(--accent-2);
  font-weight: 900;
  margin: 0 0 4px;
  font-size: 0.85rem;
}
.now-card h2, .section h2 {
  margin: 0;
  font-size: clamp(1.45rem, 6vw, 2.3rem);
  letter-spacing: -0.04em;
}
#trackNote, .section-note {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.time-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 22px;
  font-variant-numeric: tabular-nums;
}
.time-row strong {
  font-size: clamp(2rem, 11vw, 4.2rem);
  letter-spacing: -0.06em;
}
.time-row span {
  color: var(--muted);
  font-size: 1.15rem;
  font-weight: 800;
}
.seek {
  width: 100%;
  height: 58px;
  margin: 4px 0 14px;
  accent-color: var(--accent-2);
  touch-action: pan-y;
}
.seek::-webkit-slider-runnable-track {
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e, #8b5cf6);
}
.seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 44px;
  height: 44px;
  margin-top: -13px;
  border-radius: 50%;
  background: #fff;
  border: 7px solid #111827;
  box-shadow: 0 6px 20px rgba(0,0,0,0.45);
}

.transport {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  gap: 12px;
  align-items: center;
}
.round {
  min-height: 76px;
  border: 0;
  border-radius: 24px;
  color: var(--text);
  font-weight: 950;
  box-shadow: 0 12px 30px rgba(0,0,0,0.24);
}
.round.play {
  min-height: 96px;
  font-size: 2.5rem;
  background: linear-gradient(135deg, #22c55e, #84cc16);
  color: #06130a;
}
.round.secondary { background: rgba(255,255,255,0.12); }

.practice-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.practice-tools button, .settings-grid select {
  min-height: 54px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.09);
  color: var(--text);
  font-weight: 850;
}
.practice-tools button[aria-pressed="true"] {
  background: rgba(34,197,94,0.26);
  border-color: rgba(34,197,94,0.72);
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}
.settings-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 850;
}
.settings-grid input[type="range"] {
  width: 100%;
  min-height: 54px;
  accent-color: var(--accent);
}
.loop-status {
  margin: 12px 0 0;
  color: #dbeafe;
  font-weight: 750;
}

.track-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.track-card {
  width: 100%;
  min-height: 74px;
  text-align: left;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 22px;
  background: rgba(255,255,255,0.07);
  color: var(--text);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.track-card.active {
  outline: 3px solid rgba(34,197,94,0.75);
  background: rgba(34,197,94,0.16);
}
.track-card strong {
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}
.track-card span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.92rem;
}
.badge {
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 0.78rem;
  font-weight: 950;
  background: rgba(139,92,246,0.24);
  color: #ddd6fe;
}
.badge.solo { background: rgba(251,113,133,0.20); color: #fecdd3; }

@media (max-width: 540px) {
  .app-shell { padding-inline: 12px; }
  .now-card, .section { border-radius: 24px; padding: 16px; }
  .transport { grid-template-columns: 1fr; }
  .round, .round.play { min-height: 84px; }
  .settings-grid { grid-template-columns: 1fr; }
  .track-card { min-height: 82px; }
}

.sticky-player {
  position: fixed;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 9999;
  width: min(980px, calc(100vw - 24px));
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.20);
  border-radius: 24px;
  background: rgba(8, 13, 29, 0.94);
  box-shadow: 0 20px 70px rgba(0,0,0,0.62);
  backdrop-filter: blur(18px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 1.8fr) auto;
  gap: 12px;
  align-items: center;
}
.sticky-meta {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.sticky-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.02rem;
  letter-spacing: -0.03em;
}
.sticky-meta span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}
.sticky-seek {
  width: 100%;
  min-height: 52px;
  accent-color: var(--accent-2);
  touch-action: pan-y;
}
.sticky-seek::-webkit-slider-runnable-track {
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e, #8b5cf6);
}
.sticky-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 40px;
  height: 40px;
  margin-top: -12px;
  border-radius: 50%;
  background: #fff;
  border: 7px solid #111827;
  box-shadow: 0 6px 20px rgba(0,0,0,0.45);
}
.sticky-controls {
  display: grid;
  grid-template-columns: 64px 76px 64px;
  gap: 8px;
}
.sticky-controls button {
  min-height: 58px;
  border: 0;
  border-radius: 18px;
  color: var(--text);
  background: rgba(255,255,255,0.12);
  font-weight: 950;
}
.sticky-controls .sticky-play {
  color: #06130a;
  background: linear-gradient(135deg, #22c55e, #84cc16);
  font-size: 1.7rem;
}

@media (max-width: 720px) {
  body { padding-bottom: 190px; }
  .sticky-player {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 10px;
    border-radius: 22px 22px 20px 20px;
  }
  .sticky-meta {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
  }
  .sticky-meta strong { font-size: 1rem; }
  .sticky-controls {
    grid-template-columns: 1fr 1.35fr 1fr;
  }
  .sticky-controls button { min-height: 54px; }
}

.theme-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
}
.theme-switcher span {
  padding-left: 8px;
  color: var(--muted);
  font-weight: 900;
  font-size: 0.86rem;
}
.theme-option {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-weight: 900;
}
.theme-option.active {
  background: var(--accent-2);
  color: #06130a;
  box-shadow: 0 8px 22px rgba(0,0,0,0.18);
}

body.theme-cream {
  background:
    radial-gradient(circle at top left, rgba(154,50,72,0.10), transparent 28rem),
    radial-gradient(circle at bottom right, rgba(15,139,121,0.11), transparent 26rem),
    var(--bg);
  color: var(--text);
}
body.theme-cream .app-shell {
  max-width: 760px;
}
body.theme-cream .hero {
  position: relative;
  padding: 28px 0 18px;
}
body.theme-cream .eyebrow {
  color: var(--accent);
  font-size: 0.86rem;
  letter-spacing: 0.16em;
}
body.theme-cream h1 {
  font-size: clamp(3rem, 12vw, 5.1rem);
  letter-spacing: -0.08em;
  color: #17231d;
}
body.theme-cream .subtitle {
  color: var(--muted);
}
body.theme-cream .quick-links {
  position: absolute;
  right: 0;
  top: 28px;
}
body.theme-cream .pill {
  min-height: 58px;
  padding: 0 20px;
  background: #e7f2ef;
  color: #0d5f55;
  border: 1px solid #bfd8d2;
  box-shadow: none;
}
body.theme-cream .pill.ghost {
  display: none;
}
body.theme-cream .theme-switcher {
  background: rgba(255,253,247,0.72);
  border-color: rgba(23,35,29,0.12);
}
body.theme-cream .now-card,
body.theme-cream .section {
  background: var(--card);
  border: 1px solid rgba(23,35,29,0.14);
  border-radius: 10px;
  box-shadow: var(--shadow);
  backdrop-filter: none;
}
body.theme-cream .now-card > div:first-child {
  background: #17231d;
  color: #fffdf7;
  border-radius: 8px;
  padding: 22px;
  margin-bottom: 20px;
}
body.theme-cream .now-card > div:first-child .label {
  color: #f0c866;
}
body.theme-cream #trackNote {
  color: #d8ded8;
}
body.theme-cream .time-row strong,
body.theme-cream .time-row span {
  color: #637168;
}
body.theme-cream .seek::-webkit-slider-runnable-track,
body.theme-cream .sticky-seek::-webkit-slider-runnable-track {
  background: #ded7c8;
}
body.theme-cream .seek,
body.theme-cream .sticky-seek {
  accent-color: var(--accent-2);
}
body.theme-cream .round.secondary {
  color: #08695e;
  background: #e8f4f1;
  border: 1px solid #c7ddd8;
  box-shadow: none;
}
body.theme-cream .round.play,
body.theme-cream .sticky-controls .sticky-play {
  background: #0f8b79;
  color: #fffdf7;
  border: 2px solid #d19a00;
  box-shadow: 0 18px 34px rgba(15,139,121,0.20);
}
body.theme-cream .practice-tools button,
body.theme-cream .settings-grid select {
  color: var(--text);
  background: #fffdf8;
  border-color: rgba(23,35,29,0.18);
}
body.theme-cream .settings-grid label {
  color: #4d5b52;
}
body.theme-cream .section {
  margin-top: 26px;
}
body.theme-cream .section h2 {
  text-align: right;
  font-size: clamp(1.75rem, 7vw, 2.55rem);
  color: #17231d;
}
body.theme-cream .section::before {
  content: 'TRACKS';
  display: block;
  color: var(--accent);
  letter-spacing: 0.12em;
  font-weight: 950;
  margin-bottom: -28px;
}
body.theme-cream .track-card {
  background: #fffdf8;
  color: var(--text);
  border-color: rgba(23,35,29,0.15);
  border-radius: 8px;
  box-shadow: none;
}
body.theme-cream .track-card.active {
  outline: 0;
  border-color: #0f8b79;
  background: #e9f4f1;
}
body.theme-cream .track-card span {
  color: var(--muted);
}
body.theme-cream .badge {
  background: #e3f2ef;
  color: #08695e;
}
body.theme-cream .badge.solo {
  background: #f6e7c2;
  color: #8a5d17;
}
body.theme-cream .sticky-player {
  background: rgba(255,253,247,0.96);
  color: var(--text);
  border-color: rgba(23,35,29,0.15);
  box-shadow: 0 16px 45px rgba(39,34,24,0.20);
}
body.theme-cream .sticky-controls button {
  color: #08695e;
  background: #e8f4f1;
  border: 1px solid #c7ddd8;
}
body.theme-cream .sticky-controls .sticky-play {
  color: #fffdf7;
}

@media (max-width: 540px) {
  body.theme-cream .quick-links {
    position: static;
  }
  body.theme-cream .theme-switcher {
    width: 100%;
    justify-content: center;
  }
}
