/* Getij: eigen stijl. Ivoor op diep rivierblauw, een boeigeel accent, Cormorant voor de naam en Instrument Sans voor de rest. */
@font-face { font-family: 'Cormorant Garamond'; src: url('fonts/cormorant-garamond.woff2') format('woff2'); font-weight: 400 600; font-display: swap; }
@font-face { font-family: 'Cormorant Garamond'; src: url('fonts/cormorant-garamond-italic.woff2') format('woff2'); font-weight: 400 600; font-style: italic; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url('fonts/instrument-sans.woff2') format('woff2'); font-weight: 400 700; font-stretch: 75% 100%; font-display: swap; }

:root {
  --ivoor: #f3efe6;
  --ivoor-zacht: rgba(243, 239, 230, 0.72);
  --nacht: #0d1620;
  --glas: rgba(10, 18, 26, 0.42);
  --glas-rand: rgba(243, 239, 230, 0.16);
  --boei: #ffc23d;
  --rood: #e0523f;
  --groen: #3bb273;
  --rand: max(16px, env(safe-area-inset-left));
}

* { box-sizing: border-box; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--nacht); color: var(--ivoor); font-family: 'Instrument Sans', system-ui, sans-serif; -webkit-user-select: none; user-select: none; }
canvas#wereld { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* Laden */
.laden { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 18px; background: radial-gradient(120% 80% at 50% 110%, #1d3446 0%, var(--nacht) 60%); z-index: 20; transition: opacity 0.9s ease; }
.laden.weg { opacity: 0; pointer-events: none; }
.laden-merk { font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 64px; letter-spacing: 0.01em; }
.laden-balk { width: 180px; height: 2px; background: rgba(243, 239, 230, 0.15); overflow: hidden; }
.laden-balk span { display: block; height: 100%; width: 0; background: var(--ivoor); transition: width 0.3s ease; }
.laden p { margin: 0; font-size: 13px; color: var(--ivoor-zacht); }

/* Startscherm */
.titel { position: fixed; inset: 0; display: grid; grid-template-rows: 1fr auto; padding: max(28px, env(safe-area-inset-top)) var(--rand) max(20px, env(safe-area-inset-bottom)); z-index: 5;
  background: linear-gradient(180deg, rgba(8, 14, 20, 0.35) 0%, rgba(8, 14, 20, 0) 30%, rgba(8, 14, 20, 0) 50%, rgba(8, 14, 20, 0.7) 100%); animation: opkomen 1.6s ease both; }
.titel-kop { align-self: start; }
.titel h1 { font-family: 'Cormorant Garamond', serif; font-style: italic; font-weight: 500; font-size: clamp(64px, 13vw, 150px); line-height: 0.9; margin: 0; letter-spacing: -0.01em; text-shadow: 0 2px 30px rgba(0, 0, 0, 0.35); }
.ondertitel { margin: 10px 0 0 4px; font-size: clamp(14px, 1.6vw, 17px); color: var(--ivoor-zacht); max-width: 34ch; }
.titel-menu { display: grid; gap: 16px; max-width: 1080px; }
.kaartjes { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; scrollbar-width: none; }
.kaartjes::-webkit-scrollbar { display: none; }
.kaart { flex: 0 0 auto; width: 210px; min-height: 104px; text-align: left; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--glas-rand); background: var(--glas); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); scroll-snap-align: start; display: grid; align-content: start; gap: 6px; transition: transform 0.2s ease, background 0.2s ease; }
.kaart:hover, .kaart:focus-visible { background: rgba(20, 34, 46, 0.6); transform: translateY(-2px); }
.kaart:focus-visible { outline: 2px solid var(--boei); outline-offset: 2px; }
.kaart-label { font-family: 'Cormorant Garamond', serif; font-size: 25px; font-weight: 600; line-height: 1; }
.kaart-tekst { font-size: 12.5px; line-height: 1.35; color: var(--ivoor-zacht); }
.kaart-record { font-size: 12px; color: var(--boei); font-variant-numeric: tabular-nums; }
.kaart-vrij { border-color: rgba(255, 194, 61, 0.45); }
.keuzes { display: flex; flex-wrap: wrap; gap: 10px 24px; }
.keuze { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ivoor-zacht); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 7px 12px; border-radius: 99px; border: 1px solid var(--glas-rand); background: var(--glas); font-size: 13px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.chip[aria-pressed="true"] { background: var(--ivoor); color: var(--nacht); border-color: var(--ivoor); }
.titel-voet { margin: 0; font-size: 11px; color: rgba(243, 239, 230, 0.5); }

/* Spelscherm */
.hud::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 120px; background: linear-gradient(180deg, rgba(8, 14, 20, 0.35), rgba(8, 14, 20, 0)); pointer-events: none; }
.hud { position: fixed; inset: 0; pointer-events: none; z-index: 4; padding: max(12px, env(safe-area-inset-top)) var(--rand) max(12px, env(safe-area-inset-bottom)); }
.hud > * { pointer-events: auto; }
.hud-links { position: absolute; top: max(12px, env(safe-area-inset-top)); left: var(--rand); display: flex; gap: 14px; align-items: flex-end; pointer-events: none; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45); }
.meter { display: grid; line-height: 0.95; }
.meter span { font-family: 'Cormorant Garamond', serif; font-size: 52px; font-weight: 500; font-variant-numeric: tabular-nums; }
.meter small { font-size: 11px; color: var(--ivoor-zacht); letter-spacing: 0.04em; }
.regels { font-size: 12.5px; color: var(--ivoor-zacht); display: grid; gap: 3px; padding-bottom: 4px; }
.hud-midden { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5); }
.klok { font-family: 'Cormorant Garamond', serif; font-size: 40px; font-variant-numeric: tabular-nums; line-height: 1; }
.boei-info { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; color: var(--ivoor-zacht); margin-top: 2px; }
.pijl { display: inline-block; color: var(--boei); font-size: 18px; transition: transform 0.15s linear; }
.hud-rechts { position: absolute; top: max(12px, env(safe-area-inset-top)); right: var(--rand); display: grid; justify-items: end; gap: 8px; pointer-events: none; }
.windroos { width: 92px; height: 92px; filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35)); }
.roos-rand { fill: rgba(10, 18, 26, 0.35); stroke: rgba(243, 239, 230, 0.35); stroke-width: 1; }
.roos-nogo { fill: rgba(224, 82, 63, 0.22); }
.roos-boot { fill: var(--ivoor); }
.roos-pijl { stroke: var(--boei); stroke-width: 3; stroke-linecap: round; }
.roos-punt { fill: var(--boei); }
.roos-schijn { stroke: rgba(243, 239, 230, 0.8); stroke-width: 2; stroke-dasharray: 2 3; }
.minikaart { width: 110px; height: 110px; border-radius: 50%; border: 1px solid var(--glas-rand); background: rgba(10, 18, 26, 0.35); }
.knoppen { display: flex; gap: 8px; pointer-events: auto; }
.knop { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--glas-rand); background: var(--glas); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 18px; }
.melding { position: absolute; top: 32%; left: 50%; transform: translate(-50%, -50%); font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: clamp(28px, 5vw, 44px); text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5); opacity: 0; transition: opacity 0.4s ease; pointer-events: none; white-space: nowrap; }
.melding.aan { opacity: 1; }
.tip { position: absolute; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 130px); left: 50%; transform: translateX(-50%); max-width: min(440px, 80vw); text-align: center; font-size: 13.5px; line-height: 1.4; padding: 9px 14px; border-radius: 12px; background: var(--glas); border: 1px solid var(--glas-rand); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); opacity: 0; transition: opacity 0.4s ease; pointer-events: none; }
.tip.aan { opacity: 1; }

/* Helmstok en schoot (telefoon en tablet) */
.helm { position: absolute; left: var(--rand); bottom: max(14px, env(safe-area-inset-bottom)); width: min(300px, 42vw); height: 112px; display: grid; align-content: end; gap: 6px; --roer: 0; touch-action: none; }
.helm span, .schoot-auto { font-size: 11px; color: var(--ivoor-zacht); letter-spacing: 0.04em; }
.helm-baan { position: relative; height: 64px; border-radius: 32px; background: var(--glas); border: 1px solid var(--glas-rand); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.helm-baan::before { content: ''; position: absolute; left: 50%; top: 14px; bottom: 14px; width: 1px; background: rgba(243, 239, 230, 0.25); }
.helm-knop { position: absolute; top: 8px; left: calc(50% - 24px + var(--roer) * (50% - 32px)); width: 48px; height: 48px; border-radius: 50%; background: var(--ivoor); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); transition: left 0.08s linear; }
.schoot { position: absolute; right: var(--rand); bottom: max(14px, env(safe-area-inset-bottom)); width: 64px; display: grid; gap: 6px; justify-items: center; touch-action: none; }
.schoot-baan { position: relative; width: 56px; height: 150px; border-radius: 28px; background: var(--glas); border: 1px solid var(--glas-rand); overflow: hidden; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.schoot-vul { position: absolute; left: 0; right: 0; top: 0; background: rgba(243, 239, 230, 0.14); }
.schoot-knop { position: absolute; left: 6px; width: 44px; height: 30px; border-radius: 15px; background: var(--ivoor); transform: translateY(-50%); }
.schoot-auto { border: 1px solid var(--glas-rand); background: var(--glas); border-radius: 99px; padding: 6px 12px; pointer-events: auto; }
.schoot-auto[aria-pressed="true"] { background: var(--boei); color: var(--nacht); border-color: var(--boei); }
.toetsen { position: absolute; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); font-size: 12px; color: var(--ivoor-zacht); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); white-space: nowrap; pointer-events: none; }
@media (pointer: fine) { .helm { display: none; } }
@media (pointer: coarse) { .toetsen { display: none; } }

/* Aftellen */
.aftel { position: fixed; inset: 0; display: grid; place-content: center; font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 120px; z-index: 6; pointer-events: none; text-shadow: 0 4px 30px rgba(0, 0, 0, 0.4); }

/* Panelen */
.paneel { position: fixed; z-index: 8; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(380px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; padding: 22px; border-radius: 20px; background: rgba(12, 20, 28, 0.72); border: 1px solid var(--glas-rand); backdrop-filter: blur(22px) saturate(1.3); -webkit-backdrop-filter: blur(22px) saturate(1.3); display: grid; gap: 8px; animation: opkomen 0.35s ease both; }
.paneel h2 { font-family: 'Cormorant Garamond', serif; font-weight: 500; font-style: italic; font-size: 38px; margin: 0 0 6px; }
.paneel button { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--glas-rand); background: rgba(243, 239, 230, 0.06); text-align: left; font-size: 15px; }
.paneel button.groot { background: var(--ivoor); color: var(--nacht); border-color: var(--ivoor); font-weight: 600; }
.paneel .uitleg { font-size: 13px; line-height: 1.5; color: var(--ivoor-zacht); margin: 6px 0 0; }
.uitslag-baan { margin: 0; font-size: 13px; color: var(--ivoor-zacht); }
.uitslag-tijd { font-family: 'Cormorant Garamond', serif; font-size: 76px; line-height: 1; font-variant-numeric: tabular-nums; }
.uitslag-medaille { margin: 0; font-size: 15px; color: var(--boei); }

.verborgen-interface .hud > * { opacity: 0; }
.verborgen-interface .hud .knoppen { opacity: 0.35; }

@keyframes opkomen { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }
.paneel { animation-name: opkomenPaneel; }
@keyframes opkomenPaneel { from { opacity: 0; transform: translate(-50%, -48%); } to { opacity: 1; transform: translate(-50%, -50%); } }

@media (max-height: 500px) {
  .titel h1 { font-size: 60px; }
  /* Liggende telefoon: weinig hoogte, dus de ondertitel en de voetregel wijken voor de kaartjes */
  .ondertitel, .titel-voet { display: none; }
  .titel-menu { gap: 10px; }
  .kaart { min-height: 88px; width: 190px; padding: 11px 13px; }
  .meter span { font-size: 40px; }
  .windroos { width: 70px; height: 70px; }
  .minikaart { width: 80px; height: 80px; }
  .schoot-baan { height: 110px; }
  .helm { height: 96px; }
  .tip { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 104px); }
}
