:root {
  color-scheme: light;
  --ink: #243750;
  --muted: #5b5260;
  --paper: #f5eee2;
  --card: #fffaf0;
  --line: #d7c9b7;
  --rust: #9d3f2d;
  --gold: #f0ca79;
  --night: #1c2a3c;
  --serif: 'Noto Serif CJK SC', 'Songti SC', 'STSong', SimSun, serif;
  font-family: system-ui, 'Microsoft YaHei', sans-serif;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.wrap { width: min(1136px, calc(100% - 64px)); margin-inline: auto; }
.skip { position: fixed; left: 12px; top: 12px; transform: translateY(-180%); background: white; color: var(--ink); padding: 12px; z-index: 2; }
.skip:focus { transform: none; }
.masthead { border-bottom: 1px solid var(--line); background: #fbf5eb; }
.bar { min-height: 65px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; letter-spacing: .11em; }
.local-mark { display: inline-flex; gap: 7px; align-items: center; border: 1px solid #b5c3ca; padding: 4px 11px; border-radius: 20px; font-size: 12px; background: #e6eaec; }
.local-mark::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #405d76; }
.intro { display: flex; justify-content: space-between; align-items: end; gap: 16px; padding: 31px 0 21px; }
.eyebrow { margin: 0 0 7px; font-size: .71rem; font-weight: 750; letter-spacing: .13em; color: var(--rust); }
.eyebrow span { padding: 0 5px; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 800; }
h1 { font-size: clamp(2.1rem, 5vw, 3.7rem); letter-spacing: .07em; line-height: 1.17; margin-bottom: 9px; }
h1 span { color: var(--rust); }
.intro > div > p:last-child, .export-copy > p:last-child { color: var(--muted); font-size: .92rem; }
button, input, select { font: inherit; }
button { color: #fffaf0; background: var(--ink); border: 1px solid transparent; padding: 8px 13px; min-height: 42px; font-size: .88rem; font-weight: 700; border-radius: 8px; cursor: pointer; }
button:not(:disabled):hover { filter: brightness(1.12); }
button:disabled { opacity: .56; cursor: default; }
button.secondary { background: #fffaf0; color: var(--ink); border-color: #cabbab; }
button.sample { flex: 0 0 auto; }
:focus-visible { outline: 3px solid #a53824; outline-offset: 3px; }
.viewer :focus-visible { outline-color: var(--gold); }
.workbench { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.76fr); gap: 17px; align-items: stretch; }
.editor, .reel, .delivery { border: 1px solid var(--line); background: var(--card); border-radius: 16px; }
.editor { padding: 20px 22px 14px; }
h2 { font-size: 1.28rem; }
.editor h2 { margin-bottom: 14px; }
.field { display: block; font-size: .82rem; font-weight: 750; }
.optional { font-weight: 400; color: var(--muted); }
.field input, .field select { width: 100%; display: block; min-height: 41px; margin: 4px 0 0; padding: 7px 10px; border: 1px solid #bdad9e; border-radius: 7px; color: var(--ink); background: #fffcf5; }
.field input::placeholder { color: #756b68; }
[aria-invalid=true] { border-color: var(--rust) !important; }
.editor-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); }
.editor-head h3 { font-size: .96rem; }
.editor-head span { font-size: .75rem; color: var(--muted); }
.fold-types { border: 0; padding: 0; margin: 8px 0 10px; display: flex; gap: 8px; }
.fold-types legend { padding: 0 0 4px; font-size: .82rem; font-weight: 750; }
.fold { flex: 1; min-width: 0; border: 1px solid #cabbab; border-radius: 7px; display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; background: #fffcf5; cursor: pointer; }
.fold:has(input:checked) { background: #f5e8d0; border-color: #9d704f; }
.fold input { accent-color: var(--rust); margin: 0; }
.fold span, .legend span { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 650; }
.swatch { display: inline-block; width: 26px; height: 2px; }
.mountain-key { background: repeating-linear-gradient(90deg, #ba5a38 0 9px, transparent 9px 12px, #ba5a38 12px 14px, transparent 14px 17px); }
.valley-key { background: repeating-linear-gradient(90deg, #4584a2 0 5px, transparent 5px 9px); }
.prior-key { background: #a0a5ab; }
.points { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.small { font-size: .77rem; color: var(--muted); }
.point-help { margin: 5px 0 10px; }
.editor-actions { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
button.small-button { padding: 6px 10px; min-height: 36px; font-size: .78rem; }
button.remove { margin-left: auto; color: var(--rust); }
.error { color: #973523; font-weight: 700; margin-top: 6px; }
.error:empty { display: none; }
.viewer { background: var(--night); color: #fff5df; border: 1px solid #35485f; border-radius: 16px; padding: 14px 17px 13px; min-width: 0; display: flex; flex-direction: column; }
.viewer-top, .viewer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 9px 15px; flex-wrap: wrap; }
.viewer-top { margin: 0 2px 10px; }
#frame-count { color: var(--gold); font: 700 .86rem ui-monospace, monospace; letter-spacing: .12em; }
.proscenium { border-radius: 11px; padding: 10px; background: #344861; box-shadow: inset 0 0 0 1px #61809a, inset 0 -4px 0 #243850; flex: 1; display: grid; }
.mat { min-height: 310px; border-radius: 7px; display: grid; place-items: center; overflow: hidden; border: 1px solid #55718a; background: radial-gradient(ellipse at 50% 43%, #455566 3%, #29394d 52%, #172536 95%); }
#sheet { width: min(100%, 318px); }
.drawing { display: block; width: 100%; height: auto; }
.sheet-shadow { fill: #151d29; }
.sheet { fill: #fae9bb; stroke: #b78654; }
.corner { fill: #e6b977; }
.grid { fill: none; stroke: #b59d6d; stroke-width: 1; opacity: .49; }
.ticks { fill: #6c573d; font: 12px ui-monospace, monospace; }
.past, .crease { stroke-linecap: round; }
.past { stroke: #88786c; stroke-width: 2.2; opacity: .74; }
.crease { stroke-width: 3.5; }
.crease.mountain { stroke: #9d3f2d; }
.crease.valley { stroke: #245f81; }
.valley { stroke-dasharray: 7 6; }
.mountain { stroke-dasharray: 13 5 2 5; }
.start { fill: #273a50; }
.end { fill: #fae9bb; stroke: #273a50; stroke-width: 2; }
.target { fill: transparent; cursor: crosshair; }
.target:hover { fill: #a971394a; }
.caption { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 13px; min-height: 31px; padding: 5px 1px 3px; overflow-wrap: anywhere; }
.caption strong { font-size: .84rem; color: #fff2cc; }
.caption span { font-size: .79rem; color: #e2d8c9; }
.legend, .nav { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.legend span { color: #f2e9dc; white-space: nowrap; font-size: .74rem; }
.viewer .mountain-key { background: repeating-linear-gradient(90deg, #ffad83 0 9px, transparent 9px 12px, #ffad83 12px 14px, transparent 14px 17px); }
.viewer .valley-key { background: repeating-linear-gradient(90deg, #a0d9f3 0 5px, transparent 5px 9px); }
.nav button { min-height: 36px; background: #314560; border-color: #65778b; font-size: .79rem; padding: 5px 9px; }
.reel { margin-top: 14px; padding: 12px 17px 15px; }
.reel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.timeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.timeline button { text-align: left; display: flex; align-items: center; gap: 7px; padding: 6px 9px; min-height: 41px; border-color: #d5c7b4; background: #f6eddf; color: var(--ink); }
.timeline button[aria-current=true] { border-color: #a65037; background: #f6dec8; }
.timeline .frame-no { font: 750 .83rem ui-monospace, monospace; color: var(--rust); }
.timeline .frame-text { font-size: .78rem; overflow-wrap: anywhere; }
.delivery { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; padding: 18px 20px; }
.export-copy h2 { margin-bottom: 5px; }
.price { font-size: 1.36rem; font-weight: 850; color: var(--rust); }
.price small { font-size: .74rem; color: var(--muted); font-weight: 600; }
.export-actions { display: flex; flex-wrap: wrap; gap: 7px; margin: 5px 0 8px; }
.footer { padding: 15px 0 24px; color: var(--muted); font-size: .75rem; display: flex; justify-content: space-between; gap: 5px 12px; flex-wrap: wrap; }
@media (max-width: 800px) {
  .wrap { width: calc(100% - 36px); }
  .workbench { gap: 10px; }
  .editor { padding: 15px; }
  .viewer { padding: 11px; }
}
@media (max-width: 660px) {
  .wrap { width: calc(100% - 24px); }
  .bar { min-height: 57px; }
  .intro { align-items: flex-start; flex-direction: column; padding: 20px 0 14px; }
  .workbench, .delivery { grid-template-columns: minmax(0, 1fr); }
  .mat { min-height: 0; }
  #sheet { width: min(100%, 298px); }
  .timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .delivery { padding: 14px; }
}
