/* Layout: stage (canvas + transport + timeline) on the left, tabbed panel on the right; stacks on phones */
:root {
  --bg: #f6f4ec;
  --surface: #ffffff;
  --surface-2: #faf8f1;
  --ink: #221e14;
  --muted: #756d58;
  --line: #e6dfcc;
  --accent: #f2b705;
  --accent-soft: #fcf0c6;
  --accent-ink: #241b00;
  --accent-text: #8a6100;
  --cue: #d2477a;
  --stage-top: #f2ede0;
  --stage-bottom: #dcd1b3;
  --warn: #c2410c;
  --font-display: "Dela Gothic One", "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-body: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16140f; --surface: #201d16; --surface-2: #28241b; --ink: #f2eee2; --muted: #aaa18a;
    --line: #3a3426; --accent: #ffcf33; --accent-soft: #3a3014; --accent-ink: #1d1600; --accent-text: #ffd54d; --cue: #ff7aa6;
    --stage-top: #25211a; --stage-bottom: #100e0a; --warn: #ff8a4c; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16140f; --surface: #201d16; --surface-2: #28241b; --ink: #f2eee2; --muted: #aaa18a;
    --line: #3a3426; --accent: #ffcf33; --accent-soft: #3a3014; --accent-ink: #1d1600; --accent-text: #ffd54d; --cue: #ff7aa6;
    --stage-top: #25211a; --stage-bottom: #100e0a; --warn: #ff8a4c; color-scheme: dark;
}
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 14px; line-height: 1.6; padding-top: env(safe-area-inset-top, 0px); }
* { box-sizing: border-box; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.app { height: 100%; display: grid; grid-template-rows: auto 1fr; padding: 12px 16px; gap: 12px; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.logo { font-family: var(--font-display); font-size: 20px; margin: 0; line-height: 1.2; display: flex; align-items: center; gap: 10px; }
.logo img { width: 30px; height: 30px; }
.logo small { font-family: var(--font-body); font-size: 12px; color: var(--muted); font-weight: 500; }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; align-items: center; }
.file-btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px 5px 6px; cursor: pointer; max-width: 260px; }
.file-btn:hover { border-color: var(--accent); }
.file-btn .tag { font-size: 11px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; white-space: nowrap; }
.file-btn.loaded .tag { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.file-btn .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.file-btn input { display: none; }
.work-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 14px; cursor: pointer; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.work-btn:hover { border-color: var(--accent); }
.work-btn .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cue); }

.main { display: grid; grid-template-columns: minmax(0, 56fr) minmax(340px, 44fr); gap: 12px; min-height: 0; }
.stage { position: relative; border-radius: var(--r); overflow: hidden; background: linear-gradient(var(--stage-top), var(--stage-bottom)); display: grid; grid-template-rows: 1fr auto; min-height: 0; }
.viewport { position: relative; min-height: 0; overflow: hidden; }
.frame-box { position: absolute; box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 18%, transparent), 0 6px 24px rgb(0 0 0 / .12); background-size: cover; background-position: center; }
.frame-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#overlay { pointer-events: none; }
.drop-hint { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; overflow: auto; }
.drop-card { max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; display: grid; gap: 12px; }
.drop-card h2 { margin: 0; font-size: 16px; }
.drop-card ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 13px; }
.drop-card p { margin: 0; color: var(--muted); font-size: 12.5px; }
.drop-card .row { gap: 8px; }
.stage.dragging::after { content: "ここにドロップ"; position: absolute; inset: 8px; border: 2px dashed var(--accent); border-radius: var(--r); display: grid; place-items: center; font-weight: 700; color: var(--accent-text); background: color-mix(in srgb, var(--surface) 70%, transparent); z-index: 5; }
.hud { position: absolute; left: 10px; top: 10px; display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none; }
.chip { font-size: 12px; background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.chip.on { border-color: var(--cue); color: var(--cue); }
.view-tools { position: absolute; right: 10px; top: 10px; display: flex; gap: 6px; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; color: var(--muted); background: color-mix(in srgb, var(--bg) 60%, transparent); z-index: 4; text-align: center; padding: 16px; }

.transport { background: var(--surface); border-top: 1px solid var(--line); padding: 10px 12px 12px; display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.play { width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--accent); color: var(--accent-ink); cursor: pointer; display: grid; place-items: center; flex: none; }
.play:disabled { opacity: .4; cursor: default; }
.play svg { width: 16px; height: 16px; fill: currentColor; }
.frame { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 13px; }
.frame b { font-size: 18px; font-weight: 500; }
.ghost { border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: 12.5px; }
.ghost:hover { border-color: var(--accent); }
.ghost:disabled { opacity: .45; cursor: default; }
.ghost[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.primary { border: none; background: var(--accent); color: var(--accent-ink); border-radius: 8px; padding: 8px 16px; cursor: pointer; font-weight: 700; }
.primary:disabled { opacity: .45; cursor: default; }
.timeline { position: relative; max-height: 170px; overflow-y: auto; border-radius: 6px; background: var(--surface-2); }
.timeline canvas { display: block; width: 100%; touch-action: none; cursor: pointer; }
.seg { display: inline-flex; }
.seg .ghost { border-radius: 0; margin-left: -1px; }
.seg .ghost:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.seg .ghost:last-child { border-radius: 0 8px 8px 0; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); display: grid; grid-template-rows: auto 1fr; min-height: 0; }
.tabs { display: flex; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: none; border-bottom: 2px solid transparent; flex: 1 0 auto; padding: 11px 8px 9px; font-size: 13px; white-space: nowrap; cursor: pointer; font-weight: 500; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab-body { overflow-y: auto; padding: 16px; display: grid; gap: 18px; align-content: start; min-height: 0; }
.group { display: grid; gap: 10px; }
.group h3 { margin: 0; font-size: 12px; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.lead { margin: 0; font-size: 12.5px; color: var(--muted); }
.field { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.field label { font-size: 13px; }
.field output { font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
.field input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); margin: 0; }
.field .help { grid-column: 1 / -1; font-size: 11.5px; color: var(--muted); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
select.sel, input.txt { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 4px 8px; font-size: 13px; min-width: 0; }
.mini { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 1px 7px; font-size: 11.5px; cursor: pointer; white-space: nowrap; }
.mini:hover { border-color: var(--accent); }
.empty { color: var(--muted); font-size: 12.5px; border: 1px dashed var(--line); border-radius: 8px; padding: 12px; margin: 0; }

/* parameter sliders */
.prm { display: grid; grid-template-columns: minmax(0, 1fr) auto 28px; gap: 0 8px; align-items: center; padding: 4px 6px; border-radius: 8px; }
.prm.sel { background: var(--accent-soft); }
.prm-name { background: none; border: none; padding: 0; text-align: left; font-size: 13px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prm output { font-family: var(--font-mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.prm input[type=range] { grid-column: 1 / 3; width: 100%; accent-color: var(--accent); margin: 0; }
.prm .key { grid-row: 1 / 3; grid-column: 3; width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; padding: 0; display: grid; place-items: center; color: var(--muted); }
.prm .key svg { width: 12px; height: 12px; }
.prm .key[data-state="has"] { color: var(--accent-text); }
.prm .key[data-state="on"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.prm.live input[type=range] { accent-color: var(--cue); }
.keys { display: grid; gap: 6px; }
.k { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; display: grid; gap: 4px; background: var(--surface-2); }
.k-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; }
.k-row select { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 2px 4px; font-size: 12px; }
.k-row .x { margin-left: auto; }

/* parts list */
.layers { display: grid; gap: 2px; max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.ly { display: grid; grid-template-columns: 22px minmax(0, 1fr) minmax(0, 46%); gap: 6px; align-items: center; padding: 3px 6px; border-radius: 6px; cursor: pointer; }
.ly:hover { background: var(--surface-2); }
.ly.sel { background: var(--accent-soft); }
.ly input[type=checkbox] { accent-color: var(--accent); margin: 0; }
.ly .nm { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ly .nm small { color: var(--muted); margin-left: 4px; }
.ly select { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 2px 4px; font-size: 12px; }
.detail { border: 1px solid var(--accent); border-radius: 8px; padding: 10px 12px; display: grid; gap: 10px; }
.detail h4 { margin: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); }
.modal { position: fixed; inset: 0; background: color-mix(in srgb, var(--bg) 55%, transparent); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal-card { width: min(480px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: grid; gap: 14px; }
.modal-card h2 { margin: 0; font-size: 17px; }
.works { display: grid; gap: 6px; }
.work { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.work.cur { border-color: var(--accent); }
.work span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.work small { color: var(--muted); margin-left: 8px; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; font-size: 13px; max-width: calc(100% - 32px); z-index: 30; }


/* additions for 2D action */
.chip-x { border: none; background: var(--surface-2); color: var(--muted); width: 20px; height: 20px; border-radius: 50%; line-height: 1; padding: 0; cursor: pointer; flex: none; margin-right: -4px; }
.chip-x:hover { background: var(--accent); color: var(--accent-ink); }
.kv { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 4px 10px; align-items: center; font-size: 13px; }
.kv select, .kv input { width: 100%; }
.mini-in { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.txt.num { width: 76px; font-family: var(--font-mono); }
.color-row { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.color-row input[type=color] { width: 40px; height: 28px; border: 1px solid var(--line); border-radius: 6px; padding: 0; background: none; }
.credit-list { display: grid; gap: 8px; }
.credit { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; gap: 6px; background: var(--surface-2); }
.credit .k-row input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 4px 7px; font-family: "Cinzel", serif; letter-spacing: .04em; }
.credit textarea { width: 100%; min-height: 54px; resize: vertical; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 5px 7px; font: inherit; font-size: 13px; }
.credit-overlay { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; cursor: pointer; }
details.group > summary { cursor: pointer; font-size: 12px; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.psec { font-size: 12px; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 10px 6px 2px; }
.psec:first-child { margin-top: 0; }
.ly.folder { grid-template-columns: 22px minmax(0, 1fr) auto; }
.ly.folder .nm { font-weight: 700; }
.ly .tw { background: none; border: none; padding: 0 4px; cursor: pointer; color: var(--muted); font-size: 11px; }
.ly.multi { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.k.sel { border-color: var(--accent); }
.k .k-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k input.txt { min-width: 0; }
.tag-s { font-size: 11px; border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; color: var(--muted); white-space: nowrap; }
.tag-s.on { border-color: var(--accent); color: var(--accent-text); }
.work .thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--line); }
.work.model { grid-template-columns: 44px minmax(0, 1fr); }
.work.model .btns { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.form-grid { display: grid; gap: 6px; }
.keychips { display: flex; flex-wrap: wrap; gap: 4px; }
.keychips button { font-family: var(--font-mono); }
.keychips button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.warn { color: var(--warn); font-size: 12.5px; margin: 0; }
.panel .primary { justify-self: start; }

/* modeling steps */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; position: sticky; top: -16px; z-index: 2; background: var(--surface); padding: 4px 0 8px; margin-top: -4px; }
.steps button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 6px 4px; cursor: pointer; display: grid; justify-items: center; gap: 2px; font-size: 12px; position: relative; }
.steps button b { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); font-size: 11px; }
.steps button[aria-current="step"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.steps button[aria-current="step"] b { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.steps button i { position: absolute; top: 3px; right: 5px; font-style: normal; color: var(--accent-text); font-size: 12px; }
.steps button.done i::after { content: "☑"; }
.step { display: grid; gap: 14px; align-content: start; }
.cards { display: grid; gap: 8px; }
.card { border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.card.unsure { border-color: var(--warn); }
.card.drop-on, .tree .drop-on { outline: 2px dashed var(--accent); outline-offset: 2px; background: var(--accent-soft); }
.card-h { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; }
.card-h b { flex: 1; min-width: 0; font-size: 13px; }
.card-h .n { font-size: 12px; color: var(--muted); font-family: var(--font-mono); }
.card-b { display: grid; gap: 2px; padding: 0 6px 8px; }
.prow { display: grid; grid-template-columns: 18px 18px minmax(0, 1fr) 54px minmax(0, 34%) 26px; gap: 6px; align-items: center; padding: 3px 4px; border-radius: 6px; font-size: 12.5px; }
.prow:hover { background: var(--surface); }
.prow .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .nm small { color: var(--muted); margin-left: 4px; }
.prow input[type=checkbox] { accent-color: var(--accent); margin: 0; }
.prow select, .card-h select { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 2px 4px; font-size: 12px; }
.fold-h { font-size: 11.5px; color: var(--muted); padding: 6px 4px 2px; display: flex; gap: 6px; align-items: center; }
.fold-h select { width: auto; flex: 1; }
.grip { cursor: grab; color: var(--muted); user-select: none; touch-action: none; text-align: center; letter-spacing: -2px; font-size: 13px; }
.drag-ghost { position: fixed; z-index: 50; pointer-events: none; background: var(--accent); color: var(--accent-ink); border-radius: 8px; padding: 4px 10px; font-size: 12.5px; box-shadow: 0 6px 20px rgb(0 0 0 / .2); transform: translate(10px, 8px); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; }
.chips button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.chips button.done::before { content: "☑ "; }
.tree { display: grid; gap: 6px; }
.tnode { border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; display: grid; gap: 4px; background: var(--surface-2); }
.tnode > .th { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.tnode > .th b { flex: 1; }
.tnode .kids { display: grid; gap: 4px; margin-left: 12px; }
.titem { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 6px; align-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 4px 8px; font-size: 12.5px; }
.titem .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.titem.def { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.titem .sub { grid-column: 1 / -1; display: grid; gap: 2px; padding-left: 18px; }
.tnote { font-size: 11.5px; color: var(--muted); }

.prow .nm .tag-s { margin-left: 4px; font-size: 10.5px; padding: 0 5px; }
.prow .gear { padding: 1px 4px; }
.prow .gear[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.prow-d { grid-column: 1 / -1; display: grid; gap: 6px; margin: 2px 0 6px 24px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.clip-zone { display: grid; gap: 6px; padding: 6px; border: 1px dashed var(--line); border-radius: 8px; }
.chips-s { display: flex; flex-wrap: wrap; gap: 4px; }
.chips-s .tag-s { display: inline-flex; align-items: center; gap: 4px; }
.chips-s .chip-x { width: 16px; height: 16px; font-size: 11px; margin: 0; }
.mask-pick { display: grid; gap: 6px; border: 1px solid #2b7bff; border-radius: 8px; padding: 6px; background: var(--surface); }
.mask-list { max-height: 240px; overflow-y: auto; display: block; }
.mask-g { font-size: 11.5px; color: var(--muted); font-weight: 700; padding: 6px 4px 2px; }
.mask-it { display: block; width: 100%; text-align: left; border: none; background: none; padding: 4px 8px; border-radius: 6px; font-size: 12.5px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mask-it small { color: var(--muted); margin-left: 6px; }
.mask-it:hover, .mask-it:focus-visible { background: rgba(43,123,255,.14); color: #1f5fd6; outline: none; }
.prm .pkeys { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.prm .pkeys:empty { display: none; }
.prm .pkeys button { font-family: var(--font-mono); }
.prm .pkeys button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.prm .pkeys .add { font-family: var(--font-body); color: var(--muted); }
.prm.bound { background: var(--accent-soft); }
.xypad { display: grid; grid-template-columns: repeat(3, 56px); gap: 6px; }
.xypad button { height: 44px; font-size: 18px; position: relative; padding: 0; }
.xypad button i { position: absolute; top: 2px; right: 4px; font-style: normal; font-size: 10px; color: var(--accent-text); }
.xypad button[aria-pressed="true"] i { color: var(--accent-text); }
.xythumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 112px)); gap: 6px; }
.xythumbs button { padding: 3px; display: grid; justify-items: center; gap: 2px; font-size: 11.5px; border-radius: 10px; }
.xythumbs canvas { width: 100%; height: auto; aspect-ratio: 1; border-radius: 6px; background: var(--bg); display: block; }
.xythumbs button[aria-pressed="true"] { outline: 2px solid var(--accent); }
.k.warn-k { border-color: var(--warn); }
.k.ok-k { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }

@media (max-width: 860px) {
  html, body { height: auto; }
  .app { height: auto; }
  .main { grid-template-columns: minmax(0, 1fr); }
  .stage { height: 66vh; min-height: 440px; }
  .tab-body { overflow: visible; }
  .files { margin-left: 0; }
  .layers { max-height: 60vh; }
}

/* 顔の向きづくり (index.html?tool=face): only the stage and the tool's panel */
.tool-face .top .files, .tool-face .tabs { display: none; }
.tool-face .panel { grid-template-rows: 1fr; }
.tool-face #faceTool .xythumbs { grid-template-columns: repeat(3, minmax(0, 120px)); }
.ftparts { display: flex; flex-wrap: wrap; gap: 6px; }
.ftparts button[aria-pressed="true"] { outline: 2px solid var(--accent); }
.tool-cover { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(3px); }
.tool-cover[hidden] { display: none; }
.tool-face .tab-body:not(#faceTool) { display: none !important; }
.tool-face .transport, .tool-face #chipKey, .tool-face #chipModel, .tool-face #chipCam { display: none !important; }
.prow.drop-above { box-shadow: inset 0 3px 0 var(--accent); }
.prow.drop-below { box-shadow: inset 0 -3px 0 var(--accent); }
.prow .drawno { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 2px 4px; font-size: 12px; font-variant-numeric: tabular-nums; }
.prow.prow-gone { grid-template-columns: 18px 18px minmax(0, 1fr) auto; }
.card-h .gvis { accent-color: var(--accent); margin: 0; }
.card-h.drop-above { box-shadow: inset 0 3px 0 var(--accent); }
.card-h.drop-below { box-shadow: inset 0 -3px 0 var(--accent); }
