:root {
  --bg: #06111e;
  --bg-soft: #0b1a2b;
  --panel: #0e2034;
  --panel-2: #102942;
  --line: rgba(148, 190, 225, .16);
  --text: #f5f9ff;
  --muted: #91a6ba;
  --accent: #28b8ff;
  --accent-2: #70e6ff;
  --danger: #ff6178;
  --ok: #68dfa9;
  --nav-h: 68px;
  --top-h: 72px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; background: var(--bg); color: var(--text); }
html { overflow: hidden; }
body { overflow: hidden; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
button, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(100%, 760px);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% -10%, rgba(40,184,255,.14), transparent 34%),
    var(--bg);
}

.topbar {
  height: var(--top-h);
  flex: 0 0 var(--top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  border-bottom: 1px solid var(--line);
  background: rgba(6,17,30,.94);
  backdrop-filter: blur(18px);
  z-index: 5;
}
.brand-row { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  font-weight: 900; font-style: italic; font-size: 25px; color: #05111d;
  background: linear-gradient(145deg, #79efff, #168edb 60%, #004f8f);
  box-shadow: 0 0 30px rgba(40,184,255,.24);
}
.topbar h1 { margin: 0; font-size: clamp(18px, 5vw, 25px); line-height: 1; letter-spacing: .02em; white-space: nowrap; }
.topbar h1 span { color: var(--accent-2); font-size: .66em; font-weight: 700; }
.topbar p { margin: 6px 0 0; font-size: 11px; color: var(--muted); }
.icon-button { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); color: var(--text); font-size: 24px; }

.pages { flex: 1 1 auto; min-height: 0; overflow: hidden; position: relative; }
.page { display: none; width: 100%; height: 100%; min-height: 0; }
.page.active { display: block; }

/* HOME: current specification keeps the home screen inside one viewport. */
.page-home { padding: 10px 12px; overflow: hidden; }
.hero {
  min-height: 92px; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border: 1px solid rgba(56,189,248,.25); border-radius: 18px;
  background: linear-gradient(125deg, #0e3150, #081a2b 65%, #0b2840);
  box-shadow: inset 0 1px rgba(255,255,255,.04);
}
.hero-lines { position: absolute; inset: 0; opacity: .16; background: repeating-linear-gradient(135deg, transparent 0 13px, rgba(112,230,255,.25) 14px 15px); transform: skewX(-12deg) scale(1.4); }
.hero-copy, .hero-stat { position: relative; z-index: 1; }
.hero h2 { margin: 4px 0; font-size: 22px; }
.hero p { margin: 0; color: var(--muted); font-size: 11px; }
.hero-stat { text-align: right; min-width: 58px; }
.hero-stat strong { font-size: 30px; color: var(--accent-2); }
.hero-stat span { font-size: 12px; color: var(--muted); margin-left: 3px; }
.eyebrow { color: var(--accent-2); font-weight: 800; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow.danger { color: #ff8a9c; }
.daypart-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin: 8px 0; }
.daypart-row span { background: rgba(255,255,255,.035); border: 1px solid var(--line); border-radius: 9px; padding: 5px 7px; color: var(--muted); font-size: 10px; text-align: center; }
.venue-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.venue-button {
  min-width: 0; height: clamp(38px, 5.1vh, 47px); padding: 5px 4px; border: 1px solid var(--line); border-radius: 10px;
  background: linear-gradient(180deg, rgba(18,43,68,.92), rgba(10,28,45,.92)); color: var(--text); text-align: left; overflow: hidden;
}
.venue-button strong { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.venue-button small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.venue-button:active { transform: scale(.98); border-color: rgba(112,230,255,.6); }
.radar-card { min-height: 59px; margin-top: 8px; padding: 9px 11px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid rgba(255,97,120,.22); border-radius: 14px; background: linear-gradient(120deg, rgba(83,24,39,.33), rgba(14,32,52,.92)); }
.radar-card h3 { margin: 3px 0 0; font-size: 12px; }
.status-pill { flex: 0 0 auto; padding: 6px 9px; border-radius: 999px; background: rgba(112,230,255,.08); border: 1px solid rgba(112,230,255,.22); color: var(--accent-2); font-size: 10px; font-weight: 700; }

/* PREDICTION: this is intentionally scrollable on smartphones. */
.page-prediction.active { display: block; overflow: hidden; min-height: 0; }
.prediction-scroll {
  width: 100%; height: 100%; min-height: 0;
  overflow-x: hidden; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  padding: 12px 12px calc(28px + env(safe-area-inset-bottom));
  scroll-padding-bottom: 32px;
}
.prediction-scroll::-webkit-scrollbar { width: 5px; }
.prediction-scroll::-webkit-scrollbar-thumb { background: rgba(112,230,255,.24); border-radius: 999px; }
.section-card { margin-bottom: 10px; padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(15,36,58,.96), rgba(9,26,43,.96)); box-shadow: 0 12px 40px rgba(0,0,0,.12); }
.section-card h2, .section-card h3 { margin: 5px 0; }
.section-card p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.prediction-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.secondary-button, .primary-button { border-radius: 11px; padding: 10px 12px; border: 1px solid var(--line); cursor: pointer; }
.secondary-button { background: rgba(255,255,255,.035); color: var(--text); }
.primary-button { background: linear-gradient(135deg, #1ea8ed, #056cb2); border-color: rgba(112,230,255,.36); color: white; font-weight: 800; box-shadow: 0 8px 22px rgba(0,130,210,.18); }
.form-card { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.form-card label { display: grid; gap: 5px; }
.form-card label span { color: var(--muted); font-size: 10px; }
.form-card select { width: 100%; min-width: 0; appearance: none; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); color: var(--text); padding: 11px; }
.form-card .primary-button { grid-column: 1/-1; }
.section-title-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.formation-box { margin-top: 12px; display: grid; gap: 8px; }
.formation-line { display: grid; grid-template-columns: 45px 1fr; gap: 9px; align-items: center; padding: 9px 10px; border-radius: 11px; background: rgba(255,255,255,.03); }
.formation-line .label { font-size: 10px; color: var(--muted); }
.boat-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.boat-chip { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 8px; font-weight: 900; border: 1px solid rgba(255,255,255,.22); color: white; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.boat-1 { background:#f6f7f8; color:#111; text-shadow:none; }.boat-2 { background:#15171b; }.boat-3 { background:#e83340; }.boat-4 { background:#2c69d8; }.boat-5 { background:#e5c21d; color:#111; text-shadow:none; }.boat-6 { background:#3bb26e; }
.rank-grid { margin-top: 12px; display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; }
.rank-card { padding: 8px; text-align: center; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.028); }
.rank-card small { display:block; color:var(--muted); font-size:9px; }.rank-card strong { display:block; margin-top:3px; font-size:18px; }
.section-subtitle { margin-top: 14px; margin-bottom: 7px; font-size: 11px; color: var(--muted); font-weight: 700; }
.tickets { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; }
.ticket { padding: 9px 5px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.026); font-weight: 800; text-align: center; letter-spacing: .06em; font-size: 12px; }
.save-row { margin-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.save-status { color: var(--muted); font-size: 11px; }.save-status.ok { color: var(--ok); }.save-status.error { color: #ff9bad; }
.note-card { border-color: rgba(255,199,78,.18); }
.history-list { display: grid; gap: 7px; margin-top: 10px; }
.history-item { padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.025); }
.history-item strong { display: block; font-size: 12px; }.history-item small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.muted { color: var(--muted); font-size: 11px; }
.scroll-end { padding: 8px 0 4px; text-align: center; color: rgba(145,166,186,.45); letter-spacing: .3em; font-size: 9px; }

.page-settings { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.settings-content { padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); }
.settings-list { margin: 12px 0 0; }
.settings-list div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.settings-list dt { color: var(--muted); }.settings-list dd { margin: 0; text-align: right; }

.bottom-nav {
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  flex: 0 0 calc(var(--nav-h) + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(3,1fr); padding: 6px 8px env(safe-area-inset-bottom);
  border-top: 1px solid var(--line); background: rgba(6,17,30,.97); backdrop-filter: blur(18px); z-index: 10;
}
.nav-item { border: 0; border-radius: 12px; background: transparent; color: var(--muted); display: grid; place-items: center; align-content: center; gap: 2px; }
.nav-item span { font-size: 21px; line-height: 1; }.nav-item small { font-size: 9px; }.nav-item.active { color: var(--accent-2); background: rgba(40,184,255,.08); }

.about-dialog { width: min(90vw, 420px); border: 1px solid rgba(112,230,255,.25); border-radius: 16px; background: #0b1b2d; color: var(--text); padding: 18px; }
.about-dialog::backdrop { background: rgba(0,0,0,.68); backdrop-filter: blur(3px); }
.about-dialog h3 { margin-top: 0; }.about-dialog p { color: var(--muted); line-height: 1.65; font-size: 13px; }

@media (max-height: 700px) {
  :root { --top-h: 62px; --nav-h: 58px; }
  .page-home { padding-top: 7px; }
  .hero { min-height: 76px; padding: 10px 13px; }
  .hero h2 { font-size: 18px; }
  .venue-button { height: 36px; }
  .radar-card { min-height: 50px; }
}
@media (max-width: 380px) {
  .topbar h1 { font-size: 17px; }.brand-mark { width: 38px; height: 38px; }
  .venue-grid { gap: 5px; }.venue-button strong { font-size: 11px; }
  .tickets { grid-template-columns: repeat(2, 1fr); }
}
