/* soyukke.com と同じ色と書体 (紙・墨・橙、Martian Mono)。画面いっぱいの道具で、ページはスクロールしない。 */
@font-face {
  font-family: 'Martian Mono Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url(/fonts/martian-mono-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  --paper: #f2f0e9;
  --ink: #141412;
  --muted: #8b887d;
  --rule: #cfccc0;
  --accent: #ff4d00;
  --mono: 'Martian Mono Variable', ui-monospace, 'SF Mono', Menlo, monospace;
  --jp: 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
  --tap: 44px;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #111110; --ink: #ecebe4; --muted: #77756c; --rule: #2e2d29; }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { background: var(--paper); color: var(--ink); font-family: var(--mono), var(--jp); font-size: 13px; line-height: 1.5; -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.app { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }

/* 上の帯 */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; }
.mark { font-weight: 800; font-stretch: 75%; font-size: 22px; letter-spacing: -0.05em; text-decoration: none; }
.slash { color: var(--accent); }
.bar__right { display: flex; gap: 6px; align-items: center; }
.btn { min-height: 36px; padding: 0 12px; border: 1px solid var(--rule); border-radius: 999px; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn[aria-pressed=true] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--icon { width: 36px; padding: 0; }
.btn--icon svg circle { fill: currentColor; stroke: none; }
.btn--go { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn--go:hover { border-color: var(--accent); filter: brightness(1.08); }
.count { font-size: 11px; background: rgba(0,0,0,.22); border-radius: 999px; padding: 0 6px; }

/* 編集の画面 */
.stage { position: relative; overflow: hidden; margin: 0 12px; border-radius: 14px; background: #000; touch-action: none; }
#editor { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
#editor.move { cursor: grab; }
.empty { position: absolute; inset: 0; margin: auto; width: min(80%, 340px); height: 150px; border: 2px dashed rgba(242,240,233,.5); border-radius: 14px; background: rgba(17,17,16,.55); color: #f2f0e9; cursor: pointer; display: grid; place-content: center; gap: 6px; backdrop-filter: blur(4px); }
.empty__big { font-size: 20px; font-weight: 700; }
.empty__small { font-size: 12px; opacity: .75; }
.hint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); margin: 0; max-width: calc(100% - 24px); width: max-content; padding: 6px 12px; border-radius: 999px; background: rgba(17,17,16,.78); color: #f2f0e9; font-size: 12px; text-align: center; pointer-events: none; backdrop-filter: blur(4px); }
.hint:empty { display: none; }
.hint.warn { background: var(--accent); color: #fff; }

/* 下の道具 */
.dock { display: flex; align-items: center; gap: 10px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); flex-wrap: wrap; justify-content: center; }
.stepper { display: flex; align-items: center; border: 1px solid var(--rule); border-radius: 999px; height: var(--tap); }
.stepper button { width: var(--tap); height: 100%; border: 0; background: none; font-size: 20px; cursor: pointer; border-radius: 999px; }
.stepper__n { min-width: 3.4em; text-align: center; }
.stepper__n b { font-size: 16px; }
.tools { display: flex; gap: 4px; }
.tools button { width: 58px; height: 52px; border: 1px solid transparent; border-radius: 12px; background: none; cursor: pointer; display: grid; place-items: center; align-content: center; gap: 2px; font-size: 11px; padding: 0; }
.tools button svg { width: 22px; height: 22px; }
.tools button svg .fill { fill: currentColor; fill-opacity: .35; }
.tools button[aria-checked=true] { background: var(--ink); color: var(--paper); }
.tools button:disabled { opacity: .3; cursor: default; }
.knob { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.knob input { width: 130px; accent-color: var(--accent); }
@media (max-width: 560px) {
  .bar { padding: 6px 10px; }
  .mark { font-size: 20px; }
  .stage { margin: 0 8px; }
  .dock { gap: 8px 6px; padding-top: 8px; }
  .knob { order: 3; flex-basis: 100%; justify-content: center; }
  .knob input { flex: 1; max-width: 320px; }
  .tools button { width: 52px; }
}

/* 設定 (PC では右上に、スマホでは下から出す) */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 10; }
.sheet__body { position: absolute; top: 56px; right: 12px; width: 320px; max-height: calc(100dvh - 72px); overflow: auto; background: var(--paper); border: 1px solid var(--rule); border-radius: 14px; padding: 16px; display: grid; gap: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
@media (max-width: 560px) {
  .sheet__body { top: auto; right: 0; left: 0; bottom: 0; width: auto; border-radius: 16px 16px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}
.field { display: grid; gap: 8px; }
.field__k { color: var(--muted); font-size: 11px; }
.seg, .chips, .row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.seg button, .chips button { min-height: 32px; padding: 0 10px; border: 1px solid var(--rule); border-radius: 999px; background: none; cursor: pointer; font-size: 12px; }
.seg button[aria-checked=true] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 18px; height: 18px; }
input[type=number], select { background: transparent; border: 1px solid var(--rule); border-radius: 8px; padding: 6px 8px; }
input[type=number] { width: 6em; }
input[type=range] { accent-color: var(--accent); }
#aspect { flex: 1; }
.sheet__foot { margin: 0; font-size: 11px; color: var(--muted); display: flex; gap: 12px; }
