:root {
  --bg: #ffffff;
  --fg: #12232e;
  --muted: #5b6f7c;
  --accent: #0b4f6c;
  --accent-fg: #ffffff;
  --border: #d6e0e6;
  --soft: #eef4f7;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12202a; --fg: #e6eef3; --muted: #93a7b4;
    --accent: #3fa7d6; --accent-fg: #06141c; --border: #2a3d4a; --soft: #1a2c38;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; color: var(--fg); background: var(--bg); }
#map { position: fixed; inset: 0 0 0 380px; }

#panel {
  position: fixed; top: 0; left: 0; bottom: 0; width: 380px;
  overflow-y: auto; padding: 20px; background: var(--bg);
  border-right: 1px solid var(--border); z-index: 1000;
}
.grip, .sheetLake { display: none; }
h1 { margin: 0; font-size: 1.5rem; color: var(--accent); }
h2 { margin: 16px 0 4px; font-size: 1.2rem; }
.tag, .muted { color: var(--muted); font-size: .9rem; }
.tag { margin: 4px 0 16px; }

input, button, .button {
  font: inherit; border-radius: 10px; padding: 10px 12px;
}
input { width: 100%; border: 1px solid var(--border); background: var(--soft); color: var(--fg); }
button, .button {
  border: 0; background: var(--accent); color: var(--accent-fg); cursor: pointer;
  text-decoration: none; display: inline-block; text-align: center;
}
button.secondary { background: var(--soft); color: var(--fg); border: 1px solid var(--border); }
label { display: block; font-size: .85rem; color: var(--muted); margin: 8px 0; }
label input { margin-top: 4px; }

.search { display: flex; gap: 8px; }
.results { list-style: none; padding: 0; margin: 8px 0; }
.results li { padding: 10px; border-radius: 8px; cursor: pointer; }
.results li:hover { background: var(--soft); }
.results small { color: var(--muted); display: block; }

.legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.legend span { font-size: .8rem; padding: 2px 8px; border-radius: 99px; color: #fff; }

.row { display: flex; gap: 8px; align-items: end; }
.row label { flex: 1; margin: 0; }
#readingForm button[type=submit] { width: 100%; margin-top: 6px; }

.card { margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; }
.card h3 { margin: 0 0 8px; font-size: .95rem; }
.more { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.more > summary { cursor: pointer; font-weight: 600; font-size: .85rem; color: var(--accent); margin-bottom: 8px; }
.pchart { width: 100%; height: 74px; margin-top: 8px; color: var(--fg); }
#radarMap { height: 220px; border-radius: 8px; }
#radarRefresh { display: block; margin: 0 0 8px auto; padding: 2px 8px; font-size: .7rem; }
.card.collapse { margin-top: 8px; padding: 0; }
.collapse > summary { cursor: pointer; list-style: none; display: flex; align-items: center; padding: 12px; min-height: 44px; }
.collapse > summary .small { margin: 0 0 0 4px; font-weight: 400; }
.collapse > :not(summary) { margin-left: 12px; margin-right: 12px; }
.collapse > :last-child { margin-bottom: 12px; }
.collapse[open] > summary { padding-bottom: 4px; }
.collapse > summary::-webkit-details-marker { display: none; }
.collapse > summary h3 { margin: 0; flex: 1; }
.collapse > summary::after { content: '▸'; color: var(--muted); transition: transform .15s; }
.collapse[open] > summary::after { transform: rotate(90deg); }
#surveyPick { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; }
#surveyPick select { flex: 1; padding: 6px; border-radius: 8px; border: 1px solid var(--border); background: var(--soft); color: var(--fg); }
.section { border-top: 1px solid var(--border); padding: 6px 0; }
.section summary { cursor: pointer; font-weight: 600; font-size: .85rem; }
.section p { margin: 6px 0; line-height: 1.45; }
.newsList { list-style: none; margin: 0; padding: 0; }
.newsList li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.newsList li:last-child { border-bottom: 0; }
.newsList a { color: var(--accent); font-size: .85rem; text-decoration: none; }
.newsList .small { margin: 2px 0 0; }
.small { font-size: .75rem; margin: 8px 0 0; }
.wx { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wx div { background: var(--soft); border-radius: 8px; padding: 8px; }
.wx b { display: block; font-size: 1.15rem; color: var(--fg); }
.wx span { font-size: .75rem; color: var(--muted); }
.fishList { list-style: none; margin: 0; padding: 0; }
.fishList li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.fishList li:last-child { border-bottom: 0; }
.fishList .meta { margin-left: auto; font-size: .75rem; color: var(--muted); text-align: right; }
.fishList svg { flex: none; }
.small a { color: var(--accent); }
.fishList .forage { font-size: .7rem; color: var(--muted); }
.detail { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.detail .small { margin: 0; }
.chip { padding: 4px 10px; font-size: .8rem; border-radius: 99px; background: var(--soft); color: var(--fg); border: 1px solid var(--border); }
.chip.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.zoneList { list-style: none; margin: 0; padding: 0; }
.zoneList li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.zoneList li:last-child { border-bottom: 0; }
.zoneList label { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--fg); font-size: .95rem; cursor: pointer; }
.zoneList input { width: auto; margin: 0; }
.zoneList .conf { margin-left: auto; font-size: .7rem; padding: 2px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); }
.zoneList p { margin: 4px 0 0 26px; font-size: .8rem; color: var(--muted); }
.fishMarker { background: none; border: 0; }
.fishMarker div { filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.windCtl { background: var(--bg); color: var(--fg); padding: 8px 10px; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.25); text-align: center; font-size: .75rem; }
.windCtl svg { display: block; margin: 0 auto 2px; }
.promo { margin-top: 16px; padding: 12px; border-radius: 10px; background: var(--soft); font-size: .9rem; }
.disclaimer { font-size: .75rem; color: var(--muted); margin-top: 20px; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  opacity: 0; transition: opacity .2s; z-index: 2000; pointer-events: none;
}
#toast.show { opacity: 1; }

/* ----- Phone layout: full-screen map with a bottom sheet ----- */
@media (max-width: 767px) {
  #map { inset: 0; }
  #panel {
    top: auto; right: 0; width: auto; max-height: 55vh;
    border-right: 0; border-top: 1px solid var(--border);
    border-radius: 18px 18px 0 0; padding: 0 16px calc(16px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 24px rgba(0,0,0,.18); transition: max-height .25s;
  }
  #panel.peek { max-height: 120px; overflow: hidden; }
  #panel.full { max-height: calc(100vh - 56px); max-height: calc(100dvh - 56px); }
  /* Bigger touch target around the handle; dragging it resizes the sheet. */
  .grip { display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--border); margin: 0 auto; padding: 0; border: 10px solid var(--bg); box-sizing: content-box; cursor: grab; touch-action: none; }
  /* Handle + title stay pinned while the menu scrolls, so the sheet can be dragged down from anywhere. */
  .sheetTop {
    position: sticky; top: 0; z-index: 5; margin: 0 -16px 8px; padding: 0 16px 8px;
    background: var(--bg); border-radius: 18px 18px 0 0; border-bottom: 1px solid var(--border);
    touch-action: none; cursor: grab; user-select: none;
  }
  .sheetLake:not(:empty) { display: block; margin: -4px 0 0; font-size: .85rem; color: var(--muted); }
  #panel.peek .sheetTop { border-bottom-color: transparent; }
  /* Map buttons: smaller so they don't crowd the top of the map. */
  .leaflet-control-layers-toggle { width: 36px !important; height: 36px !important; }
  .windCtl { padding: 4px 6px; font-size: .65rem; }
  .windCtl svg { width: 24px; height: 24px; }
  header .tag { display: none; }
  h1 { font-size: 1.15rem; margin-bottom: 6px; }
  #toast { bottom: auto; top: 16px; }
}

.shop-pin { font-size: 20px; line-height: 26px; text-align: center; background: #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,.4); }


/* Crop map to PDF */
.crop-overlay { position: absolute; inset: 0; z-index: 1000; cursor: crosshair; background: rgba(0,0,0,.15); touch-action: none; }
.crop-hint { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: #0b4f6c; color: #fff; padding: 6px 12px; border-radius: 16px; font-size: 14px; pointer-events: none; }
.crop-box { position: absolute; border: 2px dashed #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); pointer-events: none; }
.crop-actions { position: absolute; display: flex; gap: 6px; }
.crop-actions .ghost { background: #fff; color: #0b4f6c; }
.crop-cancel { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; padding: 0; }
@media (max-width: 767px) { body.cropping #panel { display: none; } }

/* ---------- accounts (Clerk) ---------- */
#panel header { position: relative; }
.account { position: absolute; top: 0; right: 0; }
.loginPage { overflow-y: auto; }
.loginBox { max-width: 440px; margin: 0 auto; padding: 32px 16px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.loginBox #auth { width: 100%; display: flex; justify-content: center; min-height: 200px; }

/* ---------- buttons on the map ---------- */
.depthLines .ctlTitle { font-weight: 600; margin: 2px 0 4px; }
.depthLines label { display: block; margin: 2px 0; color: inherit; font-size: inherit; }
.depthLines input { width: auto; margin: 0 4px 0 0; }
.depthLines .ctlNote { max-width: 170px; font-size: .7rem; color: #666; margin-top: 4px; }
.leaflet-control-layers input { width: auto; padding: 0; margin: 0 4px 0 0; }
.mapTools a { display: flex !important; align-items: center; justify-content: center; color: #333; }
@media (max-width: 767px) {
  .mapTools a, .leaflet-touch .leaflet-bar.mapTools a { width: 36px; height: 36px; }
}

/* Fish list: thin DNR data note, catch log */
.thinNote { background: var(--soft); border-left: 3px solid #f0a500; padding: 8px 10px; border-radius: 6px; margin: 0 0 8px; }
#catchForm button[type=submit] { width: 100%; margin-top: 6px; }
#catchCard h4 { margin: 12px 0 4px; }

/* Beta label and roadmap page */
.beta { display: inline-block; vertical-align: middle; font-size: .65rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 99px; background: #f0a500; color: #1b1300; }
.disclaimer a, .roadmap a { color: var(--accent); }
.roadmap { max-width: 680px; margin: 0 auto; padding: 24px 16px 40px; line-height: 1.5; }
.roadmap h2 { margin-top: 24px; }
.roadmap li { margin: 6px 0; }

/* ---------- FishRoam: lake header, fishing-type menu, type tools ---------- */
select { font: inherit; width: 100%; margin-top: 4px; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--soft); color: var(--fg); }
.lakeHead h2 { margin-top: 4px; }
.lakeHead p { margin: 2px 0; }
.quickWx { font-size: .85rem; color: var(--fg); }
.pickTitle { margin: 14px 0 8px; font-size: 1rem; }
.typeGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.typeTile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 12px; min-height: 92px;
  background: var(--soft); color: var(--fg); border: 1px solid var(--border); border-radius: 14px; }
.typeTile:hover, .typeTile:focus-visible { border-color: var(--accent); }
.typeTile .ico { font-size: 1.5rem; line-height: 1; margin-bottom: 4px; }
.typeTile b { font-size: .95rem; }
.typeTile small { font-size: .75rem; color: var(--muted); line-height: 1.3; }
.typeTile.wide { grid-column: span 2; min-height: 0; }
.typeTile.last { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.typeHead { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.typeHead h3 { margin: 0; font-size: 1.1rem; }
#typeIntro { margin: 6px 0 4px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--fg); }
.check input { width: auto; margin: 0; }
.fullBtn { width: 100%; margin-top: 4px; }
.collapse > .fullBtn, .collapse > table { width: calc(100% - 24px); }
.rate { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.rate.good { background: #d7f0dc; color: #1b5e20; }
.rate.caution { background: #fff1c2; color: #6d4c00; }
.rate.no { background: #fbd5d5; color: #8e1b1b; }
.wavesTable, .iceTable { width: 100%; border-collapse: collapse; font-size: .8rem; margin: 6px 0; }
.wavesTable th, .wavesTable td, .iceTable th, .iceTable td { text-align: left; padding: 5px 4px; border-bottom: 1px solid var(--border); }
.wavesTable th, .iceTable th { color: var(--muted); font-weight: 600; }
.warnNote { background: #fff4e5; color: #5d3a00; border-left: 3px solid #f57c00; padding: 8px 10px; border-radius: 6px; }
.toolList, .driftList { margin: 6px 0; padding-left: 0; list-style: none; }
.driftList { padding-left: 18px; list-style: decimal; }
.toolList li, .driftList li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .9rem; cursor: pointer; }
.toolList li:last-child, .driftList li:last-child { border-bottom: 0; }
.toolList a { color: var(--accent); }
.numPin { display: flex; align-items: center; justify-content: center; border-radius: 12px; color: #fff; font: 700 12px/1 system-ui, sans-serif; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.numPin.shore { background: #1565c0; }
.numPin.ice { background: #0097a7; }
.numPin.gauge { background: #2e7d32; font-size: 14px; }
.driftArrow { background: none; border: 0; }
.mapLabel { font-size: 11px; font-weight: 600; padding: 1px 6px; }
.rig { border-top: 1px solid var(--border); padding: 8px 0; }
.rig > summary { cursor: pointer; }
.rigBody { padding-top: 6px; }
.rigDiagram { display: flex; gap: 10px; align-items: flex-start; color: var(--fg); }
.rigSvg { flex: none; }
.rigParts { margin: 0; padding: 0; list-style: none; font-size: .78rem; }
.rigParts li { height: 34px; display: flex; align-items: center; line-height: 1.2; overflow: hidden; }
.steps { padding-left: 20px; }
.steps li { margin: 4px 0; }
.inLake { color: var(--accent); }
@media (prefers-color-scheme: dark) {
  .rate.good { background: #1d4024; color: #b9f0c4; }
  .rate.caution { background: #4a3a0a; color: #ffe39a; }
  .rate.no { background: #4d1b1b; color: #ffc4c4; }
  .warnNote { background: #3a2a10; color: #ffdcae; }
}

/* Trout streams */
.troutLegend span { color: #fff; }
.troutPop { font-size: 13px; line-height: 1.45; max-width: 260px; }
.troutPop .small { margin-top: 6px; }
.typeChip { display: inline-block; color: #fff; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; margin: 3px 0 5px; }
.typeChip.gr { background: #b71c1c; }
.typeChip.blue { background: #fbc02d; color: #3a2c00; }
.numPin.trout { background: #6d4c41; font-size: 13px; }
.accessMore { margin-top: 4px; }
.accessMore summary { cursor: pointer; color: var(--accent); }
.accessMore p { margin: 4px 0; }

.thermoLine:not(:empty)::before { content: ''; display: inline-block; width: 16px; height: 0; border-top: 2.5px dashed #d32f2f; vertical-align: middle; margin-right: 6px; }

/* Shore access labels */
.access { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 99px; margin-bottom: 2px; }
.access.pub { background: #d7f0dc; color: #1b5e20; }
.access.res { background: #fff1c2; color: #6d4c00; }
.access.priv { background: #e0e0e0; color: #424242; }
.access.closed { background: #fbd5d5; color: #8e1b1b; }
.numPin.shore.pub { background: #2e7d32; }
.numPin.shore.res { background: #f9a825; }
.numPin.shore.priv { background: #757575; font-size: 11px; }
.numPin.shore.closed { background: #c62828; font-size: 11px; }
.privWarn { color: #8e1b1b; }
@media (prefers-color-scheme: dark) {
  .access.pub { background: #1d4024; color: #b9f0c4; } .access.res { background: #4a3a0a; color: #ffe39a; }
  .access.priv { background: #333; color: #ddd; } .access.closed { background: #4d1b1b; color: #ffc4c4; } .privWarn { color: #ff9e9e; }
}

/* Launches, alerts */
.numPin.launch { background: #fff; font-size: 15px; border-color: #0b4f6c; }
.alertNote { margin: 6px 0; padding: 8px 10px; border-radius: 8px; background: #fff4e5; color: #5d3a00; border-left: 3px solid #f57c00; font-size: .85rem; }
.alertNote.severe { background: #fdecea; color: #7f1d1d; border-left-color: #d32f2f; }
.alertNote summary { cursor: pointer; }
.alertNote p { margin: 6px 0 0; white-space: pre-line; }
@media (prefers-color-scheme: dark) { .alertNote { background: #3a2a10; color: #ffdcae; } .alertNote.severe { background: #4d1b1b; color: #ffc4c4; } }

/* Install pop-up (phones) */
.installPop { position: fixed; left: 12px; right: 12px; top: calc(12px + env(safe-area-inset-top)); z-index: 3000; display: flex; align-items: center; gap: 10px;
  background: var(--bg); color: var(--fg); border: 1px solid var(--border); border-radius: 16px; padding: 10px 12px; box-shadow: 0 8px 28px rgba(0,0,0,.28); }
.installPop img { border-radius: 10px; flex: none; }
.installText { display: flex; flex-direction: column; gap: 2px; font-size: .85rem; flex: 1; min-width: 0; }
.installText span { color: var(--muted); font-size: .8rem; }
.installBtns { display: flex; flex-direction: column; gap: 6px; }
.installBtns button { padding: 7px 12px; font-size: .85rem; }
.installNo { background: var(--soft); color: var(--fg); border: 1px solid var(--border); }
.shareIco { display: inline-block; border: 1.5px solid currentColor; border-radius: 4px; padding: 0 3px; font-size: .75rem; }

/* Home: fishing near you */
.homeTitle { margin: 6px 0 6px; font-size: 1.15rem; }
#nearPrompt .fullBtn { margin-top: 2px; }
.seg { display: flex; background: var(--soft); border: 1px solid var(--border); border-radius: 12px; padding: 3px; margin: 8px 0 4px; }
.segBtn { flex: 1; background: transparent; color: var(--fg); padding: 8px; border-radius: 9px; font-size: .9rem; }
.segBtn.active { background: var(--accent); color: var(--accent-fg); }
.nearList li { border-bottom: 1px solid var(--border); border-radius: 0; }
.nearList li:last-child { border-bottom: 0; }
.searchMore { margin-top: 14px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.searchMore > summary { cursor: pointer; font-weight: 600; font-size: .95rem; }
.searchMore[open] > summary { margin-bottom: 10px; }
