:root {
  color-scheme: light;
  --paper: #f7f4ec;
  --panel: #fffdf7;
  --ink: #272822;
  --muted: #5e6257;
  --line: #dedbd0;
  --accent: #9c451e;
  --accent-hover: #813715;
  --green: #28524a;
  --mint: #cfdfce;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
button, select, input { font: inherit; }
button, select, summary, input[type="range"] { cursor: pointer; }
:focus-visible { outline: 3px solid #a95124; outline-offset: 4px; }
.frame { width: min(1160px, calc(100% - 64px)); margin-inline: auto; }
.skip { position: fixed; top: 10px; left: 12px; padding: 10px; z-index: 5; background: var(--panel); transform: translateY(-200%); }
.skip:focus { transform: none; }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 72px; }
.wordmark { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-size: 1rem; font-weight: 750; white-space: nowrap; }
.wordmark > span:last-child { color: var(--muted); font-weight: 530; }
.mark { flex: none; display: grid; place-content: center; width: 31px; height: 35px; border-radius: 5px; transform: rotate(-8deg); background: var(--accent); color: white; font-family: var(--mono); }
nav { display: flex; gap: 27px; }
nav a, .header-source { font-size: .875rem; font-weight: 590; color: var(--muted); text-decoration: none; }
nav a:hover, .header-source:hover { color: var(--accent); text-decoration: underline; }

.hero { display: grid; grid-template-columns: 1.13fr 1fr; gap: clamp(30px, 5vw, 70px); align-items: center; padding-block: clamp(42px, 6vw, 88px) clamp(55px, 7vw, 98px); }
.hero h1 { margin: 0; font-size: clamp(3.65rem, 7vw, 7.2rem); letter-spacing: -.081em; line-height: .91; font-weight: 790; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-copy p { color: var(--muted); font-size: clamp(1rem, 1.45vw, 1.22rem); line-height: 1.55; max-width: 420px; margin: 23px 0; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 9px 15px; border: 1px solid transparent; border-radius: 7px; font-size: .875rem; line-height: 1.2; font-weight: 680; text-decoration: none; }
.button:disabled { cursor: default; opacity: .55; }
.primary { background: var(--accent); color: #fffaf4; }
.primary:not(:disabled):hover { background: var(--accent-hover); }
.secondary { background: var(--panel); color: var(--ink); border-color: var(--line); }
.secondary:not(:disabled):hover { background: #eee9dc; }
.featured { background: #243e34; color: #f9f6e9; padding: clamp(20px, 3vw, 31px); border-radius: 14px; box-shadow: 0 13px 30px #22291a16; min-width: 0; }
.featured-top { display: flex; gap: 10px; justify-content: space-between; color: #dae0c8; font: .69rem/1.4 var(--mono); letter-spacing: .035em; }
.featured h2 { margin: 16px 0 10px; font-size: clamp(1.55rem, 2.8vw, 2.7rem); line-height: 1.05; letter-spacing: -.05em; }
.featured p { margin: 0 0 15px; color: #dde2d3; font-size: .875rem; }
.featured a { display: inline-block; color: #f8c492; margin-top: 14px; font-size: .83rem; font-weight: 700; }
.mini-bar { display: grid; grid-template-columns: 40px 1fr 51px; align-items: center; gap: 9px; font-size: .8rem; margin-top: 8px; }
.mini-bar strong { text-align: end; color: #f9f6e9; font: .82rem var(--mono); }
progress { display: block; appearance: none; width: 100%; height: 8px; border: 0; border-radius: 5px; overflow: hidden; background: #eeeade; color: var(--green); }
progress::-webkit-progress-bar { background: transparent; }
progress::-webkit-progress-value { background: currentcolor; border-radius: 4px; }
progress::-moz-progress-bar { background: currentcolor; border-radius: 4px; }
.mini-bar progress { color: #a4b3a2; background: #475e50; }
.mini-bar.take progress { color: #f0b080; }

.section { margin-bottom: 64px; scroll-margin-top: 24px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 14px 24px; margin-bottom: 17px; }
.section-heading h2 { flex: 0 0 auto; margin: 0; font-size: clamp(1.65rem, 3vw, 2.45rem); line-height: 1.1; letter-spacing: -.054em; }
.section-heading p { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.4; }
.workbench, .decision-panel, .replay-panel { border: 1px solid var(--line); border-radius: 13px; background: var(--panel); overflow: hidden; }
.workbench { display: grid; grid-template-columns: minmax(300px, .86fr) minmax(0, 1.14fr); }
.controls, .results, .decision-panel, .replay-panel { padding: clamp(17px, 3vw, 29px); }
.controls { background: #f0ede2; border-right: 1px solid var(--line); }
.controls h3, .results h3, .rule-grid h3 { margin: 0 0 16px; font-size: 1.08rem; letter-spacing: -.025em; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
label { display: grid; gap: 5px; min-width: 0; color: var(--ink); font-size: .79rem; font-weight: 675; }
select, input[type="number"] { min-width: 0; width: 100%; min-height: 43px; border: 1px solid #cbc8ba; border-radius: 6px; padding: 7px 8px; background: var(--panel); color: var(--ink); font-size: .9rem; }
select { padding-right: 6px; text-overflow: ellipsis; }
.fine { color: var(--muted); font-size: .81rem; line-height: 1.45; }
#lineup-detail { min-height: 30px; margin: 10px 0; }
details { border-top: 1px solid #d8d3c5; margin: 13px 0 17px; padding-top: 12px; }
summary { color: var(--green); font-size: .83rem; font-weight: 680; width: fit-content; }
.detail-controls { margin-top: 12px; }
.controls .button + .button { margin-left: 4px; }

.results-heading { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.results h3 { margin-bottom: 14px; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font: .7rem/1.3 var(--mono); letter-spacing: .045em; }
#match-count, #event-number { color: var(--muted); font: .74rem/1.4 var(--mono); text-align: right; }
.bar-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "label value" "bar bar" "note note"; gap: 4px 14px; align-items: center; padding: 11px 0; }
.bar-row > span { grid-area: label; font-size: .9rem; font-weight: 620; }
.bar-row > strong { grid-area: value; font: .86rem var(--mono); }
.bar-row > progress { grid-area: bar; }
.bar-row:nth-child(even) > progress { color: var(--accent); }
.bar-row > small { grid-area: note; color: var(--muted); font-size: .74rem; }
.difference { margin: 10px 0 0; padding: 9px 11px; background: #e9efe1; color: #29433a; border-radius: 6px; font-size: .82rem; line-height: 1.4; }
.run-status p { margin-bottom: 0; }
.run-status progress { margin-top: 12px; height: 5px; }
.replay-form { display: flex; align-items: end; flex-wrap: wrap; gap: 8px 12px; }
.replay-form label { width: 145px; }
.replay-form p { margin: 0 0 11px; }
.replay-scores { display: grid; grid-template-columns: repeat(auto-fit, minmax(116px, 1fr)); gap: 8px; margin: 17px 0; }
.seat-score { display: grid; gap: 3px; padding: 9px; border: 1px solid var(--line); border-radius: 6px; line-height: 1.2; }
.seat-score strong { font-family: var(--mono); font-size: 1rem; }
.seat-score span { font-size: .77rem; }
.seat-score small { color: var(--muted); font: .68rem var(--mono); }
.event { background: #f0ede2; border-radius: 6px; padding: 12px; margin-block: 12px; }
.event p { margin: 3px 0 0; line-height: 1.4; font-weight: 640; }
.playback { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.playback .button { padding-inline: 12px; }
.playback input { flex: 1 1 140px; accent-color: var(--accent); min-height: 35px; }
.decision-panel { display: grid; grid-template-columns: minmax(200px, .82fr) minmax(0, 1fr); gap: 24px 44px; }
.decision-panel label { margin-bottom: 10px; }
#case-advice { margin: 12px 0 0; font-size: .9rem; color: var(--muted); line-height: 1.47; }
.case-results progress { height: 9px; }
.case-results .fine { margin-bottom: 0; }
.rule-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rule-grid article { padding: 17px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.rule-grid h3 { margin-bottom: 5px; }
.rule-grid p { margin: 0; font-size: .87rem; color: var(--muted); line-height: 1.45; }
.footer { display: flex; flex-wrap: wrap; gap: 12px 23px; align-items: center; border-top: 1px solid var(--line); padding: 21px 0 35px; font-size: .82rem; color: var(--muted); }
.footer span:first-child { margin-right: auto; color: var(--ink); font-weight: 700; }
.article { max-width: 730px; margin: 60px auto; }
.article h1 { font-size: clamp(2rem, 5vw, 3.75rem); line-height: 1.1; letter-spacing: -.055em; }
.article h2 { margin-top: 30px; }
.article p { line-height: 1.65; color: var(--muted); }

@media (max-width: 850px) {
  .frame { width: calc(100% - 42px); }
  .hero h1 { font-size: clamp(3.05rem, 8vw, 5.5rem); }
  .section-heading { align-items: start; flex-direction: column; }
  .header-inner { gap: 12px; }
  nav { gap: 13px; }
}
@media (max-width: 680px) {
  .frame { width: calc(100% - 28px); }
  .header-inner { min-height: 66px; flex-wrap: wrap; gap: 5px 10px; padding-block: 9px; }
  .header-source { order: 1; margin-left: auto; }
  nav { order: 2; flex: 0 0 100%; padding-top: 3px; }
  .hero { display: block; padding-block: 35px 43px; }
  .hero h1 { font-size: clamp(2.95rem, 11vw, 4.9rem); }
  .featured { margin-top: 24px; }
  .hero-copy p { margin: 15px 0; }
  .workbench, .decision-panel, .rule-grid { display: block; }
  .controls { border-right: 0; border-bottom: 1px solid var(--line); }
  .case-results, .rule-grid article + article { margin-top: 17px; }
  .section { margin-bottom: 43px; }
}
@media (max-width: 425px) {
  .controls > .form-grid > label:nth-child(-n + 2) { grid-column: 1 / -1; }
}
