:root {
  --bg: #f4f1ea;
  --card: #ffffff;
  --ink: #1f2228;
  --muted: #6b7079;
  --line: #e2ddd2;
  --accent: #d63031;
  --gold: #f0b428;
  --chip: #f2efe8;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17191d; --card: #212429; --ink: #eceef1; --muted: #9aa0a9; --line: #33373e; --chip: #2b2f35;
  }
}
:root[data-theme="dark"] {
  --bg: #17191d; --card: #212429; --ink: #eceef1; --muted: #9aa0a9; --line: #33373e; --chip: #2b2f35;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 "Noto Sans JP", system-ui, sans-serif;
}
header, main, footer { max-width: 980px; margin: 0 auto; padding: 0 16px; }
header { padding-top: 28px; }
h1 { margin: 0; font-size: 28px; font-weight: 900; letter-spacing: -0.01em; }
h1 span { font-size: 15px; font-weight: 700; color: var(--muted); margin-left: 6px; }
.lede { color: var(--muted); margin: 6px 0 20px; }
main { display: grid; grid-template-columns: minmax(0, 460px) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 760px) { main { grid-template-columns: 1fr; } }
.stage { position: sticky; top: 16px; }
@media (max-width: 760px) { .stage { position: static; } }
canvas { width: 100%; max-width: 480px; aspect-ratio: 480 / 430; display: block; border-radius: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.15); background: #e9e5dc; margin: 0 auto; }
.playbar { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.playbar input { flex: 1; accent-color: var(--accent); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 18px 14px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 4px 0 10px; }
h2:not(:first-child) { margin-top: 22px; }
ol#steps { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; counter-reset: s; }
ol#steps li { counter-increment: s; display: grid; grid-template-columns: 26px auto auto 1fr auto; gap: 8px; align-items: center; background: var(--chip); border-radius: 10px; padding: 8px; }
ol#steps li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--card); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
@media (max-width: 480px) {
  ol#steps li { grid-template-columns: 26px auto 1fr auto; }
  ol#steps li .nums { grid-column: 2 / -1; grid-row: 2; }
}
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--card); }
.seg button { white-space: nowrap; border: 0; background: transparent; color: var(--ink); padding: 6px 10px; font: inherit; font-weight: 700; cursor: pointer; min-height: 34px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--card); }
.seg i { display: block; width: 22px; height: 22px; border-radius: 5px; border: 1px solid rgba(0,0,0,.2); }
.seg:not(.text) button[aria-pressed="true"] { background: var(--gold); }
select { min-width: 84px; }
select, input:not([type="range"]) { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px; min-height: 34px; width: 100%; }
.nums { display: grid; grid-template-columns: repeat(5, 28px); gap: 3px; }
.nums button { width: 28px; height: 30px; border-radius: 7px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 800; cursor: pointer; padding: 0; }
.nums button[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.del { border: 0; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; width: 30px; height: 30px; border-radius: 8px; }
.del:hover { background: var(--line); }
.row { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; }
.row label { flex: 1 1 140px; display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 700; }
.field { display: grid; gap: 4px; }
.lbl { font-size: 13px; color: var(--muted); font-weight: 700; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
button.primary, button.secondary, button.ghost { font: inherit; font-weight: 800; border-radius: 10px; padding: 10px 16px; cursor: pointer; border: 1px solid transparent; }
button.primary { background: var(--accent); color: #fff; }
button.primary:disabled { opacity: .6; cursor: progress; }
button.secondary { background: var(--ink); color: var(--card); }
button.ghost { background: var(--card); color: var(--ink); border-color: var(--line); padding: 7px 12px; }
button.small { font-size: 14px; }
.status { min-height: 1.5em; color: var(--muted); font-size: 14px; margin: 10px 0 0; }
footer { color: var(--muted); font-size: 13px; padding-top: 24px; padding-bottom: 32px; }
