:root {
  --bg: #10182b;
  --panel: #1a2540;
  --panel-hi: #253458;
  --line: #3a4d7a;
  --ink: #eef1e6;
  --muted: #a7b4d4;
  --high: #7fd4d9;
  --low: #e9c46a;
  --alert: #ef7a5a;
  --f-display: "Press Start 2P", "Courier New", monospace;
  --f-body: "Pixelify Sans", "Trebuchet MS", system-ui, sans-serif;
  --f-num: "Jersey 15", "Arial Narrow", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { background: var(--bg); }
body { margin: 0; color: var(--ink); font-family: var(--f-body); font-size: 18px; line-height: 1.45; }
.wrap {
  max-width: 760px; margin: 0 auto;
  padding-block: 20px 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid; gap: 18px;
}
.px { background: var(--panel); border: 3px solid var(--line); box-shadow: 0 4px 0 #0a0f1d; position: relative; }
a { color: var(--high); }

header { display: grid; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; justify-self: start; }
.brand canvas { width: 36px; height: 36px; image-rendering: pixelated; }
.brand span { font-family: var(--f-display); font-size: 18px; text-shadow: 3px 3px 0 #0a0f1d; }
h1 { font-family: var(--f-body); font-weight: 600; font-size: clamp(24px, 5vw, 30px); line-height: 1.2; margin: 4px 0 0; text-wrap: balance; }
.intro { margin: 0; color: var(--muted); max-width: 62ch; }
.bar { display: flex; gap: 8px; flex-wrap: wrap; }
select, button {
  font-family: var(--f-body); font-size: 18px; color: var(--ink);
  background: var(--panel-hi); border: 3px solid var(--line); border-radius: 0;
  padding: 6px 12px; min-height: 46px;
}
select { flex: 1 1 220px; min-width: 0; }
button { cursor: pointer; box-shadow: 0 3px 0 #0a0f1d; }
button:hover:not(:disabled) { background: #304370; }
button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #0a0f1d; }
button:disabled { opacity: .4; cursor: default; }
:focus-visible { outline: 3px solid var(--low); outline-offset: 2px; }
.day { display: flex; gap: 8px; align-items: stretch; }
.day .label { flex: 1; display: flex; align-items: center; justify-content: center; font-family: var(--f-num); font-size: 28px; letter-spacing: .5px; background: var(--bg); border: 3px solid var(--line); text-transform: capitalize; }

.scene { overflow: hidden; }
.scene canvas { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; image-rendering: pixelated; max-width: 100%; }
.now { padding: 14px 16px; display: grid; gap: 4px; border-top: 3px solid var(--line); }
.now .big { font-family: var(--f-display); font-size: clamp(14px, 3.6vw, 20px); line-height: 1.4; }
.now .big.up { color: var(--high); } .now .big.down { color: var(--low); }
.now .sub { color: var(--muted); }
.now .sub b, .num { font-family: var(--f-num); font-weight: 400; font-size: 1.3em; line-height: 1; color: var(--ink); letter-spacing: .5px; font-variant-numeric: tabular-nums; }

h2 { font-family: var(--f-display); font-size: 11px; letter-spacing: 1px; margin: 0; color: var(--muted); line-height: 1.6; }
.tides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tide {
  all: unset; box-sizing: border-box; cursor: pointer;
  display: grid; gap: 2px; padding: 12px 14px; background: var(--panel); border: 3px solid var(--line);
  box-shadow: 0 4px 0 #0a0f1d;
}
.tide:focus-visible { outline: 3px solid var(--low); outline-offset: 2px; }
.tide .kind { font-family: var(--f-display); font-size: 10px; letter-spacing: 1px; }
.tide.high .kind { color: var(--high); } .tide.low .kind { color: var(--low); }
.tide .time { font-family: var(--f-num); font-size: 50px; line-height: .95; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.tide .extra { font-size: 15px; color: var(--muted); }
.tide .extra .num { font-size: 22px; }
.tide.past { opacity: .6; }
.tide.past .time { color: var(--muted); }
.tide.next { border-color: var(--ink); }
.tide.sel { background: var(--panel-hi); }
.hint { font-size: 15px; color: var(--muted); margin: 0; }

.tag { justify-self: start; margin-top: 4px; display: inline-block; font-family: var(--f-display); font-size: 9px; letter-spacing: 1px; padding: 5px 7px; background: var(--bg); }
.tag.big { color: var(--low); } .tag.small { color: var(--muted); } .tag.mid { color: var(--high); }

.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.week button { padding: 8px 2px; min-height: 0; display: grid; gap: 4px; justify-items: center; font-size: 15px; }
.week button .w { font-family: var(--f-num); font-size: clamp(18px, 4.8vw, 22px); line-height: 1; text-transform: capitalize; letter-spacing: .5px; }
.week button .dot { width: 14px; height: 14px; background: var(--line); }
.week button.mid .dot { background: var(--high); }
.week button.big .dot { background: var(--low); width: 18px; height: 18px; }
.week button.sel { background: var(--bg); border-color: var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 15px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; background: var(--line); }

section.block { display: grid; gap: 12px; }

.guide { padding: 16px 18px; display: grid; gap: 10px; }
.guide h3 { font-family: var(--f-body); font-weight: 600; font-size: 19px; margin: 6px 0 0; }
.guide p { margin: 0; max-width: 66ch; }

.ports { padding: 0; }
.ports summary { cursor: pointer; padding: 14px 16px; font-family: var(--f-display); font-size: 11px; letter-spacing: 1px; color: var(--muted); line-height: 1.6; }
.ports ul { list-style: none; margin: 0; padding: 0 16px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 16px; }
.ports a { color: var(--ink); text-decoration-color: var(--line); }
.ports a:hover { color: var(--high); }

.status { padding: 12px 16px; border-color: var(--alert); }
.status p { margin: 0; }

footer { padding: 16px; display: grid; gap: 8px; font-size: 15px; color: var(--muted); }
footer .att { color: var(--ink); }
footer a { color: var(--high); }
footer .notice { color: var(--low); }

@media (max-width: 420px) { .tide .time { font-size: 44px; } }
