/* Hunt Field: dark, high contrast, big targets. Built for an iPhone held in one
   gloved hand in daylight. */

:root {
  --bg: #000;
  --panel: #151517;
  --panel-2: #232327;
  --line: #4a4a52;
  --text: #fff;
  --dim: #c4c4cc;
  --accent: #ff7a1a;
  --accent-ink: #000;
  --ok: #45e07a;
  --warn: #ffd23f;
  --bad: #ff6259;
  --radius: 14px;
  --tap: 60px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.3 -apple-system, BlinkMacSystemFont, "Helvetica Neue", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; margin: 0; }
input, textarea, select { -webkit-user-select: text; user-select: text; }
h1, h2, h3, p { margin: 0; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none; }

/* ---- top bar ---- */

#top {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top) + 8px) calc(env(safe-area-inset-right) + 12px) 8px calc(env(safe-area-inset-left) + 12px);
}

.area-btn {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  text-align: left;
  font-size: 22px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.area-btn::after { content: " ▾"; color: var(--dim); font-size: 16px; }

.pill {
  flex: none;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 20px;
  border: 2px solid var(--line);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}
.pill.ok { border-color: var(--ok); color: var(--ok); }
.pill.warn { border-color: var(--warn); color: var(--warn); }
.pill.bad { border-color: var(--bad); color: var(--bad); }

#update-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 12px 8px;
  padding: 8px 8px 8px 14px;
  border-radius: var(--radius);
  background: var(--panel-2);
  border: 2px solid var(--accent);
  font-weight: 700;
}
#update-bar button { min-height: 44px; padding: 0 18px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 800; }

/* ---- main area ---- */

#view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px calc(env(safe-area-inset-right) + 12px) 20px calc(env(safe-area-inset-left) + 12px);
}

.boot { padding: 40px 0; text-align: center; color: var(--dim); }

h2.label {
  margin: 14px 2px 8px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid.sign > :last-child:nth-child(odd) { grid-column: span 2; }

.big {
  min-height: var(--tap);
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--panel-2);
  border: 2px solid var(--line);
  font-size: 21px;
  font-weight: 800;
  text-align: center;
}
.big.sighting { min-height: 68px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-size: 23px; }
.big:active, .row:active, .btn:active { filter: brightness(1.5); transform: scale(0.98); }
.big.sighting:active { filter: brightness(0.75); }

.live { margin: 14px 2px 0; color: var(--dim); font-size: 15px; text-align: center; min-height: 20px; }

/* ---- "just logged" card ---- */

.card {
  min-height: 136px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 2px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}
.card.logged { border-color: var(--ok); }
.card.flash { animation: flash 0.7s ease-out; }
@keyframes flash { from { background: #1f6b3a; } to { background: var(--panel); } }
@media (prefers-reduced-motion: reduce) { .card.flash { animation: none; } }

.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.card-title { font-size: 24px; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.logged .card-title::before { content: "✓ "; color: var(--ok); }
.card-time { flex: none; color: var(--dim); font-size: 16px; font-weight: 700; }
.card-sub { color: var(--dim); font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-hint { color: var(--dim); font-size: 16px; }
.card-actions { display: flex; gap: 8px; }
.card-actions .btn { flex: 1; }
.card-actions .step { flex: 0 0 56px; font-size: 28px; padding: 0; }

.btn {
  min-height: 50px;
  padding: 6px 14px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 2px solid var(--line);
  font-size: 17px;
  font-weight: 800;
  text-align: center;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.wide { display: block; width: 100%; min-height: var(--tap); font-size: 19px; }
.btn:disabled { opacity: 0.4; }

/* ---- backup reminder ---- */

.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 12px;
  border-radius: 12px;
  background: #3a2a00;
  border: 2px solid var(--warn);
  font-size: 16px;
  font-weight: 700;
}
.banner span { flex: 1; }
.banner .btn { flex: none; min-height: 46px; background: var(--warn); border-color: var(--warn); color: #000; }

/* ---- lists ---- */

.chips { display: flex; gap: 8px; margin: 6px 0 4px; }
.chip { flex: 1; min-height: 48px; border-radius: 24px; border: 2px solid var(--line); font-size: 16px; font-weight: 800; }
.chip.on { background: var(--text); border-color: var(--text); color: #000; }

h3.day { margin: 18px 2px 8px; font-size: 16px; font-weight: 800; display: flex; justify-content: space-between; gap: 10px; }
h3.day span { color: var(--dim); font-weight: 600; }

.rows { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 2px solid var(--line);
  text-align: left;
}
.row.on { border-color: var(--accent); }
.row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.row-main { font-size: 19px; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-side { flex: none; color: var(--dim); font-size: 15px; font-weight: 700; }
.row-sub { display: block; margin-top: 2px; color: var(--dim); font-size: 15px; }
.row-note { display: block; margin-top: 4px; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line); color: var(--dim); font-size: 12px; font-weight: 700; vertical-align: middle; }

.pair { display: flex; gap: 8px; align-items: stretch; }
.pair .row { flex: 1; min-width: 0; }
.pair .btn { flex: none; }

.empty { margin: 36px 12px; text-align: center; color: var(--dim); font-size: 17px; }
.note { margin: 8px 2px; color: var(--dim); font-size: 15px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.facts { margin: 8px 2px; color: var(--dim); font-size: 15px; line-height: 1.6; }
.facts b { color: var(--text); }
.facts .good { color: var(--ok); }
.facts .poor { color: var(--warn); }

/* ---- welcome ---- */

.welcome { padding-top: calc(env(safe-area-inset-top) + 24px); }
.welcome h1 { font-size: 34px; font-weight: 800; }
.welcome h1 span { color: var(--accent); }
.welcome .lead { margin: 8px 0 20px; color: var(--dim); }
.or { margin: 22px 0 10px; text-align: center; color: var(--dim); font-size: 15px; }

/* ---- forms ---- */

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin: 0 2px 6px; font-size: 14px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); }
.field input, .field select, .field textarea, .pick {
  display: block;
  width: 100%;
  min-height: 54px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--panel-2);
  font-size: 18px;
  -webkit-appearance: none;
  appearance: none;
}
.field textarea { min-height: 96px; resize: none; }
.field input:focus, .field select:focus, .field textarea:focus, .pick:focus { outline: none; border-color: var(--accent); }
select { background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 15px) 50%; background-size: 7px 7px; background-repeat: no-repeat; padding-right: 40px !important; }

.subs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.subs .chip { min-height: 50px; }
.subs .chip.on { background: var(--accent); border-color: var(--accent); }

.stepper { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.stepper .btn { flex: 0 0 72px; min-height: 60px; font-size: 30px; padding: 0; }
.stepper output { flex: 1; text-align: center; font-size: 30px; font-weight: 800; }

.photos { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.photos button { width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 2px solid var(--line); }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-full { display: block; width: 100%; border-radius: 10px; margin-bottom: 12px; }

/* ---- sheets ---- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.72);
}
.sheet {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - env(safe-area-inset-top) - 16px);
  border-radius: 20px 20px 0 0;
  border-top: 2px solid var(--line);
  background: var(--bg);
}
.sheet.full { height: calc(100dvh - env(safe-area-inset-top) - 16px); }
.sheet-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 12px 8px 16px; }
.sheet-head h2 { font-size: 22px; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-head .btn { flex: none; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 16px calc(env(safe-area-inset-bottom) + 18px); }
.sheet-foot { flex: none; padding: 10px 16px calc(env(safe-area-inset-bottom) + 12px); border-top: 2px solid var(--line); }
.message { margin-bottom: 16px; font-size: 18px; line-height: 1.4; white-space: pre-line; }

.imp { padding: 12px 0; border-bottom: 1px solid var(--line); }
.imp-name { font-size: 18px; font-weight: 800; overflow-wrap: anywhere; }
.imp-hint { margin: 2px 0 8px; color: var(--dim); font-size: 14px; overflow-wrap: anywhere; }

/* ---- toast ---- */

#toast {
  position: fixed;
  z-index: 30;
  left: 12px;
  right: 12px;
  top: calc(env(safe-area-inset-top) + 10px);
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--text);
  color: #000;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
}
#toast.error { background: var(--bad); }

/* ---- bottom tabs ---- */

#tabs {
  flex: none;
  display: flex;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--panel);
  border-top: 2px solid var(--line);
}
#tabs button {
  position: relative;
  flex: 1;
  height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--dim);
  font-size: 13px;
  font-weight: 800;
}
#tabs svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#tabs button.on { color: var(--accent); }
#tabs button.dot::after { content: ""; position: absolute; top: 9px; left: calc(50% + 10px); width: 11px; height: 11px; border-radius: 50%; background: var(--warn); }

body.fresh #top, body.fresh #tabs { display: none; }
