:root {
  --navy: #0a3d62;
  --navy-2: #0c2b44;
  --teal: #1b7a8c;
  --teal-2: #149e9e;
  --sand: #f4ead2;
  --sand-2: #efe2c4;
  --ink: #14242e;
  --muted: #5a6b73;
  --card: #ffffff;
  --bg: #eef4f6;
  --accent: #e58e26;
  --good: #2e7d32;
  --warn: #b54708;
  --line: #d9e2e6;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(10, 61, 98, 0.10);
  --maxw: 720px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(135deg, var(--navy) 0%, var(--teal) 100%);
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow);
}
.app-header__title { font-size: 1.15rem; margin: 0; font-weight: 700; }
.app-header__sub { display: block; font-size: 0.72rem; opacity: 0.85; margin-top: 2px; }
.install-btn {
  background: rgba(255,255,255,0.16);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Layout ---------- */
.view {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px 16px calc(84px + env(safe-area-inset-bottom));
}

h2.section-title {
  font-size: 1.35rem;
  margin: 4px 0 4px;
  color: var(--navy);
}
.section-intro { color: var(--muted); margin: 0 0 16px; font-size: 0.95rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 0 14px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 8px; font-size: 1.08rem; color: var(--navy-2); }
.card h4 { margin: 14px 0 6px; font-size: 0.98rem; color: var(--teal); }
.card p { margin: 0 0 10px; }
.card ul, .card ol { margin: 0 0 10px; padding-left: 22px; }
.card li { margin-bottom: 5px; }
.card:last-child { margin-bottom: 0; }

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: 999px;
  margin: 0 6px 6px 0;
}
.tag--easy { background: #e6f4ea; color: var(--good); }
.tag--med  { background: #fdf0e3; color: var(--warn); }
.tag--hard { background: #fde8e8; color: #b91c1c; }
.tag--info { background: #e7f0fb; color: var(--navy); }

.callout {
  border-left: 4px solid var(--accent);
  background: #fff8ee;
  padding: 12px 14px;
  border-radius: 0 10px 10px 0;
  margin: 0 0 14px;
  font-size: 0.95rem;
}
.callout--warn { border-color: var(--warn); background: #fdf2ec; }
.callout--good { border-color: var(--good); background: #edf7ee; }
.callout strong { display: inline; }

.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }

/* ---------- Inline icon set ---------- */
.ic { width: 1.05em; height: 1.05em; vertical-align: -0.16em; display: inline-block; flex: none; }
.section-title .ic { width: 1em; height: 1em; vertical-align: -0.08em; opacity: 0.9; }
.btn .ic { vertical-align: -0.18em; margin-right: 3px; }
.app-header__title .ic { width: 1.1em; height: 1.1em; vertical-align: -0.18em; margin-right: 3px; }
details.accordion > summary .ic { vertical-align: -0.18em; margin-right: 6px; }
.cond-grid .ic, .cond-bite .ic, .cond-mini .ic, .fc-meta .ic, .catch-meta .ic, .ytcap .ic { vertical-align: -0.16em; }
.cond-bite .ic { width: 1.15em; height: 1.15em; }
.cond-icon svg { width: 2rem; height: 2rem; }
.fc-ic svg { width: 1.5rem; height: 1.5rem; }
.species-card .emoji svg { width: 1.9rem; height: 1.9rem; color: var(--teal); }
.ytcap .ic, .catch-form h3 .ic { margin-right: 3px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 8px; }
.kv dt { color: var(--muted); font-size: 0.85rem; }
.kv dd { margin: 0; font-weight: 600; }

a { color: var(--teal); }
a.btn, button.btn {
  display: inline-block;
  background: var(--teal);
  color: #fff;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  border: none;
  font-size: 0.95rem;
  margin: 4px 0;
}

/* ---------- Knots ---------- */
.knot-anim {
  margin: 4px 0 14px;
  border: 2px solid var(--teal);
  border-radius: 12px;
  overflow: hidden;
  background: #f3f8fa;
}
.knot-anim svg.kanim { display: block; width: 100%; height: auto; }
.knot-anim figcaption {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--teal);
  text-align: center;
  padding: 6px 8px;
  background: #eaf4f5;
  border-top: 1px solid var(--line);
}
.knot__steps { display: grid; gap: 16px; margin-top: 10px; }
.knot__steps-label { font-size: 0.85rem; color: var(--muted); margin: 0 0 -4px; font-weight: 600; }

/* YouTube embed (click-to-load) */
.ytwrap { margin: 14px 0 2px; }
.ytcap { font-weight: 700; color: var(--navy-2); margin-bottom: 6px; font-size: 0.98rem; }
.yt {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
}
.yt iframe, .yt .yt-facade { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-facade { padding: 0; cursor: pointer; background: #000; display: block; }
.yt-facade img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.9; }
.yt-play {
  position: absolute; inset: 0; margin: auto;
  width: 66px; height: 66px;
  display: grid; place-items: center;
  color: #fff; font-size: 26px; padding-left: 4px;
  background: rgba(229, 142, 38, 0.94);
  border-radius: 50%;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}
.ytnote { display: block; color: var(--muted); font-size: 0.75rem; margin-top: 5px; }
.ytnote a { margin-left: 6px; font-weight: 600; white-space: nowrap; }

/* ---------- Live conditions ---------- */
.cond-card { min-height: 60px; }
.cond-loading { color: var(--muted); margin: 4px 0; }
.cond-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cond-head h3 { margin: 0; color: var(--navy-2); font-size: 1.08rem; }
.cond-refresh {
  background: #eaf4f5; color: var(--teal); border: 1px solid var(--line);
  border-radius: 8px; width: 34px; height: 30px; font-size: 1.05rem; line-height: 1; cursor: pointer;
}
.cond-stale { color: var(--warn); font-size: 0.82rem; margin: 6px 0; }
.cond-now { display: flex; align-items: center; gap: 14px; margin: 10px 0 6px; }
.cond-temp { display: flex; align-items: center; gap: 6px; }
.cond-icon { font-size: 2rem; line-height: 1; }
.cond-deg { font-size: 2.1rem; font-weight: 800; color: var(--navy); }
.cond-sky { color: var(--ink); font-weight: 600; line-height: 1.25; }
.cond-sky small { color: var(--muted); font-weight: 500; }
.cond-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 8px 0; }
.cond-grid > div { display: flex; flex-direction: column; background: #f3f8fa; border-radius: 9px; padding: 7px 10px; }
.cond-grid span { font-size: 0.74rem; color: var(--muted); }
.cond-grid b { font-size: 0.98rem; color: var(--ink); }
.cond-bite { background: #fff8ee; border-left: 4px solid var(--accent); border-radius: 0 10px 10px 0;
  padding: 9px 12px; margin: 8px 0; font-size: 0.92rem; }
.cond-bite span { font-size: 1.05rem; margin-right: 4px; }
.cond-card h4 { margin: 10px 0 4px; color: var(--teal); font-size: 0.95rem; }
.tide-list { list-style: none; padding-left: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 7px; }
.tide-list li { background: #f3f8fa; border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; font-size: 0.9rem; }
.tide-list li.next { background: #eaf4f5; border-color: var(--teal); font-weight: 700; }
.tide-type { font-weight: 700; margin-right: 4px; }
.tide-H { color: #1565c0; }
.tide-L { color: #b54708; }
.cond-foot { margin-top: 10px; font-size: 0.74rem; }

/* compact conditions strip on Home */
.cond-mini {
  display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: space-between;
  background: linear-gradient(135deg, var(--navy) 0%, var(--teal) 100%);
  color: #fff; text-decoration: none; border-radius: var(--radius);
  padding: 11px 15px; margin: 0 0 14px; font-weight: 700; font-size: 0.95rem;
  box-shadow: var(--shadow);
}

/* ---------- 7-day forecast ---------- */
.fc-head { display: flex; align-items: center; justify-content: space-between; }
.fc-head h3 { margin: 0; color: var(--navy-2); font-size: 1.05rem; }
.fc-day { border-top: 1px solid var(--line); padding: 10px 0; }
.fc-day:first-of-type { border-top: 0; padding-top: 4px; }
.fc-day__head { display: flex; align-items: center; justify-content: space-between; }
.fc-day__name b { font-size: 1rem; color: var(--navy); }
.fc-day__name small { color: var(--muted); margin-left: 7px; font-weight: 600; }
.fc-day__wx { display: flex; align-items: center; gap: 8px; }
.fc-ic { font-size: 1.5rem; line-height: 1; }
.fc-temp { font-weight: 800; color: var(--navy); font-size: 1.05rem; }
.fc-temp small { color: var(--muted); font-weight: 600; }
.fc-meta { color: var(--muted); font-size: 0.82rem; margin: 5px 0 7px; }
.fc-tides { display: flex; flex-wrap: wrap; gap: 6px; }
.fc-tide { background: #f3f8fa; border: 1px solid var(--line); border-radius: 7px; padding: 3px 8px; font-size: 0.82rem; font-weight: 600; }

/* ---------- Catch log ---------- */
.catch-form label { display: block; font-size: 0.82rem; color: var(--muted); font-weight: 600; margin: 9px 0 0; }
.catch-form input { width: 100%; font-size: 16px; padding: 9px 10px; margin-top: 3px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); }
.catch-row { display: flex; gap: 10px; }
.catch-row label { flex: 1; }
.catch-form .btn { margin-top: 14px; width: 100%; text-align: center; }
.catch-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 4px 2px 12px; font-size: 0.9rem; color: var(--muted); }
.catch-stats b { color: var(--navy); }
.linkbtn { margin-left: auto; background: none; border: none; color: var(--teal); font-weight: 700; cursor: pointer; font-size: 0.9rem; }
.catch-item { position: relative; padding: 12px 38px 12px 14px; }
.catch-item__main { font-size: 1.02rem; }
.catch-when { display: block; color: var(--muted); font-size: 0.8rem; font-weight: 500; margin-top: 2px; }
.catch-meta { font-size: 0.88rem; color: var(--ink); margin-top: 4px; }
.catch-del { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border-radius: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; font-size: 0.9rem; }
.catch-form .opt { color: var(--muted); font-weight: 500; font-size: 0.78rem; }
.catch-form input[type="file"] { border: 1px dashed var(--line); background: #f7fafb; padding: 9px 10px; }
.catch-photo { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: 10px;
  margin-top: 9px; cursor: zoom-in; border: 1px solid var(--line); }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0.92);
  display: flex; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* ---------- 7-tab bar tightening ---------- */
.tabbar .tab { padding: 8px 1px 5px; }
.tabbar .tab svg { width: 23px; height: 23px; display: block; margin: 0 auto; }
.tabbar .tab span { font-size: 0.6rem; margin-top: 3px; }
.knot-step {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.knot-step__head {
  padding: 10px 12px;
  font-size: 0.95rem;
  line-height: 1.4;
  background: #f7fafb;
  border-bottom: 1px solid var(--line);
}
.knot-step__num {
  display: inline-block;
  font-weight: 700;
  color: #fff;
  background: var(--teal);
  border-radius: 6px;
  padding: 1px 8px;
  margin-right: 6px;
  font-size: 0.82rem;
}
.knot-step svg.kdiag {
  display: block;
  width: 100%;
  height: auto;
}

.knot-legend .legend { list-style: none; padding-left: 0; margin: 6px 0 10px; }
.knot-legend .legend li { display: flex; align-items: center; gap: 9px; padding: 4px 0; font-size: 0.92rem; }
.sw { width: 26px; height: 5px; border-radius: 3px; flex: none; }
.sw--main { background: #0a3d62; }
.sw--tag { background: #e58e26; }
.sw--leader { background: #0f9b8e; }
.sw--dash {
  height: 0; border-top: 3px dashed #e58e26;
  position: relative;
}

details.accordion {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0 0 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
details.accordion > summary {
  cursor: pointer;
  list-style: none;
  padding: 15px 16px;
  font-weight: 700;
  color: var(--navy-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
details.accordion > summary::-webkit-details-marker { display: none; }
details.accordion > summary::after { content: "＋"; color: var(--teal); font-weight: 700; }
details.accordion[open] > summary::after { content: "－"; }
details.accordion > summary .sum-tag { font-size: 0.7rem; font-weight: 700; }
.accordion__body { padding: 0 16px 16px; }

/* ---------- Rig diagrams ---------- */
.rig svg { width: 100%; max-width: 360px; height: auto; display: block; margin: 8px auto; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 10px rgba(10,61,98,0.06);
}
.tab {
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: var(--muted);
  font-size: 1.35rem;
  padding: 8px 2px 6px;
  line-height: 1;
}
.tab span { display: block; font-size: 0.66rem; margin-top: 3px; font-weight: 600; letter-spacing: 0.01em; }
.tab.active { color: var(--teal); }
.tab.active span { color: var(--teal); }

/* ---------- Misc ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .grid-2 { grid-template-columns: 1fr; } }

.species-card { display: flex; gap: 12px; align-items: flex-start; }
.species-card .emoji { font-size: 2rem; line-height: 1; }
.regs { font-size: 0.85rem; color: var(--muted); }
.regs b { color: var(--ink); }

footer.legal {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 8px 0 0;
}

.checkbox-list { list-style: none; padding-left: 0; }
.checkbox-list li { padding: 7px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.checkbox-list li::before { content: "☐"; font-size: 1.1rem; color: var(--teal); }
