/* Built to be read in sunlight on a phone held in one hand: dark ink on white, large targets, no hover states relied on. */
:root {
  --ink: #0b1f3a;
  --soft: #4a5a70;
  --line: #c3ccd8;
  --paper: #fff;
  --wash: #eef2f7;
  --go: #0b6b3a;
  --go-wash: #dff3e6;
  --warn: #a12a12;
  --warn-wash: #fde8e2;
  --pick: #7a4b00;
  --pick-wash: #fff0cc;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 17px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--paper);
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  touch-action: manipulation;
}
header#top {
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
}
header#top strong { font-size: 1rem; }
header#top span { font-size: .85rem; opacity: .9; }
main { padding: 12px 16px 24px; max-width: 760px; margin: 0 auto; }
h2 { font-size: 1.05rem; margin: 20px 0 8px; }
h2:first-child { margin-top: 4px; }
p { margin: 6px 0; }
.note { color: var(--soft); font-size: .9rem; }

nav#tabs {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--paper); border-top: 2px solid var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
}
nav#tabs button {
  border: 0; background: none; font: inherit; font-weight: 600; color: var(--soft);
  min-height: 60px; padding: 6px 1px; font-size: .92rem;
}
nav#tabs button[aria-current="page"] { color: #fff; background: var(--ink); }

button { font: inherit; color: inherit; cursor: pointer; }
.btn {
  min-height: 52px; padding: 10px 16px; border-radius: 10px;
  border: 2px solid var(--ink); background: var(--paper); font-weight: 600;
}
.btn.primary { background: var(--ink); color: #fff; }
.btn.danger { border-color: var(--warn); color: var(--warn); }
.btn.on { background: var(--pick-wash); border-color: var(--pick); color: var(--pick); }
.btn.wide { width: 100%; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.row > .btn { flex: 1 1 140px; }

/* Clock */
.clock { text-align: center; padding: 8px 0 4px; }
.clock .label { font-size: .9rem; color: var(--soft); }
.clock .time { font: 700 clamp(3rem, 19vw, 5.5rem)/1 ui-monospace, "SF Mono", Menlo, monospace; font-variant-numeric: tabular-nums; }
.clock .now { font-variant-numeric: tabular-nums; color: var(--soft); }

/* Boats */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.boat {
  min-height: 76px; padding: 8px 10px; border-radius: 12px; text-align: left;
  border: 2px solid var(--ink); background: var(--paper);
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.boat b { font-size: 1.1rem; overflow-wrap: anywhere; }
.boat small { color: var(--soft); font-size: .8rem; overflow-wrap: anywhere; }
.boat.done { border-color: var(--go); background: var(--go-wash); }
.boat.done small { color: var(--go); font-weight: 600; font-variant-numeric: tabular-nums; }
.boat.out { border-style: dashed; border-color: var(--line); color: var(--soft); }
.boat:active, .btn:active, .leg:active { transform: scale(.98); }

/* Roundings */
.lap { margin: 8px 0; }
.lap > span { display: block; font-size: .8rem; font-weight: 700; color: var(--soft); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.legs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.leg {
  min-height: 56px; padding: 6px 10px; border-radius: 10px; text-align: left;
  border: 2px solid var(--line); background: var(--wash);
}
.leg b { display: block; overflow-wrap: anywhere; }
.leg small { color: var(--soft); font-size: .8rem; }
.leg[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.leg[aria-pressed="true"] small { color: #fff; }
.leg:disabled { opacity: .45; }

.moments { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.moment {
  min-height: 48px; padding: 6px 12px; border-radius: 24px; border: 2px dashed var(--pick);
  background: var(--pick-wash); color: var(--pick); font-weight: 600; font-variant-numeric: tabular-nums;
}
.moment[aria-pressed="true"] { border-style: solid; background: var(--pick); color: #fff; }
.banner { padding: 10px 12px; border-radius: 10px; margin: 8px 0; font-weight: 600; }
.banner.pick { background: var(--pick-wash); color: var(--pick); }
.banner.warn { background: var(--warn-wash); color: var(--warn); }

/* Lists and tables */
.starts { list-style: none; margin: 0; padding: 0; }
.starts li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; font-variant-numeric: tabular-nums; }
th, td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; white-space: nowrap; }
th { background: var(--wash); }
td.two { background: var(--pick-wash); }
.log { list-style: none; margin: 0; padding: 0; }
.log li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.log .btn { min-height: 44px; padding: 6px 12px; flex: 0 0 auto; }

/* Forms */
label { display: block; font-weight: 600; margin: 12px 0 4px; }
input[type=text], input[type=date], input[type=time], input[type=number], select, textarea {
  font: inherit; color: inherit; width: 100%; min-height: 48px; padding: 8px 10px;
  border: 2px solid var(--line); border-radius: 8px; background: var(--paper);
}
textarea { min-height: 96px; font-size: .85rem; }
.entry { display: grid; grid-template-columns: 1fr 96px; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line); }
.entry label { display: flex; align-items: center; gap: 10px; margin: 0; min-height: 48px; font-weight: 600; }
.entry input[type=checkbox] { width: 26px; height: 26px; flex: 0 0 auto; }

#toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom));
  background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
#toast.show { opacity: 1; }

.history { margin-top: 20px; border-top: 2px solid var(--line); padding-top: 8px; }
.history summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; cursor: pointer; }
.history .gone span > b, .history .gone span { text-decoration: line-through; text-decoration-thickness: 1px; }
.history .gone small { text-decoration: none; display: inline-block; }

/* Rigs */
h3 { font-size: 1rem; margin: 12px 0 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.chip {
  min-height: 48px; min-width: 56px; padding: 6px 14px; border-radius: 10px;
  border: 2px solid var(--line); background: var(--wash); font-weight: 600; overflow-wrap: anywhere;
}
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.chip:active { transform: scale(.98); }
.sails { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 8px; }
.sails .lbl { display: block; font-size: .8rem; font-weight: 700; color: var(--soft); text-transform: uppercase; letter-spacing: .04em; }
