/* Layout: one column. The sky first, play and star info under it, settings in an auto-fit grid, then the mapping. */
:root {
  --bg: #0e0e0c;
  --sky: #0a0b10;
  --fg: #ece8df;
  --muted: #a29d92;
  --faint: #8f8a80;
  --line: rgba(236, 232, 223, 0.14);
  --line-strong: rgba(236, 232, 223, 0.3);
  --accent: #ece8df;
  --tone: #c4a46c;
  --display: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --body: 'Inter Tight', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  color-scheme: dark;
}
html, body { background: var(--bg); color: var(--fg); }
body {
  font-family: var(--body); font-size: 16px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  -webkit-font-smoothing: antialiased;
}
a { color: var(--fg); }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1280px; margin: 0 auto; }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }

.top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 24px; padding-block: 10px; border-bottom: 1px solid var(--line); }
.top .who { display: flex; align-items: baseline; gap: 12px; text-decoration: none; font-weight: 500; font-size: 15px; padding-block: 10px; }
.top .who span[lang] { font-family: 'Noto Sans JP', var(--body); letter-spacing: 0.04em; }
.top nav a { text-decoration: none; display: inline-block; padding-block: 12px; }

.intro { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px 48px; padding-block: clamp(28px, 5vw, 64px) clamp(20px, 3vw, 36px); }
.eyebrow { color: var(--muted); margin: 0 0 12px; }
h1 { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(52px, 9vw, 128px); line-height: 0.88; letter-spacing: -0.01em; text-wrap: balance; }
.intro p { margin: 0; max-width: 40ch; color: var(--muted); font-size: 17px; text-wrap: pretty; }

.stage { position: relative; height: clamp(340px, 58vh, 700px); background: var(--sky); border: 1px solid var(--line); overflow: hidden; touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.stage.move { cursor: grab; }
.stage.turn { cursor: ew-resize; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.readout { position: absolute; top: 0; left: 0; right: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 10px 14px; color: var(--muted); pointer-events: none; font-variant-numeric: tabular-nums; }
.readout b { color: var(--fg); font-weight: 500; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); margin-right: 8px; vertical-align: 1px; }
.dot.on { background: var(--accent); }
.starinfo { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 14px; color: var(--muted); pointer-events: none; font-variant-numeric: tabular-nums; }
.starinfo b { color: var(--fg); font-weight: 500; }

.transport { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding-block: 20px; border-bottom: 1px solid var(--line); }
.play { width: 84px; height: 84px; border-radius: 50%; border: 1px solid var(--accent); background: transparent; color: var(--fg); display: grid; place-items: center; cursor: pointer; flex: 0 0 auto; touch-action: manipulation; transition: background 0.2s; }
.play[aria-pressed="true"] { background: var(--accent); color: var(--bg); }
.play svg { width: 26px; height: 26px; }
.tx-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 200px; min-width: 0; }
.tx-text strong { font-size: 18px; font-weight: 500; }
.tx-text span { color: var(--muted); font-size: 14px; }
.btn { min-height: 44px; padding: 0 18px; border-radius: 22px; border: 1px solid var(--line-strong); background: transparent; color: var(--fg); font: 500 12px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; touch-action: manipulation; }
.btn:hover { border-color: var(--fg); }
.touch { align-items: center; }
.touch .lbl { color: var(--muted); margin-right: 4px; }
.seg.strip { min-inline-size: 0; min-width: 0; max-width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; scroll-padding-inline: 8px; }
.strip::-webkit-scrollbar { display: none; }
.strip label { flex: 0 0 auto; white-space: nowrap; }
.strip .grp { flex: 0 0 auto; align-self: center; color: var(--faint); font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; padding: 0 2px 0 10px; white-space: nowrap; }
.strip .grp:first-child { padding-left: 0; }
details.more { grid-column: 1 / -1; border-bottom: 1px solid var(--line); }
details.more summary { cursor: pointer; min-height: 52px; display: flex; align-items: center; color: var(--muted); list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: "+"; margin-left: auto; font-size: 16px; }
details.more[open] summary::after { content: "−"; }
.more-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 0 40px; }
.recorder { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 0 2px; }
.recbtn { min-height: 48px; padding: 0 20px 0 16px; border-radius: 24px; border: 1px solid var(--accent); background: transparent; color: var(--fg); font: 500 12px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; display: inline-flex; align-items: center; gap: 10px; touch-action: manipulation; }
.recbtn .rd { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.recbtn[aria-pressed="true"] { background: var(--accent); color: var(--bg); }
.recbtn[aria-pressed="true"] .rd { background: var(--bg); border-radius: 2px; }
.recwave { flex: 1 1 160px; min-width: 0; height: 44px; border: 1px solid var(--line); background: var(--sky); }
.recwave canvas { width: 100%; height: 100%; display: block; }
.recorder .mono { color: var(--muted); font-variant-numeric: tabular-nums; }
.recorder p { flex: 1 1 100%; margin: 0; color: var(--muted); font-size: 13px; }
.status { min-height: 1.5em; margin: 14px 0 0; color: var(--muted); font-size: 14px; }

.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 0 40px; padding-block: 12px 8px; }
.ctl { display: flex; flex-direction: column; gap: 10px; padding-block: 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.ctl.wide { grid-column: 1 / -1; }
.ctl-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ctl-head label, .ctl-head .lbl { color: var(--muted); }
.ctl-head output { font-family: var(--mono); font-size: 12px; color: var(--fg); font-variant-numeric: tabular-nums; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; border: 0; margin: 0; padding: 0; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label { min-height: 40px; padding: 0 14px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 20px; font-size: 14px; cursor: pointer; }
.seg label small { color: var(--muted); font-size: 12px; }
.seg input:checked + label { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.seg input:checked + label small { color: var(--bg); opacity: 0.7; }
.seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="range"] { width: 100%; accent-color: var(--accent); height: 28px; margin: 0; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; cursor: pointer; }
.switch span { display: flex; flex-direction: column; }
.switch small { color: var(--muted); font-size: 13px; }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); flex: 0 0 auto; }

.how { padding-block: clamp(48px, 7vw, 96px); }
.how h2 { margin: 0 0 24px; font-family: var(--display); font-weight: 400; font-size: clamp(36px, 5vw, 60px); line-height: 1; }
.map { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.map li { padding: 20px; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.map .from { font-family: var(--display); font-style: italic; font-size: 30px; line-height: 1; }
.map .to { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.map span:last-child { color: var(--muted); font-size: 15px; }
.how .note { margin: 20px 0 0; color: var(--muted); font-size: 14px; max-width: 70ch; }
footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-block: 24px; border-top: 1px solid var(--line); color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .play { transition: none; } }

.top nav { display: flex; gap: 0 20px; }
.top nav a.langLink { color: var(--muted); }
footer a { color: var(--muted); text-decoration: none; }
.next { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 24px; padding-block: clamp(32px, 5vw, 64px); border-top: 1px solid var(--line); color: var(--fg); text-decoration: none; margin-top: clamp(64px, 8vw, 120px); }
.next .mono { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.next .big { font-family: var(--display); font-size: clamp(40px, 6vw, 84px); line-height: 1; }
.next:hover .big { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.12em; }
html[lang="ja"] .next .big { font-family: 'Noto Serif JP', var(--display); font-size: clamp(30px, 4.5vw, 56px); word-break: keep-all; }
html[lang="ja"] body { font-family: var(--body), 'Noto Sans JP', 'Hiragino Sans', sans-serif; line-break: strict; word-break: auto-phrase; }
html[lang="ja"] h1, html[lang="ja"] h2 { font-family: 'Noto Serif JP', var(--display); word-break: keep-all; }
html[lang="ja"] h1 { font-size: clamp(40px, 7vw, 96px); line-height: 1.05; }
html[lang="ja"] .map .from { font-style: normal; font-family: 'Noto Serif JP', var(--display); }
html[lang="ja"] .how li strong { font-family: 'Noto Sans JP', var(--body); }
