:root {
  color-scheme: light;
  --paper: #f1eee7;
  --ink: #18211d;
  --muted: #555e59;
  --forest: #174b3a;
  --mint: #b8e1cf;
  --orange: #a63f1c;
  --line: #c8cbc4;
  --white: #fffdf8;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); }
a { color: inherit; }
header, main, footer { width: min(1100px, calc(100% - 40px)); margin-inline: auto; }
header { height: 76px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); font-size: .88rem; }
header > a:last-child { color: var(--muted); text-decoration: none; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--forest); text-decoration: none; font-weight: 850; letter-spacing: -.02em; }
.brand-icon { display: grid; place-items: center; width: 30px; height: 38px; border: 3px solid var(--forest); background: var(--mint); }
.hero { padding: 78px 0 62px; max-width: 900px; }
.kicker, .section-number { color: var(--orange); font: 800 .72rem ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; }
h1 { max-width: 850px; margin: 15px 0 25px; font-size: clamp(3.2rem, 8vw, 6.4rem); line-height: .91; letter-spacing: -.075em; }
.hero > p:last-child { max-width: 720px; color: var(--muted); font-size: 1.12rem; line-height: 1.7; }
h2, p { margin-top: 0; }
h2 { letter-spacing: -.04em; }
.workspace, .results, .limits { border: 1px solid var(--line); background: var(--white); box-shadow: 10px 10px 0 #d7d3c9; }
.workspace { padding: clamp(24px, 5vw, 50px); }
.form-heading, .orientation-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 32px; }
.form-heading > div, .orientation-heading > div { display: flex; align-items: baseline; gap: 16px; }
.form-heading span { color: var(--orange); font: 800 .72rem ui-monospace, monospace; }
.form-heading h2, .orientation-heading h2 { margin: 0; font-size: 2rem; }
.link-button { border: 0; background: none; color: var(--forest); font: 750 .85rem inherit; cursor: pointer; padding: 4px 0; border-bottom: 1px solid currentColor; }
.measure-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
label > span { display: block; margin-bottom: 9px; color: var(--forest); font-size: .82rem; font-weight: 800; }
input, select { width: 100%; border: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--ink); padding: 15px; font: 750 1rem ui-monospace, monospace; outline: none; }
.measure-grid input { font-size: clamp(1.2rem, 3vw, 1.7rem); }
input:focus, select:focus { border-color: var(--forest); box-shadow: inset 0 -3px var(--mint); }
small { display: block; margin-top: 8px; color: var(--muted); line-height: 1.45; }
.options { display: grid; grid-template-columns: .65fr 1fr 1.4fr; gap: 14px; align-items: end; margin-top: 25px; }
.primary { min-height: 50px; border: 0; background: var(--forest); color: white; font: 850 .9rem inherit; cursor: pointer; }
.primary:hover, .primary:focus-visible { background: #21664f; }
.error { margin-top: 18px; border-left: 4px solid #b3261e; background: #fff0ee; padding: 14px 16px; color: #761b16; }
.results { margin-top: 28px; padding: clamp(24px, 5vw, 50px); }
.result-summary { display: grid; grid-template-columns: 1.2fr .8fr; align-items: center; min-height: 300px; border-bottom: 1px solid var(--line); padding-bottom: 40px; }
.verdict-label { margin: 15px 0 5px; color: var(--muted); font-weight: 750; text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; }
#verdict { margin: 0 0 15px; color: var(--forest); font-size: clamp(2.3rem, 5vw, 4.5rem); }
#verdict-detail { max-width: 600px; color: var(--muted); line-height: 1.65; }
.opening-diagram { display: grid; place-items: center; gap: 18px; min-height: 320px; }
.opening-frame { box-sizing: content-box; position: relative; width: 220px; height: 250px; border: 12px solid var(--forest); border-bottom-width: 18px; background: #eef5f0; }
.opening-frame::before { content: "CLEAR OPENING"; position: absolute; top: -32px; left: 0; font: 700 .58rem ui-monospace, monospace; letter-spacing: .1em; color: var(--muted); }
.item-face { position: absolute; left: 50%; bottom: 0; width: 75%; height: 45%; transform: translateX(-50%); border: 4px solid var(--orange); background: rgba(166,63,28,.18); }
.diagram-note { max-width: 260px; margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.45; text-align: center; }
.orientation-heading { margin: 42px 0 22px; }
.orientation-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.orientation-card { border: 1px solid var(--line); padding: 18px; background: #faf8f3; }
.orientation-card.pass { border-top: 5px solid var(--forest); }
.orientation-card.fail { border-top: 5px solid var(--orange); }
.orientation-card .state { color: var(--muted); font: 800 .7rem ui-monospace, monospace; letter-spacing: .1em; }
.orientation-card.pass .state { color: var(--forest); }
.orientation-card.fail .state { color: #a44420; }
.orientation-card h3 { margin: 12px 0; font-size: 1rem; }
.orientation-card dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; font-size: .82rem; }
.orientation-card dt { color: var(--muted); }
.orientation-card dd { margin: 0; font-family: ui-monospace, monospace; }
.limits { margin: 28px 0 60px; padding: clamp(24px, 5vw, 50px); }
.limits h2 { margin: 12px 0 28px; font-size: clamp(2rem, 4vw, 3.5rem); }
.limits > div { display: grid; grid-template-columns: 1fr 1fr; gap: 38px; }
.limits p { margin: 0; color: var(--muted); line-height: 1.7; }
footer { display: flex; justify-content: space-between; padding: 28px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
@media (max-width: 760px) {
  .measure-grid, .result-summary, .limits > div { grid-template-columns: 1fr; }
  .options { grid-template-columns: 1fr 1fr; }
  .primary { grid-column: 1 / -1; }
  .opening-diagram { margin-top: 40px; }
  .orientation-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  header, main, footer { width: min(100% - 24px, 1100px); }
  h1 { font-size: 3.5rem; }
  .hero { padding: 50px 0 42px; }
  .workspace, .results, .limits { box-shadow: 5px 5px 0 #d7d3c9; }
  .options, .orientation-grid { grid-template-columns: 1fr; }
  .form-heading, .orientation-heading, footer { align-items: flex-start; flex-direction: column; }
}
