:root {
  color-scheme: light;
  --page: #f6f4ef;
  --surface: #eae7e0;
  --ink: #39363e;
  --muted: #918b8f;
  --subtle: #ada6a8;
  --line: #dfdad6;
  --accent: #79677e;
  --accent-dark: #67546d;
  --accent-soft: #ece6ec;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--page);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled, input:disabled, select:disabled { cursor: default; }
button:disabled { opacity: .42; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
button { border: 0; }
button, select, a { touch-action: manipulation; }
[hidden] { display: none !important; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.app-shell { max-width: 1360px; margin: 0 auto; padding: 0 48px; }
.topbar { height: 88px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; color: var(--accent); }
.brand-name { font-family: var(--serif); font-size: 24px; font-weight: 600; letter-spacing: .12em; }
.brand-divider { width: 1px; height: 14px; background: var(--line); margin: 0 8px 0 15px; }
.brand-subtitle { font-size: 11px; letter-spacing: .18em; color: var(--muted); }
.topbar-note { font-size: 11px; letter-spacing: .07em; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.tiny-star { font-size: 16px; color: var(--accent); font-weight: 400; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 286px; gap: 48px; height: calc(100svh - 88px); min-height: 550px; padding-bottom: 28px; }
.studio { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 21px; }
.art-surface { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid #e3dfd8; border-radius: 8px; }
.surface-toolbar { height: 46px; padding: 0 21px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; }
.canvas-status { display: inline-flex; gap: 7px; align-items: center; font-size: 10px; letter-spacing: .08em; color: #918b89; }
.status-dot { width: 4px; height: 4px; border-radius: 50%; background: #a59b9e; }
.status-dot.is-playing { background: var(--accent); box-shadow: 0 0 0 3px #79677e13; }
.status-dot.is-complete { background: #7b8d7b; }
.preview-button { display: flex; align-items: center; gap: 7px; min-height: 32px; padding: 4px 7px; margin-right: -7px; border-radius: 4px; background: transparent; color: #847b82; font-size: 10px; letter-spacing: .06em; transition: color 160ms, background 160ms; }
.preview-button .icon { width: 15px; height: 15px; }
.preview-button:hover:not(:disabled), .preview-button[aria-pressed="true"] { background: #f6f4ef94; color: var(--accent-dark); }
.canvas-mat { flex: 1; min-height: 0; padding: 2px 30px 26px; display: flex; justify-content: center; align-items: center; overflow: hidden; }
.paper { position: relative; height: 100%; width: auto; max-width: 100%; aspect-ratio: 3 / 4; background: #fffefa; overflow: hidden; box-shadow: 0 6px 20px #534a4412, 0 1px 3px #534a4409; }
#drawing-canvas { width: 100%; height: 100%; display: block; }
.paper-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.loading-overlay { background: #fffefaf7; z-index: 3; }
.loading-ring { width: 26px; height: 26px; border-radius: 50%; border: 1px solid #e4dfe5; border-top-color: var(--accent); animation: loading-spin 1.2s linear infinite; margin-bottom: 22px; }
.overlay-title { margin: 0; font-family: var(--serif); font-size: 19px; letter-spacing: .09em; }
.overlay-detail { margin: 13px 0 0; color: var(--muted); font-size: 11px; line-height: 1.8; }
.loading-progress { margin-top: 18px; font-size: 10px; font-variant-numeric: tabular-nums; letter-spacing: .04em; color: var(--subtle); }
.loading-overlay.has-error .loading-ring { animation: none; border-color: var(--line); position: relative; }
.loading-overlay.has-error .loading-ring::after { content: "!"; position: absolute; inset: 0; color: var(--accent); line-height: 24px; font-size: 13px; }
.reload-button { background: var(--accent); color: #fff; border-radius: 5px; padding: 10px 18px; margin-top: 22px; font-size: 11px; }
.start-overlay { background: transparent; pointer-events: none; }
.start-button { display: flex; flex-direction: column; align-items: center; background: none; pointer-events: auto; padding: 25px 30px; border-radius: 14px; }
.start-play-circle { width: 62px; height: 62px; border: 1px solid #b7aaba; background: #fffefa; box-shadow: 0 5px 22px #79677e0b; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--accent); transition: color 180ms, background 180ms, transform 180ms; }
.start-play-circle .icon { width: 23px; height: 23px; margin-left: -2px; }
.start-button:hover .start-play-circle { color: #fffefa; background: var(--accent); transform: translateY(-2px); }
.start-title { font-family: var(--serif); font-size: 20px; letter-spacing: .13em; margin-top: 24px; padding-left: .13em; }
.start-subtitle { font-size: 10px; letter-spacing: .12em; color: var(--muted); margin-top: 11px; }
.preview-badge { position: absolute; right: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; font-size: 9px; background: #fffefaec; color: #817580; padding: 6px 8px; border-radius: 3px; box-shadow: 0 1px 5px #39363e08; pointer-events: none; }
.preview-badge > span { width: 3px; height: 3px; background: var(--accent); border-radius: 50%; }
.transport { padding: 0 2px; }
.timeline-labels { display: flex; align-items: center; justify-content: space-between; font-size: 10px; margin-bottom: 7px; }
.timeline-caption { color: var(--muted); letter-spacing: .08em; }
.time-display { display: flex; gap: 8px; font-variant-numeric: tabular-nums; font-family: var(--sans); letter-spacing: .025em; color: #a2989e; }
#current-time { color: #665d69; }
.time-slash { color: #c8bfc8; }
.timeline-wrap { position: relative; height: 18px; display: flex; align-items: center; }
.timeline { --progress: 0%; appearance: none; -webkit-appearance: none; margin: 0; width: 100%; height: 4px; border-radius: 8px; outline: none; cursor: pointer; background: linear-gradient(to right, var(--accent) 0 var(--progress), #ddd7dc var(--progress) 100%); }
.timeline::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; height: 10px; width: 10px; background: var(--accent); border: 2px solid var(--page); border-radius: 50%; box-shadow: 0 0 0 1px var(--accent); transition: box-shadow 130ms; position: relative; z-index: 2; }
.timeline::-moz-range-thumb { height: 7px; width: 7px; background: var(--accent); border: 2px solid var(--page); border-radius: 50%; box-shadow: 0 0 0 1px var(--accent); position: relative; z-index: 2; }
.timeline:hover::-webkit-slider-thumb { box-shadow: 0 0 0 1px var(--accent), 0 0 0 5px #79677e14; }
.timeline:focus-visible { outline-offset: 7px; }
.timeline:disabled { opacity: .4; }
.timeline-markers { position: absolute; inset: 7px 5px; pointer-events: none; }
.timeline-marker { position: absolute; width: 2px; height: 4px; top: 0; transform: translateX(-50%); background: var(--page); opacity: .85; }
.transport-row { margin-top: 13px; display: flex; align-items: center; justify-content: space-between; }
.playback-buttons, .playback-options { display: flex; align-items: center; }
.playback-buttons { gap: 13px; }
.play-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-width: 101px; height: 42px; padding: 0 21px 0 17px; background: var(--accent); color: #fffefa; border-radius: 5px; font-size: 11px; letter-spacing: .1em; transition: background 160ms, transform 160ms; }
.play-button:hover:not(:disabled) { background: var(--accent-dark); transform: translateY(-1px); }
.play-button .icon { width: 17px; height: 17px; }
.icon-button { display: inline-flex; justify-content: center; align-items: center; width: 37px; height: 37px; background: transparent; border-radius: 5px; color: #968b96; transition: color 150ms, background 150ms; }
.icon-button:hover:not(:disabled) { color: var(--accent-dark); background: #eae5e8; }
.icon-button .icon { width: 17px; height: 17px; }
.playback-options { gap: 18px; }
.completion { font-variant-numeric: tabular-nums; font-size: 12px; color: #8f8391; min-width: 33px; text-align: right; }
.completion span { margin-left: 3px; font-size: 9px; color: #b0a6b0; }
.control-divider { width: 1px; height: 14px; background: var(--line); }
.speed-control { display: flex; align-items: center; gap: 10px; font-size: 10px; color: var(--muted); }
.speed-select-wrap { position: relative; display: inline-flex; align-items: center; }
.speed-select-wrap select { appearance: none; -webkit-appearance: none; background: transparent; border: 0; color: #6b606f; width: 62px; height: 36px; padding: 0 21px 0 5px; cursor: pointer; font-size: 12px; border-radius: 4px; }
.speed-select-wrap > .icon { pointer-events: none; position: absolute; width: 15px; height: 15px; right: 2px; color: #9c909f; }
.story-panel { padding: 21px 0 1px; display: flex; flex-direction: column; min-height: 0; }
.work-eyebrow { font-family: var(--sans); display: flex; align-items: center; gap: 8px; color: #a59aa3; font-size: 8px; letter-spacing: .17em; }
.eyebrow-line { width: 18px; height: 1px; background: #baaab8; }
.work-number { margin-left: auto; color: #b9b0b7; font-size: 9px; letter-spacing: .1em; }
h1 { font-family: var(--serif); margin: 25px 0 19px; font-size: clamp(44px, 4.3vw, 58px); line-height: 1.18; font-weight: 400; letter-spacing: .12em; }
.title-dot { font-family: Georgia, serif; color: #bdaebe; font-size: 31px; font-weight: 400; vertical-align: .12em; margin-left: 10px; }
.work-description { margin: 0; color: #91858e; font-size: 11px; letter-spacing: .035em; line-height: 2; }
.chapters { margin-top: 36px; border-top: 1px solid var(--line); padding-top: 23px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-heading h2 { margin: 0; font-size: 10px; font-weight: 400; color: #857985; letter-spacing: .06em; }
.section-heading > span { font-size: 7px; color: #b6aeb4; letter-spacing: .13em; }
.chapter-list { list-style: none; padding: 0; margin: 0 -11px; display: flex; flex-direction: column; gap: 5px; }
.chapter { position: relative; display: flex; align-items: center; gap: 15px; padding: 12px 11px; width: 100%; background: transparent; border-radius: 5px; text-align: left; transition: background 150ms, color 150ms; }
.chapter:hover:not(:disabled) { background: #eee9ec; }
.chapter-number { width: 23px; height: 23px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-variant-numeric: tabular-nums; color: #b4aab2; border: 1px solid #e0d9df; border-radius: 50%; flex-shrink: 0; transition: border-color 180ms, color 180ms, background 180ms; }
.chapter-copy { display: flex; flex-direction: column; gap: 5px; }
.chapter-title { font-family: var(--serif); font-size: 17px; letter-spacing: .06em; color: #8f848e; }
.chapter-description { font-size: 9px; color: #b0a5ad; letter-spacing: .035em; }
.chapter-time { margin-left: auto; font-size: 9px; color: #b4a8b2; font-variant-numeric: tabular-nums; }
.chapter.is-current { background: var(--accent-soft); }
.chapter.is-current .chapter-number { color: #fffefa; background: var(--accent); border-color: var(--accent); }
.chapter.is-current .chapter-title { color: var(--accent-dark); }
.chapter.is-current .chapter-description { color: #9b899c; }
.chapter.is-current .chapter-time { color: #927d96; }
.chapter.is-done .chapter-number { background: #ede8ec; color: #9a8a9d; border-color: #ede8ec; }
.chapter.is-done .chapter-title { color: #9a8d99; }
.story-bottom { margin-top: auto; padding-top: 22px; }
.cursor-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 39px; padding: 0; background: transparent; }
.cursor-toggle-label { display: flex; align-items: center; gap: 8px; font-size: 10px; color: #938594; letter-spacing: .04em; }
.cursor-toggle-label .icon { width: 14px; height: 14px; color: #ab9cad; }
.toggle-track { display: block; width: 26px; height: 15px; background: #c9c1c8; border-radius: 15px; padding: 3px; transition: background 160ms; }
.toggle-track > span { width: 9px; height: 9px; background: var(--page); border-radius: 50%; display: block; transition: transform 160ms; }
.cursor-toggle[aria-pressed="true"] .toggle-track { background: #958298; }
.cursor-toggle[aria-pressed="true"] .toggle-track > span { transform: translateX(11px); }
.keyboard-hint { padding-top: 18px; margin-top: 9px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 6px; font-size: 9px; color: #b0a5ac; white-space: nowrap; }
kbd { display: inline-flex; min-width: 15px; height: 17px; padding: 0 4px; align-items: center; justify-content: center; border: 1px solid #e0d9dc; border-radius: 3px; font-family: var(--sans); color: #a497a1; font-size: 8px; background: #f9f6f4; box-shadow: 0 1px 0 #e7e0e3; }
.shortcut-separator { padding: 0 2px; }
.noscript-message { text-align: center; font-size: 12px; color: var(--accent-dark); padding: 16px; }
@keyframes loading-spin { to { transform: rotate(360deg); } }

@media (min-width: 940px) and (max-height: 790px) {
  .app-shell { padding: 0 36px; }
  .topbar { height: 72px; }
  .workspace { height: calc(100svh - 72px); padding-bottom: 22px; gap: 38px; grid-template-columns: minmax(0, 1fr) 266px; }
  .story-panel { padding-top: 10px; }
  h1 { font-size: 46px; margin: 19px 0 12px; }
  .chapters { margin-top: 23px; padding-top: 18px; }
  .section-heading { margin-bottom: 10px; }
  .chapter { padding-top: 9px; padding-bottom: 9px; }
  .chapter-list { gap: 3px; }
  .story-bottom { padding-top: 12px; }
  .keyboard-hint { padding-top: 13px; margin-top: 5px; }
  .canvas-mat { padding-bottom: 20px; }
  .studio { gap: 17px; }
}

@media (min-width: 940px) and (max-height: 670px) {
  .workspace { min-height: 500px; }
  h1 { font-size: 36px; margin-top: 15px; }
  .work-description { font-size: 10px; line-height: 1.8; }
  .chapters { margin-top: 15px; padding-top: 13px; }
  .chapter { padding-top: 7px; padding-bottom: 7px; }
  .chapter-title { font-size: 15px; }
  .chapter-copy { gap: 3px; }
  .story-bottom { padding-top: 8px; }
  .keyboard-hint { margin-top: 0; }
}

@media (max-width: 939px) {
  .app-shell { max-width: 760px; padding: 0 28px; }
  .topbar { height: 76px; }
  .topbar-note { font-size: 9px; }
  .workspace { height: auto; min-height: 0; grid-template-columns: minmax(0, 1fr); gap: 32px; padding-bottom: 28px; }
  .studio { grid-template-rows: auto auto; }
  .art-surface { height: min(71svh, 770px); min-height: 330px; }
  .canvas-mat { padding: 0 24px 23px; }
  .story-panel { padding-top: 0; display: grid; grid-template-columns: 1fr 1.2fr; column-gap: 38px; }
  .work-eyebrow { font-size: 7px; }
  .work-number { display: none; }
  h1 { font-size: 46px; margin: 20px 0 15px; }
  .chapters { margin: 0; padding-top: 0; border: 0; }
  .section-heading { margin-bottom: 11px; }
  .chapter { padding: 9px 11px; }
  .story-bottom { grid-column: 1 / -1; padding-top: 22px; display: flex; align-items: center; justify-content: space-between; gap: 30px; }
  .cursor-toggle { width: 170px; }
  .keyboard-hint { margin: 0; padding: 0; border: 0; }
}

@media (max-width: 560px) {
  .app-shell { padding: 0 18px; }
  .topbar { height: 65px; }
  .brand { gap: 5px; }
  .brand-mark { width: 30px; height: 30px; }
  .brand-name { font-size: 21px; }
  .brand-divider { margin: 0 5px 0 10px; height: 12px; }
  .brand-subtitle { font-size: 9px; letter-spacing: .1em; }
  .topbar-note { display: none; }
  .workspace { gap: 28px; }
  .art-surface { height: min(65svh, 590px); min-height: 340px; }
  .surface-toolbar { height: 40px; padding: 0 13px; }
  .canvas-status, .preview-button { font-size: 9px; }
  .canvas-mat { padding: 0 15px 17px; }
  .studio { gap: 17px; }
  .transport { padding: 0 1px; }
  .timeline-labels { font-size: 9px; }
  .transport-row { margin-top: 11px; }
  .play-button { height: 40px; min-width: 92px; padding: 0 16px 0 13px; }
  .playback-buttons { gap: 6px; }
  .playback-options { gap: 12px; }
  .speed-control { gap: 5px; }
  .speed-select-wrap select { width: 57px; }
  .start-play-circle { width: 52px; height: 52px; }
  .start-title { font-size: 18px; margin-top: 20px; }
  .start-subtitle { font-size: 9px; }
  .story-panel { grid-template-columns: 1fr; }
  .work-info { display: grid; grid-template-columns: 1fr 1fr; align-items: center; column-gap: 15px; }
  .work-eyebrow { grid-column: 1 / -1; }
  h1 { font-size: 37px; margin: 15px 0 20px; line-height: 1.1; }
  h1 br { display: none; }
  .title-dot { font-size: 20px; margin-left: 0; margin-right: 3px; }
  .work-description { font-size: 9px; line-height: 1.9; letter-spacing: 0; padding-bottom: 4px; }
  .chapters { border-top: 1px solid var(--line); padding-top: 19px; }
  .chapter-list { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 0 -7px; }
  .chapter { gap: 9px; padding: 10px 7px; }
  .chapter-title { font-size: 16px; }
  .chapter-description { font-size: 8px; }
  .chapter-number { width: 21px; height: 21px; font-size: 9px; }
  .chapter-time { font-size: 8px; }
  .section-heading { margin-bottom: 12px; }
  .story-bottom { padding-top: 16px; gap: 16px; }
  .cursor-toggle { width: 120px; }
  .cursor-toggle-label { font-size: 9px; gap: 5px; }
  .keyboard-hint { font-size: 8px; gap: 4px; }
  .keyboard-hint .shortcut-separator, .keyboard-hint .shortcut-separator ~ * { display: none; }
}

@media (max-width: 370px) {
  .app-shell { padding: 0 12px; }
  .work-description { font-size: 8px; }
  h1 { font-size: 32px; }
  .chapter-time { display: none; }
  .playback-options { gap: 9px; }
  .speed-control > span:first-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .loading-ring { animation-duration: 2.5s; }
}
