:root {
  --navy: #1b2b4b;
  --navy-soft: #e8ecf4;
  --yellow: #ffc93c;
  --yellow-soft: #fff4d6;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1b2b4b;
  --muted: #5d6a82;
  --line: #dde3ee;
  --radius: 20px;
  --head: "Poppins", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --body: "Nunito", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; }
.wrap { max-width: 440px; margin: 0 auto; padding: 0 16px 32px; }

/* Top bar */
.topbar { background: var(--navy); color: #fff; padding: 14px 16px; padding-top: calc(14px + env(safe-area-inset-top)); }
.topbar-inner { max-width: 440px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-family: var(--head); font-weight: 700; font-size: 18px; letter-spacing: 0.2px; text-decoration: none; color: #fff; }
.brand span { color: var(--yellow); }
.toplink {
  color: var(--yellow); font-weight: 700; font-size: 14px; text-decoration: none;
  padding: 8px 12px; border-radius: 999px; border: 1.5px solid rgba(255, 201, 60, 0.6);
}
.toplink:hover { background: rgba(255, 201, 60, 0.12); }

/* Chapter hero */
.hero { background: var(--navy); color: #fff; padding: 8px 24px 72px; text-align: center; border-radius: 0 0 32px 32px; }
.eyebrow {
  display: inline-block; margin-top: 14px;
  font-family: var(--head); font-weight: 600; font-size: 12px; letter-spacing: 2px;
  color: var(--navy); background: var(--yellow); padding: 4px 12px; border-radius: 999px;
}
.title { font-family: var(--head); font-weight: 700; font-size: 34px; line-height: 1.15; margin: 14px 0 4px; }
.subtitle { font-size: 18px; color: #c9d3e6; margin: 0; }

/* Player card */
.player {
  background: var(--card); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(27, 43, 75, 0.12);
  margin-top: -48px; padding: 24px 20px 20px; position: relative;
}
.controls { display: flex; align-items: center; justify-content: center; gap: 22px; }
.skip {
  width: 52px; height: 52px; border-radius: 50%;
  border: 1.5px solid var(--line); background: #fff; color: var(--navy);
  display: grid; place-items: center; cursor: pointer; position: relative;
}
.skip:hover { background: var(--navy-soft); }
.skip svg { width: 24px; height: 24px; }
.skip small {
  position: absolute; inset: 0; display: grid; place-items: center; padding-top: 1px;
  font-size: 8.5px; font-weight: 800; line-height: 1; pointer-events: none;
}
.play {
  width: 84px; height: 84px; border-radius: 50%; border: none;
  background: var(--yellow); color: var(--navy);
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 6px 16px rgba(255, 201, 60, 0.55);
  transition: transform 0.12s ease;
}
.play:active { transform: scale(0.96); }
.play svg { width: 36px; height: 36px; }
.play .i-pause { display: none; }
.play.is-playing .i-play { display: none; }
.play.is-playing .i-pause { display: block; }

.seek { margin-top: 22px; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; margin: 0; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(to right,
    var(--navy) 0%, var(--navy) var(--p, 0%),
    #b9c3d8 var(--p, 0%), #b9c3d8 var(--b, 0%),
    var(--line) var(--b, 0%), var(--line) 100%);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--navy); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); margin-top: -6px;
}
input[type=range]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--line); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--navy); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--navy); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); }
.times { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.speed-label { margin: 18px 0 8px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 1.2px; }
.speeds { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; background: var(--navy-soft); padding: 5px; border-radius: 14px; }
.speeds button {
  border: none; background: transparent; color: var(--navy);
  font-family: var(--body); font-weight: 700; font-size: 15px;
  padding: 10px 0; border-radius: 10px; cursor: pointer;
}
.speeds button[aria-checked="true"] { background: var(--navy); color: var(--yellow); }

.yt {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 18px; padding: 14px; border-radius: 14px;
  border: 1.5px solid var(--navy); color: var(--navy); text-decoration: none; font-weight: 700;
}
.yt:hover { background: var(--navy-soft); }
.yt svg { width: 22px; height: 22px; }

.nav { display: flex; justify-content: space-between; margin-top: 22px; font-size: 14px; font-weight: 700; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 0; }
.nav a:hover { color: var(--navy); }

/* Chapter list (home) */
.list-head { padding: 22px 0 8px; }
.list-head h1 { font-family: var(--head); font-size: 26px; margin: 0; }
.list-head p { margin: 4px 0 0; color: var(--muted); }
.chapters { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.chapters a {
  display: flex; align-items: center; gap: 14px; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; color: var(--text);
}
.chapters a:hover { border-color: var(--navy); }
.num {
  flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--yellow-soft); color: var(--navy); font-family: var(--head); font-weight: 700;
}
.ch-text { flex: 1; min-width: 0; }
.ch-text strong { display: block; font-size: 16px; }
.ch-text span { display: block; font-size: 14px; color: var(--muted); }
.chev { color: var(--muted); }

footer { text-align: center; color: var(--muted); font-size: 12px; margin-top: 28px; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
