/* CNC platform — single stylesheet, no web fonts, no framework. */
:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #eef1f5; --text: #0f1720; --muted: #5b6878; --line: #dde3ea;
  --accent: #f2600c; --accent-ink: #ffffff; --accent-soft: #fff1e8; --accent-2: #1f6feb; --ok: #0f9d58; --warn: #b45309; --warn-soft: #fff7e6;
  --code-bg: #0e141c; --code-text: #e6edf3; --shadow: 0 1px 2px rgba(15,23,32,.06), 0 6px 24px rgba(15,23,32,.06);
  --radius: 14px; --radius-sm: 9px; --wrap: 1200px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1016; --surface: #121a23; --surface-2: #18222e; --text: #e8edf2; --muted: #93a1b1; --line: #253241;
    --accent: #ff7a2e; --accent-soft: #2a1a10; --accent-2: #5b9dff; --ok: #3ccf7f; --warn: #f5a524; --warn-soft: #2a2110;
    --code-bg: #070b10; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 28px rgba(0,0,0,.35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1016; --surface: #121a23; --surface-2: #18222e; --text: #e8edf2; --muted: #93a1b1; --line: #253241;
  --accent: #ff7a2e; --accent-soft: #2a1a10; --accent-2: #5b9dff; --ok: #3ccf7f; --warn: #f5a524; --warn-soft: #2a2110;
  --code-bg: #070b10; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 28px rgba(0,0,0,.35); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; font: 16px/1.65 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
img, svg, canvas { max-width: 100%; }
a { color: var(--accent-2); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent); }
code, kbd, pre { font-family: var(--mono); font-size: .92em; }
:not(pre) > code { background: var(--surface-2); padding: .1em .38em; border-radius: 6px; border: 1px solid var(--line); }
kbd { display: inline-block; padding: 0 .4em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--surface); font-size: .78em; line-height: 1.6; color: var(--muted); }
small { font-size: .82em; color: var(--muted); }
h1, h2, h3 { line-height: 1.22; letter-spacing: -.015em; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); z-index: 60; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 18px; height: 62px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; color: var(--text); text-decoration: none; font-size: 1.08rem; white-space: nowrap; }
.brand:hover { color: var(--text); }
.main-nav { display: flex; gap: 2px; flex: 1; overflow: auto; scrollbar-width: none; }
.main-nav a { padding: 7px 11px; border-radius: 9px; color: var(--text); text-decoration: none; font-weight: 550; font-size: .93rem; white-space: nowrap; }
.main-nav a:hover { background: var(--surface-2); color: var(--text); }
.header-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.search-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 12px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 10px; cursor: pointer; font: inherit; font-size: .9rem; }
.search-btn:hover { border-color: var(--accent); color: var(--text); }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 10px; cursor: pointer; }
.icon-btn:hover { border-color: var(--accent); }
.menu-btn { display: none; }

/* Buttons & chips */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; transition: transform .08s ease, filter .15s; }
.btn:hover { color: var(--accent-ink); filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.btn-sm { padding: 6px 12px; font-size: .88rem; }
.btn-lg { padding: 14px 24px; font-size: 1.05rem; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: .86rem; cursor: pointer; text-decoration: none; }
.chip-btn:hover { border-color: var(--accent); color: var(--text); }
.chip-btn.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .74rem; font-weight: 700; vertical-align: middle; }

/* Hero */
.hero { background: radial-gradient(1200px 400px at 80% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%), linear-gradient(180deg, var(--surface), var(--bg)); border-bottom: 1px solid var(--line); }
.hero-inner { padding: 64px 20px 48px; }
.hero h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); margin: 8px 0 14px; max-width: 900px; font-weight: 850; letter-spacing: -.03em; }
.hero .lead { font-size: 1.18rem; max-width: 720px; color: var(--muted); }
.hero-search { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 640px; margin: 26px 0 30px; padding: 15px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; text-align: left; cursor: text; box-shadow: var(--shadow); }
.hero-search span { flex: 1; }
.hero-search:hover { border-color: var(--accent); }
.hero-stats { display: flex; flex-wrap: wrap; gap: 12px 32px; list-style: none; padding: 0; margin: 0; }
.hero-stats strong { display: block; font-size: 1.7rem; font-weight: 850; letter-spacing: -.02em; }
.hero-stats span { color: var(--muted); font-size: .9rem; }
.kicker { text-transform: uppercase; letter-spacing: .09em; font-size: .76rem; font-weight: 750; color: var(--accent); margin: 0; }

/* Home sections */
.home-section { margin: 46px 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; }
.section-head h2, .home-section > h2 { font-size: 1.45rem; margin: 0 0 16px; }
.split { display: grid; grid-template-columns: 1.3fr 1fr; gap: 22px; }
.cotd, .quiz-cta { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.cotd h2 a { color: var(--text); text-decoration: none; }
.quiz-cta { background: linear-gradient(145deg, var(--accent-soft), var(--surface)); }

/* Card grids */
.tool-cards, .ref-cards, .link-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.tool-cards a, .ref-cards a, .link-grid a { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s; }
.tool-cards a:hover, .ref-cards a:hover, .link-grid a:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); color: var(--text); }
.tool-cards span:not(.ico), .ref-cards span, .link-grid span { color: var(--muted); font-size: .9rem; line-height: 1.5; }
.link-grid a { padding: 14px 16px; }
.chip-list { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.chip-list a { display: inline-block; padding: 6px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); text-decoration: none; font-size: .9rem; }
.chip-list a:hover { border-color: var(--accent); color: var(--accent); }
.chip-list a strong { font-weight: 500; }
.article-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.article-list a { display: block; padding: 14px 4px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.article-list a:hover strong { color: var(--accent); }
.article-list span { display: block; color: var(--muted); font-size: .92rem; }

/* Icons (mask) */
.ico { display: inline-block; width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); position: relative; flex: none; }
.ico::after { content: ""; position: absolute; inset: 6px; background: var(--accent); -webkit-mask: var(--i) center/contain no-repeat; mask: var(--i) center/contain no-repeat; }
.ico-gauge { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4a10 10 0 0 0-8.66 15h17.32A10 10 0 0 0 12 4Zm1 9.73V7h-2v6.73a2 2 0 1 0 2 0Z'/%3E%3C/svg%3E"); }
.ico-drill { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 2h6v6l-1 2v2l-1 1v2l-1 1v2l-1 1v3h-1l1-5-1-1v-2l1-1V9L9 8z'/%3E%3C/svg%3E"); }
.ico-wave { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2 14l3-6 3 6 3-6 3 6 3-6 3 6 2-4v4l-2 4-3-6-3 6-3-6-3 6-3-6-3 6z'/%3E%3C/svg%3E"); }
.ico-thread { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 2h8v3l-8 3 8 3-8 3 8 3-8 3v-3l5-1.5L8 13v-2l5-1.5L8 8V5l5-1.5H8z'/%3E%3C/svg%3E"); }
.ico-circle { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='4' r='2.5'/%3E%3Ccircle cx='19' cy='12' r='2.5'/%3E%3Ccircle cx='12' cy='20' r='2.5'/%3E%3Ccircle cx='5' cy='12' r='2.5'/%3E%3Ccircle cx='12' cy='12' r='1.5'/%3E%3C/svg%3E"); }
.ico-layers { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2 2 7l10 5 10-5zm-8 9.5L2 12.5l10 5 10-5-2-1-8 4zm0 5L2 17.5l10 5 10-5-2-1-8 4z'/%3E%3C/svg%3E"); }
.ico-coin { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm1 15.9V19h-2v-1.1c-1.7-.3-3-1.4-3.1-3h2c.1.8.9 1.4 2.1 1.4 1.3 0 1.9-.6 1.9-1.3 0-.8-.6-1.2-2.3-1.6-2-.5-3.4-1.2-3.4-3 0-1.4 1.1-2.5 2.8-2.8V6.5h2v1.1c1.6.3 2.6 1.4 2.7 2.8h-2c-.1-.7-.7-1.2-1.7-1.2-1.1 0-1.7.5-1.7 1.2s.6 1 2.2 1.4c2 .5 3.5 1.2 3.5 3.1 0 1.5-1.1 2.6-3 3Z'/%3E%3C/svg%3E"); }
.ico-ruler { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2 16 16 2l6 6L8 22zm4-1 1.5 1.5L9 15l-1.5-1.5zm3-3 2 2L12.5 12.5l-2-2zm3-3 1.5 1.5L15 9l-1.5-1.5zm3-3 2 2L18.5 6.5l-2-2z'/%3E%3C/svg%3E"); }
.ico-play { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4v16l13-8z'/%3E%3C/svg%3E"); }


.ico-lathe { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2 7h5v10H2zm6 2h9v6H8zm10 1h4v4h-4z'/%3E%3C/svg%3E"); }
.ico-target { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm0 3a7 7 0 1 1 0 14 7 7 0 0 1 0-14Zm0 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z'/%3E%3C/svg%3E"); }
.ico-chamfer { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2 6h7l4 4v12H2zm13 0h7v16h-7V10z'/%3E%3C/svg%3E"); }
.ico-triangle { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 21V3l18 18zm3-3h7.8L6 10.2z'/%3E%3C/svg%3E"); }
.ico-weight { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a3 3 0 0 1 2.8 4H18l3 15H3L6 6h3.2A3 3 0 0 1 12 2Zm0 2a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z'/%3E%3C/svg%3E"); }
.ico-cone { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2 8l20-4v16L2 16z'/%3E%3C/svg%3E"); }
.badge-clearance { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.badge-transition { background: var(--warn-soft); color: var(--warn); }
.badge-interference { background: color-mix(in srgb, #d93025 14%, transparent); color: #d93025; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.fit-canvas { width: 100%; height: auto; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 1em; }
.tri-canvas { width: 100%; height: auto; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); }

.answer { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 18px 20px; margin: 0 0 14px; }
.answer.accepted { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); box-shadow: inset 4px 0 0 var(--ok); }
.answer header { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.answer footer { display: flex; gap: 8px; margin-top: 10px; }
.q-body { font-size: 1.06rem; }
.ugc-form { margin: 2em 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: grid; gap: 12px; }
.ugc-form h2 { margin: 0; padding: 0; }
.ugc-form.ask { border: 0; padding: 0; background: none; }
.ugc-form textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; resize: vertical; }
.ugc-msg { min-height: 1.4em; margin: 0; font-weight: 600; } .ugc-msg.ok { color: var(--ok); } .ugc-msg.err { color: #d93025; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps li { counter-increment: s; position: relative; padding: 10px 12px 10px 48px; margin-bottom: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.steps li::before { content: counter(s); position: absolute; left: 12px; top: 9px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: .85rem; }
.cta-box { margin: 2em 0; padding: 22px; border-radius: var(--radius); background: linear-gradient(145deg, var(--accent-soft), var(--surface)); border: 1px solid var(--line); }
.cta-box h3 { margin-top: 0; }
.size-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.size-grid a { display: block; text-align: center; padding: 8px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); text-decoration: none; font-variant-numeric: tabular-nums; }
.size-grid a:hover { border-color: var(--accent); color: var(--accent); }
.affiliate { margin: 1.6em 0; padding: 16px 18px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); }
.affiliate h3 { margin: 0 0 8px; font-size: 1rem; } .affiliate ul { margin: 0 0 6px; padding-left: 1.1em; }
.cheat { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
table.mini { font-size: .84rem; margin-bottom: 1em; border: 1px solid var(--line); } table.mini th, table.mini td { padding: 4px 8px; }
@media (max-width: 760px) { .cheat { grid-template-columns: 1fr; } }
@media print { .no-print { display: none !important; } .cheat { grid-template-columns: 1fr 1fr; font-size: 10px; } .page-head .lead, .crumbs { display: none; } }

.acc-link { display: inline-flex; align-items: center; height: 38px; padding: 0 14px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 650; text-decoration: none; font-size: .9rem; gap: 8px; }
.acc-link:hover { color: #fff; filter: brightness(1.06); }
.acc-area { display: inline-flex; align-items: center; gap: 14px; }
.acc-bell { position: relative; text-decoration: none; font-size: 1.05rem; }
.bell-count { position: absolute; top: -8px; right: -10px; background: #d93025; color: #fff; border-radius: 999px; font-size: .68rem; padding: 1px 5px; font-weight: 700; }
.acc-user { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; }
.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; font-size: .8rem; flex: none; }
.member { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--text); }
.level { font-size: .78rem; color: var(--muted); }
.vote { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; min-width: 46px; padding: 6px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); cursor: pointer; font: inherit; }
.vote:hover { border-color: var(--accent); color: var(--accent); }
.vote.is-voted { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.vote-count { font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.answer { display: flex; gap: 14px; }
.answer.accepted:not(:has(.answer-vote)) { display: block; }
.answer-main { flex: 1; min-width: 0; }
.q-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 1em; }
.q-list { list-style: none; padding: 0; margin: 0 0 1.4em; }
.q-list li { display: flex; gap: 16px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.q-list a { color: var(--text); text-decoration: none; font-weight: 600; } .q-list a:hover { color: var(--accent); }
.q-stats { display: flex; gap: 8px; flex: none; font-size: .78rem; color: var(--muted); }
.q-stats span { min-width: 62px; text-align: center; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); }
.q-stats .has-ans { border-color: var(--ok); color: var(--ok); } .q-stats .has-acc { background: var(--ok); color: #fff; border-color: var(--ok); }
.q-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.topic-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.login-prompt { padding: 18px; border: 1px dashed var(--accent); border-radius: var(--radius); background: var(--accent-soft); }
.similar { padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.similar ul { margin: 4px 0 0; padding-left: 1.1em; }
.acc-form { display: grid; gap: 14px; max-width: 460px; margin-bottom: 2em; }
.acc-form input, .acc-form textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
.acc-grid { display: grid; grid-template-columns: minmax(0, 460px) 1fr; gap: 40px; }
.acc-side { padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); align-self: start; }
.check-line { display: flex; gap: 8px; align-items: flex-start; font-size: .92rem; }
.flash-msg { padding: 12px 16px; border-radius: 10px; font-weight: 600; } .flash-msg.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); } .flash-msg.err { background: color-mix(in srgb, #d93025 12%, transparent); color: #d93025; }
.btn-danger { background: #d93025; } .danger-zone { padding: 16px; border: 1px solid color-mix(in srgb, #d93025 40%, var(--line)); border-radius: var(--radius); }
.notif-list { list-style: none; padding: 0; } .notif-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--line); }
.notif-list li.unread a { font-weight: 700; }
textarea.mono { font-family: var(--mono); font-size: .85rem; }
@media (max-width: 760px) { .acc-grid { grid-template-columns: 1fr; } .q-stats span:first-child { display: none; } }

/* Page */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 18px 0 0; font-size: .86rem; color: var(--muted); }
.crumbs li:not(:last-child)::after { content: "›"; margin-left: 6px; color: var(--line); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.page { padding-bottom: 60px; }
.page-head { padding: 18px 0 22px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.page-head h1 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); margin: 6px 0 10px; font-weight: 820; letter-spacing: -.025em; max-width: 960px; }
.page-head .lead { font-size: 1.12rem; color: var(--muted); margin: 0 0 14px; max-width: 860px; }
.page-meta { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; font-size: .9rem; }
.page-actions { display: flex; gap: 8px; }
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; align-items: start; }
.page-grid.no-aside { grid-template-columns: minmax(0, 1fr); }
.page-wide .page-grid { grid-template-columns: minmax(0, 1fr) 280px; }
.sidebar { position: sticky; top: 84px; display: grid; gap: 18px; max-height: calc(100vh - 100px); overflow: auto; scrollbar-width: thin; }
.toc h3, .aside-box h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: 0 0 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -2px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; font-size: .9rem; line-height: 1.4; }
.toc a:hover, .toc a.is-active { color: var(--accent); border-left-color: var(--accent); }
.aside-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.aside-tools { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.aside-tools a { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 9px; color: var(--text); text-decoration: none; font-weight: 550; font-size: .93rem; }
.aside-tools a:hover { background: var(--surface-2); }
.aside-tools .ico { width: 26px; height: 26px; }

/* Prose */
.prose { font-size: 1.04rem; min-width: 0; }
.prose h2 { font-size: 1.5rem; margin: 2.2em 0 .6em; padding-top: .4em; }
.prose h3 { font-size: 1.18rem; margin: 1.8em 0 .5em; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.05em; }
.prose > :first-child { margin-top: 0; }
.prose img { height: auto; border-radius: var(--radius-sm); }
.prose blockquote { margin: 1.4em 0; padding: 4px 18px; border-left: 4px solid var(--accent); color: var(--muted); }
.list { padding-left: 1.2em; }
.list li { margin: .35em 0; }
.list li::marker { color: var(--accent); }
.definition { font-size: 1.22rem; line-height: 1.6; padding: 22px 24px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); }
.editor-note { padding: 16px 20px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); margin-bottom: 1.6em; }
.callout { padding: 14px 18px; border-radius: var(--radius-sm); margin: 1.4em 0; border: 1px solid var(--line); background: var(--surface); }
.callout p:last-child { margin-bottom: 0; }
.callout-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.callout-info { background: color-mix(in srgb, var(--accent-2) 8%, var(--surface)); }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 0 1.4em; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; white-space: nowrap; position: sticky; top: 0; }
tbody tr:last-child > * { border-bottom: 0; }
tbody th { font-weight: 650; }
table.chart tbody tr:hover { background: var(--surface-2); }
table.chart td, table.chart th { white-space: nowrap; }
table.facts th { width: 38%; color: var(--muted); font-weight: 600; }
.filter { width: 100%; max-width: 420px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; margin: 0 0 14px; }

/* Code */
.code { margin: 0 0 1.4em; border-radius: var(--radius-sm); overflow: hidden; background: var(--code-bg); border: 1px solid #1f2a36; }
.code-bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 6px 14px; background: rgba(255,255,255,.04); color: #8ea0b3; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.btn-copy { border: 1px solid #2b3846; background: transparent; color: #c9d4df; border-radius: 7px; padding: 3px 10px; font: inherit; font-size: .78rem; cursor: pointer; text-transform: none; letter-spacing: 0; }
.btn-copy:hover { border-color: var(--accent); color: #fff; }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; color: var(--code-text); line-height: 1.55; font-size: .9rem; tab-size: 4; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; margin: 0 0 1.4em; }
.stat { display: flex; flex-direction: column; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); min-width: 0; }
.stat-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; }
.stat-value { font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.25; margin-top: 2px; overflow-wrap: break-word; hyphens: none; }
.stat-unit { font-size: .82rem; color: var(--muted); }
.stat-hero { background: linear-gradient(150deg, var(--accent-soft), var(--surface)); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.stat-hero .stat-value { color: var(--accent); font-size: 2rem; }
.stats-col { grid-template-columns: 1fr; align-content: start; }

/* FAQ */
.faq details { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); margin-bottom: 8px; }
.faq summary { cursor: pointer; padding: 13px 16px; font-weight: 650; list-style: none; position: relative; padding-right: 40px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 16px; top: 10px; font-size: 1.3rem; color: var(--accent); }
.faq details[open] summary::after { content: "–"; }
.faq details > div { padding: 0 16px 14px; color: var(--muted); }

/* Prev/next & pager */
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 2.2em 0; }
.prevnext a { display: flex; flex-direction: column; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 600; }
.prevnext a[rel="next"] { text-align: right; }
.prevnext a:hover { border-color: var(--accent); }
.prevnext span { font-size: .8rem; color: var(--muted); font-weight: 500; }
.pager { display: flex; gap: 6px; flex-wrap: wrap; margin: 24px 0; }
.pager a, .pager span { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; }
.pager span { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Share row */
.share-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 1.8em 0; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.share-row > span { font-weight: 650; margin-right: 4px; }

/* Ads */
.ad { margin: 1.8em 0; min-height: 120px; text-align: center; }
.ad-label { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 4px; }
.ad-sidebar { min-height: 250px; }

/* Tools */
.tool { display: grid; grid-template-columns: minmax(260px, 380px) minmax(0, 1fr); gap: 24px; align-items: start; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.6em; }
.tool-form { display: grid; gap: 14px; position: sticky; top: 84px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field label, .field > span { font-size: .84rem; font-weight: 650; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field input, .field select, .gv-text, .conv-grid input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; font-variant-numeric: tabular-nums; }
.field input:focus, .field select:focus, .gv-text:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.field input[type="range"] { padding: 0; accent-color: var(--accent); }
.units { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 11px; }
.units label { flex: 1; text-align: center; cursor: pointer; padding: 7px 10px; border-radius: 8px; font-weight: 600; font-size: .9rem; color: var(--muted); }
.units input { position: absolute; opacity: 0; pointer-events: none; }
.units label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tool-results { min-width: 0; }
.tool-results h3 { font-size: 1rem; margin: 1.2em 0 .6em; }
.tool-note { color: var(--muted); font-size: .93rem; min-height: 1em; }
.tool-note.warn { color: var(--warn); }
.tool-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bc-wrap { display: grid; grid-template-columns: minmax(0, 360px) 1fr; gap: 16px; align-items: start; margin-bottom: 1em; }
.bc-canvas { width: 100%; height: auto; aspect-ratio: 1; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.conv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-bottom: 1.2em; }
.conv-grid label { display: grid; gap: 4px; font-size: .84rem; font-weight: 650; color: var(--muted); }

/* G-code viewer */
.tool[data-tool="gcode-viewer"] { display: block; }
.gv { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 20px; }
.gv-side { display: grid; gap: 12px; align-content: start; }
.gv-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.gv-toolbar label { cursor: pointer; }
.gv-text { min-height: 420px; font-family: var(--mono); font-size: .85rem; line-height: 1.5; resize: vertical; white-space: pre; }
.gv-views { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.gv-canvas { width: 100%; height: 520px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); display: block; }
.gv-scrub { width: 100%; margin: 10px 0 14px; accent-color: var(--accent); }
.legend { font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.lg { display: inline-block; width: 22px; height: 3px; border-radius: 2px; vertical-align: middle; }
.lg-rapid { background: repeating-linear-gradient(90deg, var(--muted) 0 4px, transparent 4px 8px); }
.lg-feed { background: var(--accent-2); } .lg-arc { background: var(--ok); } .lg-drill { background: var(--accent); }

/* Quiz */
.quiz { max-width: 820px; }
.quiz-top { display: flex; flex-wrap: wrap; gap: 12px; align-items: stretch; margin-bottom: 16px; }
.quiz-score { padding: 10px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); min-width: 100px; }
.quiz-score span { display: block; font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.quiz-score strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.quiz-mode { display: flex; gap: 6px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.quiz-card { padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.quiz-question { font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 850; font-family: var(--mono); margin: 6px 0 20px; letter-spacing: -.02em; }
.quiz-answers { display: grid; gap: 10px; }
.quiz-answer { text-align: left; padding: 14px 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; display: flex; gap: 12px; align-items: center; }
.quiz-answer:hover:not(:disabled) { border-color: var(--accent); }
.quiz-answer.is-right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.quiz-answer.is-wrong { border-color: #d93025; background: color-mix(in srgb, #d93025 12%, var(--surface)); }
.quiz-feedback { min-height: 1.6em; margin: 16px 0 10px; font-weight: 600; }
.quiz-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Search & palette */
.search-form { display: flex; gap: 8px; max-width: 640px; margin: 0 0 24px; }
.search-form input { flex: 1; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }
.palette { position: fixed; inset: 0; z-index: 80; background: rgba(5,10,16,.5); backdrop-filter: blur(3px); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
.palette-box { width: 100%; max-width: 640px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 80px rgba(0,0,0,.35); overflow: hidden; }
.palette-input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 18px 20px; font: inherit; font-size: 1.1rem; background: transparent; color: var(--text); outline: none; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 56vh; overflow: auto; }
.palette-list a { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; }
.palette-list .is-sel a, .palette-list a:hover { background: var(--accent-soft); }
.palette-list .pk { flex: none; font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 2px 7px; min-width: 78px; text-align: center; }
.palette-list .empty { padding: 16px; color: var(--muted); }
.palette-foot { padding: 10px 16px; border-top: 1px solid var(--line); font-size: .8rem; display: flex; gap: 6px; align-items: center; }
body.palette-open { overflow: hidden; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: .92rem; transition: .25s ease; z-index: 90; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Footer */
.site-footer { margin-top: 40px; border-top: 1px solid var(--line); background: var(--surface); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr; gap: 28px; padding: 40px 20px 24px; }
.footer-grid h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: 6px 0 10px; }
.footer-grid a:not(.brand) { display: block; color: var(--text); text-decoration: none; padding: 3px 0; font-size: .93rem; }
.footer-grid a:not(.brand):hover { color: var(--accent); }
.footer-bottom { padding: 16px 20px 28px; font-size: .85rem; border-top: 1px solid var(--line); }

/* Embed */
body.embed { background: var(--surface); padding: 12px; }
body.embed .tool { box-shadow: none; margin: 0; }
.embed-credit { text-align: right; font-size: .82rem; margin: 8px 4px 0; }

/* Responsive */
@media (max-width: 1100px) { .hide-md { display: none; } }
@media (max-width: 980px) {
  .page-grid, .page-wide .page-grid { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; max-height: none; }
  .toc { display: none; }
  .tool, .gv { grid-template-columns: minmax(0, 1fr); }
  .tool-form { position: static; }
  .split { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .menu-btn { display: inline-grid; }
  .main-nav { display: none; position: absolute; top: 62px; left: 0; right: 0; flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 12px 14px; box-shadow: var(--shadow); }
  body.menu-open .main-nav { display: flex; }
  .main-nav a { padding: 11px 12px; }
  .main-nav a.hide-md { display: block; }
  .hide-sm { display: none !important; }
  .search-btn { padding: 0 10px; }
  .hero-inner { padding: 40px 20px 32px; }
  .bc-wrap, .conv-grid, .field-row { grid-template-columns: 1fr; }
  .prevnext { grid-template-columns: 1fr; }
  .tool { padding: 16px; }
  .gv-canvas { height: 360px; }
  .gv-text { min-height: 220px; }
  .stat-hero .stat-value { font-size: 1.6rem; }
}

/* Print */
@media print {
  .site-header, .site-footer, .sidebar, .ad, .share-row, .page-actions, .palette, .toast, .progress, .tool-actions { display: none !important; }
  body { background: #fff; color: #000; }
  .page-grid { display: block; }
  .code { border: 1px solid #999; } .code pre { color: #000; background: #fff; }
  a { color: #000; }
}
