:root {
  --bg: #071a22;
  --card: #0e2a35;
  --line: #1d4250;
  --text: #e8f3f1;
  --muted: #8fb0b0;
  --accent: #ffb547;
  --good: #4fd1a5;
  --bad: #ff6b6b;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: env(safe-area-inset-bottom); }
.hidden { display: none !important; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: rgba(7,26,34,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 10px; align-items: center; }
.brand h1 { font-size: 20px; margin: 0; letter-spacing: .3px; }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 10px;
  width: 40px; height: 40px; font-size: 20px; }

main { max-width: 640px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.step-head { display: flex; align-items: center; gap: 10px; }
.step-head h2 { margin: 0; font-size: 18px; }
.num { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #241400;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; }
h3 { font-size: 15px; margin: 16px 0 8px; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.center { text-align: center; }

.btn { display: block; width: 100%; text-align: center; padding: 14px; margin-top: 8px; border-radius: 12px;
  border: 1px solid var(--line); background: #133846; color: var(--text); font-size: 16px; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--accent); color: #241400; border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn:active { transform: scale(.98); }

.place { font-weight: 700; margin: 12px 0 8px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: #0a2029; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.stat b { display: block; font-size: 17px; }
.stat span { font-size: 12px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #0a2029; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 13px; }
.chip i { color: var(--muted); font-style: italic; }

.preview { width: 100%; border-radius: 12px; margin-top: 12px; }
.stage { margin-top: 12px; }
.stage canvas { width: 100%; height: auto; border-radius: 12px; display: block; }
.result { margin-top: 12px; padding: 12px; border-radius: 12px; background: #0a2029; border: 1px solid var(--line); }
.result h4 { margin: 0 0 6px; font-size: 16px; color: var(--accent); }
.result ol { padding-left: 20px; margin: 8px 0 0; }
.result li { margin-bottom: 6px; }
.result .err { color: var(--bad); }
.pick { border-color: var(--good); }
.pick h4 { color: var(--good); }

.busy { position: fixed; inset: 0; background: rgba(4,14,18,.8); display: grid; place-content: center; gap: 12px;
  text-align: center; z-index: 20; }
.spinner { width: 44px; height: 44px; margin: 0 auto; border: 4px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

dialog { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius);
  width: min(92vw, 480px); padding: 20px; }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h2 { margin-top: 0; }
dialog label { display: block; margin: 12px 0; font-size: 14px; color: var(--muted); }
dialog input { display: block; width: 100%; margin-top: 4px; padding: 12px; border-radius: 10px;
  border: 1px solid var(--line); background: #0a2029; color: var(--text); font-size: 16px; }
.row { display: flex; gap: 8px; }
.icon-btn.lang { font-size: 13px; font-weight: 700; width: 44px; }
.top .row { gap: 8px; }
/* iOS: stop zoom on input focus, smooth tap feel */
input, button { font-size: 16px; -webkit-tap-highlight-color: transparent; }

/* segmented choices */
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; padding: 10px 4px; border-radius: 10px; border: 1px solid var(--line); background: #0a2029;
  color: var(--text); font-weight: 600; font-size: 14px; }
.seg button.on { background: var(--accent); color: #241400; border-color: var(--accent); }

/* download progress */
.bar { width: 220px; height: 8px; margin: 0 auto; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }

/* bait list */
ul.baits { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
ul.baits li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line); }
ul.baits li.best { border-color: var(--good); }
.badge { font-weight: 700; min-width: 32px; }
ul.baits select { flex: 1; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: #0e2a35; color: var(--text); font-size: 16px; }
.score { font-weight: 700; color: var(--accent); min-width: 28px; text-align: right; }

/* language flag */
.icon-btn.lang { width: auto; padding: 0 10px; display: flex; align-items: center; gap: 6px; }
.flag { font-size: 18px; line-height: 1; }

/* download banner */
.banner { border-color: var(--accent); }
.banner p { margin: 0 0 8px; }
.banner .bar { width: 100%; margin: 8px 0; }

/* species chips as buttons */
button.chip { color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
button.chip.sel { background: var(--accent); color: #241400; border-color: var(--accent); }
button.chip.sel i { color: #4a3100; }
.pref { margin: 0 0 8px; font-size: 14px; }
.pref button { background: none; border: none; color: var(--accent); text-decoration: underline; padding: 0 4px; font-size: 14px; }
.note { margin-top: 10px; padding: 10px; border-radius: 10px; background: #2a2412; border: 1px solid #6b5520; font-size: 14px; }

/* species sheet */
#sheet { padding: 0 0 16px; max-height: 88vh; overflow-y: auto; }
#sheet > :not(.sheet-img) { margin-left: 16px; margin-right: 16px; }
#sheet .btn { width: calc(100% - 32px); text-decoration: none; }
.sheet-img { background: #0a2029; }
.sheet-img img { width: 100%; max-height: 240px; object-fit: contain; display: block; }
#sheet h2 { margin: 12px 16px 0; }
#sheet p { margin-top: 6px; }
.errdetail { display: block; margin-top: 6px; font-size: 11px; color: var(--bad); word-break: break-word; }

/* ---------- icon integration ---------- */
.brand-icon { border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.4); }

/* loading: the lure wiggles like it's being retrieved */
.busy-icon { width: 88px; height: 88px; margin: 0 auto; border-radius: 22px;
  box-shadow: 0 6px 24px rgba(0,0,0,.5); animation: wiggle 0.9s ease-in-out infinite; }
@keyframes wiggle {
  0%, 100% { transform: rotate(-8deg) translateY(0); }
  50% { transform: rotate(8deg) translateY(-6px); }
}

/* ---------- splash (~1200 ms) ---------- */
#splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 38%, #16627a 0%, #0b3644 55%, #061820 100%);
  transition: opacity .3s ease; }
#splash.gone { opacity: 0; pointer-events: none; }
.splash-inner { text-align: center; }
.splash-icon { width: 148px; height: 148px; border-radius: 34px; box-shadow: 0 12px 40px rgba(0,0,0,.55);
  animation: splashIn .6s cubic-bezier(.2,1.4,.4,1) both, splashBite .25s ease-in-out .65s 2; }
.splash-title { margin-top: 22px; font-size: 34px; font-weight: 800; letter-spacing: .5px;
  animation: fadeUp .4s ease-out .3s both; }
.splash-tag { margin-top: 4px; color: var(--accent); font-weight: 600;
  animation: fadeUp .4s ease-out .5s both; }
@keyframes splashIn { from { transform: translateY(-60px) rotate(-25deg) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes splashBite { 50% { transform: scale(1.06) rotate(4deg); } }
@keyframes fadeUp { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .splash-icon, .splash-title, .splash-tag, .busy-icon { animation: none; }
}

/* ---------- no header: floating language button ---------- */
main { padding-top: calc(16px + env(safe-area-inset-top)); }
.lang-float { position: fixed; z-index: 10; top: calc(10px + env(safe-area-inset-top)); right: 12px;
  display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(14,42,53,.92); backdrop-filter: blur(8px);
  color: var(--text); font-weight: 700; font-size: 13px; box-shadow: 0 2px 10px rgba(0,0,0,.4); }
/* keep step 1's title clear of the floating button */
#step1 .step-head, .banner p { padding-right: 84px; }

/* ---------- colours ---------- */
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 50%; flex: none;
  border: 1px solid rgba(255,255,255,.35); vertical-align: -2px; margin-right: 5px; }
ul.baits li { flex-wrap: wrap; }
ul.baits select { min-width: 0; flex: 1 1 38%; }
.bestcols { margin: 4px 0 2px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; }
.colchip { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: #0e2a35; font-size: 13px; }
.colchip.have { border-color: var(--good); }

/* ---------- step 2 checklist ---------- */
.checklist { list-style: none; padding: 0; margin: 12px 0 8px; display: grid; gap: 6px; }
.checklist li { display: grid; grid-template-columns: 22px 24px 1fr; grid-template-rows: auto auto; column-gap: 6px;
  align-items: start; padding: 8px 10px; border-radius: 10px; background: #0a2029; border: 1px solid var(--line); }
.checklist .st { grid-row: 1 / span 2; font-weight: 800; text-align: center; }
.checklist .st.ok { color: var(--good); } .checklist .st.warn { color: var(--accent); } .checklist .st.todo { color: var(--muted); }
.checklist .ic { grid-row: 1 / span 2; }
.checklist .lbl { font-size: 13px; color: var(--muted); }
.checklist .val { grid-column: 3; font-weight: 600; }
.checklist .val small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.ask { margin: 10px 0 4px; padding: 10px 12px; border-radius: 10px; border: 1px dashed var(--accent); font-size: 15px; }
.ask:empty { display: none; }
.ask.done { border-style: solid; border-color: var(--good); color: var(--good); }
.photo-btns { display: grid; gap: 0; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumbs figure { margin: 0; position: relative; }
.thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.thumbs figcaption { position: absolute; bottom: 2px; right: 4px; font-size: 14px; }
details.fix { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
details.fix summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 4px 0; }
.seg button.mine { box-shadow: inset 0 0 0 2px #fff; }

/* ---------- buy suggestion (quiet, one line) ---------- */
details.buy { margin-top: 10px; font-size: 13px; color: var(--muted); }
details.buy summary { cursor: pointer; list-style: none; padding: 4px 0; }
details.buy summary::-webkit-details-marker { display: none; }
details.buy summary b { color: var(--text); font-weight: 600; }
details.buy a { color: var(--accent); }
details.buy p { margin: 4px 0; }
ul.shops { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
ul.shops li { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
ul.shops .route { white-space: nowrap; }

/* ---------- offline / plan trip ---------- */
.net-badge { position: fixed; z-index: 10; top: calc(10px + env(safe-area-inset-top)); left: 12px; padding: 8px 12px; border-radius: 999px;
  background: #3a2a10; border: 1px solid #6b5520; color: var(--accent); font-weight: 700; font-size: 13px; }
details.plan { margin-top: 10px; }
details.plan summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 6px 0; }
details.plan .row { align-items: stretch; }
details.plan input { flex: 1; min-width: 0; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: #0a2029; color: var(--text); font-size: 16px; margin-top: 8px; }
details.plan .row .btn { width: auto; padding: 12px 16px; }
.plan-results, .trips { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 4px; }
button.link { background: none; border: none; color: var(--accent); text-align: left; padding: 6px 0; font-size: 14px; cursor: pointer; }
.trips li { display: flex; justify-content: space-between; align-items: center; font-size: 14px; padding: 4px 0; }
.trips .x { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; width: 32px; height: 32px; }

/* ---------- version number ---------- */
.splash-ver { margin-top: 10px; font-size: 12px; color: var(--muted); animation: fadeUp .4s ease-out .6s both; }
.version { margin-top: -4px; opacity: .8; }

/* ---------- in-app camera with torch ---------- */
.camera { position: fixed; inset: 0; z-index: 50; background: #000; }
.camera video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-guide { position: absolute; left: 8%; right: 8%; top: 16%; bottom: 26%; border: 2px dashed rgba(255,255,255,.45); border-radius: 18px; pointer-events: none; }
.cam-hint { position: absolute; left: 16px; right: 16px; top: calc(16px + env(safe-area-inset-top)); margin: 0; padding: 8px 12px; padding-right: 56px;
  border-radius: 12px; background: rgba(0,0,0,.55); color: #fff; font-size: 14px; }
.cam-close { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 16px; width: 44px; height: 44px; border-radius: 50%;
  border: none; background: rgba(0,0,0,.6); color: #fff; font-size: 20px; }
.cam-bar { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 24px calc(22px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; background: linear-gradient(transparent, rgba(0,0,0,.75)); }
.cam-shoot { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: rgba(255,255,255,.25); justify-self: center; }
.cam-shoot:active { background: rgba(255,255,255,.7); }
.cam-side { justify-self: center; display: grid; justify-items: center; gap: 2px; min-width: 76px; padding: 8px 10px; border-radius: 16px;
  border: 1px solid rgba(255,255,255,.3); background: rgba(0,0,0,.45); color: #fff; }
.cam-side span { font-size: 26px; line-height: 1; }
.cam-side small { font-size: 12px; font-weight: 600; }
.cam-torch.on { background: var(--accent); color: #241400; border-color: var(--accent); box-shadow: 0 0 24px rgba(255,181,71,.7); }

/* ---------- install button ---------- */
.install-top { margin: 0 0 4px; font-size: 17px; padding: 16px; box-shadow: 0 4px 18px rgba(255,181,71,.25); }
#iosInstall .link { padding: 0 0 0 6px; }
