:root {
    color-scheme: dark;
    --bg: #0d0d1a;
    --player: #000000;
    --surface: #171724;
    --surface-2: #222231;
    --border: rgba(255, 255, 255, 0.14);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --text: #f5f5f7;
    --muted: #aeaeb2;
    --tertiary: #9b9baa;
    --accent: #e94560;
    --source: #8fd3ff;
    --pronunciation: rgba(207, 235, 255, 0.8);
    --focus: 0 0 0 3px rgba(143, 211, 255, 0.38);
    --max: 1360px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

button, a { -webkit-tap-highlight-color: transparent; }

:focus-visible { outline: 0; box-shadow: var(--focus); }

.skip-link {
    position: fixed;
    z-index: 10;
    top: 12px;
    left: 12px;
    padding: 10px 14px;
    background: var(--text);
    color: var(--bg);
    transform: translateY(-160%);
}

.skip-link:focus { transform: none; }

.site-header,
footer {
    width: min(var(--max), calc(100% - 64px));
    min-height: 84px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}

.wordmark {
    font-size: 29px;
    font-weight: 760;
    letter-spacing: -1.2px;
    white-space: nowrap;
}

.wordmark strong { color: var(--accent); font-weight: inherit; }

.site-header nav,
footer nav {
    display: flex;
    align-items: center;
    gap: 34px;
    margin-left: auto;
    color: #dedee3;
    font-size: 15px;
    font-weight: 590;
}

.site-header nav a,
footer nav a,
.text-link { transition: color 160ms ease; }

.site-header nav a:hover,
footer nav a:hover,
.text-link:hover { color: var(--source); }

.button {
    min-height: 50px;
    padding: 0 24px;
    border: 1px solid transparent;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1.2;
    font-weight: 700;
    text-align: center;
    transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button-primary { background: var(--accent); color: #fff; }
.button-primary:hover { background: #f04e68; }
.button-secondary { border-color: rgba(190, 198, 221, 0.55); background: transparent; }
.button-secondary:hover { border-color: var(--source); }
.header-cta { min-width: 174px; }

.hero {
    width: min(var(--max), calc(100% - 64px));
    min-height: clamp(660px, calc(100svh - 200px), 800px);
    margin: 0 auto;
    padding: 48px 0 40px;
    display: grid;
    grid-template-columns: minmax(0, 0.98fr) minmax(520px, 1.02fr);
    align-items: start;
    gap: clamp(42px, 4vw, 62px);
}

.hero-copy { max-width: 610px; padding-top: 86px; }

h1,
h2,
h3,
p { margin-top: 0; }

h1 {
    margin-bottom: 32px;
    font-size: clamp(54px, 5.2vw, 78px);
    line-height: 0.98;
    letter-spacing: -0.052em;
    font-weight: 770;
}

.hero-copy > p {
    max-width: 590px;
    margin-bottom: 34px;
    color: #b8b8c3;
    font-size: clamp(18px, 1.55vw, 22px);
    line-height: 1.55;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

.lesson-player {
    min-width: 0;
    min-height: 680px;
    padding: 36px 38px 28px;
    border: 1px solid rgba(179, 192, 224, 0.34);
    border-radius: 16px;
    background: var(--player);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.32);
    display: flex;
    flex-direction: column;
}

.player-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 20px;
}

.player-heading h2 {
    margin: 0;
    font-size: 20px;
    line-height: 1.3;
    letter-spacing: -0.015em;
}

.player-heading span { color: #c3c3cc; font-size: 14px; white-space: nowrap; }

.phrase {
    min-height: 230px;
    padding: 56px 12px 28px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.phrase p { margin-bottom: 0; }

.phrase-thai {
    color: var(--source);
    font-size: clamp(40px, 4vw, 61px);
    line-height: 1.45;
    font-weight: 650;
}

.phrase-romanization {
    color: var(--pronunciation);
    font-size: 24px;
    line-height: 1.45;
}

.phrase-translation {
    color: rgba(255, 255, 255, 0.92);
    font-size: 21px;
    line-height: 1.45;
}

.sequence {
    margin: 10px 0 28px;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.sequence li {
    position: relative;
    min-width: 0;
    color: #93939f;
    text-align: center;
    font-size: 13px;
    display: grid;
    justify-items: center;
    gap: 8px;
}

.sequence li::after {
    content: "";
    position: absolute;
    z-index: 0;
    top: 17px;
    left: calc(50% + 25px);
    width: calc(100% - 50px);
    height: 1px;
    background: #444452;
}

.sequence li:last-child::after { display: none; }

.sequence span {
    position: relative;
    z-index: 1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2e2e3d;
    color: #c9c9d2;
    display: grid;
    place-items: center;
    font-size: 15px;
    font-weight: 700;
    transition: background-color 160ms ease, color 160ms ease;
}

.sequence li.active,
.sequence li.complete { color: var(--text); }
.sequence li.active span { background: var(--accent); color: #fff; }
.sequence li.complete span { background: #622b3a; color: #fff; }

.waveform {
    position: relative;
    width: min(100%, 470px);
    height: 58px;
    margin: 0 auto 14px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.waveform-bar {
    width: 4px;
    height: var(--bar-height);
    border-radius: 99px;
    background: #323242;
}

.waveform-progress {
    display: none;
}

.waveform-bar.played { background: var(--accent); }

.play-button {
    min-width: 126px;
    min-height: 92px;
    margin: auto auto 0;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    display: grid;
    justify-items: center;
    gap: 9px;
}

.play-icon {
    width: 62px;
    height: 62px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--accent);
    display: grid;
    place-items: center;
    transition: transform 160ms ease, background-color 160ms ease;
}

.play-button:hover .play-icon { transform: scale(1.035); background: #f04e68; }
.play-button:disabled { cursor: wait; opacity: 0.62; }
.play-button:disabled .play-icon { transform: none; background: #4c4c5b; }
.play-icon svg { width: 28px; height: 28px; fill: currentColor; }
.play-button.playing .play-icon svg { display: none; }
.play-button.playing .play-icon::before,
.play-button.playing .play-icon::after {
    content: "";
    width: 5px;
    height: 24px;
    border-radius: 2px;
    background: #fff;
}
.play-button.playing .play-icon { grid-template-columns: repeat(2, 5px); gap: 6px; }

.player-status {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.player-error {
    margin: 8px 0 0;
    color: #ff9f0a;
    text-align: center;
    font-size: 12px;
    line-height: 1.4;
}

.section-band { border-top: 1px solid var(--border-subtle); }

.section-inner {
    width: min(1240px, calc(100% - 64px));
    margin: 0 auto;
    padding: 84px 0;
}

.section-inner > h2,
.course-copy h2,
.final-cta h2 {
    margin-bottom: 44px;
    font-size: clamp(34px, 3vw, 48px);
    line-height: 1.08;
    letter-spacing: -0.035em;
}

.method-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(36px, 7vw, 100px);
}

.method-steps h3 {
    margin-bottom: 8px;
    font-size: 25px;
    letter-spacing: -0.02em;
}

.method-steps h3 span { margin-right: 13px; color: var(--accent); font-size: 38px; }
.method-steps p { margin-bottom: 0; color: var(--muted); line-height: 1.55; }

.method-rail {
    min-height: 78px;
    margin-top: 48px;
    padding: 16px 26px;
    border: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr 32px 1fr 32px 1fr;
    align-items: center;
    gap: 20px;
}

.method-rail span { display: flex; align-items: center; justify-content: center; gap: 14px; font-weight: 700; }
.method-rail i {
    width: 3px;
    height: 22px;
    border-radius: 2px;
    background: var(--source);
    box-shadow: 7px 5px 0 var(--source), 14px -3px 0 var(--source), 21px 3px 0 var(--source), 28px 7px 0 var(--source);
    opacity: 0.9;
    margin-right: 30px;
}
.method-rail svg { width: 32px; stroke: #9ea7bc; stroke-width: 1.5; fill: none; }

.course-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(520px, 1.2fr);
    align-items: center;
    gap: 72px;
}

.course-copy h2 { margin-bottom: 20px; }
.course-copy > p { max-width: 540px; margin-bottom: 30px; color: var(--muted); font-size: 18px; line-height: 1.6; }
.course-copy .button { margin-bottom: 20px; }
.text-link { display: block; width: fit-content; color: var(--source); font-weight: 650; text-decoration: underline; text-underline-offset: 4px; }

.sentence-slice { border-top: 1px solid var(--border); }
.sentence-slice > div {
    min-width: 0;
    min-height: 84px;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: 42px minmax(150px, 1.1fr) minmax(150px, 1fr) minmax(150px, 1fr);
    align-items: center;
    gap: 18px;
}
.row-play { width: 34px; height: 34px; border: 1px solid #b8bfd1; border-radius: 50%; display: grid; place-items: center; font-size: 11px; }
.sentence-slice strong { color: var(--source); font-size: 21px; line-height: 1.55; font-weight: 600; }
.sentence-slice small { color: var(--pronunciation); font-size: 13px; line-height: 1.5; }
.sentence-slice p { margin: 0; color: rgba(255, 255, 255, 0.92); line-height: 1.45; }

.faq-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 80px;
}
.faq-list article { padding: 0 0 30px; }
.faq-list article:nth-child(3) { grid-column: 2; grid-row: 1; }
.faq-list h3 { margin-bottom: 8px; font-size: 20px; line-height: 1.35; }
.faq-list p { margin-bottom: 0; color: var(--muted); font-size: 16px; line-height: 1.55; }

.final-cta .section-inner { display: flex; align-items: center; justify-content: space-between; gap: 32px; padding-top: 48px; padding-bottom: 48px; }
.final-cta h2 { margin: 0; }

footer { border-top: 1px solid var(--border-subtle); min-height: 96px; }
footer .wordmark { font-size: 22px; }
footer nav { font-size: 14px; font-weight: 450; }

@media (max-width: 1080px) {
    .hero { min-height: 0; grid-template-columns: 1fr; padding-top: 36px; }
    .hero-copy { max-width: 780px; padding-top: 0; }
    .lesson-player { width: 100%; }
    .course-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .site-header,
    footer,
    .hero,
    .section-inner { width: min(100% - 32px, var(--max)); }
    .site-header { min-height: 72px; gap: 16px; }
    .site-header nav { display: none; }
    .wordmark { font-size: 24px; }
    .header-cta { min-width: 0; min-height: 44px; padding: 0 15px; font-size: 14px; }
    .hero { min-height: 0; padding: 44px 0 64px; gap: 46px; }
    h1 { margin-bottom: 24px; font-size: clamp(44px, 12vw, 58px); line-height: 1.02; }
    .hero-copy > p { font-size: 18px; }
    .hero-actions { display: grid; }
    .button { width: 100%; min-height: 52px; }
    .lesson-player { min-height: 540px; padding: 24px 18px 20px; border-radius: 13px; }
    .player-heading { align-items: flex-start; }
    .player-heading h2 { font-size: 17px; }
    .player-heading span { font-size: 12px; }
    .phrase { min-height: 198px; padding-top: 40px; }
    .phrase-thai { font-size: clamp(36px, 11vw, 48px); }
    .phrase-romanization { font-size: 19px; }
    .phrase-translation { font-size: 18px; }
    .sequence { margin-bottom: 22px; }
    .sequence li { font-size: 11px; }
    .sequence li::after { left: calc(50% + 19px); width: calc(100% - 38px); }
    .sequence span { width: 32px; height: 32px; }
    .waveform { gap: 3px; }
    .waveform-bar { width: 3px; }
    .section-inner { padding: 64px 0; }
    .section-inner > h2,
    .course-copy h2 { margin-bottom: 32px; font-size: 36px; }
    .method-steps { grid-template-columns: 1fr; gap: 28px; }
    .method-steps article { padding-bottom: 28px; border-bottom: 1px solid var(--border-subtle); }
    .method-rail { grid-template-columns: 1fr; justify-items: stretch; gap: 8px; }
    .method-rail span { min-height: 48px; justify-content: flex-start; }
    .method-rail svg { transform: rotate(90deg); justify-self: center; }
    .sentence-slice > div { grid-template-columns: 38px 1fr; gap: 6px 12px; padding: 14px 0; }
    .sentence-slice small,
    .sentence-slice p { grid-column: 2; }
    .faq-list { grid-template-columns: 1fr; }
    .faq-list article:nth-child(3) { grid-column: auto; grid-row: auto; }
    .final-cta .section-inner { align-items: flex-start; flex-direction: column; }
    .final-cta h2 { font-size: 34px; }
    footer { padding: 24px 0; align-items: flex-start; }
    footer nav { gap: 18px; flex-wrap: wrap; justify-content: flex-end; }
}

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