:root {
  --bg: #121212;
  --bg-stage: #1a1a1a;
  --surface-1: #1e1e1e;
  --surface-2: #262626;
  --surface-3: #303030;
  --border: #3a3a3a;
  --border-strong: #525252;
  --text: #f2f2f2;
  --text-sub: #a3a3a3;
  --text-faint: #737373;
  --accent: #ff3d7f;
  --accent-hover: #ff5c93;
  --accent-press: #e62e6c;
  --on-accent: #ffffff;
  --on-accent-dark: #1a0710;
  --accent-2: #ffd23f;
  --accent-grad: linear-gradient(135deg, #ff3d7f, #ff8a3d 55%, #ffd23f);
  --focus: #4dd8ff;
  --success: #3ddc97;
  --warning: #ffb020;
  --danger: #ff5a5a;
  --selection: #4dd8ff;
  --checker-a: #2a2a2a;
  --checker-b: #3a3a3a;
  --chroma-green: #00b140;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", "Noto Sans JP", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
a { color: var(--text); }
.top {
  height: 56px; display: flex; align-items: center; gap: 16px; padding: 0 16px;
  border-bottom: 1px solid var(--border); background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 800; font-size: 17px; letter-spacing: .04em; }
.brand img { border-radius: 7px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-weight: 700; text-decoration: none; white-space: nowrap; transition: background .12s, transform .08s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.primary:active { background: var(--accent-press); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.text { background: none; border-color: transparent; color: var(--text-sub); }
.btn.text:hover { color: var(--text); }
.btn.danger { background: none; color: var(--danger); border-color: rgba(255, 90, 90, .4); }
.btn:disabled { opacity: .4; cursor: default; }
.icon {
  width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 8px;
  background: none; border: 0; color: var(--text-sub);
}
.icon:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.icon:disabled { opacity: .35; cursor: default; }
.icon.small { width: 32px; height: 32px; }
.icon.toggle.on { color: var(--text); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 7px;
  color: var(--text-sub); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.seg span small { color: var(--text-faint); font-weight: 500; font-size: 11px; }
.seg input:checked + span { background: var(--surface-3); color: var(--text); box-shadow: 0 0 0 1px var(--border-strong) inset; }
.seg input:focus-visible + span { outline: 2px solid var(--focus); }
.ar { display: inline-block; border: 1.6px solid currentColor; border-radius: 2px; }
.ar-h { width: 16px; height: 10px; } .ar-v { width: 10px; height: 16px; } .ar-s { width: 13px; height: 13px; }
.app {
  height: calc(100vh - 56px); height: calc(100dvh - 56px);
  display: grid; grid-template-columns: 280px minmax(480px, 1fr) 340px;
}
.app.tpl-collapsed { grid-template-columns: 0 minmax(480px, 1fr) 340px; }
.app.tpl-collapsed .tpl { visibility: hidden; }
.tpl { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; background: var(--bg); overflow: hidden; }
.pane-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 4px 16px; }
.pane-head h2 { margin: 0; font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 16px 10px; }
.chip {
  height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--border); background: none;
  color: var(--text-sub); font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip[aria-selected="true"], .chip[aria-pressed="true"] { background: var(--text); color: #121212; border-color: var(--text); }
.cards { flex: 1; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 4px 16px 24px; align-content: start; }
.card {
  position: relative; display: block; text-align: left; padding: 0; border: 0; background: none; border-radius: 10px; color: var(--text);
}
.card canvas {
  display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 9px; background-color: var(--checker-a);
  background-image: conic-gradient(var(--checker-b) 25%, transparent 0 50%, var(--checker-b) 0 75%, transparent 0);
  background-size: 12px 12px; box-shadow: 0 0 0 1px var(--border) inset;
}
.card:hover canvas { box-shadow: 0 0 0 1px var(--border-strong) inset; }
.card[aria-selected="true"] canvas { box-shadow: 0 0 0 2px var(--accent); }
.card[aria-selected="true"]::before {
  content: "✓"; position: absolute; left: 6px; top: 6px; z-index: 1; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 800;
}
.card b { display: block; font-size: 12.5px; margin-top: 6px; line-height: 1.3; }
.card small { display: block; color: var(--text-sub); font-size: 11px; line-height: 1.35; }
.card .del {
  position: absolute; right: 4px; top: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .6); color: #fff; font-size: 14px; line-height: 1;
}
.cards .empty { grid-column: 1 / -1; color: var(--text-sub); font-size: 13px; padding: 12px 2px; }
.stage-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg-stage); }
.stage-area { flex: 1; min-height: 0; display: grid; place-items: center; padding: 24px; position: relative; }
.stage { position: relative; box-shadow: 0 0 0 1px var(--border); border-radius: 4px; overflow: hidden; touch-action: none; }
.stage canvas#view, .backdrop, .overlay, .safe { position: absolute; inset: 0; width: 100%; height: 100%; }
.backdrop { background: #000; }
.backdrop img, .backdrop video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.backdrop .dim { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; }
.checker {
  background-color: var(--checker-a);
  background-image: conic-gradient(var(--checker-b) 25%, transparent 0 50%, var(--checker-b) 0 75%, transparent 0);
  background-size: 32px 32px;
}
.backdrop.checker-light { background-color: #fff; background-image: conic-gradient(#ccc 25%, transparent 0 50%, #ccc 0 75%, transparent 0); background-size: 32px 32px; }
.backdrop.black { background: #000; } .backdrop.white { background: #fff; } .backdrop.green { background: var(--chroma-green); }
.overlay { cursor: default; }
.overlay.can-move { cursor: move; }
.selbox { position: absolute; border: 1.5px solid var(--selection); border-radius: 2px; pointer-events: none; transform-origin: center; }
.selbox.warn { border-color: var(--warning); }
.selbox span {
  position: absolute; width: 14px; height: 14px; background: #fff; border: 2px solid var(--selection); border-radius: 50%;
  pointer-events: auto; touch-action: none;
}
.selbox .h-size { right: -8px; bottom: -8px; cursor: nwse-resize; border-radius: 3px; }
.selbox .h-rot { left: 50%; top: -30px; margin-left: -7px; cursor: grab; }
.selbox .h-rot::after { content: ""; position: absolute; left: 4px; top: 12px; width: 1.5px; height: 14px; background: var(--selection); }
.safe { pointer-events: none; }
.safe i { position: absolute; background: repeating-linear-gradient(45deg, rgba(77, 216, 255, .16) 0 6px, transparent 6px 12px); border: 1px dashed rgba(77, 216, 255, .7); }
.safe i::after { content: attr(data-l); position: absolute; left: 6px; top: 4px; font-size: 10px; color: var(--focus); font-style: normal; white-space: nowrap; }
.coach {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%); margin: 0; z-index: 3; white-space: nowrap;
  background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 999px; padding: 6px 6px 6px 14px;
  display: flex; align-items: center; gap: 10px; font-size: 13px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}
.coach button { border: 0; border-radius: 999px; background: var(--text); color: #121212; font-weight: 700; height: 28px; padding: 0 12px; font-size: 12px; }
.reopen { position: absolute; left: 16px; top: 14px; z-index: 4; }
.reopen svg { width: 16px; height: 16px; }
.hint {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 8px;
  background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 12px; padding: 8px 10px 8px 14px; font-size: 13px; white-space: nowrap;
}
.transport { display: flex; align-items: center; gap: 8px; padding: 10px 20px 2px; }
.play { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--text); color: #121212; display: grid; place-items: center; flex: none; }
.play svg { fill: currentColor; stroke: none; }
.seek-wrap { position: relative; flex: 1; height: 32px; display: flex; align-items: center; }
.phases { position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px; display: flex; border-radius: 3px; overflow: hidden; background: var(--surface-3); }
.phases span { height: 100%; }
.ph-in, .lg-in::before { background: #ff3d7f; }
.ph-hold, .lg-hold::before { background: #5c5c5c; }
.ph-out, .lg-out::before { background: #4dd8ff; }
#seek { position: relative; width: 100%; margin: 0; -webkit-appearance: none; appearance: none; background: none; height: 32px; }
#seek::-webkit-slider-runnable-track { height: 6px; background: transparent; }
#seek::-moz-range-track { height: 6px; background: transparent; }
#seek::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -5px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 3px rgba(0, 0, 0, .35); }
#seek::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 0; }
.time { font-variant-numeric: tabular-nums; color: var(--text-sub); font-size: 13px; min-width: 44px; text-align: right; }
.dur { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-sub); white-space: nowrap; }
.dur input {
  width: 54px; height: 30px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  text-align: right; padding: 0 6px; font-size: 13px; font-variant-numeric: tabular-nums;
}
.dur input:hover { border-color: var(--border-strong); }
.phase-legend { display: flex; gap: 14px; justify-content: center; margin: 0 0 12px; font-size: 11px; color: var(--text-sub); }
.phase-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: 0; }
.panel { border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; background: var(--surface-1); }
.layers { display: flex; gap: 6px; padding: 12px 16px 8px; flex-wrap: wrap; }
.layers .chip { height: 30px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.layers .chip.add { border-style: dashed; }
.tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 8px; }
.tabs button { flex: 1; height: 40px; background: none; border: 0; color: var(--text-sub); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--text); font-weight: 800; border-bottom-color: var(--accent); }
.tabpanel { flex: 1; overflow-y: auto; padding: 14px 16px 40px; }
.sec { margin-bottom: 18px; }
.sec > h3, .sub-h { font-size: 12px; color: var(--text-sub); font-weight: 700; margin: 0 0 8px; letter-spacing: .04em; }
.sub-h { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; }
textarea.textin {
  width: 100%; min-height: 76px; resize: vertical; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface-2); padding: 10px 12px; font-size: 16px; line-height: 1.4;
}
textarea.textin:focus { border-color: var(--border-strong); outline: none; box-shadow: 0 0 0 2px var(--focus); }
.fontbtn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 48px; padding: 0 12px;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); text-align: left;
}
.fontbtn .face { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fontbtn small { color: var(--text-sub); font-size: 12px; white-space: nowrap; }
.slider { margin: 10px 0 12px; }
.slider .lab { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.slider .lab > span:first-child { flex: 1; font-size: 13px; }
.slider .num {
  width: 60px; height: 28px; text-align: right; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2);
  padding: 0 6px; font-variant-numeric: tabular-nums; font-size: 13px;
}
.slider .num.bad { border-color: var(--warning); }
.slider .unit { color: var(--text-sub); font-size: 12px; min-width: 18px; }
.slider .reset { width: 24px; height: 24px; border: 0; background: none; color: var(--text-sub); padding: 0; visibility: hidden; }
.slider .reset.show { visibility: visible; }
.slider .reset svg { width: 15px; height: 15px; }
.slider .note { margin: 2px 0 0; }
input[type="range"].rng { width: 100%; margin: 6px 0 0; -webkit-appearance: none; appearance: none; background: none; height: 22px; }
input[type="range"].rng::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--text) var(--p, 0%), var(--surface-3) var(--p, 0%)); }
input[type="range"].rng::-moz-range-track { height: 4px; border-radius: 2px; background: var(--surface-3); }
input[type="range"].rng::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--text); }
input[type="range"].rng::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
input[type="range"].rng::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0; }
.row2 { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.row2 > .lbl { flex: 1; font-size: 13px; }
.swatch-btn {
  width: 36px; height: 30px; border-radius: 7px; border: 1px solid var(--border-strong); padding: 0; position: relative; overflow: hidden;
  background-color: #fff; background-image: conic-gradient(#ccc 25%, transparent 0 50%, #ccc 0 75%, transparent 0); background-size: 8px 8px;
}
.swatch-btn i { position: absolute; inset: 0; }
.palettes { display: flex; gap: 8px; flex-wrap: wrap; }
.palettes button {
  width: 40px; height: 40px; border-radius: 50%; border: 2px solid transparent; padding: 3px; background: none; display: grid; place-items: center;
}
.palettes button i { width: 100%; height: 100%; border-radius: 50%; display: block; box-shadow: 0 0 0 1px rgba(255, 255, 255, .15) inset; }
.palettes button[aria-pressed="true"] { border-color: var(--text); }
.grid-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.grid-pick.four { grid-template-columns: repeat(4, 1fr); }
.grid-pick button {
  height: 40px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-sub);
  font-size: 12.5px; font-weight: 600; padding: 0 4px; display: flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.2;
}
.grid-pick button:hover { color: var(--text); border-color: var(--border-strong); }
.grid-pick button[aria-pressed="true"] { border-color: var(--accent); color: var(--text); box-shadow: 0 0 0 1px var(--accent) inset; background: var(--surface-3); }
.grid-pick.with-mini button { height: auto; min-height: 64px; flex-direction: column; gap: 3px; padding: 6px 4px 7px; }
.grid-pick .mini-view { width: 84px; height: 40px; display: block; border-radius: 5px; background: #0c0c0c; }
.grid-pick .mini { width: 18px; height: 12px; border-radius: 3px; display: inline-block; flex: none; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 8px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.switch-h { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 4px; }
.switch-h b { font-size: 13px; }
.switch-h input { width: 18px; height: 18px; accent-color: var(--accent); }
.indent { padding-left: 2px; border-left: 2px solid var(--surface-3); padding-left: 12px; margin-left: 2px; }
details.more { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 4px; }
details.more > summary {
  list-style: none; cursor: pointer; height: 40px; display: flex; align-items: center; justify-content: space-between; color: var(--text-sub); font-weight: 700; font-size: 13px;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "＋"; font-weight: 400; }
details.more[open] > summary::after { content: "－"; }
details.more > summary:hover { color: var(--text); }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-sub); margin: 8px 0; }
.field select, .field input {
  height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); padding: 0 10px; font-size: 14px; color: var(--text);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid2 .wide { grid-column: 1 / -1; }
.note { color: var(--text-sub); font-size: 12px; margin: 6px 0; line-height: 1.5; }
.note.warn, p.warn { color: var(--warning); }
p.warn { font-size: 13px; background: rgba(255, 176, 32, .08); border: 1px solid rgba(255, 176, 32, .35); border-radius: 8px; padding: 8px 10px; }
.plates-list { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.empty-plate { color: var(--text-sub); font-size: 13px; margin: 0 0 10px; }
.tabbar { display: none; }
.toast {
  position: fixed; left: 50%; bottom: 104px; transform: translateX(-50%); z-index: 50; max-width: min(420px, calc(100vw - 32px));
  background: var(--surface-3); color: var(--text); border-radius: 10px; padding: 10px 14px; border-left: 4px solid var(--text-sub);
  display: flex; align-items: center; gap: 12px; font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
.toast.ok { border-left-color: var(--success); } .toast.warn { border-left-color: var(--warning); } .toast.err { border-left-color: var(--danger); }
.toast button { border: 0; background: none; color: var(--text); font-weight: 800; text-decoration: underline; white-space: nowrap; }
.pop {
  position: fixed; z-index: 60; width: 272px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, .55);
}
.pop-label { margin: 6px 0 6px; font-size: 11.5px; color: var(--text-sub); font-weight: 700; }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.swatches button { aspect-ratio: 1; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .14); padding: 0; }
.swatches button:hover { transform: scale(1.1); }
.swatches button[aria-pressed="true"] { outline: 2px solid var(--text); outline-offset: 1px; }
.cp-row { display: flex; gap: 8px; margin-top: 12px; }
.cp-native { flex: 1; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; font-size: 12.5px; }
.cp-native input { width: 22px; height: 22px; border: 0; padding: 0; background: none; }
.cp-hex { display: flex; align-items: center; gap: 2px; height: 34px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-1); width: 108px; }
.cp-hex span { color: var(--text-sub); }
.cp-hex input { width: 100%; border: 0; background: none; outline: none; font-family: ui-monospace, Consolas, monospace; text-transform: uppercase; }
.cp-alpha { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--text-sub); }
.cp-alpha input { flex: 1; accent-color: var(--text); }
.cp-alpha output { width: 36px; text-align: right; font-variant-numeric: tabular-nums; }
dialog.sheet {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--border-strong);
  border-radius: 16px; background: var(--surface-1); color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, .6); overflow: auto;
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, .6); }
dialog.export { width: min(680px, calc(100vw - 32px)); }
.dlg-head { position: sticky; top: 0; z-index: 2; background: var(--surface-1); display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px 20px; }
.dlg-head h2 { margin: 0; font-size: 18px; }
dialog .chips { padding: 4px 20px 10px; }
.dlg-foot { padding: 12px 20px 20px; }
.dlg-foot.row { display: flex; justify-content: flex-end; gap: 8px; }
.dlg-foot.col { display: flex; flex-direction: column; gap: 8px; }
dialog .field, dialog .note, dialog .help, dialog .summary, dialog .howto, dialog details.more, dialog p.warn { margin-left: 20px; margin-right: 20px; }
.font-list { padding: 0 12px; display: flex; flex-direction: column; gap: 4px; max-height: 52vh; overflow-y: auto; }
.font-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px;
  border: 1px solid transparent; background: none;
}
.font-row:hover { background: var(--surface-2); }
.font-row[aria-selected="true"] { border-color: var(--accent); background: var(--surface-2); }
.font-row .face { flex: 1; font-size: 26px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.font-row small { color: var(--text-sub); font-size: 12px; text-align: right; white-space: nowrap; }
.font-row small b { display: block; color: var(--text); font-size: 13px; }
.dest { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 4px 20px 4px; }
.dest button {
  text-align: left; padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); min-height: 108px;
  display: flex; flex-direction: column; gap: 4px;
}
.dest button:hover { border-color: var(--border-strong); background: var(--surface-3); }
.dest button[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.dest b { font-size: 14px; }
.dest small { color: var(--text-sub); font-size: 12px; line-height: 1.5; }
.dest .fmt { margin-top: auto; font-size: 11px; color: var(--text); background: var(--surface-1); border-radius: 999px; padding: 2px 8px; align-self: flex-start; }
.dest button:disabled { opacity: .45; }
.frame-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 20px 12px; }
.frame-pick button { text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; gap: 2px; }
.frame-pick button[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.frame-pick b { font-size: 14px; } .frame-pick small { color: var(--text-sub); font-size: 12px; font-variant-numeric: tabular-nums; }
.frame-pick button:disabled { opacity: .45; }
.safe-note { margin-top: 12px !important; margin-bottom: 20px !important; }
.summary { background: var(--surface-2); border-radius: 12px; padding: 14px 16px; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13px; }
.summary dt { color: var(--text-sub); } .summary dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.howto { font-size: 13px; color: var(--text-sub); margin-top: 12px; }
.howto b { color: var(--text); display: block; margin-bottom: 4px; font-size: 13px; }
.howto ol { margin: 0; padding-left: 20px; }
.progress-view { padding: 4px 20px 12px; display: grid; place-items: center; }
.progress-view canvas { max-width: 100%; max-height: 40vh; border-radius: 8px; background-size: 16px 16px; }
.bar { margin: 0 20px; height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent-grad); transition: width .15s; }
.progress-text { display: flex; justify-content: space-between; margin: 8px 20px 0; font-variant-numeric: tabular-nums; font-weight: 700; }
.progress-text span:last-child { color: var(--text-sub); font-weight: 500; }
.done-title {
  margin: 8px 20px 4px; font-size: 26px; font-weight: 900; background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.done-file { margin: 0 20px; color: var(--text-sub); font-size: 13px; word-break: break-all; }
.sister { margin: 4px 20px 20px; font-size: 12px; color: var(--text-sub); }
.help .steps { padding-left: 20px; } .help .steps li { margin: 6px 0; }
.help h3 { font-size: 14px; margin: 18px 0 8px; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 13px; }
.keys dt { font-family: ui-monospace, Consolas, monospace; color: var(--text); font-size: 12px; }
.keys dd { margin: 0; color: var(--text-sub); }
.help p { color: var(--text-sub); font-size: 13px; }
.help { padding-bottom: 20px; }
@media (max-width: 1279px) {
  .app { grid-template-columns: 200px minmax(420px, 1fr) 320px; }
  .cards { grid-template-columns: 1fr; }
}
@media (max-width: 1023px) {
  .top { height: 48px; padding: 0 8px 0 12px; gap: 8px; }
  .brand span { display: none; }
  .seg.aspect span { padding: 0 9px; } .seg.aspect small, .seg.aspect .ar { display: none; }
  #helpBtn, #redo, .reopen { display: none !important; }
  .top-actions { gap: 2px; }
  body { overflow-x: hidden; }
  .top-actions .btn.primary { height: 36px; padding: 0 12px; }
  .top-actions .btn.primary svg { display: none; }
  .app {
    height: calc(100dvh - 48px - 64px - env(safe-area-inset-bottom)); display: flex; flex-direction: column; grid-template-columns: none;
  }
  .stage-col { flex: none; height: 42%; order: -1; }
  .app.vertical .stage-col { height: 50%; }
  .app.sheet-low .stage-col { height: 62%; }
  .app.typing .stage-col { height: 28%; }
  .stage-area { padding: 10px; }
  .transport { padding: 4px 12px 6px; }
  .phase-legend { display: none; }
  .tpl, .panel { flex: 1; border: 0; border-top: 1px solid var(--border); min-height: 0; }
  .tpl { display: none; } .panel { display: none; }
  .app[data-m="tpl"] .tpl { display: flex; }
  .app:not([data-m="tpl"]) .panel { display: flex; }
  .tpl .pane-head { display: none; }
  .tpl .chips { flex-wrap: nowrap; overflow-x: auto; padding-top: 10px; scrollbar-width: none; }
  .cards { grid-template-columns: repeat(3, 1fr); padding: 4px 12px 16px; gap: 8px; }
  .tabs { display: none; }
  .tabpanel { padding: 10px 14px 24px; }
  .layers { padding: 10px 14px 4px; flex-wrap: nowrap; overflow-x: auto; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface-1); border-top: 1px solid var(--border);
  }
  .tabbar button { background: none; border: 0; color: var(--text-sub); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; }
  .tabbar button svg { width: 24px; height: 24px; }
  .tabbar button[aria-selected="true"] { color: var(--accent); }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
  body { font-size: 15px; }
  .dest { grid-template-columns: 1fr; }
  .dest button { min-height: 0; }
  dialog.sheet { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 16px 16px 0 0; border-bottom: 0; }
  .slider .reset { width: 32px; height: 32px; }
  input[type="range"].rng { height: 32px; }
  input[type="range"].rng::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -11px; }
  .selbox span { width: 22px; height: 22px; }
  .selbox .h-size { right: -12px; bottom: -12px; }
  .selbox .h-rot { margin-left: -11px; top: -40px; }
  .selbox .h-rot::after { left: 8px; top: 18px; height: 18px; }
  .grid-pick button { height: 44px; }
  .coach { white-space: normal; width: max-content; max-width: 92%; }
  .hint { white-space: normal; width: 92%; flex-wrap: wrap; justify-content: center; }
}
@media (max-width: 480px) {
  #loopBtn { display: none; }
  .transport { gap: 6px; }
  .time { min-width: 36px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
body.docpage { overflow: auto; }
.doc { max-width: 760px; margin: 0 auto; padding: 24px 20px 60px; }
.doc h1 { font-size: 24px; } .doc h2 { font-size: 17px; margin-top: 28px; }
.doc p { color: #d8d8d8; line-height: 1.8; }
.doc .date { color: var(--text-sub); }
.foot { max-width: 760px; margin: 0 auto; padding: 20px; border-top: 1px solid var(--border); color: var(--text-sub); font-size: 13px; display: flex; justify-content: space-between; }
.foot nav { display: flex; gap: 16px; }
