:root {
  color-scheme: dark;
  --bg: #111411;
  --surface: #171c18;
  --text: #e4e8df;
  --muted: #a5afa2;
  --accent: #d2e684;
  --line: #343e34;
  --code: #0d100e;
  --code-hover: #1e281b;
  --hover: #fff;
  --target: #28351c;
  --comment: #94a18e;
  --keyword: #ddadf1;
  --type: #93cbd4;
  --string: #d2e684;
  --number: #edb47f;
  --error: #f2aaaa;
  --font: "JetBrains Mono", "Iosevka", "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f3eb;
  --surface: #e8ebde;
  --text: #293226;
  --muted: #596451;
  --accent: #466019;
  --line: #c5cdba;
  --code: #eaece2;
  --code-hover: #dfe5d2;
  --hover: #263b0b;
  --target: #dce5c3;
  --comment: #596451;
  --keyword: #794486;
  --type: #28646d;
  --string: #4d641b;
  --number: #895024;
  --error: #a33933;
}
* { box-sizing: border-box; border-radius: 0; }
html { scroll-padding-top: 1rem; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.65 var(--font); }
a { color: var(--accent); text-underline-offset: .22em; }
a:hover { color: var(--hover); }
a:focus-visible, button:focus-visible, summary:focus-visible, select:focus-visible, textarea:focus-visible, pre:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
button, select, textarea { font: inherit; color: inherit; background: var(--code); border: 1px solid var(--line); padding: .5rem .8rem; }
button, summary, select { cursor: pointer; }
button:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
[hidden] { display: none !important; }
.site-header { min-height: 4rem; display: flex; align-items: center; gap: 1.5rem; border-bottom: 1px solid var(--line); padding: .8rem 1.5rem; }
.mark { font-weight: 700; text-decoration: none; letter-spacing: -.03em; font-size: 1.2rem; }
.tag { margin-right: auto; }
.header-actions { display: flex; align-items: center; gap: 1rem; margin-left: auto; white-space: nowrap; }
#theme-toggle { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 2.5rem; height: 2.5rem; padding: .55rem; color: var(--accent); background: transparent; }
#theme-toggle svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#theme-toggle .theme-moon, :root[data-theme="light"] #theme-toggle .theme-sun { display: none; }
:root[data-theme="light"] #theme-toggle .theme-moon { display: block; }
.tag, .fine, .eyebrow, .line-number, .site-footer, #solve-status, #copy-status { color: var(--muted); }
.fine { font-size: .8rem; }
.skip-link { position: absolute; top: -5rem; left: 1rem; background: var(--bg); padding: .5rem; z-index: 5; }
.skip-link:focus { top: .5rem; }
.layout { display: grid; grid-template-columns: 18rem minmax(0,1fr); min-height: calc(100vh - 8rem); }
.sidebar { padding: 1.5rem 1rem; border-right: 1px solid var(--line); }
.sidebar-inner { position: sticky; top: 1rem; }
.sidebar-controls { display: flex; justify-content: flex-end; }
#sidebar-toggle { width: 2rem; height: 2rem; padding: 0; font-size: 1.2rem; }
#navigation { max-height: calc(100vh - 5rem); overflow-y: auto; }
.layout.sidebar-collapsed { grid-template-columns: 2.5rem minmax(0,1fr); }
.sidebar-collapsed .sidebar { padding: 1rem .25rem; border-right: 1px solid var(--line); border-bottom: 0; }
.sidebar-home, .sidebar-topics { display: block; padding: .35rem .5rem; text-decoration: none; }
.nav-heading { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; margin: 1.5rem .5rem .5rem; }
.year-group { border-top: 1px solid var(--line); }
.year-group summary { padding: .65rem .5rem; }
.year-group summary span { float: right; font-size: .8rem; color: var(--muted); }
.year-links { padding: .1rem 0 .8rem; }
.year-links a { display: flex; align-items: baseline; gap: .6rem; padding: .35rem .5rem; color: var(--muted); font-size: .8rem; text-decoration: none; }
.day-number { flex: 0 0 1.4rem; }
[aria-current="page"] { color: var(--accent) !important; background: var(--surface); box-shadow: inset 2px 0 var(--accent); }
main { min-width: 0; padding: 2.5rem clamp(1.25rem,4vw,4rem) 4rem; }
article { max-width: 76rem; }
article > p, .page-section > p, .limits { max-width: 76ch; }
h1 { font-size: clamp(1.8rem,3.2vw,3rem); line-height: 1.2; letter-spacing: -.05em; font-weight: 600; margin: .4rem 0 1.25rem; }
h2 { font-size: 1.15rem; line-height: 1.4; margin: 0 0 1rem; }
h3 { font-size: 1rem; }
p { margin: .7rem 0 1.2rem; }
.eyebrow { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; margin: 0; }
.lede { font-size: 1.05rem; }
.page-section { border-top: 1px solid var(--line); padding-top: 1.5rem; margin-top: 2.5rem; }
code, pre { font-family: var(--font); }
pre { background: var(--code); padding: 1rem; overflow: auto; font-size: .82rem; line-height: 1.65; tab-size: 4; }
.solution-heading { display: flex; align-items: center; gap: .4rem; }
#solution-toggle { display: inline-flex; align-items: center; justify-content: center; width: 1.75rem; height: 1.75rem; padding: .2rem; border: 0; background: transparent; color: var(--accent); }
#solution-toggle svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; }
#solution-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
#solution-preview[data-collapsed="true"] { max-height: 20rem; overflow: clip; }
.code-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; color: var(--muted); font-size: .8rem; }
.code-heading button { padding: .25rem .5rem; }
.code-heading > button { margin-left: auto; }
.code-tabs { display: flex; flex-wrap: wrap; gap: .25rem; }
.code-tabs [aria-selected="true"] { color: var(--accent); border-color: var(--accent); background: var(--surface); }
.source { padding: 1rem 0; max-width: 100%; overflow: visible; }
.source > code { display: block; white-space: normal; }
.code-line { display: flex; min-width: 100%; scroll-margin-top: 1rem; }
.code-line:hover { background: var(--code-hover); }
.code-line:hover .line-number { color: var(--accent); }
.code-line:target { background: var(--target); }
.line-number { flex: 0 0 4.5rem; text-align: right; padding-right: 1.3rem; margin-right: 1.3rem; border-right: 1px solid var(--line); user-select: none; text-decoration: none; }
.line-text { flex: 1; min-width: 0; padding-right: 1rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.c-comment { color: var(--comment); }
.c-keyword { color: var(--keyword); }
.c-type { color: var(--type); }
.c-string { color: var(--string); }
.c-number, .c-constant { color: var(--number); }
.tags { display: flex; flex-wrap: wrap; gap: .5rem 1rem; list-style: none; padding: 0; margin: .5rem 0 1rem; font-size: .8rem; }
.tags a { text-decoration: none; border-bottom: 1px solid var(--line); }
.related-days, .puzzle-list, .topic-list { list-style: none; padding: 0; }
.related-days li, .puzzle-list > li, .topic-list li { padding: .8rem 0; border-bottom: 1px solid var(--line); }
.related-days .fine { display: block; margin-top: .25rem; }
.topic-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 2rem; }
.topic-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.topic-list li span { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.form-options { display: flex; gap: 1rem; margin: 1rem 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
label { display: block; }
select { display: block; margin-top: .35rem; }
textarea { display: block; width: 100%; min-height: 13rem; margin-top: .35rem; resize: vertical; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 1rem; }
#solve-output { white-space: pre-wrap; overflow-wrap: anywhere; }
.error { color: var(--error); }
.limits div { border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 8rem minmax(0,1fr); padding: .75rem 0; }
dt { color: var(--accent); } dd { margin: 0; }
.site-footer, .noscript { padding: 1.5rem; border-top: 1px solid var(--line); font-size: .75rem; }
@media (max-width: 760px) {
  .site-header { flex-wrap: wrap; gap: .5rem 1rem; padding: 1rem; }
  body.sidebar-ready .site-header, body.sidebar-ready .site-footer, body.sidebar-ready .noscript { padding-left: 3.5rem; }
  .site-header .mark { flex-basis: 100%; }
  .site-header .tag { font-size: .65rem; }
  .header-actions { gap: .5rem; font-size: .75rem; }
  .layout { grid-template-columns: minmax(0,1fr); }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 1rem; }
  .sidebar-inner { top: 1rem; }
  #navigation { max-height: 24rem; }
  .layout[data-sidebar-ready] { grid-template-columns: 2.5rem minmax(0,1fr); }
  .layout[data-sidebar-ready] main { grid-column: 2; }
  .layout[data-sidebar-ready] .sidebar { position: fixed; inset: 0 auto 0 0; width: min(18rem,calc(100vw - 2.5rem)); z-index: 3; background: var(--bg); border-right: 1px solid var(--line); border-bottom: 0; }
  .layout.sidebar-collapsed[data-sidebar-ready] .sidebar { width: 2.5rem; }
  .layout[data-sidebar-ready] #navigation { max-height: calc(100vh - 5rem); }
  .nav-heading { margin-top: 1rem; }
  .year-group summary { padding: .4rem .5rem; }
  main { padding: 1.5rem 1rem 3rem; }
  .topic-list { grid-template-columns: minmax(0,1fr); }
  .limits div { grid-template-columns: minmax(0,1fr); gap: .3rem; }
  .line-number { flex-basis: 3rem; padding-right: .7rem; margin-right: .7rem; }
}
