/* Inter Medium (500) – same files are embedded into SVG/PNG exports (see js/export.js) */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: local('Inter Medium'), local('Inter-Medium'),
       url('https://cdn.jsdelivr.net/npm/@fontsource/inter@5.1.1/files/inter-latin-500-normal.woff2') format('woff2');
  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;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('https://cdn.jsdelivr.net/npm/@fontsource/inter@5.1.1/files/inter-greek-500-normal.woff2') format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

:root {
  --bg: #f3f3ef;
  --panel: #fafaf7;
  --line: #e1e1db;
  --text: #1b1c20;
  --muted: #74757c;
  --accent: #1f3fbf;
  --red: #d42222;
  --stage: #d8d9d4;
  --radius: 8px;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 500;
  font-size: 13px;
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }

.app { display: grid; grid-template-columns: 360px 1fr; height: 100vh; }

/* ---------- panel ---------- */
.panel { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; }
.brand { display: flex; gap: 12px; align-items: center; padding: 18px 18px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 2; }
.brand .logo { font-size: 28px; color: var(--accent); line-height: 1; }
.brand h1 { margin: 0; font-size: 16px; font-weight: 500; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

details.section { border-bottom: 1px solid var(--line); }
details.section > summary { list-style: none; cursor: pointer; padding: 13px 18px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; }
details.section > summary::after { content: '+'; }
details.section[open] > summary::after { content: '−'; }
details.section > summary::-webkit-details-marker { display: none; }
.section-body { padding: 0 18px 16px; display: flex; flex-direction: column; gap: 6px; }

.sub { margin: 10px 0 2px; font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.hint { margin: 0 0 4px; color: var(--muted); font-size: 12px; line-height: 1.4; }

.ctl { display: grid; grid-template-columns: 104px 1fr 44px; align-items: center; gap: 8px; min-height: 26px; }
.ctl > label { color: #44454b; font-size: 12px; }
.ctl output { font-variant-numeric: tabular-nums; font-size: 12px; text-align: right; color: var(--muted); }
.ctl input[type=range] { width: 100%; accent-color: var(--accent); }
.ctl select, .ctl input[type=number], .ctl input[type=text] { grid-column: 2 / 4; width: 100%; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.ctl input[type=color] { grid-column: 2 / 4; width: 100%; height: 26px; border: 1px solid var(--line); border-radius: 6px; padding: 2px; background: #fff; }

.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.toggle { display: flex; gap: 8px; align-items: center; font-size: 12px; cursor: pointer; min-height: 24px; }
.toggle input { accent-color: var(--accent); }

.row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 5px 10px; cursor: pointer; font-size: 12px; }
.btn:hover { border-color: #b9bac0; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.icon { padding: 3px 7px; min-width: 28px; }
.btn.on { background: #eef1fb; border-color: var(--accent); color: var(--accent); }
.btn.danger:hover { border-color: var(--red); color: var(--red); }

/* layer cards */
.layer { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.layer.hidden { opacity: .5; }
.layer-head { display: flex; gap: 6px; align-items: center; }
.layer-head .name { font-size: 13px; width: 18px; }
.layer-head select { padding: 3px 4px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 12px; }
.layer > select.type { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 12px; }
.swatch { width: 14px; height: 14px; border-radius: 50%; flex: none; border: 1px solid rgba(0,0,0,.15); }
.formula { font-size: 11.5px; line-height: 1.45; color: #34353b; background: #f6f6f2; border-radius: 6px; padding: 6px 8px; white-space: pre-wrap; word-break: break-word; }
.layer details > summary { cursor: pointer; font-size: 11px; color: var(--muted); padding: 2px 0; }
.layer details[open] > summary { margin-bottom: 4px; }

.block { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.block textarea { width: 100%; min-height: 54px; resize: vertical; border: 1px solid var(--line); border-radius: 6px; padding: 6px; }

/* ---------- stage ---------- */
.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--stage); }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.toolbar button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.toolbar button:hover { border-color: #b9bac0; }
.toolbar button.on { background: #eef1fb; border-color: var(--accent); color: var(--accent); }
.toolbar .primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.toolbar .primary:hover { border-color: var(--accent); filter: brightness(1.08); }
.mic { display: inline-flex; gap: 8px; align-items: center; }
.mic .dot { width: 8px; height: 8px; border-radius: 50%; background: #b9bac0; }
.mic.on { background: #fdeeee !important; border-color: var(--red) !important; color: var(--red) !important; }
.mic.on .dot { background: var(--red); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.meter { width: 120px; display: flex; flex-direction: column; gap: 3px; }
.meter .bar { height: 5px; background: #e6e6e1; border-radius: 3px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--accent); }
.meter .energy i { background: #1a8a3a; }
.meter .damage i { background: var(--red); }
.seed { color: var(--muted); font-size: 12px; }
.seed b { font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }

.canvas-wrap { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; overflow: hidden; }
#poster { display: block; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 12px 40px rgba(0,0,0,.18); }
#poster .tb, #poster .box { cursor: move; }
.status { padding: 6px 16px; font-size: 11px; color: var(--muted); background: var(--panel); border-top: 1px solid var(--line); }

/* ---------- print (PDF export) ---------- */
#print-root { display: none; }
@page { size: 297mm 420mm; margin: 0; }
@media print {
  html, body { background: none; }
  .app { display: none !important; }
  #print-root { display: block; }
  #print-root svg { width: 297mm; height: 420mm; display: block; }
}
