:root {
  --bg: #fafaf7; --fg: #1f2328; --muted: #5b6470; --line: #e2e2dc;
  --card: #ffffff; --accent: #c0392b; --accent2: #1f6feb; --pick: #eaf6ec;
  --warn: #fff4e0; --code: #2d3748;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 56px; }
body { margin: 0; font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--fg); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
h1 { font-size: clamp(1.5rem, 3vw, 2.2rem); line-height: 1.2; margin: .3em 0 .5em; }
h2 { font-size: 1.5rem; margin: 0 0 .8em; padding-top: 8px; border-bottom: 2px solid var(--fg); padding-bottom: 6px; }
h3 { font-size: 1.08rem; margin: 1em 0 .5em; }
section { padding: 36px 0 12px; }
a { color: var(--accent2); }
code { background: #eef0f3; padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.small { font-size: .88rem; color: var(--muted); }

/* hero */
.hero { background: #1f2a36; color: #f3f4f6; padding: 36px 0 28px; }
.hero code { background: #33414f; color: #fff; }
.kicker { text-transform: uppercase; letter-spacing: .06em; font-size: .8rem; color: #9fb3c8; margin: 0; }
.lead { font-size: 1.08rem; max-width: 900px; }
.deadlines { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 22px 0; }
.deadlines div { background: #2b3a4a; border-left: 4px solid #f5a623; padding: 10px 12px; border-radius: 6px; display: flex; flex-direction: column; }
.d-date { font-weight: 700; color: #f5a623; }
.howto { background: #2b3a4a; padding: 12px 14px; border-radius: 6px; font-size: .95rem; }

/* toc */
.toc { position: sticky; top: 0; z-index: 10; background: #fff; border-bottom: 1px solid var(--line); }
.toc .wrap { display: flex; gap: 4px; overflow-x: auto; white-space: nowrap; }
.toc a { padding: 12px 10px; text-decoration: none; color: var(--fg); font-weight: 500; font-size: .93rem; }
.toc a:hover { color: var(--accent); }

/* layout */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

/* tables */
table { border-collapse: collapse; width: 100%; font-size: .93rem; background: var(--card); }
th, td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; vertical-align: top; }
thead th { background: #f0f0ea; }
.facts th { width: 150px; background: #f6f6f1; }
.data, .opts { margin: 8px 0; }
.opts tr.pick td { background: var(--pick); font-weight: 500; }
.cost td:not(:first-child) { white-space: nowrap; }
.cost tr.total td { font-weight: 700; background: #f0f0ea; }
.spares td:first-child, .opts td:first-child { white-space: nowrap; }
.card, details, #cost, #spares { overflow-x: auto; }
@media (max-width: 700px) { table { font-size: .82rem; } th, td { padding: 4px 6px; } }

/* lists */
.bullets li { margin-bottom: 8px; }
.qlist { list-style: none; padding: 0; }
.qlist li { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card header h3 { margin: 0; flex: 1; }
.card:target, .qlist li:target { outline: 3px solid #f5a623; }
.code { display: inline-block; background: var(--code); color: #fff; font-weight: 700; font-size: .85rem; border-radius: 5px; padding: 2px 8px; font-family: ui-monospace, Consolas, monospace; transition: background .2s; }
.code.flash { background: #2e8b57; }
.tag { font-size: .78rem; padding: 2px 8px; border-radius: 999px; background: #eef0f3; color: var(--muted); font-weight: 600; }
.tag.urgent { background: #fde2df; color: var(--accent); }
.tag.ok { background: var(--pick); color: #23733a; }
.ask { background: var(--warn); border-left: 4px solid #f5a623; padding: 8px 12px; margin: 10px 0 0; border-radius: 4px; }

/* figures */
figure { margin: 0; }
figure img { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
figcaption { font-size: .86rem; color: var(--muted); margin-top: 6px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.gallery img { aspect-ratio: 4 / 3; object-fit: contain; }
pre.ascii { background: #1f2a36; color: #e6edf3; padding: 14px; border-radius: 8px; overflow-x: auto; font-size: 12.5px; line-height: 1.35; margin-top: 20px; }

/* details */
details { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; }
summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: 10px; }

/* post */
.postbox textarea { width: 100%; height: 290px; font: 13.5px/1.45 ui-monospace, Consolas, monospace; padding: 10px; border: 1px solid var(--line); border-radius: 6px; resize: vertical; }
button.copy { margin-top: 8px; background: var(--accent2); color: #fff; border: 0; border-radius: 6px; padding: 9px 16px; font-weight: 600; cursor: pointer; }
button.copy:hover { filter: brightness(1.1); }

footer { margin-top: 40px; padding: 20px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }

/* lightbox */
#lightbox { position: fixed; inset: 0; background: rgba(10,14,20,.92); z-index: 100; display: flex; align-items: center; justify-content: center; overflow: auto; }
#lightbox[hidden] { display: none; }
#lightbox img { max-width: 96vw; max-height: 94vh; cursor: zoom-in; background: #fff; }
#lightbox img.big { max-width: none; max-height: none; width: 2400px; cursor: zoom-out; align-self: flex-start; }
#lightbox button { position: fixed; top: 10px; right: 16px; font-size: 2rem; background: none; border: 0; color: #fff; cursor: pointer; }

/* Tweakers site additions */
.btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.btn { background: #f5a623; color: #1f2a36; padding: 10px 16px; border-radius: 6px; font-weight: 700; text-decoration: none; }
.btn.alt { background: #2b3a4a; color: #fff; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 18px 0 4px; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.stats b { display: block; font-size: 1.25rem; }
.stats span { font-size: .85rem; color: var(--muted); }
.qgroup { margin: 22px 0 6px; font-size: 1.05rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.q { background: var(--card); border: 1px solid var(--line); border-left: 5px solid #f5a623; border-radius: 8px; padding: 12px 16px; margin-bottom: 12px; }
.q:target { outline: 3px solid #f5a623; }
.q h3 { margin: 0 0 6px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.q .ctx { font-size: .86rem; color: var(--muted); margin: 8px 0 0; }
.q .ctx a { white-space: nowrap; }
.note { background: #eef4ff; border-left: 4px solid var(--accent2); padding: 8px 12px; border-radius: 4px; margin: 10px 0; }
td.yes { color: #23733a; font-weight: 600; }

/* language switch */
.lang { margin-left: auto; position: sticky; right: 0; background: #fff; box-shadow: -8px 0 8px #fff; padding: 12px 10px; font-weight: 700; color: var(--accent2) !important; }
.hero .lang-top { float: right; color: #f5a623; font-weight: 700; text-decoration: none; margin-left: 12px; }
.chooser { max-width: 560px; margin: 12vh auto; text-align: center; padding: 0 20px; }
.chooser .btns { justify-content: center; }
