/* HarborMuster — Split-Flap Departure Board theme */

:root {
  --primary: #1f4e5f;
  --primary-deep: #152f3a;
  --navy: #14232b;
  --secondary: #e8dcc4;
  --secondary-dim: #c8b995;
  --accent: #d96c4b;
  --brass: #c69a4e;
  --sea: #5b7a6f;
  --mist: #7fa8b8;
  --flap-hi: #2c4c58;
  --flap-lo: #1b3641;
  --ready-hi: #43615a;
  --ready-lo: #334b45;
  --ink: #0c1c24;
  --danger: #b0492f;
  --hole: #122b35;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: linear-gradient(180deg, #265a6c 0%, var(--primary) 34%, var(--primary-deep) 100%);
  background-attachment: fixed;
  color: var(--secondary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
body.modal-open { overflow: hidden; }

button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Riveted steel masthead ---------- */

.masthead {
  background: linear-gradient(180deg, #2a5a6b, #1c4251);
  border-bottom: 1px solid rgba(0, 0, 0, 0.5);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35), 0 8px 18px rgba(0, 0, 0, 0.3);
  padding: calc(12px + env(safe-area-inset-top)) 14px 12px;
  position: relative;
  z-index: 20;
}
.rivet-row {
  position: absolute;
  top: 5px;
  left: 12px;
  right: 12px;
  height: 6px;
  background-image: radial-gradient(circle, rgba(232, 220, 196, 0.38) 1.2px, transparent 1.7px);
  background-size: 13px 6px;
  background-position: center;
  opacity: 0.75;
}

.masthead-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 20px;
  height: 20px;
  flex: none;
  background: var(--secondary);
  clip-path: polygon(50% 0, 63% 37%, 100% 50%, 63% 63%, 50% 100%, 37% 63%, 0 50%, 37% 37%);
}
.brand-text h1 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--secondary);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}
.brand-text p {
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--secondary-dim);
  font-style: italic;
}

/* Boarding-pass button */
.pass-btn {
  --notch: var(--hole);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--secondary);
  color: var(--ink);
  border: 0;
  border-radius: 9px;
  padding: 10px 14px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-size: 11.5px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4);
}
.pass-btn::before,
.pass-btn::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--notch);
  top: 50%;
  transform: translateY(-50%);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}
.pass-btn::before { left: -6px; }
.pass-btn::after { right: -6px; }
.pass-star {
  width: 12px;
  height: 12px;
  flex: none;
  background: var(--accent);
  clip-path: polygon(50% 0, 63% 37%, 100% 50%, 63% 63%, 50% 100%, 37% 63%, 0 50%, 37% 37%);
}
.pass-divider {
  width: 0;
  align-self: stretch;
  border-left: 2px dashed rgba(12, 28, 36, 0.35);
}
.pass-btn--wide {
  --notch: #1a3a46;
  width: 100%;
  max-width: 420px;
  display: flex;
  justify-content: center;
  margin: 24px auto 0;
  padding: 14px;
  font-size: 13px;
}

/* Gauge counters */
.gauge-rack {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 40px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.gauge { display: flex; flex-direction: column; align-items: center; }
.gauge-dial {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 36%, #1e3c48, #0f1f29 78%);
  border: 3px solid #0b161d;
  box-shadow: inset 0 0 0 2px rgba(232, 220, 196, 0.14), 0 3px 7px rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  position: relative;
}
.gauge-dial::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 1px dashed rgba(232, 220, 196, 0.3);
  pointer-events: none;
}
.gauge-dial span {
  font-size: 20px;
  font-weight: 800;
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
  z-index: 1;
}
.gauge-dial--ready { border-color: rgba(91, 122, 111, 0.9); }
.gauge-dial--ready span { color: #b9d3c2; }
.gauge-label {
  margin-top: 6px;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--secondary-dim);
}
.gauge-caption {
  width: 100%;
  text-align: center;
  order: -1;
  font-size: 11px;
  font-style: italic;
  color: var(--secondary-dim);
}

/* ---------- Main / views ---------- */

#main { display: block; }
.view {
  padding: 16px 14px calc(112px + env(safe-area-inset-bottom));
  max-width: 520px;
  margin: 0 auto;
}
.view-lede {
  font-size: 12px;
  font-style: italic;
  color: var(--secondary-dim);
  margin-bottom: 14px;
}

/* ---------- Board tab ---------- */

.hero-board {
  max-width: 420px;
  margin: 4px auto 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 5px 0 #0b161d, 0 12px 20px rgba(0, 0, 0, 0.35);
}
.hero-flap {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 13px 18px 15px;
  position: relative;
}
.hero-flap--top { background: linear-gradient(180deg, var(--flap-hi), #22414d 94%); }
.hero-flap--bottom {
  background: linear-gradient(180deg, #1d3a45, var(--flap-lo));
  border-top: 1px solid rgba(0, 0, 0, 0.65);
}
.hero-num {
  font-size: 46px;
  font-weight: 800;
  line-height: 1;
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
}
.hero-num--ready { color: #b9d3c2; }
.hero-word {
  font-size: 10.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(232, 220, 196, 0.72);
}

.stage-strip { display: flex; gap: 8px; margin-top: 20px; }
.stage-plate {
  flex: 1;
  background: rgba(9, 22, 28, 0.55);
  border: 1px solid rgba(232, 220, 196, 0.12);
  border-radius: 8px;
  padding: 8px 10px 9px;
}
.stage-plate b {
  display: block;
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 3px;
}
.stage-plate span { font-size: 10.5px; color: var(--secondary-dim); }
.stage-plate.s-before { border-top: 3px solid var(--accent); }
.stage-plate.s-packing { border-top: 3px solid var(--brass); }
.stage-plate.s-dayof { border-top: 3px solid var(--mist); }

.board-next { margin-top: 22px; }
.board-next-label {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--secondary-dim);
  margin-bottom: 8px;
}
.board-next-note {
  font-size: 13px;
  font-style: italic;
  color: #b9d3c2;
  padding: 10px 2px;
}

/* ---------- Split-flap rows ---------- */

.flap-row {
  display: flex;
  align-items: stretch;
  position: relative;
  width: 100%;
  border: 0;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--flap-hi);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.42), 0 7px 12px rgba(0, 0, 0, 0.24);
  margin-bottom: 11px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.flap-row .stripe {
  width: 10px;
  flex: none;
  background: var(--flap-lo);
}
.stripe.st-before { background: var(--accent); }
.stripe.st-packing { background: var(--brass); }
.stripe.st-dayof { background: var(--mist); }

.flap-face {
  flex: 1;
  min-width: 0;
  min-height: 58px;
  padding: 9px 12px 10px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  background: linear-gradient(180deg, var(--flap-hi) 0%, var(--flap-hi) 49.6%, var(--flap-lo) 50%, var(--flap-lo) 100%);
}
.flap-face::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.24) 28%, rgba(0, 0, 0, 0.24) 72%, rgba(0, 0, 0, 0.72));
}
.flap-title {
  position: relative;
  z-index: 1;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--secondary);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}
.flap-note {
  position: relative;
  z-index: 1;
  margin-top: 3px;
  font-size: 12px;
  font-style: italic;
  line-height: 1.3;
  color: rgba(232, 220, 196, 0.6);
}

/* Solid readiness dot — never a tick */
.dot-toggle {
  flex: none;
  width: 52px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.2);
  border: 0;
  border-left: 1px dashed rgba(232, 220, 196, 0.22);
}
.dot-core {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 3px solid rgba(232, 220, 196, 0.5);
  background: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.is-ready .dot-core { background: var(--secondary); border-color: var(--secondary); }

/* Ready rows dim to muted sea-green */
.flap-row.is-ready { box-shadow: 0 2px 0 rgba(0, 0, 0, 0.28), 0 5px 9px rgba(0, 0, 0, 0.18); }
.flap-row.is-ready .flap-face {
  background: linear-gradient(180deg, var(--ready-hi) 0%, var(--ready-hi) 49.6%, var(--ready-lo) 50%, var(--ready-lo) 100%);
}
.flap-row.is-ready .flap-title { color: rgba(216, 229, 215, 0.78); text-shadow: none; }
.flap-row.is-ready .flap-note { color: rgba(216, 229, 215, 0.5); }
.flap-row.is-ready .stripe { opacity: 0.55; }

/* ---------- Checklist groups ---------- */

.group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0 11px;
}
#checklist-groups .group:first-child .group-head { margin-top: 4px; }
.group-stripe { width: 26px; height: 8px; border-radius: 2px; flex: none; }
.group-stripe.gs-before { background: var(--accent); }
.group-stripe.gs-packing { background: var(--brass); }
.group-stripe.gs-dayof { background: var(--mist); }
.group-head h3 {
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--secondary);
}
.group-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--secondary-dim);
  font-variant-numeric: tabular-nums;
}
.group-empty {
  border: 1px dashed rgba(232, 220, 196, 0.28);
  border-radius: 8px;
  padding: 11px 13px;
  font-size: 12px;
  font-style: italic;
  color: var(--secondary-dim);
  margin-bottom: 11px;
}
/* Vary row shapes per stage */
.group--packing .flap-face { min-height: 50px; }
.group--packing .flap-row { margin-bottom: 9px; }
.group--dayof .stripe { width: 16px; }
.group--dayof .flap-title { font-size: 13.5px; letter-spacing: 0.1em; }

/* ---------- Search ---------- */

.search-wrap input {
  width: 100%;
  background: #0d2029;
  border: 1px solid rgba(232, 220, 196, 0.26);
  border-radius: 10px;
  color: var(--secondary);
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
}
.search-wrap input::placeholder { color: rgba(232, 220, 196, 0.4); }
.search-count {
  margin: 12px 2px 10px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--secondary-dim);
}
.search-empty {
  border: 1px dashed rgba(232, 220, 196, 0.3);
  border-radius: 12px;
  padding: 22px 16px;
}
.search-empty p { font-size: 13.5px; font-style: italic; color: var(--secondary-dim); line-height: 1.55; }

/* ---------- Guide ---------- */

.guide-title {
  font-size: 17px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.guide-lede {
  font-size: 12.5px;
  font-style: italic;
  color: var(--secondary-dim);
  line-height: 1.5;
  margin-bottom: 16px;
}
.reminder {
  background: rgba(9, 22, 28, 0.5);
  border-left: 4px solid var(--brass);
  border-radius: 6px;
  padding: 11px 13px;
  margin-bottom: 10px;
}
.reminder:nth-of-type(2) { border-left-color: var(--accent); }
.reminder:nth-of-type(3) { border-left-color: var(--mist); }
.reminder:nth-of-type(4) { border-left-color: var(--sea); }
.reminder:nth-of-type(5) { border-left-color: var(--brass); }
.reminder b {
  display: block;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 3px;
}
.reminder span { display: block; font-size: 12.5px; line-height: 1.45; color: var(--secondary-dim); }
.storage-note {
  margin-top: 20px;
  background: var(--secondary);
  color: var(--ink);
  border-radius: 12px 12px 12px 3px;
  padding: 13px 15px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}
.storage-note b {
  display: block;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.storage-note p { font-size: 12.5px; line-height: 1.55; color: rgba(12, 28, 36, 0.82); }
.guide-version {
  margin-top: 18px;
  text-align: center;
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(232, 220, 196, 0.4);
}

/* ---------- Empty states ---------- */

.empty-stub {
  max-width: 420px;
  margin: 8px auto 0;
  border: 2px dashed rgba(232, 220, 196, 0.32);
  border-radius: 14px;
  padding: 24px 18px;
  background: rgba(9, 22, 28, 0.35);
  position: relative;
}
.empty-stub--slim { padding: 18px 16px; margin-top: 0; }
.empty-star {
  display: block;
  width: 22px;
  height: 22px;
  background: var(--accent);
  clip-path: polygon(50% 0, 63% 37%, 100% 50%, 63% 63%, 50% 100%, 37% 63%, 0 50%, 37% 37%);
  margin-bottom: 12px;
}
.empty-stub h2 {
  font-size: 18px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-bottom: 7px;
}
.empty-stub p { font-size: 13px; color: var(--secondary-dim); line-height: 1.55; }

/* ---------- Harbor-buoy bottom bar ---------- */

.buoy-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  background: linear-gradient(180deg, #101c23, #0b141a);
  border-top: 1px solid rgba(232, 220, 196, 0.14);
  box-shadow: 0 -5px 12px rgba(0, 0, 0, 0.38);
  padding: 8px 8px calc(9px + env(safe-area-inset-bottom));
}
.buoy {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: 0;
  padding: 2px 0 0;
  transform: translateY(0);
  transition: transform 0.18s ease;
}
.buoy:nth-child(1) .buoy-hull { width: 32px; }
.buoy:nth-child(2) .buoy-hull { width: 28px; }
.buoy:nth-child(3) .buoy-hull { width: 34px; }
.buoy:nth-child(4) .buoy-hull { width: 30px; }
.buoy-hull {
  height: 27px;
  border-radius: 16px 16px 6px 6px;
  position: relative;
  display: block;
}
.buoy[data-tab="board"] .buoy-hull { background: var(--accent); }
.buoy[data-tab="checklist"] .buoy-hull { background: var(--brass); }
.buoy[data-tab="search"] .buoy-hull { background: var(--mist); }
.buoy[data-tab="guide"] .buoy-hull { background: var(--sea); }
.buoy-light {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(232, 220, 196, 0.9);
}
.buoy-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 12px;
  height: 3px;
  background: rgba(0, 0, 0, 0.28);
}
.buoy-foot {
  width: 42px;
  height: 6px;
  border-radius: 3px;
  background: #0d161c;
  display: block;
}
.buoy-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--secondary-dim);
}
.buoy.active { transform: translateY(-8px) rotate(-4deg); }
.buoy.active .buoy-hull { box-shadow: 0 11px 14px rgba(0, 0, 0, 0.5); }
.buoy.active .buoy-foot { background: rgba(232, 220, 196, 0.4); }
.buoy.active .buoy-label { color: var(--secondary); }

/* ---------- Overlays / sheet / confirm ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 13, 17, 0.66);
  z-index: 60;
  display: flex;
}
.overlay[hidden] { display: none; }
.overlay--sheet { align-items: flex-end; }
.overlay--confirm { align-items: center; justify-content: center; }

.sheet {
  width: 100%;
  background: #173440;
  border-radius: 16px 16px 0 0;
  padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.55);
  max-height: 88dvh;
  overflow: auto;
  border-top: 1px solid rgba(232, 220, 196, 0.16);
}
.sheet-grip {
  width: 44px;
  height: 4px;
  border-radius: 2px;
  background: rgba(232, 220, 196, 0.3);
  margin: 2px auto 12px;
}
.sheet-title {
  font-size: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.field { display: block; margin-bottom: 13px; }
.field > span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--secondary-dim);
  margin-bottom: 5px;
}
.field > span small { text-transform: none; letter-spacing: 0.03em; }
.field input,
.field select,
.field textarea {
  width: 100%;
  background: #0e222c;
  border: 1px solid rgba(232, 220, 196, 0.24);
  border-radius: 8px;
  color: var(--secondary);
  padding: 11px 12px;
  font-size: 16px;
  font-family: inherit;
}
.field textarea { resize: vertical; min-height: 58px; }
.field select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--secondary-dim) 50%), linear-gradient(135deg, var(--secondary-dim) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.field-error {
  display: block;
  color: #f0a08a;
  font-size: 12px;
  font-style: normal;
  margin-top: 5px;
}

.field-row { display: flex; align-items: center; gap: 12px; }
.field-row-label { margin: 0 !important; flex: 1; }
.dot-switch {
  position: relative;
  width: 56px;
  height: 32px;
  flex: none;
  border-radius: 16px;
  background: #0e222c;
  border: 1px solid rgba(232, 220, 196, 0.26);
  display: grid;
  place-items: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.dot-switch[aria-pressed="true"] {
  background: #2e4a41;
  border-color: rgba(232, 220, 196, 0.42);
}
.dot-switch[aria-pressed="true"] .dot-core {
  background: var(--secondary);
  border-color: var(--secondary);
}
.ready-word {
  font-size: 12.5px;
  font-style: italic;
  color: var(--secondary-dim);
  min-width: 88px;
}

.pull-link {
  display: block;
  width: 100%;
  background: none;
  border: 0;
  color: #e79b7e;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: underline;
  padding: 8px 2px 2px;
  text-align: left;
}
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions .btn { flex: 1; }

.btn {
  border: 0;
  border-radius: 9px;
  padding: 13px 16px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 12px;
}
.btn-solid { background: var(--accent); color: #241109; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35); }
.btn-ghost { background: transparent; border: 1px solid rgba(232, 220, 196, 0.38); color: var(--secondary); }
.btn-danger { background: var(--danger); color: #ffe9e2; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35); }

.confirm-card {
  background: #173440;
  border: 1px solid rgba(232, 220, 196, 0.16);
  border-radius: 12px;
  padding: 18px;
  width: calc(100% - 48px);
  max-width: 320px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.55);
}
.confirm-card h2 {
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.confirm-card p { font-size: 13px; line-height: 1.55; color: var(--secondary-dim); }

@media (min-width: 560px) {
  .view { padding-left: 20px; padding-right: 20px; }
  .masthead { padding-left: 20px; padding-right: 20px; }
}
