:root {
  color-scheme: light;
  --ink: #26354f;
  --muted: #66738b;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --line: rgba(81, 101, 141, 0.16);
  --brand: #afca05;
  --brand-strong: #93aa00;
  --brand-dark: #51658d;
  --accent: #3f5278;
  --soft: #f4f8df;
  --success: #5e7900;
  --danger: #c53a52;
  --shadow: 0 26px 70px rgba(66, 82, 116, 0.16);
  --shadow-soft: 0 12px 34px rgba(66, 82, 116, 0.10);
  --radius-xl: 32px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --content: 1120px;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 4%, rgba(175, 202, 5, 0.16), transparent 29rem),
    radial-gradient(circle at 92% 16%, rgba(81, 101, 141, 0.13), transparent 31rem),
    linear-gradient(150deg, #fcfdf8 0%, #f8faf2 50%, #f2f5f9 100%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: #fff;
  background: var(--ink);
  transform: translateY(-160%);
  transition: transform .18s ease;
}
.skip-link:focus { transform: translateY(0); }

.ambient {
  position: fixed;
  z-index: -1;
  width: 19rem;
  height: 19rem;
  border-radius: 50%;
  filter: blur(2px);
  opacity: .58;
  pointer-events: none;
}
.ambient-one { top: 18%; left: -11rem; background: rgba(175, 202, 5, .15); }
.ambient-two { right: -10rem; bottom: 4%; background: rgba(81, 101, 141, .12); }

.site-header {
  width: min(calc(100% - 32px), var(--content));
  margin: 0 auto;
  padding: 24px 0 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 52px;
  height: 49px;
  object-fit: contain;
  filter: drop-shadow(0 8px 15px rgba(62, 77, 109, .16));
}

.brand-copy { display: grid; line-height: 1.1; }
.brand-copy strong { font-size: .98rem; letter-spacing: -.015em; }
.brand-copy span { margin-top: 4px; color: var(--muted); font-size: .72rem; }

.lesson-main, .library-main {
  width: min(calc(100% - 32px), var(--content));
  margin: 0 auto;
}

.lesson-main {
  display: grid;
  min-height: calc(100vh - 164px);
  align-items: center;
  padding: 34px 0 56px;
}

.player-shell { width: 100%; }

.player-card {
  display: grid;
  grid-template-columns: minmax(230px, 37%) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.album-art {
  position: relative;
  display: grid;
  min-height: 500px;
  place-items: center;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 26% 22%, rgba(175,202,5,.38), transparent 25%),
    linear-gradient(145deg, #64779d 0%, #51658d 48%, #334665 100%);
}

.album-art::before,
.album-art::after {
  position: absolute;
  content: "";
  border: 1px solid rgba(214, 234, 78, .32);
  border-radius: 50%;
}
.album-art::before { width: 20rem; height: 20rem; }
.album-art::after { width: 14rem; height: 14rem; }

.letter-orbit {
  position: relative;
  z-index: 1;
  display: grid;
  width: 9.4rem;
  height: 9.4rem;
  place-items: center;
  border: 1px solid rgba(226, 239, 125, .70);
  border-radius: 50%;
  color: #f5ffd0;
  background: rgba(175, 202, 5, .16);
  box-shadow: inset 0 0 0 14px rgba(175,202,5,.055), 0 20px 60px rgba(28, 41, 67, .28);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4.9rem, 10vw, 7rem);
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 8px 28px rgba(28,41,67,.32);
}

.album-brand {
  position: absolute;
  z-index: 2;
  top: 22px;
  left: 22px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 7px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 13px;
  color: rgba(255,255,255,.92);
  background: rgba(38,53,79,.28);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  font-size: .67rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.album-brand img { width: 29px; height: 27px; object-fit: contain; }

.art-caption {
  position: absolute;
  z-index: 1;
  right: 24px;
  bottom: 22px;
  left: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(255,255,255,.88);
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.wave-bars { display: flex; height: 18px; align-items: center; gap: 3px; }
.wave-bars i { width: 3px; border-radius: 3px; background: currentColor; }
.wave-bars i:nth-child(1) { height: 7px; }
.wave-bars i:nth-child(2) { height: 14px; }
.wave-bars i:nth-child(3) { height: 10px; }
.wave-bars i:nth-child(4) { height: 18px; }
.wave-bars i:nth-child(5) { height: 9px; }

.player-content {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: clamp(30px, 6vw, 68px);
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--brand-dark);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
.lesson-title {
  margin-bottom: 8px;
  font-size: clamp(2.2rem, 5vw, 4.25rem);
  line-height: 1.03;
  letter-spacing: -.045em;
}
.lesson-subtitle { margin-bottom: 0; color: var(--muted); font-size: clamp(.98rem, 2vw, 1.08rem); }

.rule {
  width: 100%;
  height: 1px;
  margin: 28px 0;
  border: 0;
  background: linear-gradient(90deg, var(--line), rgba(81,101,141,.03));
}

.native-audio { width: 100%; }
.custom-player[hidden] { display: none !important; }

.progress-wrap { display: grid; gap: 8px; }
.time-row { display: flex; justify-content: space-between; color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }

input[type="range"] {
  width: 100%;
  height: 24px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--brand-dark);
}

.timeline {
  --progress: 0%;
  appearance: none;
  -webkit-appearance: none;
  height: 6px !important;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand) 0 var(--progress), #e3e8d3 var(--progress) 100%);
}
.timeline::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  border: 4px solid #fff;
  border-radius: 50%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--accent);
  box-shadow: 0 3px 10px rgba(61,78,112,.28);
}
.timeline::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 3px 10px rgba(61,78,112,.28);
}

.primary-controls {
  display: grid;
  grid-template-columns: 44px 54px 44px;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 24px 0 20px;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.icon-button:hover { border-color: rgba(175,202,5,.72); box-shadow: 0 8px 18px rgba(66,82,116,.12); transform: translateY(-1px); }
.icon-button:active { transform: scale(.97); }
.play-button {
  width: 54px;
  height: 54px;
  border: 0;
  color: var(--ink);
  background: linear-gradient(135deg, #c0da19, var(--brand));
  box-shadow: 0 13px 25px rgba(126, 151, 0, .24);
}
.icon-button svg { width: 19px; height: 19px; fill: currentColor; }
.play-button svg { width: 22px; height: 22px; }
.pause-icon { display: none; }
.is-playing .play-icon { display: none; }
.is-playing .pause-icon { display: block; }

.secondary-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
}
.volume-wrap { display: flex; min-width: 0; align-items: center; gap: 9px; }
.volume-wrap .icon-button { flex: 0 0 auto; width: 36px; height: 36px; }
.volume { max-width: 150px; }

.speed-label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .78rem; font-weight: 700; }
.speed-select {
  min-height: 38px;
  padding: 0 31px 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.player-status {
  min-height: 1.5em;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: .82rem;
}
.player-status.error { color: var(--danger); font-weight: 700; }

.utility-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.soft-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255,255,255,.7);
  font-size: .82rem;
  font-weight: 750;
  text-decoration: none;
}
.soft-link:hover { border-color: rgba(175,202,5,.72); background: #fff; }
.soft-link svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.lesson-navigation {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}
.nav-link {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--ink);
  background: rgba(255,255,255,.72);
  box-shadow: var(--shadow-soft);
  font-size: .84rem;
  font-weight: 780;
  text-decoration: none;
}
.nav-link:first-child { justify-self: start; }
.nav-link:last-child { justify-self: end; }
.nav-link:hover { border-color: rgba(175,202,5,.72); background: #fff; }
.nav-placeholder { min-width: 1px; }

.site-footer {
  width: min(calc(100% - 32px), var(--content));
  margin: 0 auto;
  padding: 10px 0 calc(24px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: .76rem;
  text-align: center;
}

.library-main { padding: 62px 0 64px; }
.library-hero { max-width: 820px; margin: 0 auto 48px; text-align: center; }
.hero-logo {
  display: block;
  width: 118px;
  height: auto;
  margin: 0 auto 16px;
  object-fit: contain;
  filter: drop-shadow(0 15px 24px rgba(62,77,109,.17));
}
.library-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 8px 12px;
  border: 1px solid rgba(175,202,5,.38);
  border-radius: 999px;
  color: var(--brand-dark);
  background: rgba(244,248,223,.88);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.library-title { margin-bottom: 18px; font-size: clamp(2.55rem, 8vw, 5.7rem); line-height: .98; letter-spacing: -.055em; }
.gradient-text { color: var(--brand-dark); background: linear-gradient(125deg, var(--brand-dark) 12%, #829700 88%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.library-intro { max-width: 670px; margin: 0 auto; color: var(--muted); font-size: clamp(1rem, 2vw, 1.14rem); }

.letters-panel {
  padding: clamp(20px, 4vw, 38px);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.panel-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.panel-head h2 { margin-bottom: 5px; font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: -.03em; }
.panel-head p { margin-bottom: 0; color: var(--muted); font-size: .9rem; }
.lesson-count { flex: 0 0 auto; padding: 8px 11px; border-radius: 999px; color: var(--brand-dark); background: var(--soft); font-size: .78rem; font-weight: 800; }

.letter-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
.letter-card {
  position: relative;
  display: grid;
  min-height: 108px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: linear-gradient(145deg, #fff, #f8faef);
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.letter-card::after {
  position: absolute;
  right: -28px;
  bottom: -36px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(175,202,5,.15);
  content: "";
}
.letter-card strong { font-family: Georgia, "Times New Roman", serif; font-size: 2.15rem; font-style: italic; line-height: 1; }
.letter-card span { margin-top: -22px; color: var(--muted); font-size: .66rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.letter-card:hover, .letter-card:focus-visible { border-color: rgba(175,202,5,.72); box-shadow: 0 14px 28px rgba(66,82,116,.12); transform: translateY(-3px); }

.feature-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 18px; }
.feature {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255,255,255,.58);
  font-size: .82rem;
}
.feature-badge { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 11px; color: var(--brand-dark); background: var(--soft); font-weight: 900; }

:focus-visible { outline: 3px solid rgba(81,101,141,.52); outline-offset: 3px; }

@media (max-width: 900px) {
  .player-card { grid-template-columns: minmax(190px, 34%) minmax(0, 1fr); }
  .album-art { min-height: 465px; }
  .player-content { padding: 40px; }
  .letter-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .site-header { padding-top: 18px; }
  .lesson-main { min-height: auto; padding-top: 24px; }
  .player-card { grid-template-columns: 1fr; border-radius: 26px; }
  .album-art { min-height: 224px; }
  .album-art::before { width: 15rem; height: 15rem; }
  .album-art::after { width: 10.5rem; height: 10.5rem; }
  .album-brand { top: 14px; left: 14px; padding: 4px; }
  .album-brand span { display: none; }
  .album-brand img { width: 25px; height: 24px; }
  .letter-orbit { width: 7.6rem; height: 7.6rem; font-size: 5.25rem; }
  .art-caption { right: 18px; bottom: 15px; left: 18px; }
  .player-content { padding: 29px 24px 26px; }
  .lesson-title { font-size: 2.55rem; }
  .rule { margin: 22px 0; }
  .lesson-navigation { grid-template-columns: 1fr 1fr; }
  .lesson-navigation .all-lessons { grid-column: 1 / -1; grid-row: 2; }
  .nav-placeholder { display: none; }
  .nav-link { width: 100%; }
  .library-main { padding-top: 42px; }
  .library-hero { margin-bottom: 34px; }
  .hero-logo { width: 102px; }
  .letter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
  .letter-card { min-height: 92px; border-radius: 15px; }
  .feature-row { grid-template-columns: 1fr; }
  .panel-head { align-items: start; flex-direction: column; gap: 12px; }
}

@media (max-width: 390px) {
  .site-header, .lesson-main, .library-main, .site-footer { width: min(calc(100% - 22px), var(--content)); }
  .brand-copy span { display: none; }
  .album-art { min-height: 205px; }
  .letter-orbit { width: 6.8rem; height: 6.8rem; font-size: 4.65rem; }
  .player-content { padding: 25px 18px 22px; }
  .primary-controls { gap: 11px; }
  .secondary-controls { align-items: start; grid-template-columns: 1fr; gap: 12px; }
  .volume { max-width: none; }
  .speed-label { justify-content: space-between; }
  .utility-row { display: grid; grid-template-columns: 1fr 1fr; }
  .soft-link { justify-content: center; padding-inline: 8px; }
  .letter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@supports not (backdrop-filter: blur(1px)) {
  .player-card, .letters-panel { background: var(--surface-solid); }
}
