/* Plate VI · Basic Geometric Constructions (Circles, Ellipses, Spirals)
   (Incircle and Circumcircle of a Triangle, Circle Center, Ellipse, Spiral) –
   Module styles (tokens provided by ../plate-theme.css) */
:root {
  --primary: #63a3e6;
  --primary-light: #0f151f;
  --accent: #ff7d61;          /* Vermilion construction step numbers 1..6 */
  --accent-blue: #53a5f7;
  --accent-green: #5bba73;
  --accent-amber: #f89338;
  --accent-purple: #a98dff;
  --ok: #5bba73;
  --bad: #ff776b;
  --bg-app: #121722;
  --bg-card: #151b26;
  --bg-alt: #131923;
  --border: #1e242f;
  --border-subtle: #0d121c;
  --text: #e8ecf4;
  --muted: #98a3b7;
  --light: #495263;
  --ink: #e7ecf3;
  --arc-stroke: #b1bacb;
  --grid: #1e242f;
  --dia-plain: #141a24;       /* Warm parchment drafting plate surface */
  --hl: #fba31b;
  --given-bg: #0e131d;        /* Specimen header box */
  --given-border: #e9b206;
  --pt-fill: #151b26;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  --radius: 10px;
  --font: var(--xt-text);
  --font-dia: var(--xt-sub);
  --mono: var(--xt-mono);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); background: var(--bg-app); color: var(--text); -webkit-font-smoothing: antialiased; }

/* Header bar (base styles supplied by ../plate-theme.css) */
.plate-header { background: var(--bg-panel); color: var(--text); }
.plate-top { max-width: 1360px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.plate-meta { display: flex; align-items: center; gap: 12px; min-width: 0; }
.plate-meta h1 { margin: 0; font-size: 1.06rem; font-weight: 800; }
.plate-meta .sub { font-size: 0.76rem; color: var(--muted); }
.plate-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-header { appearance: none; border: 1px solid rgba(21, 27, 38, 0.35); background: rgba(21, 27, 38, 0.1); color: #151b26; font: 600 0.82rem var(--font); padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.btn-header:hover { background: rgba(21, 27, 38, 0.2); }
.back-link { color: #0d121c; font-size: 0.8rem; text-decoration: none; padding: 4px 6px; border-radius: 4px; }
.back-link:hover { text-decoration: underline; background: rgba(21, 27, 38, 0.08); }
.tabs { max-width: 1320px; margin: 0 auto; padding: 0 12px; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin; }
.tabs button { appearance: none; border: 0; background: transparent; color: rgba(21, 27, 38, 0.78); font: 600 0.86rem var(--font); padding: 10px 13px; border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: #151b26; }
.tabs button.active { color: #151b26; border-bottom-color: #f1b507; }

main { max-width: 1320px; margin: 0 auto; padding: 18px 20px 30px; }
.tab { display: none; }
.tab.active { display: block; }
.tab-head h2 { margin: 0 0 4px; font-size: 1.3rem; color: var(--primary); }
.tab-head p { margin: 0 0 14px; color: var(--muted); max-width: 960px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 16px; align-items: start; }
@media (max-width: 1020px) { .layout { grid-template-columns: 1fr; } }
.card { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; min-width: 0; }
.card + .card { margin-top: 14px; }
.card h3 { margin: 0 0 8px; font-size: 0.95rem; color: var(--primary); display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.card h3 .score { margin-left: auto; }
.side .card h3 { font-size: 0.9rem; }

/* Specimen header box "Given: ..." */
.given-box { background: var(--given-bg); border-left: 4px solid var(--given-border); padding: 8px 12px; border-radius: 0 6px 6px 0; font-size: 0.88rem; margin-bottom: 10px; }

/* Control rows */
.ctl-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; font-size: 0.86rem; }
.ctl-row > span:first-child { font-weight: 600; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg button { appearance: none; border: 0; background: var(--bg-card); color: var(--muted); padding: 5px 9px; font: 600 0.8rem var(--font); cursor: pointer; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--bg-alt); }
.seg button.on { background: var(--primary); color: #151b26; }

.btn { appearance: none; border: 1px solid var(--border); background: var(--bg-card); color: var(--text); padding: 6px 12px; font: 600 0.82rem var(--font); border-radius: 6px; cursor: pointer; }
.btn:hover { background: var(--bg-alt); border-color: var(--primary); }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--primary); }
.btn.ghost:hover { background: var(--primary-light); }
.btn.primary { background: var(--primary); color: #151b26; border-color: var(--primary); }
.btn.primary:hover { opacity: 0.9; }

.slider { display: grid; grid-template-columns: 180px 1fr 70px; gap: 8px; align-items: center; font-size: 0.84rem; margin-bottom: 6px; }
.slider span { color: var(--muted); }
.slider input[type=range] { width: 100%; accent-color: var(--primary); cursor: pointer; }
.slider output { font-variant-numeric: tabular-nums; font-family: var(--mono); text-align: right; font-weight: 600; }

.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 0.84rem; color: var(--muted); cursor: pointer; user-select: none; }
.chk input { accent-color: var(--primary); }

/* SVG drawing canvas */
svg.dia { width: 100%; height: auto; display: block; border: 1px solid var(--border); border-radius: 6px; background: var(--dia-plain); user-select: none; touch-action: none; }
.note { font-size: 0.78rem; color: var(--muted); margin: 8px 0 0; line-height: 1.4; }

/* Step list on right */
ul.rules { margin: 0; padding-left: 0; list-style: none; font-size: 0.85rem; }
ul.rules li { display: flex; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--border-subtle); border-radius: 4px; transition: background 0.15s ease; }
ul.rules li:last-child { border-bottom: 0; }
ul.rules li.hover-able { cursor: pointer; }
ul.rules li.hover-able:hover, ul.rules li.active { background: var(--primary-light); }
.step-badge { flex: 0 0 20px; height: 20px; line-height: 20px; text-align: center; border-radius: 50%; background: var(--accent); color: #151b26; font-weight: 800; font-size: 0.72rem; }
ul.rules li.step-pending { opacity: 0.55; }
ul.rules li.step-done .step-badge { background: var(--accent); }

/* Tabular evaluations (characteristic values) */
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 0.82rem; margin-top: 6px; }
.kv dt { color: var(--muted); margin: 0; }
.kv dd { font-family: var(--mono); font-weight: 600; margin: 0; text-align: right; }

.result { padding: 8px 10px; border-radius: 6px; background: var(--bg-alt); font-size: 0.84rem; margin-bottom: 8px; border-left: 3px solid var(--primary); }
.result.ok { border-left-color: var(--ok); }
.result.warn { border-left-color: var(--accent-amber); }

/* Diagnostic / Interactive quiz */
.quiz-box { font-size: 0.85rem; }
.quiz-box p { margin: 0 0 8px; }
.quiz-row { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.quiz-row input { flex: 1; padding: 6px 8px; font: 0.85rem var(--mono); border: 1px solid var(--border); border-radius: 5px; background: var(--bg-card); color: var(--text); }
.quiz-row span.unit { font-size: 0.82rem; color: var(--muted); }
.feedback { margin-top: 8px; padding: 6px 10px; border-radius: 5px; font-size: 0.82rem; }
.feedback.ok { background: #101621; color: #68b27c; }
.feedback.bad { background: #0d131d; color: #f27166; }

/* SVG classes for technical drawing elements */
.bg-plain { fill: var(--dia-plain); }
.given-line { stroke: var(--ink); fill: none; stroke-linecap: round; stroke-linejoin: round; }
.thin-line { stroke: var(--arc-stroke); fill: none; stroke-linecap: round; }
.arc-line { stroke: var(--arc-stroke); fill: none; }
.hl-line { stroke: var(--hl) !important; }
.warn-arc { stroke: var(--bad); fill: none; stroke-dasharray: 4 3; }
.result-line { stroke: var(--accent-green); fill: none; }
.secant-line { stroke: var(--primary); fill: none; }
.ellipse-line { stroke: var(--accent); fill: none; stroke-width: 2.2; }
.spiral-line { stroke: var(--ink); fill: none; stroke-width: 2.2; stroke-linecap: round; }
.ray-line { stroke: var(--light); fill: none; stroke-dasharray: 3 3; }
.pt-circ { fill: var(--pt-fill); stroke: var(--ink); stroke-width: 1.5; cursor: default; }
.pt-drag { fill: #4bc6ff; stroke: #4ab1f7; stroke-width: 2; cursor: move; }
.pt-drag:hover { fill: #e9bd00; stroke: #e4a334; }
.pt-label { font-family: var(--font-dia); font-size: 13px; font-weight: 700; fill: var(--ink); user-select: none; }
.dim-text { font-family: var(--font-dia); font-size: 11px; fill: var(--muted); user-select: none; }
.step-num { font-family: var(--font-dia); font-weight: 800; font-size: 15px; fill: var(--accent); user-select: none; }
.halo { paint-order: stroke fill; stroke: var(--dia-plain); stroke-width: 3.5px; stroke-linejoin: round; }
.ax-head { fill: var(--arc-stroke); }
.overline { text-decoration: overline; }
