/* ========== Tokens ========== */
:root {
  --bg: #F6F4EE;
  --surface: #FFFFFF;
  --surface-2: #EDEAE1;
  --border: #D8D3C6;
  --border-strong: #BDB6A6;
  --text: #1B1D1A;
  --muted: #5F635C;
  --accent: #0F6B4F;
  --accent-hover: #0C5A42;
  --accent-soft: #DCEBE3;
  --accent-contrast: #FFFFFF;
  --danger: #B42318;
  --danger-soft: #FBE7E4;
  --block-ink: #14161A;

  --p1: #E4A11B; --p2: #3B9AE1; --p3: #E0654A;
  --p4: #4FB286; --p5: #A77BD6; --p6: #D572A8;

  --font-head: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --radius: 6px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --header-h: 52px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #121412;
  --surface: #1A1D1A;
  --surface-2: #232723;
  --border: #343A34;
  --border-strong: #4A524A;
  --text: #ECEEE8;
  --muted: #9AA196;
  --accent: #4FD1A1;
  --accent-hover: #6FDDB4;
  --accent-soft: #173229;
  --accent-contrast: #0B1A14;
  --danger: #FF7A6B;
  --danger-soft: #3A1D19;
  color-scheme: dark;
}

/* ========== Base ========== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/23px var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}
h1, h2, h3 { font-family: var(--font-head); font-weight: 650; margin: 0; letter-spacing: -0.015em; }
h1 { font-size: 28px; line-height: 32px; font-weight: 700; }
h2 { font-size: 20px; line-height: 26px; }
h3 { font-size: 16px; line-height: 22px; }
p { margin: 0; }
a { color: inherit; }
strong { font-weight: 600; }
button, input { font: inherit; color: inherit; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 19px; }
.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.eyebrow {
  font: 500 12px/16px var(--font-mono);
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.section { padding-top: 28px; padding-bottom: 28px; }
.section-head { display: grid; gap: 6px; margin-bottom: 16px; max-width: 640px; }

/* Penggaris: motif sumbu waktu */
.ruler {
  height: 10px;
  background:
    repeating-linear-gradient(90deg, var(--border-strong) 0 1px, transparent 1px 40px) bottom left / 100% 10px no-repeat,
    repeating-linear-gradient(90deg, var(--border) 0 1px, transparent 1px 8px) bottom left / 100% 5px no-repeat;
  background-clip: content-box;
  border-bottom: 1px solid var(--border);
}

/* ========== Header ========== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  transition: background-color .25s ease;
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 16px;
  height: var(--header-h); display: flex; align-items: center; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font: 650 16px/1 var(--font-head); }
.brand-mark { display: block; width: 26px; height: 26px; border-radius: 6px; }
.nav { display: none; margin-left: auto; gap: 4px; }
.nav a { text-decoration: none; padding: 6px 10px; border-radius: var(--radius); color: var(--muted); font-weight: 500; font-size: 14px; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.theme-toggle {
  margin-left: auto; width: 40px; height: 40px; display: grid; place-items: center;
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
  position: relative;
}
.theme-toggle:hover { background: var(--surface-2); }
.theme-toggle .icon { position: absolute; transition: transform .25s var(--ease), opacity .25s ease; }
:root[data-theme="light"] .icon-sun { opacity: 0; transform: rotate(-90deg) scale(.6); }
:root[data-theme="dark"] .icon-moon { opacity: 0; transform: rotate(90deg) scale(.6); }

/* ========== Hero ========== */
.hero { display: grid; gap: 24px; padding-top: 28px; padding-bottom: 28px; }
.hero-text { display: grid; gap: 14px; align-content: start; }
.lead { color: var(--muted); max-width: 560px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.algo-note { font-size: 13px; color: var(--muted); }
.hero-art {
  margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px; transition: background-color .25s ease;
}
.hero-art svg { display: block; width: 100%; height: auto; }
/* Ilustrasi hero */
.h-dotgrid { fill: var(--border); }
.h-label { font: 500 9px var(--font-mono); letter-spacing: .08em; fill: var(--muted); }
.h-lane { fill: var(--surface); stroke: var(--border-strong); stroke-dasharray: 4 4; }
.h-flow { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.h-clock-bg { fill: var(--surface-2); stroke: var(--border); }
.h-clock-text { font: 500 11px var(--font-mono); fill: var(--text); text-anchor: middle; font-variant-numeric: tabular-nums; }
.h-cpu-body { fill: var(--surface-2); stroke: var(--border-strong); }
.h-die { fill: var(--surface); stroke: var(--border-strong); stroke-dasharray: 3 3; transition: stroke .3s ease; }
.h-pin { fill: none; stroke: var(--border-strong); stroke-width: 2.5; stroke-linecap: round; transition: stroke .3s ease; }
.h-cpu.is-active .h-pin { stroke: var(--accent); }
.h-cpu.is-active .h-die { stroke: var(--accent); stroke-dasharray: none; }
.h-run-label { text-anchor: middle; }
.h-cpu.is-active .h-run-label { fill: var(--accent); }
.h-card-box { stroke: rgba(20, 22, 26, .18); }
.h-card-id { font: 600 13px var(--font-mono); fill: var(--block-ink); text-anchor: middle; }
.h-card-pr { font: 500 8.5px var(--font-mono); fill: var(--block-ink); text-anchor: middle; opacity: .72; }
.h-bt-dot { fill: var(--block-ink); }
.h-cap-dot { fill: var(--accent); }
.h-caption { font: 500 9.5px var(--font-mono); fill: var(--text); }
.h-track { fill: var(--surface); stroke: var(--border); }
.h-seg-id { font: 600 10px var(--font-mono); fill: var(--block-ink); text-anchor: middle; dominant-baseline: central; }
.h-tick { stroke: var(--border-strong); }
.h-tick.minor { stroke: var(--border); }
.h-tick-label { font: 500 8.5px var(--font-mono); fill: var(--muted); text-anchor: middle; }
.h-play path { fill: var(--accent); }
.h-play line { stroke: var(--accent); stroke-width: 2; }

/* ========== Buttons ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius);
  font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: background-color .15s ease, border-color .15s ease, transform .08s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; }

/* ========== Presets ========== */
.presets {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 78%);
  gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px;
  margin: 0 -16px; padding-left: 16px; padding-right: 16px; scroll-padding-left: 16px;
  scrollbar-width: thin;
}
.preset {
  scroll-snap-align: start; text-align: left; cursor: pointer;
  display: grid; gap: 8px; align-content: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; transition: border-color .15s ease, background-color .25s ease;
}
.preset:hover { border-color: var(--border-strong); }
.preset.is-active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.preset-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tag {
  font: 500 11px/1 var(--font-mono); letter-spacing: .04em; text-transform: uppercase;
  padding: 5px 7px; border-radius: 4px; border: 1px solid var(--border); color: var(--muted);
}
.tag[data-group="Idle"] { border-style: dashed; }
.preset-num { font: 500 12px var(--font-mono); color: var(--muted); }
.preset-title { font: 600 15px/20px var(--font-body); }
.preset-desc { font-size: 13px; line-height: 19px; color: var(--muted); }
.preset svg { width: 100%; height: 22px; display: block; margin-top: 2px; }

/* ========== Workspace ========== */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; transition: background-color .25s ease;
}
.input-panel { padding: 0; }
.block { border: 0; margin: 0; padding: 16px; min-width: 0; }
.block + .block { box-shadow: inset 0 1px 0 var(--border); }
.block-title { float: left; width: 100%; padding: 0; display: grid; gap: 2px; font: 650 18px/24px var(--font-head); margin-bottom: 12px; }
.block-title + * { clear: both; }

.algo-group { margin-bottom: 12px; }
.group-label { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.algo-more summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 0; user-select: none;
}
.algo-more summary::-webkit-details-marker { display: none; }
.algo-more summary .icon { width: 14px; height: 14px; transition: transform .2s var(--ease); }
.algo-more[open] summary .icon { transform: rotate(90deg); }
.algo-more:not([open]) { margin-bottom: 4px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile {
  position: relative; display: grid; gap: 2px; padding: 10px 12px; min-height: 58px;
  border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
  background: var(--surface); transition: border-color .15s ease, background-color .15s ease;
}
.tile-main { min-height: 64px; }
.tile:hover { border-color: var(--border-strong); }
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile-name { font-weight: 600; font-size: 15px; }
.tile-sub { font-size: 12px; color: var(--muted); }
.tile-check { position: absolute; top: 10px; right: 10px; width: 16px; height: 16px; color: var(--accent); opacity: 0; transform: scale(.6); transition: opacity .15s, transform .2s var(--ease); }
.tile:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.tile:has(input:checked) .tile-check { opacity: 1; transform: none; }
.tile:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.algo-desc { font-size: 13px; line-height: 19px; color: var(--muted); padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius); }

.quantum { margin-top: 12px; display: grid; grid-template-columns: auto auto; align-items: center; justify-content: start; gap: 6px 12px; }
.quantum label { font-weight: 600; font-size: 14px; }
.quantum .field-error { grid-column: 1 / -1; }
.stepper { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.stepper input { width: 48px; height: 40px; border: 0; text-align: center; background: var(--surface); font-family: var(--font-mono); }
.stepper input:focus-visible { outline-offset: -2px; }
.step-btn { width: 40px; height: 40px; border: 0; background: var(--surface-2); cursor: pointer; font-size: 18px; }
.step-btn:hover { background: var(--border); }

/* Grid input proses */
.proc-head, .proc-row {
  display: grid; grid-template-columns: 44px 1fr 1fr 1fr 40px; gap: 6px; align-items: center;
}
.proc-head { font: 500 11px/1 var(--font-mono); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding-bottom: 8px; }
.proc-head span:nth-child(n+2) { padding-left: 2px; }
.proc-row-wrap { padding: 4px 0; }
.proc-row-wrap.is-entering { animation: rowIn .28s var(--ease); }
@keyframes rowIn { from { opacity: 0; transform: translateY(-4px); } }
.chip {
  display: inline-grid; place-items: center; height: 30px; border-radius: 999px;
  font: 600 13px var(--font-mono); color: var(--block-ink);
}
.proc-row input {
  width: 100%; min-width: 0; height: 44px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface);
  font-family: var(--font-mono); font-size: 15px; transition: border-color .15s, background-color .15s, opacity .2s;
}
.proc-row input:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.proc-row input[aria-invalid="true"] { border-color: var(--danger); background: var(--danger-soft); }
.proc-grid[data-priority="off"] .col-pr,
.proc-grid[data-priority="off"] .in-pr { opacity: .35; }
.del-btn {
  width: 40px; height: 44px; display: grid; place-items: center; border: 0; background: transparent;
  border-radius: var(--radius); color: var(--muted); cursor: pointer;
}
.del-btn:hover:not(:disabled) { color: var(--danger); background: var(--danger-soft); }
.del-btn:disabled { opacity: .3; cursor: not-allowed; }
.row-error { color: var(--danger); font-size: 12px; line-height: 16px; padding: 4px 0 0 50px; }
.row-error:empty { display: none; }
.field-error { color: var(--danger); font-size: 12px; }
.field-error:empty { display: none; }

.add-row {
  margin-top: 8px; width: 100%; min-height: 44px; display: flex; align-items: center; gap: 8px;
  padding: 0 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius);
  background: transparent; cursor: pointer; font-weight: 500; color: var(--muted);
}
.add-row:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.add-row:disabled { opacity: .5; cursor: not-allowed; }
.add-row .counter { margin-left: auto; font-size: 13px; }
.hint { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; font-size: 13px; line-height: 19px; color: var(--muted); }
.hint .icon { width: 16px; height: 16px; margin-top: 2px; }

.action-bar {
  position: sticky; bottom: 0; z-index: 5; padding: 12px 16px;
  background: var(--surface); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius);
}

/* ========== Hasil ========== */
.results { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.results-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stale-badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500;
  color: var(--danger); background: var(--danger-soft); padding: 6px 10px; border-radius: var(--radius);
}
.stale-badge .icon { width: 14px; height: 14px; }
.result-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; transition: opacity .25s ease; min-width: 0; }
.result-body.is-stale { opacity: .6; }
.result-body.is-updated .gantt .seg rect.fill,
.result-body.is-updated .result-table tbody td { animation: softIn .22s ease; }
@keyframes softIn { from { opacity: .55; } }
.live-note { display: none; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; line-height: 18px; color: var(--muted); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
@media (min-width: 960px) { .live-note { display: flex; } }
.result-body > .panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }

.empty {
  display: grid; gap: 12px; justify-items: center; text-align: center; padding: 32px 16px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--muted);
}
.empty-axis { width: 100%; max-width: 320px; }
.empty-track { fill: var(--surface); stroke: var(--border); }
.empty-block { fill: var(--surface-2); stroke: var(--border-strong); stroke-dasharray: 4 3; animation: march 1.8s linear infinite; }
.empty-block.idle { fill: url(#hatch); }
.empty-label { font: 500 10px var(--font-mono); fill: var(--muted); text-anchor: middle; }
@keyframes march { to { stroke-dashoffset: -14; } }
.empty-ticks line { stroke: var(--border-strong); }
.empty-ticks text { font: 500 9px var(--font-mono); fill: var(--muted); text-anchor: middle; }

.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.now {
  display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center;
  font-size: 13px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius);
}
.now .k { font: 500 11px var(--font-mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-right: 6px; }
.now .grp { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.now .chip { height: 22px; padding: 0 8px; font-size: 12px; }
.now .none { font-family: var(--font-mono); color: var(--muted); }
.chip-idle { background: transparent; border: 1px dashed var(--border-strong); color: var(--muted); }

.gantt-scroll { overflow-x: auto; overscroll-behavior-x: contain; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; }
.gantt { display: block; }
.gantt .seg rect.fill { transform-box: fill-box; transform-origin: left center; }
.gantt.animate .seg rect.fill { animation: grow .28s var(--ease) both; animation-delay: var(--d); }
.gantt.animate .seg text { animation: fadeIn .2s ease both; animation-delay: calc(var(--d) + .18s); }
.gantt.animate .tick-label { animation: fadeIn .2s ease both; animation-delay: var(--d); }
@keyframes grow { from { transform: scaleX(0); } }
/* Menunggu terlihat di layar sebelum dianimasikan */
.gantt.pending .seg rect.fill { transform: scaleX(0); }
.gantt.pending .seg text, .gantt.pending .tick-label { opacity: 0; }
.metric.pending, .result-table tr.pending { opacity: 0; transform: translateY(8px); }
.metric.reveal, .result-table tr.reveal { animation: rise .42s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes fadeIn { from { opacity: 0; } }
.gantt .seg { cursor: pointer; }
.gantt .seg text { font: 600 13px var(--font-mono); fill: var(--block-ink); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.gantt .seg.idle text { fill: var(--muted); font-size: 11px; letter-spacing: .06em; }
.gantt .seg.idle rect.fill { stroke: var(--border-strong); stroke-dasharray: 3 2; }
.gantt .seg.is-past rect.fill { opacity: 1; }
.gantt .seg.is-future rect.fill { opacity: .28; }
.gantt .seg.is-future text { opacity: .5; }
.gantt .seg rect.fill { transition: opacity .2s ease; }
.gantt .seg.is-picked rect.fill { stroke: var(--text); stroke-width: 2; }
.gantt .axis-line { stroke: var(--border-strong); }
.gantt .tick { stroke: var(--border-strong); }
.gantt .tick.minor { stroke: var(--border); }
.gantt .tick-label { font: 500 12px var(--font-mono); fill: var(--text); text-anchor: middle; }
.gantt .playhead line { stroke: var(--accent); stroke-width: 2; }
.gantt .playhead path { fill: var(--accent); }
.hatch-bg { fill: var(--surface-2); }
.hatch-line { stroke: var(--border-strong); stroke-width: 1.2; }

.player { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.icon-btn-primary:hover { background: var(--accent-hover); }
.icon-btn-primary .icon { fill: currentColor; }
.icon-btn-primary .ic-pause { fill: none; stroke-width: 3; }
.icon-btn .ic-pause, .icon-btn.is-playing .ic-play { display: none; }
.icon-btn.is-playing .ic-pause { display: block; }
.player input[type="range"] { flex: 1; min-width: 60px; accent-color: var(--accent); height: 24px; }
.p-time { min-width: 52px; text-align: right; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend i.idle { background: repeating-linear-gradient(45deg, var(--surface-2) 0 3px, var(--border-strong) 3px 4px); border: 1px dashed var(--border-strong); }

.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metric {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; display: grid; gap: 2px; transition: background-color .25s ease;
}
.metric .label { font: 500 11px/14px var(--font-mono); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.metric .value { font: 500 26px/32px var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.metric .sub { font-size: 12px; color: var(--muted); }

.table-scroll { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.result-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; min-width: 330px; }
.result-table th, .result-table td { padding: 0 3px; height: 44px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.result-table th { font: 500 11px var(--font-mono); letter-spacing: .02em; text-transform: uppercase; color: var(--muted); height: 36px; }
.result-table th:first-child, .result-table td:first-child {
  text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; padding-left: 0;
}
.result-table td { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.result-table tfoot td { font-weight: 600; border-bottom: 0; border-top: 1px solid var(--border-strong); }
.result-table tfoot td:first-child { font-family: var(--font-body); font-size: 13px; }
.result-table td.calc { color: var(--text); }
.cell-btn {
  font: inherit; background: transparent; border: 0; padding: 6px 4px; margin-right: -4px; min-width: 28px; text-align: right;
  border-radius: 4px; cursor: pointer; text-decoration: underline; text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}
.cell-btn:hover { background: var(--surface-2); text-decoration-color: var(--accent); }
.cell-btn.is-picked { background: var(--accent-soft); color: var(--accent); text-decoration-color: var(--accent); }
.result-table .chip { width: 34px; height: 24px; font-size: 12px; }
@media (min-width: 600px) {
  .result-table th, .result-table td { padding: 0 12px; }
  .result-table th:first-child, .result-table td:first-child { padding-left: 0; }
}
.explain {
  font-size: 14px; padding: 10px 12px; border-left: 3px solid var(--accent);
  background: var(--surface-2); border-radius: 0 var(--radius) var(--radius) 0;
}
.explain:empty { display: none; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; }
.step {
  display: grid; grid-template-columns: 52px 1fr; gap: 10px; padding: 8px 8px 8px 0;
  border-radius: var(--radius); position: relative; transition: background-color .2s ease, opacity .2s ease;
}
.step-t { font: 500 13px/21px var(--font-mono); color: var(--muted); text-align: right; padding-right: 10px; border-right: 2px solid var(--border); }
.step-text { font-size: 14px; line-height: 21px; }
.step[data-kind="idle"] .step-t { border-right-style: dashed; }
.step[data-kind="preempt"] .step-t { border-right-color: var(--p3); }
.step[data-kind="done"] .step-text { color: var(--muted); }
.step.is-future { opacity: .4; }
.step.is-current { background: var(--accent-soft); }
.step.is-current .step-t { color: var(--accent); border-right-color: var(--accent); }

/* ========== Teori ========== */
.theory { display: grid; gap: 16px; }
.formulas { margin: 0; display: grid; gap: 8px; }
.formulas > div {
  display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px;
}
.formulas dt { font: 700 18px/24px var(--font-head); color: var(--accent); }
.formulas dd { margin: 0; display: grid; gap: 4px; color: var(--muted); font-size: 14px; line-height: 21px; }
.formulas .f { color: var(--text); font-size: 15px; font-weight: 500; }
.concepts { display: grid; gap: 8px; }
.concept { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: grid; gap: 6px; background: var(--surface); }
.concept p { font-size: 14px; line-height: 21px; color: var(--muted); }
.concept strong { color: var(--text); }

.footer { padding-top: 24px; padding-bottom: 32px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); margin-top: 16px; }

/* ========== Breakpoints ========== */
@media (min-width: 600px) {
  .presets { grid-auto-flow: row; grid-template-columns: repeat(2, 1fr); overflow: visible; margin: 0; padding: 0; }
  .metrics { grid-template-columns: repeat(4, 1fr); }
  .concepts { grid-template-columns: 1fr 1fr; }
  .concept-wide { grid-column: 1 / -1; }
  .formulas { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 960px) {
  body { font-size: 16px; line-height: 26px; }
  h1 { font-size: 44px; line-height: 48px; }
  h2 { font-size: 24px; line-height: 30px; }
  .nav { display: flex; }
  .theme-toggle { margin-left: 8px; }
  .wrap, .topbar-inner { padding-left: 24px; padding-right: 24px; }
  .section { padding-top: 40px; padding-bottom: 40px; }
  .hero { grid-template-columns: 1.05fr 1fr; align-items: center; gap: 48px; padding-top: 56px; padding-bottom: 48px; }
  .presets { grid-template-columns: repeat(3, 1fr); }
  .workspace { grid-template-columns: 400px minmax(0, 1fr); gap: 24px; }
  .theory { grid-template-columns: 1fr 1.3fr; align-items: start; }
  .formulas { grid-template-columns: 1fr; }
  .action-bar { position: static; }
}

@media (min-width: 960px) and (min-height: 860px) {
  .input-panel { position: sticky; top: calc(var(--header-h) + 16px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
}
