:root {
  --ink: #17202a;
  --muted: #5c6873;
  --paper: #f7f8f6;
  --surface: #ffffff;
  --line: #d9dedb;
  --teal: #0f766e;
  --teal-dark: #0b544f;
  --orange: #f36d21;
  --orange-soft: #fff0e6;
  --focus: #0b61d8;
  --max: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0;
}
a { color: inherit; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.wrap { width: min(var(--max), calc(100% - 40px)); margin-inline: auto; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 100; background: var(--ink); color: white; padding: 10px 14px; }
.skip-link:focus { top: 12px; }

.site-header {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 max(20px, calc((100vw - var(--max)) / 2));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--orange); color: #17202a; border: 2px solid var(--ink); font-weight: 900; }
.desktop-nav { display: flex; align-items: center; gap: 26px; }
.desktop-nav a { min-height: 44px; display: inline-flex; align-items: center; color: var(--muted); text-decoration: none; font-size: .94rem; font-weight: 650; border-bottom: 2px solid transparent; }
.desktop-nav a:hover, .desktop-nav a:focus-visible, .desktop-nav a.active { color: var(--ink); border-color: var(--orange); }
.mobile-menu { display: none; position: relative; }
.mobile-menu summary { cursor: pointer; font-weight: 750; list-style: none; }
.mobile-menu summary::-webkit-details-marker { display: none; }
.mobile-menu[open] > div { position: absolute; right: 0; top: 38px; min-width: 180px; display: grid; background: white; border: 1px solid var(--line); box-shadow: 0 14px 32px rgba(23,32,42,.16); }
.mobile-menu a { padding: 12px 15px; text-decoration: none; font-weight: 700; }
.mobile-menu a + a { border-top: 1px solid var(--line); }

.intro { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 48px; padding-block: 54px 34px; }
.eyebrow, .section-kicker { margin: 0 0 8px; color: var(--teal); font-size: .76rem; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 740px; margin-bottom: 12px; font-size: clamp(2.15rem, 6vw, 4.4rem); line-height: .98; letter-spacing: 0; }
.lede { max-width: 760px; margin: 0; color: var(--muted); font-size: 1.08rem; }
.intro-note { max-width: 230px; padding-left: 16px; border-left: 3px solid var(--teal); display: grid; gap: 2px; color: var(--muted); font-size: .9rem; }
.intro-note strong { color: var(--ink); }

.workspace { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr); align-items: start; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 16px 40px rgba(23, 32, 42, .08); }
.stat-form { padding: 30px; border-right: 1px solid var(--line); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.panel-heading h2, .method h2, .up-next h2 { margin: 0; font-size: 1.55rem; line-height: 1.15; }
.text-button { border: 0; background: transparent; color: var(--teal-dark); font-weight: 750; text-decoration: underline; text-underline-offset: 4px; }
.text-button:hover { color: var(--orange); }
.form-section { padding-top: 24px; }
.form-section + .form-section { margin-top: 24px; border-top: 1px solid var(--line); }
.form-section h3 { margin-bottom: 14px; font-size: .95rem; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: .82rem; font-weight: 650; }
input {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid #bbc4c0;
  border-radius: 4px;
  background: #fcfdfc;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}
select {
  width: 100%;
  min-height: 44px;
  padding: 9px 34px 9px 11px;
  border: 1px solid #bbc4c0;
  border-radius: 4px;
  background: #fcfdfc;
  color: var(--ink);
  font-weight: 750;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 30%, transparent); outline-offset: 2px; }
input[aria-invalid="true"] { border-color: #b42318; background: #fff4f2; }
.form-error { margin: 18px 0 0; padding: 10px 12px; border-left: 3px solid #b42318; background: #fff4f2; color: #7a271a; }

.result-panel { min-height: 100%; padding: 30px; background: #153d3a; color: white; position: sticky; top: 86px; }
.result-panel .section-kicker { color: #8de0d6; }
.rating-score { display: flex; align-items: baseline; gap: 12px; margin: 20px 0 2px; }
.rating-score span { font-size: clamp(4.4rem, 9vw, 7.2rem); line-height: .86; font-weight: 880; font-variant-numeric: tabular-nums; color: #ff8a45; }
.rating-score small { font-size: .95rem; color: #c3d5d1; }
.rating-reading { min-height: 48px; color: #e5efed; }
.metric-list { margin: 26px 0; border-top: 1px solid rgba(255,255,255,.2); }
.metric-list div { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid rgba(255,255,255,.16); }
.metric-list dt { color: #c3d5d1; }
.metric-list dd { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; }
.formula-box { padding: 18px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.17); }
.formula-box p { margin: 7px 0 9px; color: #d5e3e0; font-size: .9rem; }
.formula-box a { color: white; text-underline-offset: 3px; }

.method { display: grid; grid-template-columns: .85fr 1.15fr; gap: 52px; align-items: center; padding-block: 82px; }
.method-copy > p:not(.eyebrow) { color: var(--muted); }
.equation { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 24px; font-size: .9rem; font-weight: 750; }
.equation span { padding: 8px 10px; border: 1px solid var(--line); background: white; }
.equation b { color: var(--orange); }
.court-photo { margin: 0; aspect-ratio: 16 / 8.2; overflow: hidden; border-left: 7px solid var(--orange); }
.court-photo img { width: 100%; height: 100%; display: block; object-fit: cover; }

.up-next { padding-block: 0 84px; }
.up-next > div:first-child { display: grid; grid-template-columns: .35fr 1fr; gap: 28px; align-items: start; margin-bottom: 28px; }
.tool-preview-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tool-preview-grid article { padding: 26px 26px 28px; }
.tool-preview-grid article + article { border-left: 1px solid var(--line); }
.tool-preview-grid span { color: var(--orange); font-variant-numeric: tabular-nums; font-weight: 850; }
.tool-preview-grid h3 { margin: 24px 0 7px; font-size: 1.05rem; }
.tool-preview-grid h3 a { text-underline-offset: 4px; text-decoration-color: var(--orange); }
.tool-preview-grid p { margin: 0; color: var(--muted); font-size: .92rem; }

.site-footer { padding-block: 24px; background: var(--ink); color: #cad1d4; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 30px; }
.site-footer p { margin: 0; font-size: .84rem; }
.site-footer strong { color: white; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-nav a { color: #e7ecee; font-size: .84rem; text-underline-offset: 3px; }

.tool-page { padding-block: 46px 82px; }
.page-intro { max-width: 790px; margin-bottom: 28px; }
.page-intro h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); }
.page-intro p:last-child { color: var(--muted); font-size: 1.05rem; }
.tool-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, .75fr); align-items: start; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 16px 40px rgba(23,32,42,.07); }
.calculator-panel { padding: 30px; border-right: 1px solid var(--line); }
.results-card { padding: 30px; position: sticky; top: 86px; }
.results-card.dark { background: #153d3a; color: white; min-height: 100%; }
.results-card.dark .section-kicker { color: #8de0d6; }
.results-card h2 { margin-bottom: 8px; font-size: 1.2rem; }
.results-card .big-result { margin: 22px 0 3px; color: var(--orange); font-size: clamp(3.4rem, 7vw, 5.8rem); line-height: .9; font-weight: 880; font-variant-numeric: tabular-nums; }
.results-card .result-label { color: #c3d5d1; }
.tool-fieldset { margin: 0; padding: 0; border: 0; }
.tool-fieldset + .tool-fieldset { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--line); }
.tool-fieldset legend { margin-bottom: 14px; font-weight: 800; }
.input-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.input-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.input-help { margin: 8px 0 0; color: var(--muted); font-size: .82rem; }
.metric-bars { display: grid; gap: 17px; margin: 28px 0; }
.metric-bar-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 5px; font-size: .88rem; }
.metric-track { height: 8px; background: rgba(255,255,255,.16); overflow: hidden; }
.metric-fill { display: block; width: 0; height: 100%; background: #ff8a45; transition: width .18s ease; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.button { min-height: 44px; padding: 10px 15px; border: 1px solid var(--ink); border-radius: 4px; background: var(--ink); color: white; font-weight: 760; }
.button:hover { background: #2a3641; }
.button.secondary { background: white; color: var(--ink); }
.button.secondary:hover { background: #eef1ef; }
.button.danger { border-color: #b42318; background: transparent; color: #b42318; }
.tool-explainer { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; padding-block: 58px 0; }
.tool-explainer article { border-top: 3px solid var(--teal); padding-top: 18px; }
.tool-explainer h2, .tool-explainer h3 { font-size: 1.08rem; }
.tool-explainer p { color: var(--muted); font-size: .93rem; }
.source-note { margin-top: 30px; padding: 16px 18px; background: #eef5f3; border-left: 3px solid var(--teal); color: #36504d; font-size: .88rem; }
.source-note a { text-underline-offset: 3px; }

.roster-toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 22px; }
.roster-table { width: 100%; border-collapse: collapse; }
.roster-table th { padding: 10px 8px; color: var(--muted); font-size: .78rem; text-align: left; border-bottom: 1px solid var(--line); }
.roster-table td { padding: 8px; border-bottom: 1px solid var(--line); }
.roster-table th:first-child, .roster-table td:first-child { padding-left: 0; }
.roster-table input[type="text"] { font-weight: 650; }
.roster-table .minutes-input { width: 92px; }
.icon-button { width: 40px; height: 40px; border: 0; background: transparent; color: #8b2c25; font-size: 1.25rem; }
.allocation-summary { margin: 22px 0; padding: 18px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.17); }
.allocation-row { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; }
.allocation-row strong { font-size: 1.8rem; font-variant-numeric: tabular-nums; color: #ff8a45; }
.allocation-track { height: 9px; margin: 13px 0 8px; background: rgba(255,255,255,.15); overflow: hidden; }
.allocation-track span { display: block; height: 100%; width: 0; background: #70d2c8; transition: width .18s ease; }
.allocation-status { margin: 0; color: #d5e3e0; font-size: .9rem; }
.facts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin: 24px 0; background: rgba(255,255,255,.16); }
.facts-grid div { padding: 14px; background: #153d3a; }
.facts-grid span { display: block; color: #c3d5d1; font-size: .8rem; }
.facts-grid strong { display: block; margin-top: 3px; font-size: 1.15rem; font-variant-numeric: tabular-nums; }

.article-page { padding-block: 48px 84px; }
.article-header { max-width: 830px; padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.article-header h1 { font-size: clamp(2.3rem, 5vw, 4rem); }
.article-meta { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: .84rem; }
.article-layout { display: grid; grid-template-columns: minmax(0, 740px) 260px; gap: 76px; align-items: start; padding-top: 38px; }
.article-body h2 { margin: 42px 0 12px; font-size: 1.55rem; }
.article-body h3 { margin: 28px 0 10px; font-size: 1.12rem; }
.article-body p, .article-body li { color: #394550; }
.article-body li + li { margin-top: 8px; }
.article-body .equation-block { margin: 24px 0; padding: 20px; background: #153d3a; color: white; font-size: 1.05rem; font-weight: 750; overflow-wrap: anywhere; }
.article-body .callout { margin: 26px 0; padding: 18px 20px; border-left: 4px solid var(--orange); background: var(--orange-soft); }
.article-body .callout p { margin: 0; color: #593018; }
.article-aside { position: sticky; top: 92px; border-top: 3px solid var(--orange); padding-top: 16px; }
.article-aside strong { display: block; margin-bottom: 10px; }
.article-aside a { display: block; padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--teal-dark); font-size: .9rem; text-underline-offset: 3px; }
.info-page { max-width: 780px; padding-block: 50px 84px; }
.info-page h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); }
.info-page h2 { margin-top: 38px; font-size: 1.35rem; }
.info-page p, .info-page li { color: #394550; }
.info-page li + li { margin-top: 7px; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.guide-index { padding-block: 50px 84px; }
.guide-index-header { max-width: 820px; margin-bottom: 38px; }
.guide-index-header h1 { font-size: clamp(2.3rem, 5vw, 4rem); }
.guide-index-header p:last-child { color: var(--muted); font-size: 1.06rem; }
.guide-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-block: 1px solid var(--line); }
.guide-list article { padding: 28px; }
.guide-list article + article { border-left: 1px solid var(--line); }
.guide-list span { color: var(--orange); font-weight: 850; font-variant-numeric: tabular-nums; }
.guide-list h2 { margin: 22px 0 10px; font-size: 1.2rem; }
.guide-list h2 a { text-decoration-color: var(--orange); text-underline-offset: 4px; }
.guide-list p { color: var(--muted); font-size: .92rem; }
.guide-list .guide-action { color: var(--teal-dark); font-weight: 750; }
.definition-list { margin: 26px 0; border-top: 1px solid var(--line); }
.definition-list div { display: grid; grid-template-columns: 150px 1fr; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.definition-list dt { font-weight: 800; }
.definition-list dd { margin: 0; color: #394550; }
.related-tools { margin-top: 42px; padding-top: 22px; border-top: 3px solid var(--teal); }
.related-tools a { font-weight: 750; text-underline-offset: 3px; }
.status-note { margin: 24px 0; padding: 18px 20px; background: #eef5f3; border-left: 4px solid var(--teal); }
.status-note p:last-child { margin-bottom: 0; }
.not-found { min-height: calc(100vh - 140px); display: grid; align-content: center; padding-block: 64px; }
.not-found h1 { margin-bottom: 14px; }
.not-found p { max-width: 620px; color: var(--muted); }

@media (max-width: 840px) {
  .site-header { padding-inline: 20px; }
  .desktop-nav { display: none; }
  .mobile-menu { display: block; }
  .intro { grid-template-columns: 1fr; gap: 22px; padding-top: 40px; }
  .intro-note { max-width: none; }
  .workspace { grid-template-columns: 1fr; }
  .stat-form { border-right: 0; border-bottom: 1px solid var(--line); }
  .result-panel { position: static; }
  .method { grid-template-columns: 1fr; gap: 30px; padding-block: 62px; }
  .up-next > div:first-child { grid-template-columns: 1fr; gap: 4px; }
  .tool-layout { grid-template-columns: 1fr; }
  .calculator-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .results-card { position: static; }
  .tool-explainer { grid-template-columns: 1fr; }
  .article-layout { grid-template-columns: 1fr; gap: 46px; }
  .article-aside { position: static; }
  .guide-list { grid-template-columns: 1fr; }
  .guide-list article + article { border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 600px) {
  .wrap { width: min(100% - 24px, var(--max)); }
  .site-header { min-height: 58px; padding-inline: 12px; }
  .brand-mark { width: 30px; height: 30px; }
  h1 { font-size: 2.55rem; }
  .stat-form, .result-panel { padding: 22px 18px; }
  .calculator-panel, .results-card { padding: 22px 18px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .input-grid, .input-grid.three, .roster-toolbar { grid-template-columns: 1fr; }
  .roster-table th:nth-child(2), .roster-table td:nth-child(2) { width: 82px; }
  .roster-table input { padding-inline: 8px; }
  .roster-table .minutes-input { width: 72px; }
  .tool-preview-grid { grid-template-columns: 1fr; }
  .tool-preview-grid article + article { border-left: 0; border-top: 1px solid var(--line); }
  .site-footer .wrap { flex-direction: column; gap: 8px; }
  .definition-list div { grid-template-columns: 1fr; gap: 3px; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
