@layer reset, theme, responsive;
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p, dl, dd { margin: 0; }
  [hidden] { display: none !important; }
  button, input, select { font: inherit; }
  svg, img { vertical-align: middle; }
}
@layer theme {
  :root { color-scheme: light; --paper:#f5f5ee; --white:#fffefa; --ink:#19322a; --muted:#50645a; --green:#173b31; --lime:#d7ea9b; --line:#d8dfd2; --red:#9b302e; font: 16px/1.55 system-ui,-apple-system,"Segoe UI",sans-serif; }
  body { color:var(--ink); background:var(--paper); }
  a { color:#245a46; text-underline-offset:3px; }
  a:hover { color:#14352a; }
  :focus-visible { outline:3px solid #487c54; outline-offset:4px; }
  .skip { position:fixed; z-index:2; left:1rem; top:1rem; background:white; padding:.75rem; transform:translateY(-200%); }
  .skip:focus { transform:none; }
  .wrap { width:min(1120px, calc(100% - 48px)); margin-inline:auto; }
  .bar { background:var(--white); border-bottom:1px solid var(--line); }
  .bar-inner, .footer { display:flex; justify-content:space-between; align-items:center; gap:1rem; }
  .bar-inner { min-height:76px; }
  .brand { display:inline-flex; align-items:center; gap:.65rem; color:var(--ink); text-decoration:none; font-weight:800; line-height:1.15; }
  .brand small { display:block; font-size:.61rem; letter-spacing:.12em; margin-top:.23rem; }
  nav { display:flex; gap:.4rem; align-items:center; }
  nav a { text-decoration:none; padding:.55rem .8rem; border-radius:.5rem; font-size:.88rem; font-weight:700; color:var(--muted); }
  nav a[aria-current] { background:#e9efe1; color:var(--green); }
  main { min-height:65vh; padding-block:2rem 3rem; }
  main:focus { outline:none; }
  .hero { background:var(--green); color:#fffefa; border-radius:1.25rem; overflow:hidden; display:grid; grid-template-columns: 1fr .85fr; min-height:335px; position:relative; }
  .hero-copy { position:relative; z-index:1; padding:clamp(1.75rem,5vw,3.6rem); }
  h1, h2, h3 { line-height:1.1; letter-spacing:-.035em; }
  h1 { font-size:clamp(2.25rem,6vw,4.2rem); font-weight:780; }
  h2 { font-size:clamp(1.4rem,3vw,1.85rem); }
  h3 { font-size:1.15rem; }
  .eyebrow { color:#37614d; font-weight:800; font-size:.68rem; letter-spacing:.15em; margin-bottom:.55rem; }
  .hero .eyebrow { color:var(--lime); }
  .hero-copy > p:not(.eyebrow) { margin-block:.85rem 1.35rem; color:#e0e9da; max-width:36ch; }
  .hero .primary { background:var(--lime); color:#19332a; }
  .hero .primary:hover { background:#e5f3bd; }
  .hero-settings { display:inline-flex; align-items:center; min-height:44px; margin-left:.85rem; color:#eef6e7; font-weight:700; font-size:.88rem; }
  .hero-settings:hover { color:#fff; }
  .hero :focus-visible { outline-color:#d7ea9b; }
  .contours { width:100%; height:100%; position:absolute; inset:0 0 0 auto; width:49%; stroke:#78a187; stroke-width:1.1; fill:none; opacity:.85; }
  .survey { stroke:#d7ea9b; stroke-width:1.8; stroke-dasharray:6 6; fill:#d7ea9b15; }
  .stakes { stroke:none; fill:var(--lime); }
  .tool-section, .activity { margin-top:2rem; }
  .section-heading { display:flex; align-items:end; justify-content:space-between; margin-bottom:1rem; }
  .pill { border:1px solid var(--line); border-radius:99px; padding:.3rem .65rem; font-size:.7rem; color:var(--muted); letter-spacing:.09em; font-weight:800; }
  .tool-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:.8rem; }
  .tool-card, .panel { background:var(--white); border:1px solid var(--line); border-radius:.9rem; padding:1.2rem; min-width:0; }
  .panel { box-shadow:0 2px 8px #19322a0b; }
  .settings { margin-top:1rem; }
  .tool-card { min-height:155px; color:var(--ink); text-decoration:none; position:relative; transition:border-color .15s, background .15s; }
  .tool-card:hover { background:#f3f7ea; border-color:#8ca68e; }
  .tool-card.featured { background:#eaf1db; border-color:#c6d6b4; }
  .tool-card.featured:hover { background:#e0eccd; border-color:#8ca68e; }
  .tool-card p { font-size:.88rem; color:var(--muted); margin-top:.4rem; }
  .tool-icon { display:grid; place-items:center; width:42px; height:42px; border-radius:.6rem; background:#eaf0e3; color:#315d49; margin-bottom:.7rem; }
  .featured .tool-icon { background:#d9e7c4; }
  .arrow { position:absolute; top:1.15rem; right:1.15rem; color:#416653; }
  .page-heading { margin-bottom:1rem; }
  .page-heading h1 { font-size:clamp(2rem,5vw,3.45rem); overflow-wrap:anywhere; }
  .page-heading > p:last-child { max-width:64ch; margin-top:.55rem; color:var(--muted); }
  .grid-two { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1rem; align-items:start; }
  .workspace { margin-top:1rem; }
  .panel h2 { margin-bottom:.9rem; }
  .panel p + .actions, .panel p + a { margin-top:.75rem; }
  .muted, .record-list small { color:var(--muted); }
  .text-link { display:inline-block; font-weight:700; }
  .record-list { padding:0; margin:0 0 .7rem; list-style:none; }
  .record-list li { padding:.6rem 0; border-bottom:1px solid var(--line); overflow-wrap:anywhere; }
  .record-list a { font-weight:700; }
  .record-list small { display:block; }
  form, .fields, #sections, #gps { display:grid; gap:.8rem; }
  .fields { grid-template-columns:repeat(2,minmax(0,1fr)); }
  label { display:grid; gap:.28rem; min-width:0; font-size:.9rem; font-weight:650; }
  label small { color:var(--muted); font-weight:500; }
  input, select { width:100%; color:var(--ink); border:1px solid #a9b9ad; border-radius:.45rem; background:#fff; min-height:44px; padding:.5rem .6rem; }
  select:disabled { opacity:.8; }
  fieldset { margin:0; padding:.65rem .75rem .8rem; border:1px solid var(--line); border-radius:.5rem; min-inline-size:0; }
  legend { padding:0 .35rem; font-weight:750; }
  fieldset button { margin-top:.55rem; }
  button, .primary, .secondary, .danger, .file-picker { display:inline-flex; align-items:center; justify-content:center; gap:.55rem; min-height:44px; width:fit-content; padding:.55rem .85rem; border:1px solid transparent; border-radius:.48rem; font-weight:700; font-size:.9rem; text-decoration:none; cursor:pointer; }
  button:disabled { opacity:.48; cursor:default; }
  .primary { color:#fff; background:var(--green); }
  .primary:hover:not(:disabled) { color:#fff; background:#285544; }
  .secondary, .chip { color:#234737; background:#eef3e9; border-color:#d8e1d4; }
  .secondary:hover:not(:disabled), .chip:hover, .chip[aria-pressed=true] { background:#dfeccf; border-color:#a5b99d; }
  .chip.recommended { border-color:#7b9771; }
  .danger { color:var(--red); background:#fff2ef; border-color:#f0d7d2; }
  .danger:hover:not(:disabled) { background:#fce3de; }
  .actions { display:flex; gap:.45rem; align-items:center; flex-wrap:wrap; }
  .presets { background:#f1f5e9; border:1px solid #d9e5d1; padding:.75rem; border-radius:.55rem; }
  details { margin-top:.55rem; font-size:.88rem; }
  summary { cursor:pointer; padding-block:.4rem; font-weight:750; }
  .results > div { display:flex; justify-content:space-between; align-items:baseline; gap:.8rem; padding:.55rem 0; border-bottom:1px solid var(--line); }
  .results dt, .results dd { min-width:0; overflow-wrap:anywhere; }
  .results dd { font-weight:760; text-align:right; font-variant-numeric:tabular-nums; }
  .results small { color:var(--muted); font-weight:600; }
  .results .purchase { background:#eaf1db; padding-inline:.6rem; border-radius:.3rem; }
  .result-panel > label, #manual, #gps, .result-panel .muted { margin-top:.85rem; }
  .save-form { margin-top:1rem; border-top:1px solid var(--line); padding-top:1rem; }
  .save-form + .danger { margin-top:1rem; }
  #boundary { margin:0; padding:.7rem; background:#eef3e9; border:1px solid var(--line); border-radius:.5rem; }
  #boundary svg { display:block; width:100%; max-height:180px; }
  #boundary polygon, #boundary polyline { stroke:#37614d; stroke-width:2; fill:#dbe9ce; }
  #boundary polyline { fill:none; }
  #boundary circle { fill:#173b31; }
  #boundary text { fill:#173b31; font-size:10px; }
  #boundary figcaption { color:var(--ink); font-weight:700; }
  #point-edit { align-items:end; }
  #point-edit input { max-width:8rem; }
  .status:empty { position:absolute; width:1px; height:1px; overflow:hidden; }
  .status { color:#245a46; }
  .status.error, .storage-warning { color:var(--red); }
  .storage-warning { background:#fff2ef; padding:.75rem; border-radius:.5rem; margin-bottom:.9rem; }
  .file-picker { position:relative; }
  .file-picker input { opacity:0; position:absolute; inset:0; width:100%; height:100%; cursor:pointer; }
  .file-picker:focus-within { outline:3px solid #487c54; outline-offset:4px; }
  .footer { border-top:1px solid var(--line); padding-block:1rem; color:var(--muted); font-size:.75rem; }
  .footer span:first-child { font-weight:750; letter-spacing:.1em; }
}
@layer responsive {
  @media (max-width:850px) { .tool-grid { grid-template-columns:repeat(3,minmax(0,1fr)); } }
  @media (max-width:640px) {
    .wrap { width:calc(100% - 28px); }
    .bar-inner { min-height:66px; }
    .bar-inner { flex-wrap:wrap; gap:.25rem .75rem; padding-block:.55rem; }
    nav a { padding:.65rem .45rem; min-height:44px; }
    main { padding-block:1rem 2rem; }
    .hero { grid-template-columns:1fr; min-height:0; }
    .contours { width:65%; opacity:.24; }
    .grid-two { grid-template-columns:1fr; }
    .tool-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:.6rem; }
    .tool-card, .panel { padding:.9rem; }
    .arrow { top:.9rem; right:.9rem; }
  }
  @media (max-width:390px) { .hero-settings { margin-left:0; display:flex; width:fit-content; } }
  @media (max-width:340px) { .fields { grid-template-columns:1fr; } .brand img { width:30px; height:30px; } .brand small { font-size:.51rem; } }
  @media (prefers-reduced-motion:reduce) { *, *::before, *::after { transition:none !important; } }
}
