:root {
  color-scheme: light;
  --ink: #10242b;
  --muted: #607076;
  --line: #d7e1e3;
  --paper: #fbfcfb;
  --panel: #ffffff;
  --sea: #0c4656;
  --sea-2: #147284;
  --accent: #c5422a;
  --gold: #d79a2b;
  --soft: #eef6f3;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #e7f2f2 0, #f8fbf9 260px);
  color: var(--ink);
}

button, input, select { font: inherit; }

.desktop-notice {
  display: none;
}

.welcome-screen {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(12,70,86,.86), rgba(20,114,132,.72)),
    url("assets/wolderwijd.jpg") center / cover no-repeat;
}

.welcome-screen[hidden] {
  display: none;
}

.welcome-panel {
  width: min(440px, 100%);
  padding: 24px 18px 18px;
  border-radius: 8px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 18px 60px rgba(16, 36, 43, .32);
  text-align: center;
}

.welcome-logo {
  width: 104px;
  height: 104px;
  object-fit: contain;
  margin-bottom: 12px;
  border-radius: 8px;
  background: white;
}

.welcome-panel h1 {
  margin: 4px 0 10px;
  color: var(--sea);
  font-size: 2rem;
}

.welcome-panel p:not(.eyebrow) {
  margin: 0;
  color: var(--ink);
  line-height: 1.55;
}

.welcome-actions {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.app-shell {
  max-width: 840px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: 0 0 40px rgba(16, 36, 43, .12);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(18px, env(safe-area-inset-top)) 18px 14px;
  background: var(--sea);
  color: white;
}

.eyebrow {
  margin: 0 0 3px;
  color: #bde0de;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.35rem, 5vw, 2rem);
  letter-spacing: 0;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 8px;
  background: rgba(255,255,255,.12);
  color: white;
  font-size: 1.7rem;
  line-height: 1;
}

main { padding: 16px; }

.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.summary div {
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: center;
}

.summary strong {
  display: block;
  color: var(--sea);
  font-size: 1.35rem;
}

.summary span {
  color: var(--muted);
  font-size: .78rem;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}

.tab {
  min-height: 44px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.tab:last-child { border-right: 0; }
.tab.active { background: var(--sea); color: white; }

.search-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 14px;
}

.search-panel input {
  min-width: 0;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.search-panel button,
.secondary-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--sea);
  font-weight: 800;
}

.primary-button {
  min-height: 44px;
  border: 1px solid var(--sea);
  border-radius: 8px;
  background: var(--sea);
  color: white;
  font-weight: 900;
}

.install-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: end center;
  padding: 16px;
  background: rgba(16, 36, 43, .42);
}

.install-modal[hidden] {
  display: none;
}

.install-card {
  width: min(520px, 100%);
  padding: 18px;
  border-radius: 8px;
  background: white;
  box-shadow: 0 18px 60px rgba(16, 36, 43, .28);
}

.install-card h2 {
  margin: 4px 0 10px;
  color: var(--sea);
  font-size: 1.25rem;
}

.install-steps {
  display: grid;
  gap: 8px;
}

.install-steps p {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
}

.install-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 16px;
}

.content {
  display: grid;
  gap: 12px;
  padding-bottom: 28px;
}

.grid-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: 8px;
}

.ship-tile,
.company-tile {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 900;
}

.ship-tile.hk { border-color: #e3ba66; background: #fff8e8; }

.company-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  text-align: left;
}

.count {
  min-width: 28px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--sea);
  text-align: center;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.card-head {
  display: grid;
  gap: 8px;
  padding: 15px;
  border-bottom: 1px solid var(--line);
}

.card h2, .card h3 {
  margin: 0;
  font-size: 1.18rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--sea);
  font-size: .78rem;
  font-weight: 800;
}

.badge.hk { background: #fff2cf; color: #8b5b04; }
.badge.warn { background: #feece7; color: #93341f; }

.card-body {
  display: grid;
  gap: 14px;
  padding: 15px;
}

.kv {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 12px;
  margin: 0;
}

.kv dt {
  color: var(--muted);
  font-weight: 800;
}

.kv dd { margin: 0; }

.wide-text {
  grid-template-columns: 130px 1fr;
}

.note {
  padding: 12px;
  border-left: 4px solid var(--gold);
  background: #fffaf0;
}

.omroep {
  padding: 12px;
  border-radius: 8px;
  background: #eef7fb;
}

.program-image {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.timeline {
  display: grid;
  gap: 8px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.time { color: var(--accent); font-weight: 900; }
.section-title { margin: 6px 0 0; font-size: 1.15rem; }

.results-hero {
  padding: 18px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--sea), var(--sea-2));
  color: white;
}

.results-hero .eyebrow {
  color: #cdeae8;
}

.results-hero h2 {
  margin: 4px 0 8px;
  font-size: 1.45rem;
}

.results-hero p {
  margin: 0;
  color: #eef8f7;
  line-height: 1.5;
}

.podium {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 8px;
  align-items: stretch;
}

.podium-card {
  display: grid;
  gap: 6px;
  align-content: start;
  min-height: 150px;
  padding: 14px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  text-align: center;
}

.podium-card.place-1 {
  border-color: #d8a530;
  background: #fff8e7;
}

.podium-card.place-2 {
  background: #f5f8f9;
}

.podium-card.place-3 {
  background: #fff1e8;
}

.medal {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--sea);
  color: white;
  font-weight: 900;
}

.place-1 .medal { background: #b77a03; }
.place-2 .medal { background: #6b7c84; }
.place-3 .medal { background: #a75820; }

.podium-card h3 {
  margin: 2px 0 0;
  color: var(--sea);
  font-size: 1.15rem;
}

.podium-card p {
  margin: 0;
  color: var(--muted);
  font-size: .86rem;
}

.podium-card strong {
  color: var(--ink);
  font-size: 1rem;
}

.results-list {
  display: grid;
}

.result-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.result-row:first-child {
  border-top: 0;
}

.result-row.podium-row {
  background: #fffaf0;
}

.result-row.withdrawn {
  background: #f5f7f7;
}

.result-place {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--soft);
  color: var(--sea);
  font-weight: 900;
}

.result-main {
  display: grid;
  min-width: 0;
}

.result-main strong,
.result-main span {
  overflow-wrap: anywhere;
}

.result-main span {
  color: var(--muted);
  font-weight: 800;
}

.result-time {
  color: var(--accent);
  font-weight: 900;
  white-space: nowrap;
}

@media (max-width: 430px) {
  main { padding: 12px; }
  .summary { gap: 6px; }
  .summary div { padding: 10px 5px; }
  .tab { font-size: .9rem; }
  .kv { grid-template-columns: 1fr; gap: 3px; }
  .timeline-item { grid-template-columns: 1fr; gap: 3px; }
  .install-actions { grid-template-columns: 1fr; }
  .tabs { grid-template-columns: repeat(2, 1fr); }
  .podium { grid-template-columns: 1fr; }
  .podium-card { min-height: auto; }
  .result-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }
  .result-time {
    grid-column: 2;
    justify-self: start;
  }
}

@media (hover: hover) and (pointer: fine) and (min-width: 900px) {
  body {
    display: grid;
    place-items: center;
    padding: 28px;
    background: #eef6f3;
  }

  .desktop-notice {
    display: none;
    place-items: center;
    width: min(680px, 100%);
    min-height: 72vh;
    padding: 32px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    box-shadow: 0 18px 55px rgba(16, 36, 43, .14);
    text-align: center;
  }

  .welcome-screen {
    display: none;
  }

  .desktop-notice h1 {
    color: var(--sea);
    font-size: 2rem;
  }

  .desktop-notice p {
    max-width: 520px;
    margin: 12px auto 0;
    color: var(--muted);
    line-height: 1.55;
  }

  .desktop-notice .desktop-url {
    padding: 12px;
    border-radius: 8px;
    background: var(--soft);
    color: var(--sea);
    font-weight: 800;
    overflow-wrap: anywhere;
  }

  .app-shell {
    display: block;
  }
}
