/* THE MODAL EARTH — 旋法の地球儀 */
:root {
  --paper: #f3eee3;
  --paper-2: #ebe4d4;
  --card: #fbf8f1;
  --ink: #2a2420;
  --mist: #6f6253;
  --faint: rgba(42, 36, 32, .12);
  --hair: rgba(42, 36, 32, .07);
  --accent: #b5523a;
  --accent-soft: rgba(181, 82, 58, .14);
  --indigo: #2f3f63;
  --serif: "Fraunces", "Shippori Mincho", Georgia, serif;
  --mincho: "Shippori Mincho", "Fraunces", serif;
  --sans: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
  --shadow: 0 18px 40px -24px rgba(70, 50, 30, .5);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --top: 64px;
  --label-w: 222px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.8; font-weight: 500; -webkit-font-smoothing: antialiased; }
body::before { /* paper grain */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .32 0 0 0 0 .22 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── header ───────────────────────────────────────────── */
.top { position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 24px; background: rgba(243, 238, 227, .86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--hair); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.brand-mark { width: 34px; height: 34px; color: var(--ink); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-title { font-family: var(--serif); font-weight: 500; font-size: 19px; letter-spacing: .14em; font-variation-settings: 'SOFT' 100, 'opsz' 40; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-family: var(--mincho); font-size: 12px; letter-spacing: .2em; color: var(--mist); }
.top-nav { display: flex; gap: 8px; align-items: center; flex: none; }
.top-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; display: flex; align-items: center; gap: 14px; font-family: var(--mincho); font-weight: 600; font-size: 14px; letter-spacing: .42em; text-indent: .42em; color: var(--ink); pointer-events: none; white-space: nowrap; }
.top-center::before, .top-center::after { content: ""; width: 28px; height: 1px; background: rgba(42, 36, 32, .3); }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--faint); background: rgba(251, 248, 241, .6); font-size: 12.5px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .2s, border-color .2s, color .2s; }
.chip:hover { border-color: rgba(42, 36, 32, .3); background: var(--card); }
.chip-lang { font-family: var(--serif); letter-spacing: .14em; min-width: 46px; justify-content: center; }
.chip-fragile .ring { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--accent); }
.chip-fragile[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff8f0; }
.chip-fragile[aria-pressed="true"] .ring { border-color: #fff8f0; }

/* ── layout ───────────────────────────────────────────── */
.stage { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(380px, 44%) 1fr; }
.atlas { position: sticky; top: var(--top); height: calc(100vh - var(--top)); height: calc(100dvh - var(--top)); display: grid; grid-template-rows: minmax(260px, 52%) 1fr; border-right: 1px solid var(--hair); }
.globe-wrap { position: relative; overflow: hidden; touch-action: none; }
#globe { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#globe:active { cursor: grabbing; }
.globe-hint { position: absolute; left: 18px; bottom: 10px; margin: 0; font-size: 11px; color: var(--mist); letter-spacing: .06em; pointer-events: none; transition: opacity .6s; }
.pins { position: absolute; inset: 0; pointer-events: none; }
.pin { position: absolute; left: 0; top: 0; width: 22px; height: 22px; margin: -11px 0 0 -11px; padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto; display: grid; place-items: center; transition: opacity .3s; }
.pin i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px rgba(251, 248, 241, .9), 0 2px 6px rgba(0, 0, 0, .25); transition: transform .3s var(--ease); }
.pin:hover i { transform: scale(1.35); }
.pin.is-kin i { box-shadow: 0 0 0 2px rgba(251, 248, 241, .95), 0 0 0 5px var(--accent-soft), 0 2px 6px rgba(0, 0, 0, .25); }
.pin.is-sel { z-index: 3; }
.pin.is-sel i { width: 13px; height: 13px; box-shadow: 0 0 0 3px #fbf8f1, 0 0 0 5px var(--c), 0 3px 10px rgba(0, 0, 0, .3); }
.pin-label { position: absolute; left: 50%; bottom: 100%; transform: translate(-50%, -2px); padding: 2px 9px; border-radius: 999px; background: rgba(251, 248, 241, .92); border: 1px solid var(--faint); font-family: var(--mincho); font-weight: 600; font-size: 12px; white-space: nowrap; opacity: 0; transition: opacity .2s; pointer-events: none; }
.pin:hover .pin-label, .pin:focus-visible .pin-label, .pin.is-sel .pin-label { opacity: 1; }
.pin:hover { z-index: 4; }
.pin.frag i { width: 10px; height: 10px; border-radius: 2px; transform: rotate(45deg); background: transparent; border: 2px solid var(--accent); box-shadow: 0 0 0 2px rgba(251, 248, 241, .85); }
.pin.frag:hover i { transform: rotate(45deg) scale(1.3); }
.pin.is-hidden { opacity: 0; pointer-events: none; }

/* ── detail ───────────────────────────────────────────── */
.detail { overflow-y: auto; overscroll-behavior: contain; padding: 22px 28px 40px; border-top: 1px solid var(--hair); background: linear-gradient(var(--paper), rgba(235, 228, 212, .55)); scrollbar-width: thin; }
.d-kicker { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12px; color: var(--mist); letter-spacing: .04em; }
.d-kicker .swatch { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.d-title { margin: 6px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.d-name { font-family: var(--mincho); font-weight: 700; font-size: 34px; line-height: 1.2; letter-spacing: .03em; }
.d-native { font-family: var(--serif); font-size: 16px; color: var(--mist); }
.d-steps { margin: 16px 0 4px; }
.d-steps-label { font-size: 11px; color: var(--mist); letter-spacing: .08em; }
.steps { display: flex; height: 30px; margin-top: 6px; border-radius: 6px; overflow: hidden; border: 1px solid var(--faint); background: var(--card); }
.step { position: relative; display: grid; place-items: center; font-family: var(--serif); font-size: 11.5px; font-variant-numeric: tabular-nums; border-right: 1px solid var(--faint); color: var(--ink); min-width: 0; }
.step:last-child { border-right: 0; }
.step.is-odd { background: var(--accent-soft); color: #8a3a26; }
.step.is-wide { background: rgba(47, 63, 99, .09); }
.d-desc { margin: 14px 0 0; font-size: 14.5px; line-height: 1.95; }
.unesco { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; padding: 5px 12px 5px 8px; border-radius: 999px; background: rgba(47, 63, 99, .08); color: var(--indigo); font-size: 12px; }
.unesco svg { flex: none; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--ink); background: var(--ink); color: var(--card); cursor: pointer; font-size: 13px; transition: transform .15s, background .2s; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--faint); }
.btn.ghost:hover { border-color: rgba(42, 36, 32, .35); }
.btn.is-playing { background: var(--accent); border-color: var(--accent); }
.btn svg { width: 12px; height: 12px; }
.toggle { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px dashed rgba(42, 36, 32, .25); background: transparent; cursor: pointer; font-size: 12px; color: var(--mist); }
.toggle[aria-pressed="true"] { border-style: solid; border-color: var(--indigo); color: var(--indigo); background: rgba(47, 63, 99, .07); }
.toggle .tk { width: 22px; height: 12px; border-radius: 6px; background: rgba(42, 36, 32, .18); position: relative; transition: background .2s; }
.toggle .tk::after { content: ""; position: absolute; left: 2px; top: 2px; width: 8px; height: 8px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.toggle[aria-pressed="true"] .tk { background: var(--indigo); }
.toggle[aria-pressed="true"] .tk::after { transform: translateX(10px); }
.timbre { width: 100%; margin: 2px 0 0; font-size: 11.5px; color: var(--mist); }
.d-sec { margin-top: 26px; }
.d-sec h3 { margin: 0 0 10px; font-family: var(--mincho); font-weight: 600; font-size: 16px; letter-spacing: .05em; display: flex; align-items: baseline; gap: 10px; }
.d-sec h3 small { font-family: var(--sans); font-weight: 500; font-size: 11.5px; color: var(--mist); letter-spacing: 0; }
.kin { display: flex; flex-wrap: wrap; gap: 8px; }
.kin button { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 9px; border-radius: 12px; border: 1px solid var(--faint); background: var(--card); cursor: pointer; text-align: left; line-height: 1.35; transition: border-color .2s, transform .15s; }
.kin button:hover { border-color: rgba(42, 36, 32, .35); transform: translateY(-1px); }
.kin .sw { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.kin b { display: block; font-family: var(--mincho); font-weight: 600; font-size: 13.5px; }
.kin em { display: block; font-style: normal; font-size: 11px; color: var(--mist); }
.kin-empty { margin: 0; font-size: 12.5px; color: var(--mist); }
.tracks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.track { display: grid; grid-template-columns: 58px 1fr auto; gap: 12px; align-items: center; padding: 8px 10px 8px 8px; border-radius: 12px; background: var(--card); border: 1px solid var(--hair); }
.track .art { position: relative; width: 58px; height: 58px; border-radius: 6px; overflow: hidden; background: var(--paper-2); border: 0; padding: 0; cursor: pointer; }
.track .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.track .art .pl { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(20, 16, 12, .28); color: #fff; opacity: 0; transition: opacity .2s; }
.track .art:hover .pl, .track.is-on .art .pl { opacity: 1; }
.track .art svg { width: 18px; height: 18px; }
.track .ring { position: absolute; inset: 3px; pointer-events: none; }
.t-title { display: block; font-weight: 700; font-size: 13.5px; line-height: 1.4; }
.t-artist { display: block; font-size: 12px; color: var(--mist); line-height: 1.4; }
.t-note { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ink); opacity: .78; line-height: 1.5; }
.t-am { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--faint); text-decoration: none; color: var(--ink); }
.t-am:hover { border-color: rgba(42, 36, 32, .35); background: #fff; }
.t-am svg { width: 15px; height: 15px; }
.track.is-loading .art .pl { opacity: 1; }
.track.is-error .t-note::after { content: " — " attr(data-err); color: var(--accent); }
.d-foot { margin: 22px 0 0; font-size: 11px; color: var(--mist); line-height: 1.7; }

/* intro state of the detail panel */
.welcome h2 { margin: 2px 0 0; font-family: var(--mincho); font-weight: 700; font-size: 24px; line-height: 1.45; letter-spacing: .03em; }
.welcome p { margin: 12px 0 0; font-size: 13.5px; line-height: 1.95; }
.quests { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; }
.quests button { width: 100%; display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; text-align: left; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--faint); background: var(--card); cursor: pointer; line-height: 1.6; transition: border-color .2s, transform .15s; }
.quests button:hover { border-color: rgba(42, 36, 32, .35); transform: translateY(-1px); }
.quests .q-n { font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--accent); line-height: 1.2; }
.quests b { font-family: var(--mincho); font-weight: 600; font-size: 14px; display: block; }
.quests span span { font-size: 12px; color: var(--mist); }

/* ── chart ────────────────────────────────────────────── */
.chart { min-width: 0; padding: 0 0 60px; }
.chart-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 18px 34px 14px; }
.tools { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--hair); }
.seg button { height: 30px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; cursor: pointer; font-size: 12.5px; color: var(--mist); }
.seg button[aria-checked="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.seg button:disabled { opacity: .4; cursor: default; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; margin: 0; padding: 0; font-size: 11px; color: var(--mist); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend svg { height: 16px; width: auto; }
.lg-dot { fill: var(--ink); }
.lg-off { fill: var(--accent); }
.lg-grid { stroke: rgba(42, 36, 32, .35); stroke-width: 1; stroke-dasharray: 2 2; }
.lg-band { fill: rgba(181, 82, 58, .22); }
.lg-alt { fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-dasharray: 2 2; }

.dock { position: sticky; top: var(--top); z-index: 6; background: rgba(243, 238, 227, .94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 1px solid var(--hair); border-bottom: 1px solid var(--faint); }
.ruler { display: grid; grid-template-columns: var(--label-w) 1fr; align-items: end; padding: 10px 34px 6px; }
/* sticky transport: the selected mode and its buttons sit right above the chart */
.player { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; min-height: 58px; padding: 9px 34px; border-bottom: 1px solid var(--hair); }
.player.is-empty { color: var(--mist); font-size: 12.5px; }
.pl-keys { font-size: 11px; opacity: .8; }
.pl-id { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.pl-id .swatch { width: 10px; height: 10px; border-radius: 50%; background: var(--c); align-self: center; flex: none; }
.pl-name { font-family: var(--mincho); font-weight: 700; font-size: 18px; letter-spacing: .03em; white-space: nowrap; }
.d-timbre { margin: 8px 0 0; font-size: 11.5px; color: var(--mist); }
.pl-timbre { display: none; font-size: 11px; color: var(--mist); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.controls.ctrl-dock { margin: 0; flex-wrap: nowrap; }
.controls.ctrl-dock .btn { height: 34px; padding: 0 14px; }
.btn-daw { gap: 6px; }
.btn-daw span { display: inline-grid; }
.ctrl-sep { width: 1px; height: 20px; background: var(--faint); margin: 0 2px; }
.ctrl-sheet { display: none; }
.ctrl-sheet .ctrl-sep { display: none; }
.ruler-label { font-family: var(--mincho); font-weight: 600; font-size: 13px; line-height: 1.3; padding-bottom: 6px; }
.ruler-label small { display: block; font-family: var(--sans); font-weight: 500; font-size: 10.5px; color: var(--mist); }
.tonic-wrap { display: inline-flex; align-items: center; gap: 4px; margin-left: 4px; white-space: nowrap; }
.tonic { appearance: none; -webkit-appearance: none; border: 0; border-bottom: 1px dotted rgba(42, 36, 32, .45); background: transparent; padding: 0 1px; font: inherit; font-size: 10.5px; color: var(--ink); cursor: pointer; border-radius: 0; }
.tonic:hover { border-bottom-style: solid; }
.ruler svg { display: block; width: 100%; height: 58px; overflow: visible; }
.key { cursor: pointer; }
.key rect { fill: var(--card); stroke: rgba(42, 36, 32, .3); stroke-width: 1; transition: fill .15s; }
.key.black rect { fill: #3a312a; stroke: #3a312a; }
.key:hover rect { fill: #fff; }
.key.black:hover rect { fill: #5a4c40; }
.key.is-hit rect { fill: var(--accent); stroke: var(--accent); }
.key text { font-family: var(--serif); font-size: 10.5px; fill: var(--mist); text-anchor: middle; pointer-events: none; }
.ruler .cents { font-family: var(--serif); font-size: 9.5px; fill: rgba(42, 36, 32, .45); text-anchor: middle; font-variant-numeric: tabular-nums; }

.rows { list-style: none; margin: 0; padding: 4px 0 0; }
.row { position: relative; display: grid; grid-template-columns: var(--label-w) 1fr; align-items: center; padding: 0 34px; min-height: 58px; border-bottom: 1px solid var(--hair); transition: background .25s; }
.row::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--c); opacity: .75; }
.row:hover { background: rgba(251, 248, 241, .65); }
.row.is-sel { background: var(--card); box-shadow: inset 0 0 0 1px var(--faint); }
.row.is-sel::before { opacity: 1; width: 5px; }
.row.is-kin { background: rgba(181, 82, 58, .05); }
.row.is-group-start { margin-top: 14px; border-top: 1px solid var(--faint); }
.row-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row-play { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--faint); background: var(--card); color: var(--ink); cursor: pointer; display: grid; place-items: center; padding: 0; transition: background .2s, color .2s, border-color .2s, transform .15s; }
.row-play svg { width: 10px; height: 10px; margin-left: 1px; }
.row-play:hover { border-color: var(--ink); transform: scale(1.06); }
.row-play.is-playing { background: var(--accent); border-color: var(--accent); color: #fff; }
.row-play.is-playing svg { margin-left: 0; }
.row.is-playing { background: rgba(181, 82, 58, .06); }
.row-label { display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 8px 10px 8px 0; border: 0; background: none; cursor: pointer; text-align: left; min-width: 0; flex: 1; }
.row-name { font-family: var(--mincho); font-weight: 700; font-size: 15.5px; line-height: 1.3; letter-spacing: .02em; }
.row-place { font-size: 11px; color: var(--mist); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-group { font-size: 11px; color: var(--mist); letter-spacing: .1em; padding: 18px 34px 6px; font-family: var(--serif); font-style: italic; list-style: none; display: flex; align-items: center; gap: 8px; }
.row-group i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.staff { display: block; width: 100%; height: 50px; overflow: visible; }
.staff .grid { stroke: rgba(42, 36, 32, .11); stroke-width: 1; }
.staff .grid.oct { stroke: rgba(42, 36, 32, .22); }
.staff .base { stroke: rgba(42, 36, 32, .2); stroke-width: 1; }
.staff .band { fill: rgba(181, 82, 58, .2); }
.staff .whisker { stroke: var(--accent); stroke-width: 1.2; }
.staff .off-label { font-family: var(--serif); font-size: 9.5px; fill: var(--accent); text-anchor: middle; font-variant-numeric: tabular-nums; }
.staff .whisker.slight { stroke: rgba(42, 36, 32, .45); }
.staff .off-label.slight { fill: var(--mist); }
.n.slight circle.dot { fill: #6b4a3a; }
.staff .ghost { stroke: var(--indigo); stroke-width: 2; stroke-linecap: round; opacity: .35; }
.n { cursor: pointer; }
.n circle.dot { fill: var(--ink); transition: r .2s var(--ease); }
.n.off circle.dot { fill: var(--accent); }
.n.tonic circle.dot { fill: var(--ink); }
.n.tonic circle.halo { fill: none; stroke: var(--ink); stroke-width: 1; opacity: .5; }
.n.alt circle.dot { fill: var(--paper); stroke: var(--ink); stroke-width: 1.4; stroke-dasharray: 2.4 2; }
.n.octave circle.dot { fill: none; stroke: rgba(42, 36, 32, .4); stroke-width: 1.2; }
.n .hit { fill: transparent; }
.n:hover circle.dot { r: 8.5; }
.n.is-hit circle.dot { r: 9.5; }
.n.is-hit circle.flash { animation: flash .7s var(--ease) forwards; }
.n circle.flash { fill: none; stroke: var(--accent); stroke-width: 2; opacity: 0; }
@keyframes flash { from { r: 8; opacity: .9; } to { r: 22; opacity: 0; } }

.fragile-list { margin: 48px 34px 0; padding-top: 30px; border-top: 1px solid var(--faint); }
.fragile-list h2 { margin: 0; font-family: var(--mincho); font-weight: 700; font-size: 24px; letter-spacing: .04em; display: flex; align-items: center; gap: 10px; }
.fragile-list h2::before { content: ""; width: 12px; height: 12px; border: 2px solid var(--accent); transform: rotate(45deg); border-radius: 2px; }
.fl-grid { list-style: none; margin: 20px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(4, auto); grid-auto-flow: column; column-gap: 28px; border-top: 1px solid var(--faint); }
.fl-grid li { border-bottom: 1px solid var(--faint); }
.fl-item { width: 100%; display: grid; grid-template-columns: 44px minmax(0, 1fr) 18px; align-items: center; gap: 12px; padding: 13px 4px; border: 0; background: none; cursor: pointer; text-align: left; transition: background .2s; }
.fl-item:hover { background: rgba(251, 248, 241, .7); }
.fl-yr { font-family: var(--serif); font-style: italic; font-size: 13px; color: var(--accent); font-variant-numeric: tabular-nums; }
.fl-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.fl-text b { font-family: var(--mincho); font-weight: 700; font-size: 15px; }
.fl-text span { font-size: 11.5px; color: var(--mist); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fl-arrow { color: var(--mist); font-size: 13px; transition: transform .2s var(--ease), color .2s; }
.fl-item:hover .fl-arrow { transform: translateX(3px); color: var(--accent); }
.fl-lead { margin: 10px 0 0; font-size: 13.5px; color: var(--mist); max-width: 44em; }

/* ── now playing (previews) ─────────────────────────── */
.now { position: fixed; z-index: 40; left: 50%; bottom: 18px; transform: translateX(-50%); display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: min(460px, calc(100vw - 32px)); padding: 9px 14px 11px 10px; border-radius: 16px; background: rgba(42, 36, 32, .94); color: #f6f0e4; box-shadow: var(--shadow); }
.now[hidden] { display: none; }
.now-play { width: 34px; height: 34px; border-radius: 50%; border: 0; background: #f6f0e4; color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.now-play svg { width: 13px; height: 13px; }
.now-text { min-width: 0; line-height: 1.35; }
.now-title, .now-artist { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-title { font-weight: 700; font-size: 13px; }
.now-artist { font-size: 11.5px; opacity: .7; }
.now-am { font-size: 11.5px; color: #f6f0e4; opacity: .85; text-decoration: none; border: 1px solid rgba(246, 240, 228, .3); border-radius: 999px; padding: 4px 10px; }
.now-bar { position: absolute; left: 14px; right: 14px; bottom: 5px; height: 2px; border-radius: 1px; background: rgba(246, 240, 228, .15); overflow: hidden; }
.now-bar span { display: block; height: 100%; width: 0; background: #e6a184; }

/* ── modal ───────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(30, 24, 20, .35); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal[hidden] { display: none; }
.modal-card { position: relative; width: min(680px, 100%); max-height: min(86vh, 900px); overflow-y: auto; overscroll-behavior: contain; padding: 34px 36px 30px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow); }
.modal-card h2 { margin: 0; font-family: var(--mincho); font-weight: 700; font-size: 26px; }
.modal-card h3 { margin: 24px 0 6px; font-family: var(--mincho); font-weight: 600; font-size: 16px; }
.modal-card p, .modal-card li { font-size: 13.5px; line-height: 1.95; }
.modal-card ul { padding-left: 1.2em; }
.modal-card .src li { font-size: 12px; line-height: 1.7; margin-bottom: 4px; }
.modal-card .src a { color: var(--indigo); }
.x { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--faint); background: var(--card); cursor: pointer; display: grid; place-items: center; }

/* ── footer & seo ───────────────────────────────────── */
.foot { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; padding: 22px 34px 90px; border-top: 1px solid var(--hair); font-size: 11px; color: var(--mist); }
.playground { font-family: Georgia, "Times New Roman", serif; font-weight: 700; letter-spacing: .32em; font-size: 11px; text-decoration: none; background: linear-gradient(90deg, #8a6a32, #c09346); -webkit-background-clip: text; background-clip: text; color: transparent; }
.seo { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
#fatal { position: fixed; inset: auto 20px 20px; padding: 14px 18px; background: var(--card); border-radius: 12px; box-shadow: var(--shadow); z-index: 70; }
#fatal[hidden] { display: none; }
.sheet-scrim[hidden] { display: none; }

/* ── responsive ─────────────────────────────────────── */
@media (min-width: 1600px) { .pl-timbre { display: inline; } }
@media (max-width: 1180px) {
  :root { --label-w: 190px; }
  .row, .ruler, .player { padding-left: 22px; padding-right: 22px; }
  .chart-top { padding: 18px 22px 12px; }
  .pl-timbre { display: none; }
  .fragile-list { margin-left: 22px; margin-right: 22px; }
  .row-group { padding-left: 22px; }
}
@media (max-width: 900px) {
  :root { --top: 56px; --label-w: 136px; }
  .top { padding: 0 16px; }
  .brand-title { font-size: 15px; letter-spacing: .1em; }
  .brand-sub { font-size: 10.5px; }
  .brand-mark { width: 28px; height: 28px; }
  .chip { height: 32px; padding: 0 11px; font-size: 12px; }
  #btn-about { display: none; }
  /* the sheet and its scrim live inside .stage, whose z-index caps theirs; lift it over the footer that follows it */
  .stage { display: block; z-index: 2; }
  .atlas { position: relative; top: 0; height: auto; display: block; border-right: 0; }
  .globe-wrap { height: 46vh; height: 46svh; min-height: 280px; }
  #globe { height: calc(100% - 28px); }
  .globe-hint { left: 0; right: 0; bottom: 6px; text-align: center; }
  .detail { position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; max-height: 82vh; max-height: 82dvh; padding: 10px 20px 40px; border-radius: 20px 20px 0 0; background: var(--paper); box-shadow: 0 -18px 40px -20px rgba(40, 28, 18, .45); border-top: 0; transform: translateY(105%); transition: transform .45s var(--ease); }
  .detail.is-open { transform: none; }
  body:has(#now:not([hidden])) .detail { padding-bottom: 104px; }  /* last item stays clear of the preview bar */
  .detail::before { content: ""; display: block; width: 44px; height: 5px; margin: 0 auto 10px; border-radius: 3px; background: rgba(42, 36, 32, .2); }
  .detail .sheet-close { display: grid; }
  .sheet-scrim { position: fixed; inset: 0; z-index: 45; background: rgba(30, 24, 20, .2); touch-action: none; }
  .d-name { font-size: 28px; }
  .chart-top { padding: 16px 16px 10px; }
        .player { display: none; }
  .ctrl-sheet { display: flex; }
  .top-center { display: none; }
  .ruler { padding: 8px 12px 6px 16px; }
  .row-play { width: 26px; height: 26px; }
  .row-head { gap: 7px; }
  .ruler-label { font-size: 11.5px; }
  .ruler-label .rs { display: none; }
  .tonic-wrap { margin-left: 0; }
  .row { padding: 0 12px 0 16px; min-height: 54px; }
  .row-group { padding-left: 16px; }
  .row-name { font-size: 13.5px; }
  .row-place { font-size: 10px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .staff .off-label { display: none; }
  .fragile-list { margin: 40px 16px 0; }
  .fl-grid { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-flow: row; }
  .foot { padding: 20px 16px 100px; }
  .now { bottom: 12px; }
}
.sheet-close { display: none; position: absolute; right: 14px; top: 12px; width: 34px; height: 34px; place-items: center; border-radius: 50%; border: 1px solid var(--faint); background: var(--card); cursor: pointer; }
@media (max-width: 480px) {
  .brand-title { font-size: 13px; letter-spacing: .06em; }
  .brand-sub { letter-spacing: .1em; }
  .brand { gap: 8px; }
  .top-nav { gap: 6px; }
  .chip { padding: 0 10px; font-size: 11.5px; }
  .chip-lang { min-width: 40px; }
}
/* small phones (360px class and below): the header chips need the room, so the globe mark steps aside
   and the title tightens rather than running under the buttons */
@media (max-width: 380px) {
  .brand-mark { display: none; }
}
@media (max-width: 340px) {
  .top { padding: 0 10px; gap: 8px; }
  .brand-title { font-size: 12px; letter-spacing: .03em; }
  .brand-sub { font-size: 10px; letter-spacing: .06em; }
  .top-nav { gap: 4px; }
  .chip { padding: 0 8px; gap: 5px; font-size: 11px; }
  .chip-lang { min-width: 34px; letter-spacing: .08em; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } html { scroll-behavior: auto; } }

/* ── export panel ───────────────────────────────────── */
.ex-card { width: min(600px, 100%); padding: 30px 32px 26px; }
.ex-kicker { margin: 0; font-size: 11.5px; letter-spacing: .12em; color: var(--accent); }
#export-title { margin: 4px 0 0; font-family: var(--mincho); font-weight: 700; font-size: 26px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
#export-title small { font-family: var(--sans); font-weight: 500; font-size: 13px; color: var(--mist); }
.ex-lead { margin: 10px 0 0; font-size: 13px; line-height: 1.9; }
.ex-keys { margin-top: 18px; }
.ex-label { font-size: 11px; color: var(--mist); letter-spacing: .08em; }
.ex-kb { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 3px; margin-top: 6px; }
.ex-key { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; height: 64px; padding-bottom: 6px; border-radius: 4px; border: 1px solid rgba(42, 36, 32, .2); background: #fff; color: rgba(42, 36, 32, .35); font-size: 10px; line-height: 1.1; }
.ex-key.black { background: #e7e1d6; }
.ex-key b { font-family: var(--serif); font-weight: 500; font-size: 11px; }
.ex-key i { font-style: normal; font-variant-numeric: tabular-nums; min-height: 1.1em; }
.ex-key.on { color: var(--ink); border-color: var(--ink); box-shadow: inset 0 -3px 0 var(--ink); }
.ex-key.on.off { color: #8a3a26; border-color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); background: #fff6f1; }
.ex-key.alt { border-style: dashed; box-shadow: none; }
.ex-hint { margin: 6px 0 0; font-size: 11px; color: var(--mist); }
.modal-card .ex-uses { list-style: none; margin: 18px 0 0; padding: 0; border-top: 1px solid var(--faint); }
.modal-card .ex-uses li { display: grid; grid-template-columns: 9.5em 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--faint); font-size: 12.5px; line-height: 1.6; }
.ex-uses b { font-weight: 700; }
.ex-uses span { color: var(--mist); }
.ex-check { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 12.5px; cursor: pointer; }
.ex-check input { width: 16px; height: 16px; accent-color: var(--ink); }
.ex-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 18px; }
.ex-save { height: 42px; padding: 0 22px; }
.ex-save:disabled { opacity: .75; cursor: progress; }
.ex-foot { margin: 0; flex: 1; min-width: 200px; font-size: 11px; color: var(--mist); line-height: 1.7; }
@media (max-width: 560px) {
  .ex-card { padding: 26px 18px 22px; }
  .modal-card .ex-uses li { grid-template-columns: 1fr; gap: 0; }
  .ex-key { height: 56px; font-size: 9px; }
  .ex-key b { font-size: 10px; }
}
