/* ── Heat Treatment Virtual Lab ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d1117;
  --surface:   #161b27;
  --surface2:  #1f2535;
  --border:    #2a3050;
  /* Accent — ember */
  --accent:    #e8590c;
  --accent-lo: rgba(232,89,12,.22);
  --green:     #3ddc84;
  --red:       #ff5555;
  --gold:      #f5c842;
  --text:      #dde3f0;
  --text-dim:  #6b7a99;
  --font:      'Segoe UI', system-ui, sans-serif;
  --mono:      'Courier New', monospace;
  --radius:    12px;
}

body { background: var(--bg); color: var(--text); font-family: var(--font); min-height: 100vh; padding: 0 16px; }
#app { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

header { text-align: center; padding: 4px 0; }
header h1 {
  font-size: 1.8rem; font-weight: 700;
  background: linear-gradient(120deg, #ffd27a 0%, #ff8a3d 45%, #e8590c 75%, #c92a2a 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.subtitle { color: var(--text-dim); font-size: 0.85rem; margin-top: 3px; }

.controls-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.ctrl-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ctrl-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); white-space: nowrap; }

.pill-tabs { display: flex; background: var(--bg); border-radius: 8px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.pill { padding: 5px 13px; min-height: 30px; border: none; background: transparent; color: var(--text-dim); border-radius: 6px; cursor: pointer; font-size: 0.81rem; font-family: var(--font); transition: background .18s, color .18s, box-shadow .18s; }
.pill.active { background: var(--accent); color: #fff; box-shadow: 0 0 12px var(--accent-lo); }
.pill:hover:not(.active) { background: var(--surface2); color: var(--text); }
.pill:focus-visible, .btn:focus-visible, .vt-pill:focus-visible, .chart-tab:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.btn { padding: 8px 18px; min-height: 36px; border: none; border-radius: 8px; cursor: pointer; font-size: 0.84rem; font-weight: 600; font-family: var(--font); transition: filter .18s, box-shadow .18s, opacity .18s; }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:not(:disabled):hover { filter: brightness(1.12); box-shadow: 0 0 12px var(--accent-lo); }
.btn-ghost { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); }

select { padding: 6px 10px; min-height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); font-family: var(--font); font-size: .82rem; }

/* ── The lab card ── */
.canvas-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; overflow-x: clip; position: relative; }
.view-strip { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.vt-tabs { display: flex; gap: 2px; padding: 3px; background: var(--bg); border-radius: 8px; }
.vt-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; min-height: 32px; border: none; border-radius: 6px; background: transparent; color: var(--text-dim); font-family: var(--font); font-size: .8rem; font-weight: 700; cursor: pointer; }
.vt-pill.active { background: var(--accent); color: #fff; box-shadow: 0 0 10px var(--accent-lo); }
.vt-pill:hover:not(.active) { background: var(--surface2); color: var(--text); }
.vt-pill:disabled { opacity: .4; cursor: not-allowed; }
.proc-quick select { min-width: 190px; font-weight: 700; color: #ffd6bf; border-color: rgba(232,89,12,.5); }
.steel-quick select { min-width: 230px; color: var(--text); border-color: var(--border); }
.status-line { flex: 1; min-width: 0; font-size: .84rem; color: var(--text); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-line b { color: var(--gold); }
.status-line .st-warn { color: var(--gold); }
.stage-wrap { position: relative; }
.stage-wrap canvas#lab-canvas { display: block; width: 100%; aspect-ratio: 1000 / 560; border-radius: 8px; touch-action: pan-y; background: #10141a; }
.ht3d-stage { position: relative; width: 100%; aspect-ratio: 1000 / 560; border-radius: 8px; overflow: hidden; background: #10141a; }
.ht3d-stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.ht3d-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-dim); font-size: .9rem; text-align: center; padding: 20px; }
.ht3d-note { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 6; background: rgba(13,17,23,.92); border: 1px solid var(--gold); color: var(--gold); padding: 6px 10px; border-radius: 8px; font-size: .78rem; display: flex; gap: 8px; align-items: center; }
.ht3d-note button { background: none; border: none; color: var(--text); cursor: pointer; font-size: .9rem; }
.ht3d-bar { position: absolute; right: 10px; bottom: 10px; z-index: 5; display: flex; gap: 4px; padding: 3px; background: rgba(13,17,23,.85); border: 1px solid var(--border); border-radius: 9px; flex-wrap: wrap; }
.ht3d-btn { padding: 6px 11px; min-height: 30px; border: none; border-radius: 6px; background: transparent; color: var(--text-dim); font-family: var(--font); font-size: .76rem; font-weight: 700; cursor: pointer; }
.ht3d-btn.active { background: var(--accent); color: #fff; }
.ht3d-btn:hover:not(.active) { background: var(--surface2); color: var(--text); }

/* transport */
.transport { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.btn-run { min-width: 96px; font-size: .9rem; }
.timeline { position: relative; flex: 1; min-width: 140px; height: 30px; }
.transport .pill-tabs { flex-wrap: nowrap; }
.transport .pill { padding: 5px 9px; }
.tl-stages { position: absolute; left: 9px; right: 9px; top: 11px; height: 8px; display: flex; border-radius: 4px; overflow: hidden; pointer-events: none; }
.tl-stages span { height: 100%; border-right: 1px solid rgba(13,17,23,.9); }
.tl-scrub { position: absolute; inset: 0; width: 100%; -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; height: 30px; }
.tl-scrub::-webkit-slider-runnable-track { height: 30px; background: transparent; }
.tl-scrub::-moz-range-track { height: 30px; background: transparent; }
.tl-scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: 6px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); box-shadow: 0 0 8px var(--accent-lo); }
.tl-scrub::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }
.tl-clock { font-family: var(--mono); font-size: .82rem; color: var(--gold); min-width: 78px; text-align: right; white-space: nowrap; }
.speed-tabs .pill { min-width: 34px; }

/* Display Controls — collapsible overlay pinned to the canvas */
.canvas-toggles {
  position: absolute; top: 8px; left: 8px; z-index: 5;
  background: rgba(13,17,23,0.88); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  border: 1px solid var(--border); border-radius: 9px; box-shadow: 0 4px 14px rgba(0,0,0,0.35); max-width: calc(100% - 16px);
}
.canvas-toggles > summary {
  list-style: none; cursor: pointer; user-select: none; display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text); border-radius: 9px; transition: background .12s, color .12s;
}
.canvas-toggles > summary .cvt-title, .canvas-toggles > summary .cvt-caret { display: none; }
.canvas-toggles[open] > summary { width: auto; height: auto; min-height: 30px; padding: 6px 10px; gap: 7px; justify-content: flex-start; border-bottom: 1px solid var(--border); border-radius: 9px 9px 0 0; }
.canvas-toggles[open] > summary .cvt-title, .canvas-toggles[open] > summary .cvt-caret { display: inline; }
.canvas-toggles > summary::-webkit-details-marker { display: none; }
.canvas-toggles > summary::marker { content: ''; }
.canvas-toggles > summary:hover { background: var(--accent-lo); color: var(--accent); }
.canvas-toggles > summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.canvas-toggles .cvt-ico { flex-shrink: 0; color: var(--accent); width: 17px; height: 17px; }
.canvas-toggles .cvt-caret { margin-left: auto; padding-left: 4px; color: var(--text-dim); font-size: 0.7rem; }
.canvas-toggles .cvt-body { display: flex; flex-direction: column; gap: 5px; padding: 8px 11px 10px; max-height: 60vh; overflow-y: auto; }
.canvas-toggles .cvt-item { display: flex; align-items: center; gap: 6px; font-size: 0.72rem; color: var(--text-dim); cursor: pointer; white-space: nowrap; }
.canvas-toggles .cvt-item:hover { color: var(--text); }
.canvas-toggles .cvt-item input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }
.canvas-toggles .cvt-reset { margin-top: 7px; padding: 5px 9px; min-height: 28px; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; color: var(--text-dim); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; cursor: pointer; }
.canvas-toggles .cvt-reset:hover { border-color: var(--accent); color: var(--accent); }

.ctx-menu { position: absolute; z-index: 20; min-width: 170px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 4px 0; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.ctx-item { display: block; width: 100%; padding: 8px 16px; border: none; background: transparent; color: var(--text); font-size: 0.82rem; text-align: left; cursor: pointer; font-family: var(--font); }
.ctx-item:hover { background: var(--accent-lo); color: var(--accent); }

/* ── inspect + chart row ── */
.side-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.side-tabs { display: none; gap: 3px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.side-tab { flex: 1; min-height: 34px; border: none; border-radius: 7px; background: transparent; color: var(--text-dim); font-family: var(--font); font-size: .84rem; font-weight: 700; cursor: pointer; }
.side-tab.active { background: var(--accent); color: #fff; }
.side-tab:hover:not(.active) { color: var(--text); background: var(--surface2); }
.side-tab:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.chart-info { margin: 8px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 16px; }
.chart-info .ci { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.chart-info dt { font-size: .72rem; color: var(--text-dim); white-space: nowrap; }
.chart-info dd { margin: 0; font-family: var(--mono); font-size: .78rem; color: var(--text); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-info .ci-wide { grid-column: 1 / -1; }
.chart-info .ci-wide dd { white-space: normal; }
.sim-grid { display: flex; flex-direction: column; gap: 14px; }
/* Desktop: the shop on the left, the microstructure above the diagram in a column on
   its right, all inside the page width the mode banner uses (#app, 1180 px). The side
   column has size containment so its canvases, which fill it, never feed back into the
   row height: the shop sets the row, the column fills it. */
@media (min-width: 1200px) {
  .sim-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 35%); align-items: stretch; }
  .side-col .chart-tabs { gap: 1px; }
  .side-col .chart-tab { padding: 4px 7px; }
  .side-col { display: flex; flex-direction: column; contain: size; min-width: 0; }
  .side-col .canvas-card { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
  .side-col .card-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  /* one view at a time, chosen by the toggle, gets the whole column */
  .side-tabs { display: flex; flex: none; }
  /* a taller 3D frame here: the shop is a tall scene, and the row height is what the column gets */
  .ht3d-stage { aspect-ratio: 1000 / 680; }
  .side-col[data-pane="inspect"] .chart-card, .side-col[data-pane="chart"] .inspect-card { display: none; }
  .side-col .canvas-card.inspect-card, .side-col .canvas-card.chart-card { flex-grow: 1; }
  .side-col .chart-info { flex: none; }
  .side-col .card-head { flex: none; }
  .side-col .inspect-card canvas, .side-col .chart-card canvas { flex: 1 1 0; min-height: 0; height: auto; aspect-ratio: auto; }
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.card-title { font-size: .98rem; color: var(--text); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.step-n { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--accent); color: #fff; font-size: .78rem; font-weight: 800; }
.inspect-card canvas, .chart-card canvas { display: block; width: 100%; aspect-ratio: 640 / 380; border-radius: 8px; background: #0f131b; }
.chart-tabs { display: flex; flex-wrap: wrap; gap: 3px; background: var(--bg); padding: 3px; border-radius: 8px; }
.chart-tab { padding: 4px 9px; min-height: 28px; border: none; border-radius: 6px; background: transparent; color: var(--text-dim); font-family: var(--font); font-size: .74rem; font-weight: 700; cursor: pointer; }
.chart-tab.active { background: var(--accent); color: #fff; }
.chart-tab:hover:not(.active) { background: var(--surface2); color: var(--text); }
.loc-tabs .pill { padding: 4px 10px; min-height: 28px; font-size: .76rem; }

/* ── recipe + results ── */
.bench { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.bench-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.bcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.bcard-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.bcard-title { font-size: 1rem; color: var(--text); font-weight: 700; display: flex; align-items: center; gap: 9px; margin: 0; }
.bcard-sub { font-size: .8rem; color: var(--accent); font-weight: 700; }

.proc-desc { margin: 0; font-size: .8rem; line-height: 1.45; color: var(--text); background: var(--bg); border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; padding: 8px 10px; }

/* one control = one row: label | slider | value */
.prow { display: grid; grid-template-columns: minmax(120px, 34%) minmax(0, 1fr) 104px; gap: 6px 12px; align-items: center; }
.prow-wide { grid-template-columns: minmax(120px, 34%) minmax(0, 1fr); }
.prow-l { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.prow-name { font-size: .8rem; font-weight: 600; color: var(--text); }
.prow-hint { font-size: .68rem; color: var(--text-dim); line-height: 1.3; }
.prow-ctl { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.prow-ctl select { width: 100%; }
.prow-v { display: flex; align-items: center; height: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); overflow: hidden; }
.prow-v:focus-within { border-color: var(--accent); }
.stepper-input { flex: 1; min-width: 0; height: 100%; border: none; background: transparent; color: var(--accent); font-family: var(--mono); font-size: .86rem; font-weight: 700; text-align: right; padding: 0 4px 0 6px; outline: none; -moz-appearance: textfield; }
.stepper-input::-webkit-outer-spin-button, .stepper-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.prow-u { font-size: .7rem; color: var(--text-dim); font-weight: 600; padding: 0 8px 0 2px; white-space: nowrap; }
.sim-slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; margin: 0;
}
.sim-slider::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; border: 1px solid rgba(255,255,255,.1); background: linear-gradient(to right, var(--stg, var(--accent)) 0, var(--stg, var(--accent)) var(--pct, 50%), rgba(255,255,255,.12) var(--pct, 50%)); }
.sim-slider::-moz-range-track { height: 6px; border-radius: 3px; border: none; background: linear-gradient(to right, var(--stg, var(--accent)) 0, var(--stg, var(--accent)) var(--pct, 50%), rgba(255,255,255,.12) var(--pct, 50%)); }
.sim-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: #fff; border: 4px solid var(--stg, var(--accent)); box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.sim-slider::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 4px solid var(--stg, var(--accent)); }
.sim-slider:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button { padding: 5px 10px; min-height: 30px; border-radius: 7px; border: 1px solid var(--border); background: var(--bg); color: var(--text-dim); font-family: var(--font); font-size: .76rem; font-weight: 600; cursor: pointer; }
.seg button.active { background: var(--stg, var(--accent)); border-color: var(--stg, var(--accent)); color: #fff; }
.seg button:hover:not(.active) { color: var(--text); border-color: var(--stg, var(--accent)); }
.agit-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .74rem; color: var(--text-dim); }
.agit-row select { width: auto; min-width: 110px; }
.h-badge { font-family: var(--mono); font-size: .74rem; color: var(--text); background: var(--surface2); border-radius: 6px; padding: 3px 7px; }
.steel-comp { font-size: .72rem; color: var(--text-dim); line-height: 1.5; display: flex; flex-direction: column; }
/* the setup column is narrow: label above, then slider and value */
.bench-setup .prow { grid-template-columns: minmax(0, 1fr) 100px; }

.bench-setup .prow-l { grid-column: 1 / -1; flex-direction: row; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.bench-setup .prow-wide { grid-template-columns: 1fr; }
.work-grid { display: flex; flex-direction: column; gap: 12px; }
/* 1 What is happening now: the live commentary, with the workpiece controls in one compact row under it */
.now-body { display: flex; flex-direction: column; gap: 6px; min-height: 92px; }
.now-title { display: flex; align-items: center; gap: 9px; font-size: .95rem; font-weight: 700; color: var(--text); }
.now-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 10px currentColor; }
.now-line { margin: 0; display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; font-size: .84rem; line-height: 1.5; color: var(--text); }
.now-k { font-size: .66rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-dim); font-weight: 700; padding-top: 3px; }
.now-card .work-grid { display: flex !important; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 22px; border-top: 1px solid var(--border); padding-top: 10px; }
.now-card .work-grid .prow, .now-card .work-grid .prow-wide { display: flex; align-items: center; gap: 10px; flex: 1 1 300px; min-width: 0; }
.now-card .work-grid .prow-l { flex: none; flex-direction: row; grid-column: auto; }
.now-card .work-grid .prow-hint { display: none; }
.now-card .work-grid .prow-name { font-size: .74rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; }
.now-card .work-grid .prow-ctl { flex-direction: row; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.now-card .work-grid select { width: 220px; flex: none; }
.now-card .work-grid .steel-comp { font-size: .68rem; line-height: 1.35; min-width: 0; }
.now-card .work-grid .sim-slider { flex: 1; min-width: 90px; }
.now-card .work-grid .prow-v { width: 92px; flex: none; height: 32px; }

/* 3 Recipe: the stages in shop order, each in its timeline colour */
.stage-list { display: flex; flex-direction: column; gap: 0; position: relative; }
.stg { position: relative; padding: 0 0 14px 34px; }
.stg::before { content: ''; position: absolute; left: 11px; top: 22px; bottom: 0; width: 2px; background: linear-gradient(var(--stg), rgba(255,255,255,.08)); }
.stg:last-child { padding-bottom: 0; }
.stg:last-child::before { display: none; }
.stg-head { display: flex; align-items: center; gap: 10px; min-height: 26px; margin-left: -34px; margin-bottom: 8px; }
.stg-n { width: 14px; height: 14px; flex: none; margin: 0 5px; border-radius: 50%; box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px rgba(255,255,255,.12); }
.stg-title { font-size: .86rem; font-weight: 700; color: var(--text); flex: 1; }
.stg-body { display: flex; flex-direction: column; gap: 10px; background: var(--bg); border: 1px solid var(--border); border-left: 3px solid var(--stg); border-radius: 0 10px 10px 0; padding: 10px 12px; }
.stg-note { margin: 0; font-size: .74rem; color: var(--text-dim); font-style: italic; }
.stg-offnote { display: none; }
.stg.off .stg-body { display: none; }
.stg.off .stg-offnote { display: block; padding: 2px 0 0; }
.stg.off .stg-n { background: var(--surface2) !important; }
.stg.off .stg-title { color: var(--text-dim); }
/* on/off switch */
.sw { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: .74rem; color: var(--text-dim); font-weight: 600; }
.sw input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw-t { width: 36px; height: 20px; border-radius: 10px; background: var(--surface2); border: 1px solid var(--border); position: relative; transition: background .15s; }
.sw-t::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-dim); transition: transform .15s, background .15s; }
.sw input:checked + .sw-t { background: var(--stg, var(--accent)); border-color: var(--stg, var(--accent)); }
.sw input:checked + .sw-t::after { transform: translateX(16px); background: #fff; }
.sw input:focus-visible + .sw-t { outline: 2px solid var(--gold); outline-offset: 2px; }
.recipe-note { font-size: .76rem; color: var(--text-dim); line-height: 1.5; border-top: 1px solid var(--border); padding-top: 10px; }
.recipe-note .warn { display: block; color: var(--gold); font-weight: 600; margin-top: 4px; }

/* 4 Result */
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hero { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.hero-l { font-size: .66rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-dim); font-weight: 700; }
.hero-v { font-family: var(--mono); color: var(--text-dim); font-size: .8rem; }
.hero-v b { font-size: 1.7rem; color: var(--accent); font-weight: 800; }
.hero-s { font-family: var(--mono); font-size: .8rem; color: var(--text); }
.bad { color: var(--red, #ff6b6b); font-weight: 700; }
.kv-list { margin: 0; display: flex; flex-direction: column; }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.kv:last-child { border-bottom: none; }
.kv dt { font-size: .76rem; color: var(--text-dim); flex: none; max-width: 48%; }
.kv dd { margin: 0; font-family: var(--mono); font-size: .8rem; color: var(--text); text-align: right; }
.kv dd small { font-family: var(--font); color: var(--text-dim); font-size: .7rem; }
.prop-bars { display: flex; flex-direction: column; gap: 7px; }
.pb { display: grid; grid-template-columns: 82px minmax(0, 1fr) 78px; gap: 10px; align-items: center; font-size: .76rem; }
.pb-l { color: var(--text-dim); }
.pb-t { display: block; height: 8px; border-radius: 4px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; }
.pb-f { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #e8590c, #ffb347); transition: width .35s; }
.pb-v { font-family: var(--mono); color: var(--text); text-align: right; font-size: .74rem; white-space: nowrap; }
.pb-ind .pb-f { background: linear-gradient(90deg, #5b6b8c, #8a9bbd); }
.pb-foot { margin: 0; font-size: .68rem; color: var(--text-dim); }
.result-why { font-size: .82rem; color: var(--text); line-height: 1.55; border-left: 3px solid var(--accent); padding-left: 10px; margin: 0; }

.pbar-score { font-size: .84rem; color: var(--text-dim); }
.pbar-score span { color: var(--text); font-weight: 700; }
.practice-prompt { font-size: .95rem; line-height: 1.6; }
.practice-input-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.practice-input-group input { width: 150px; padding: 8px 10px; min-height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); font-family: var(--mono); font-size: .95rem; }
.practice-unit { color: var(--text-dim); font-size: .85rem; min-width: 40px; }
.practice-note { font-size: .74rem; color: var(--text-dim); }
.fb-ok { color: var(--green); font-weight: 700; }
.fb-bad { color: var(--red); font-weight: 700; }
.fb-sol { font-size: .85rem; color: var(--text-dim); margin-top: 4px; font-family: var(--mono); }
.quiz-counter { font-size: .78rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .08em; }
.quiz-prompt { font-size: 1rem; line-height: 1.5; }
.quiz-options { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt { display: flex; gap: 10px; align-items: center; padding: 11px 14px; min-height: 44px; border-radius: 8px; cursor: pointer; background: var(--surface2); border: 1px solid var(--border); color: var(--text); font-size: .9rem; text-align: left; font-family: var(--font); }
.quiz-opt:hover:not(:disabled) { border-color: var(--accent); }
.quiz-opt:disabled { cursor: default; }
.quiz-opt.right { border-color: var(--green); background: rgba(61,220,132,.15); }
.quiz-opt.wrong { border-color: var(--red); background: rgba(255,85,85,.15); }
.qo-k { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); color: var(--accent); font-weight: 800; font-size: .78rem; flex-shrink: 0; }
.quiz-result { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.quiz-stars { font-size: 2.2rem; color: var(--gold); letter-spacing: 4px; }

/* ── SEO article ── */
.seo-article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 24px; line-height: 1.7; }
.seo-article h2 { font-size: 1.3rem; color: var(--accent); margin: 8px 0 12px; }
.seo-article h3 { font-size: 1.05rem; color: var(--text); margin: 18px 0 8px; }
.seo-article p { font-size: 0.92rem; color: var(--text-dim); margin-bottom: 10px; }
.seo-article a { color: var(--accent); text-decoration: none; }
.seo-article a:hover { text-decoration: underline; }
.seo-table { width: 100%; border-collapse: collapse; font-size: .84rem; margin: 10px 0 16px; display: block; overflow-x: auto; }
.seo-table caption { text-align: left; color: var(--text); font-weight: 700; padding-bottom: 6px; }
.seo-table th { text-align: left; color: var(--accent); padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.seo-table td { padding: 6px 8px; color: var(--text); border-bottom: 1px solid rgba(255,255,255,.05); vertical-align: top; }

/* INTERLINK-START header quick-links */
.head-actions{display:flex;align-items:center;gap:8px;margin-left:auto;flex-wrap:wrap;justify-content:flex-end;}
.btn-link{display:inline-flex;align-items:center;gap:7px;padding:5px 12px;border-radius:8px;font-size:.82rem;font-weight:700;text-decoration:none;cursor:pointer;background:var(--surface2,#1f2535);color:var(--text,#dde3f0);border:1.5px solid var(--border,#2a3050);white-space:nowrap;transition:border-color .18s,background .18s,color .18s;}
.btn-link:hover{border-color:var(--accent,#4fc3f7);background:var(--accent-lo,rgba(79,195,247,.18));color:#fff;}
.btn-link img{width:20px;height:20px;border-radius:4px;flex:none;}
.btn-link .lbl{line-height:1;}
@media(max-width:1000px){.btn-link .lbl{display:none;}.btn-link{padding:5px 9px;}}
/* INTERLINK-END */

/* ── Responsive ── */
/* Workpiece as a strip across the top, then the recipe beside the result */
@media (min-width: 900px) {
  .bench { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
  .bench-setup { grid-column: 1 / -1; }
  .bench-setup .work-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 24px; align-items: start; }
}
@media (max-width: 960px) {
  .side-col { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .controls-bar { gap: 10px; }
  .explore-cards { grid-template-columns: 1fr; }
  .status-line { min-width: 100%; order: 3; }
}
@media (max-width: 500px) {
  body { padding: 0 10px; }
  header h1 { font-size: 1.4rem; }
  .subtitle { font-size: .76rem; }
  .controls-bar { padding: 10px 12px; gap: 8px; }
  .pill { padding: 5px 10px; font-size: .76rem; }
  .prow { grid-template-columns: minmax(0, 1fr) 100px; }
  .prow-l, .prow-wide .prow-ctl { grid-column: 1 / -1; }
  .prow-wide { grid-template-columns: 1fr; }
  .pb { grid-template-columns: 74px minmax(0, 1fr) 70px; }
  .proc-quick select { min-width: 150px; }
  .tl-clock { min-width: 64px; }
  .seo-article { padding: 20px 14px; }
}
.faq-item { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; background: var(--bg); }
.faq-item summary { cursor: pointer; color: var(--text); font-weight: 600; font-size: .9rem; }
.faq-item p { margin: 8px 0 2px; }
@media (max-width: 600px) {
  .now-card .now-line { grid-template-columns: 1fr; gap: 2px; }
  .now-card .work-grid .prow, .now-card .work-grid .prow-ctl { flex-wrap: wrap; }
  .now-card .work-grid select { width: 100%; flex: 1 1 100%; }
}
