:root {
  color-scheme: light;
  --paper: #f0ede3;
  --white: #fffefa;
  --ink: #1e282b;
  --muted: #586366;
  --line: #d8d5cc;
  --blue: #3358d4;
  --blue-dark: #2443ad;
  --coral: #b94429;
  --leaf: #53651c;
  --danger: #a22b28;
  --content: 1220px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 22px; }
body { min-width: 320px; margin: 0; font-size: 16px; line-height: 1.65; }
button, input, audio { font: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { color: inherit; }
h1, h2, h3, p, figure { margin-top: 0; }
h1, h2, h3 { line-height: 1.16; letter-spacing: -.035em; }
h1 { font-size: clamp(2.8rem, 5.8vw, 5.6rem); font-weight: 760; }
h2 { font-size: clamp(2rem, 3.6vw, 3.45rem); font-weight: 720; }
h3 { font-size: 1.3rem; }
.hidden { display: none !important; }
.content-width, .app-shell { width: min(var(--content), calc(100% - 80px)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 30; top: 8px; left: 8px; padding: 10px 16px; transform: translateY(-150%); color: white; background: var(--ink); }
.skip-link:focus { transform: none; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }

.topbar { position: relative; z-index: 5; display: flex; min-height: 76px; align-items: center; justify-content: space-between; gap: 24px; padding: 0 max(40px, calc((100vw - var(--content)) / 2)); border-bottom: 1px solid var(--line); background: var(--paper); }
.wordmark { display: inline-flex; align-items: center; gap: 11px; flex: none; text-decoration: none; font-size: .95rem; font-weight: 760; letter-spacing: -.02em; }
.mark { display: flex; height: 24px; align-items: center; gap: 3px; }
.mark i { width: 3px; height: 12px; border-radius: 9px; background: var(--blue); }
.mark i:nth-child(2) { height: 22px; background: var(--coral); }
.mark i:nth-child(3) { height: 16px; background: var(--leaf); }
.site-nav { display: flex; align-items: center; gap: clamp(16px, 3vw, 38px); font-size: .83rem; }
.site-nav a { text-decoration: none; }
.site-nav a:hover, .text-link:hover, .site-footer a:hover { text-decoration: underline; text-underline-offset: 4px; }
.local-note { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.local-note i, .opening-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--leaf); }
.nav-action { display: inline-flex; min-height: 44px; align-items: center; gap: 18px; padding: 0 15px; color: white; background: var(--blue); font-weight: 680; }
.nav-action:hover, .button-primary:hover, .button-secondary:hover { background: var(--blue-dark); }

.hero { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(380px, .92fr); align-items: center; gap: clamp(40px, 7vw, 100px); padding-block: clamp(52px, 8vw, 112px); }
.hero-copy { padding-block: 16px; }
.opening-line { display: flex; align-items: center; gap: 10px; margin-bottom: 23px; color: var(--leaf); font-size: .85rem; font-weight: 720; letter-spacing: .04em; }
.hero h1 { max-width: none; margin-bottom: 24px; font-size: clamp(2.6rem, 4.6vw, 4.8rem); white-space: nowrap; }
.hero h1 span { color: var(--blue); }
.hero-lede { max-width: 39rem; margin-bottom: 30px; color: #465154; font-size: clamp(1rem, 1.4vw, 1.15rem); line-height: 1.8; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.button-primary, .button-secondary { display: inline-flex; min-height: 52px; align-items: center; justify-content: space-between; gap: 35px; padding: 0 18px; color: white; background: var(--blue); text-decoration: none; font-weight: 700; transition: background .16s ease, transform .16s ease; }
.button-primary:hover, .button-secondary:hover { transform: translateY(-2px); }
.text-link { color: var(--ink); font-size: .92rem; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.hero-note { margin: 21px 0 0; color: var(--muted); font-size: .82rem; }
.sound-field { min-width: 0; margin: 0; }
.sound-field svg { display: block; width: 100%; height: auto; overflow: visible; }
.field-ground { fill: var(--blue); }
.field-rings { stroke: #9fb1ff; stroke-width: 1; opacity: .4; }
.field-contour { fill: none; stroke: #b3c0ff; stroke-width: 2; opacity: .55; }
.field-contour-two { stroke: #f3c9aa; stroke-width: 1.4; opacity: .72; }
.field-ribbon { fill: none; stroke: #a7bd69; stroke-width: 10; stroke-linecap: round; opacity: .9; }
.pulse-marks { fill: none; stroke: #ffe0cf; stroke-width: 3; stroke-linecap: round; opacity: .94; }
.field-grain { fill: #e8ebff; opacity: .7; }
.signal { stroke: var(--blue); stroke-width: 4; }
.rhythm-signal { fill: #f0906f; }
.texture-signal { fill: #b5cb68; }
.sound-field figcaption { display: flex; justify-content: space-between; padding: 8px 3px 0; color: var(--muted); font-size: .76rem; }

.story-section { padding-block: clamp(65px, 9vw, 120px); border-top: 1px solid var(--line); }
.section-heading { display: grid; grid-template-columns: 1fr minmax(200px, .54fr); align-items: end; gap: 16px 60px; margin-bottom: 46px; }
.section-kicker { margin-bottom: 12px; color: var(--blue); font-size: .77rem; font-weight: 760; letter-spacing: .13em; }
.section-heading .section-kicker { grid-column: 1 / -1; margin-bottom: -3px; }
.section-heading h2 { max-width: 18ch; margin-bottom: 0; }
.section-heading > p:last-child { max-width: 29rem; margin: 0 0 3px; color: var(--muted); }
.role-stories { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.role-story { min-width: 0; padding: 26px 32px 24px 0; }
.role-story + .role-story { padding-inline: 32px 0; border-left: 1px solid var(--line); }
.role-title { display: flex; align-items: center; gap: 13px; }
.role-color-mark { width: 12px; height: 42px; background: var(--coral); }
.role-story-texture .role-color-mark { background: var(--leaf); }
.role-title h3 { margin: 0; font-size: 1.2rem; }
.role-title p { margin: 3px 0 0; color: var(--muted); font-size: .83rem; }
.role-detail { max-width: 35rem; min-height: 53px; margin: 19px 0 17px; color: #4d585b; font-size: .93rem; }
.score-illustration { display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 8px; padding: 0 8px; border-top: 1px solid #d5d0c3; border-bottom: 1px solid #d5d0c3; }
.score-rhythm i { width: 2px; height: 11px; background: var(--coral); }
.score-rhythm i:nth-child(4n + 1), .score-rhythm i:nth-child(4n + 3) { height: 37px; width: 3px; }
.score-rhythm i:nth-child(8n + 1), .score-rhythm i:nth-child(8n + 5) { height: 48px; }
.score-illustration svg { width: 100%; height: 68px; }
.score-texture path { fill: none; stroke: var(--leaf); stroke-width: 3; stroke-linecap: round; }
.illustration-note { margin: 10px 0 0; color: var(--muted); font-size: .76rem; }
.process-section { color: var(--white); background: var(--ink); }
.process-inner { display: grid; grid-template-columns: minmax(230px, .85fr) 1fr auto; align-items: center; gap: clamp(25px, 5vw, 70px); padding-block: clamp(44px, 6vw, 76px); }
.process-intro .section-kicker { color: #b9ca73; }
.process-intro h2 { margin: 0; font-size: clamp(1.9rem, 3vw, 2.7rem); }
.process-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 19px; margin: 0; padding: 0; list-style: none; }
.process-steps li { border-top: 1px solid #778082; padding-top: 12px; }
.step-name { color: #d1dd91; font-weight: 720; }
.process-steps p { margin: 6px 0 0; color: #d0d5d3; font-size: .82rem; line-height: 1.55; }
.button-secondary { border: 1px solid #b5c2bc; color: var(--white); background: transparent; white-space: nowrap; }
.button-secondary:hover { background: #344144; }

.setup-stage { padding-block: clamp(62px, 8vw, 96px) 100px; }
.create-heading { display: grid; grid-template-columns: 1fr minmax(220px, .55fr); align-items: end; gap: 24px 60px; margin-bottom: 34px; }
.create-heading h1 { max-width: 16ch; margin: 0; font-size: clamp(2.25rem, 4vw, 3.7rem); }
.create-heading > p { max-width: 30rem; margin: 0 0 4px; color: var(--muted); }
.small-only { display: none; }
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.role-card { --role: var(--coral); display: flex; min-width: 0; min-height: 340px; flex-direction: column; padding: 24px 26px 25px; border: 1px solid var(--line); border-top: 4px solid var(--role); background: var(--white); }
.texture-card { --role: var(--leaf); }
.role-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.role-index { margin: 0 0 7px; color: var(--role, var(--blue)); font-size: .74rem; font-weight: 770; letter-spacing: .11em; }
.role-card h2 { margin: 0; font-size: 1.34rem; }
.status-pill { display: inline-flex; min-height: 30px; align-items: center; gap: 7px; flex: none; padding: 3px 9px; border: 1px solid var(--line); color: var(--muted); font-size: .72rem; }
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: #858d8d; }
.role-card[data-status="processing"] .status-pill i { background: var(--blue); animation: status-pulse .7s ease-in-out infinite alternate; }
.role-card[data-status="ready"] .status-pill { border-color: #b4c28a; color: #435417; }
.role-card[data-status="ready"] .status-pill i { background: var(--leaf); }
.role-card[data-status="error"] .status-pill { border-color: #d5a5a1; color: var(--danger); }
.role-card[data-status="error"] .status-pill i { background: var(--danger); }
@keyframes status-pulse { to { opacity: .38; } }
.role-meta { margin: 18px 0 7px; color: var(--muted); font-size: .83rem; }
.role-explanation { min-height: 53px; margin-bottom: 12px; color: #455154; font-size: .9rem; }
.role-error { margin: 0 0 12px; padding: 9px 11px; border-left: 3px solid var(--danger); color: var(--danger); background: #fff3f0; font-size: .84rem; line-height: 1.5; }
.role-preview { display: block; width: 100%; height: 40px; margin: auto 0 13px; accent-color: var(--blue); }
.role-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; }
.role-actions button, .upload-action, .restart-action, .generate-action, .retry-action { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; padding: 0 16px; border: 1px solid var(--blue); cursor: pointer; font-size: .88rem; font-weight: 690; transition: background .15s ease, color .15s ease, border-color .15s ease; }
.record-action { gap: 10px; color: white; background: var(--blue); }
.record-action:hover { background: var(--blue-dark); }
.upload-action { color: var(--blue-dark); background: transparent; }
.upload-action:hover, .replace-action:hover { background: #f0f2ff; }
.replace-action { color: var(--blue-dark); background: transparent; }
.record-icon { width: 11px; height: 11px; border-radius: 50%; background: white; }
.record-action.is-recording { border-color: var(--danger); background: var(--danger); }
.is-recording .record-icon { box-shadow: 0 0 0 4px #ffffff66; }
button:disabled { cursor: not-allowed !important; opacity: .55; }

.arrangement-card { display: grid; grid-template-columns: minmax(205px, .72fr) minmax(280px, 1fr) auto; align-items: center; gap: clamp(19px, 3vw, 42px); margin-top: 18px; padding: 24px; border: 1px solid var(--line); background: #e5e1d6; }
.arrangement-copy .role-index { color: var(--blue-dark); }
.arrangement-copy h2 { margin: 0 0 7px; font-size: 1.28rem; letter-spacing: -.02em; }
.arrangement-copy > p:last-child { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.55; }
.arrangement-timeline { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.timeline-bar { position: relative; display: block; height: 56px; overflow: hidden; background: #d4d0c6; }
.timeline-bar::before, .timeline-bar::after { position: absolute; right: 5px; left: 5px; height: 7px; border-radius: 8px; content: ""; transform-origin: left; transition: transform 250ms ease; }
.timeline-bar::before { top: 12px; background: var(--coral); transform: scaleX(var(--rhythm, .08)); }
.timeline-bar::after { bottom: 12px; background: var(--leaf); transform: scaleX(var(--texture, .08)); }
.arrangement-timeline.is-empty { opacity: .48; }
.timeline-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; color: var(--muted); font-size: .72rem; }
.timeline-legend span { display: inline-flex; align-items: center; gap: 6px; }
.timeline-legend span:last-child { margin-left: auto; }
.timeline-legend i { width: 10px; height: 5px; border-radius: 6px; }
.rhythm-swatch { background: var(--coral); }
.texture-swatch { background: var(--leaf); }
.generate-action { white-space: nowrap; color: white; background: var(--blue); }
.generate-action:hover { background: var(--blue-dark); }
.retry-action { grid-column: 3; color: var(--danger); border-color: var(--danger); background: transparent; }
.retry-action:hover { background: #fff3f0; }

.working-state { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 25px; margin: 0 auto 70px; padding: 30px; border-block: 1px solid var(--line); }
.analysis-radar { position: relative; width: 70px; height: 70px; border: 1px solid var(--blue); border-radius: 50%; background: radial-gradient(circle, var(--coral) 0 4px, transparent 5px); }
.analysis-radar span { position: absolute; inset: 18%; border: 1px solid var(--blue); border-radius: inherit; animation: radar 1.8s ease-out infinite; }
.analysis-radar span:nth-child(2) { animation-delay: .6s; }
.analysis-radar span:nth-child(3) { animation-delay: 1.2s; }
@keyframes radar { from { transform: scale(.3); opacity: .8; } to { transform: scale(1.5); opacity: 0; } }
.working-state h2 { margin-bottom: 5px; font-size: 1.55rem; }
.working-state p:last-child { margin: 0; color: var(--muted); }

.result-stage { padding-block: 60px 100px; }
.result-title-row { display: flex; align-items: end; justify-content: space-between; gap: 25px; margin-bottom: 30px; }
.result-title-row h1 { max-width: 15ch; margin: 0 0 13px; font-size: clamp(2.7rem, 5vw, 4.8rem); }
.result-title-row > div > p:last-child { max-width: 40rem; margin: 0; color: var(--muted); }
.restart-action { flex: none; color: var(--blue-dark); background: transparent; }
.restart-action:hover { background: #e5e9ff; }
.hero-player { position: relative; display: grid; grid-template-columns: minmax(200px, .7fr) minmax(270px, 1.25fr) auto; align-items: center; gap: 26px; padding: clamp(22px, 4vw, 42px); color: white; background: var(--ink); }
.hero-player-copy { display: flex; align-items: flex-start; gap: 15px; }
.tape-mark { display: grid; width: 42px; height: 42px; flex: none; place-items: center; color: var(--ink); background: #cad786; font-weight: 800; }
.hero-player h2 { margin: 0 0 5px; font-size: 1.5rem; }
.hero-player p { margin: 0; color: #d5dbd8; font-size: .82rem; }
.hero-player audio { width: 100%; min-width: 0; accent-color: #c7d87f; }
.download-link { display: inline-flex; min-height: 46px; align-items: center; gap: 17px; padding: 0 15px; color: var(--ink); background: #d0de90; font-weight: 720; text-decoration: none; white-space: nowrap; }
.download-link:hover { background: #e0eba9; }
.qa-panel { margin-top: 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.qa-panel summary { min-height: 60px; padding: 17px 2px; cursor: pointer; font-weight: 720; }
.qa-panel summary::marker { color: var(--blue); }
.qa-intro { max-width: 50rem; color: var(--muted); }
.comparison-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.comparison-column { --role: var(--coral); min-width: 0; padding: 22px; border: 1px solid var(--line); background: var(--white); }
.texture-column { --role: var(--leaf); }
.comparison-column h3 { margin-bottom: 17px; }
.listen-row { display: grid; grid-template-columns: minmax(110px, .5fr) 1fr; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
.listen-row audio, .roles-player audio { min-width: 0; width: 100%; accent-color: var(--blue); }
.roles-player { display: grid; grid-template-columns: minmax(220px, .65fr) 1.35fr; align-items: center; gap: 25px; margin-top: 18px; padding: 22px; background: #e5e1d6; }
.roles-player h3 { margin-bottom: 5px; }
.roles-player p:last-child { margin: 0; color: var(--muted); font-size: .84rem; }
.truth-note { margin: 18px 0 25px; padding: 14px 17px; border-left: 3px solid var(--leaf); background: #e7e9dc; }
.truth-note p { margin: 0; color: #3f4945; font-size: .82rem; line-height: 1.65; }
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px max(40px, calc((100vw - var(--content)) / 2)); border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.site-footer span:first-child { color: var(--ink); font-weight: 750; }
.site-footer a { text-decoration: none; }

@media (max-width: 940px) {
  .content-width, .app-shell { width: min(var(--content), calc(100% - 48px)); }
  .topbar { padding-inline: 24px; }
  .hero { grid-template-columns: minmax(0, 1fr) minmax(300px, .85fr); gap: 32px; }
  .process-inner { grid-template-columns: 1fr auto; }
  .process-steps { grid-column: 1 / -1; grid-row: 2; }
  .arrangement-card { grid-template-columns: 1fr 1fr; }
  .generate-action, .retry-action { grid-column: 1 / -1; justify-self: stretch; }
  .hero-player { grid-template-columns: 1fr 1.25fr; }
  .download-link { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .content-width, .app-shell { width: calc(100% - 40px); }
  .topbar { min-height: 64px; padding-inline: 20px; }
  .site-nav { gap: 12px; }
  .site-nav .nav-story, .local-note { display: none; }
  .nav-action { min-height: 42px; padding-inline: 12px; gap: 9px; }
  .hero { grid-template-columns: 1fr; gap: 25px; padding-block: 50px 56px; }
  .hero-copy { padding: 0; }
  .hero h1 { max-width: none; margin-bottom: 18px; font-size: clamp(2.35rem, 10vw, 3.2rem); }
  .hero-lede { margin-bottom: 22px; font-size: 1rem; }
  .sound-field { max-width: 500px; margin-inline: auto; }
  .story-section { padding-block: 60px; }
  .section-heading { grid-template-columns: 1fr; gap: 17px; margin-bottom: 29px; }
  .section-heading .section-kicker { grid-column: auto; }
  .section-heading h2 { font-size: clamp(2rem, 9vw, 3rem); }
  .section-heading > p:last-child { max-width: 38rem; }
  .role-stories { grid-template-columns: 1fr; }
  .role-story, .role-story + .role-story { padding: 23px 0; border-left: 0; }
  .role-story + .role-story { border-top: 1px solid var(--line); }
  .role-detail { min-height: 0; }
  .process-inner { grid-template-columns: 1fr; gap: 27px; }
  .process-steps { grid-column: auto; grid-row: auto; }
  .button-secondary { justify-self: start; }
  .setup-stage { padding-block: 60px 72px; }
  .create-heading { grid-template-columns: 1fr; gap: 15px; margin-bottom: 25px; }
  .create-heading h1 { font-size: clamp(2.1rem, 9vw, 3rem); }
  .small-only { display: initial; }
  .role-grid, .comparison-grid { grid-template-columns: 1fr; }
  .role-card { min-height: 0; padding: 21px; }
  .role-explanation { min-height: 0; }
  .role-actions > * { flex: 1; }
  .arrangement-card { grid-template-columns: 1fr; padding: 20px; }
  .timeline-bar { height: 50px; }
  .timeline-legend span:last-child { width: 100%; margin-left: 0; }
  .working-state { grid-template-columns: 1fr; gap: 16px; padding: 25px 0; }
  .analysis-radar { width: 56px; height: 56px; }
  .result-stage { padding-block: 46px 72px; }
  .result-title-row { align-items: flex-start; flex-direction: column; }
  .result-title-row h1 { font-size: clamp(2.55rem, 10vw, 4rem); }
  .hero-player { grid-template-columns: 1fr; gap: 20px; padding: 22px; }
  .download-link { grid-column: auto; }
  .listen-row { grid-template-columns: 1fr; gap: 4px; }
  .roles-player { grid-template-columns: 1fr; gap: 14px; padding: 19px; }
  .site-footer { align-items: flex-start; flex-direction: column; padding: 20px; }
}
@media (max-width: 360px) {
  .content-width, .app-shell { width: calc(100% - 32px); }
  .wordmark { font-size: .87rem; }
  .hero-actions { align-items: flex-start; flex-direction: column; gap: 14px; }
  .process-steps { grid-template-columns: 1fr; }
  .process-steps li { padding-top: 9px; }
  .role-card-head { align-items: flex-start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
