/* ═══════════════════════════════════════════════════════════════
   REGATTAPLANER — eigenständige Seite, immer dunkel (Revier-Look).
   Schrift und Palette folgen der Marke (styles.css / hero3d).
   ═══════════════════════════════════════════════════════════════ */

:root {
  --deep: #0d1b22;
  --deep-2: #14293a;
  --ink: #e8f1f6;
  --ink-dim: #9db4c0;
  --line: rgba(157, 180, 192, .16);
  --accent: #45b1e2;            /* Wasser-Cyan der Tiefenrampe */
  --kurs: #ffb057;              /* Signature: Regatta-Orange der Kurslinie */
  --kreuz: #7fd4a8;
  --glass: rgba(13, 27, 34, .78);
  --glass-soft: rgba(20, 41, 58, .55);
  --radius: 16px;
  --shadow: 0 12px 40px rgba(0, 0, 0, .45);
  --font-d: "Bricolage Grotesque", system-ui, sans-serif;
  --font-b: "Instrument Sans", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  font-family: var(--font-b);
  background: var(--deep);
  color: var(--ink);
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

#map { position: fixed; inset: 0; }
#map::after {                                   /* Abendlicht-Vignette wie im Hero */
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background:
    radial-gradient(120% 90% at 50% 8%, rgba(255, 176, 87, .05), transparent 55%),
    radial-gradient(140% 120% at 50% 110%, rgba(4, 10, 14, .55), transparent 62%),
    linear-gradient(rgba(4, 10, 14, .28), transparent 18%, transparent 78%, rgba(4, 10, 14, .38));
}

/* ── Kopfzeile ─────────────────────────────────────────────── */
.rp-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: linear-gradient(rgba(6, 13, 18, .82), rgba(6, 13, 18, .35) 75%, transparent);
  pointer-events: none;
}
.rp-top > * { pointer-events: auto; }
.rp-brand {
  display: flex; align-items: center; gap: 8px; text-decoration: none;
  color: var(--ink-dim); font-size: .82rem; letter-spacing: .02em;
  transition: color .2s;
}
.rp-brand:hover { color: var(--ink); }
.rp-brand-name b { color: var(--accent); font-weight: 650; }
.rp-brand-arrow { font-size: 1rem; translate: 0 -1px; transition: translate .2s; }
.rp-brand:hover .rp-brand-arrow { translate: -3px -1px; }
.rp-title {
  font-family: var(--font-d); font-size: 1.18rem; font-weight: 700;
  letter-spacing: .01em; margin-right: auto;
}
.rp-title span { color: var(--kurs); font-weight: 350; }
.rp-actions { display: flex; gap: 8px; }
.rp-btn {
  padding: 7px 14px; border-radius: 999px; font-size: .82rem; font-weight: 550;
  background: var(--glass-soft); border: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: background .2s, border-color .2s, scale .15s;
}
.rp-btn:hover { background: rgba(69, 177, 226, .18); border-color: rgba(69, 177, 226, .4); }
.rp-btn:active { scale: .96; }
.rp-btn-round { width: 32px; height: 32px; padding: 0; font-family: var(--font-d); font-style: italic; }

/* Bereichs-Tabs (Infocenter · Regatta · Beißfenster) */
.site-tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--glass-soft); border: 1px solid var(--line); border-radius: 999px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.site-tabs a {
  padding: 6px 13px; border-radius: 999px;
  font-size: .78rem; font-weight: 550; white-space: nowrap;
  color: var(--ink-dim); text-decoration: none;
  transition: background .2s, color .2s;
}
.site-tabs a:hover { color: var(--ink); background: rgba(69, 177, 226, .16); }
.site-tabs a[aria-current="page"] { background: var(--kurs); color: #241503; font-weight: 650; }

/* ── Panels (Glass) ────────────────────────────────────────── */
.rp-panel {
  position: fixed; z-index: 10; width: 296px;
  max-height: calc(100dvh - 176px);
  top: 68px;
  display: flex; flex-direction: column;
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(1.3); -webkit-backdrop-filter: blur(22px) saturate(1.3);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.rp-course { left: 14px; }
.rp-boat { right: 14px; }
.rp-panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 14px 16px 10px; position: sticky; top: 0; z-index: 2;
  background: linear-gradient(var(--glass), transparent 320%);
}
.rp-panel-head h2 {
  font-family: var(--font-d); font-size: .78rem; font-weight: 650;
  text-transform: uppercase; letter-spacing: .14em; color: var(--ink-dim);
}
.rp-mini {
  font-size: .72rem; color: var(--ink-dim); padding: 3px 9px;
  border: 1px solid var(--line); border-radius: 999px; transition: color .2s, border-color .2s;
}
.rp-mini:hover { color: #ff9d9d; border-color: rgba(255, 120, 120, .4); }
.rp-bahnen { padding: 2px 16px 4px; }
#bahn-select {
  width: 100%; padding: 8px 12px; border-radius: 10px;
  border: 1px solid rgba(255, 176, 87, .4);
  background: rgba(255, 176, 87, .08); color: var(--kurs);
  font: inherit; font-size: .8rem; font-weight: 550; cursor: pointer;
  appearance: none;
  background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="10" height="6"%3E%3Cpath d="M1 1l4 4 4-4" fill="none" stroke="%23ffb057" stroke-width="1.6"/%3E%3C/svg%3E');
  background-repeat: no-repeat; background-position: right 12px center;
}
#bahn-select:focus-visible { outline: 2px solid var(--kurs); outline-offset: 2px; }
#bahn-select option { background: var(--deep-2); color: var(--ink); }

.rp-hint {
  padding: 6px 16px 16px; font-size: .84rem; line-height: 1.5; color: var(--ink-dim);
}

/* Markenliste */
.rp-marks { list-style: none; padding: 0 10px; }
.rp-marks li {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 6px; border-radius: 10px; font-size: .84rem;
  touch-action: none;
}
.rp-marks li.dragging { opacity: .35; }
.rp-marks li.dragover { box-shadow: 0 -2px 0 var(--kurs); }
.rp-grip { cursor: grab; color: var(--ink-dim); font-size: .9rem; letter-spacing: -1px; user-select: none; }
.rp-badge {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-d); font-size: .7rem; font-weight: 700;
  background: var(--kurs); color: #241503;
}
li.is-start .rp-badge { background: var(--kreuz); }
li.is-ziel .rp-badge {
  background: repeating-conic-gradient(#e8f1f6 0 25%, #1a2b34 0 50%) 50%/8px 8px; color: transparent;
}
.rp-mark-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-mark-name small { display: block; color: var(--ink-dim); font-size: .7rem; }
.rp-round {
  flex: none; font-size: .68rem; font-weight: 650; padding: 3px 7px; border-radius: 7px;
  border: 1px solid var(--line); color: var(--ink-dim); transition: all .2s;
}
.rp-round[data-side="bb"] { color: #ff9d9d; border-color: rgba(255, 199, 199, .35); }
.rp-round[data-side="stb"] { color: var(--kreuz); border-color: rgba(127, 212, 168, .35); }
.rp-del { flex: none; color: var(--ink-dim); font-size: 1rem; padding: 2px 6px; border-radius: 7px; }
.rp-del:hover { color: #ff9d9d; background: rgba(255, 120, 120, .12); }

/* Summen + Schenkel */
.rp-sum {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px;
  margin: 10px 16px 4px; padding: 12px 0; border-top: 1px solid var(--line);
}
.rp-sum dt { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-dim); }
.rp-sum dd { font-family: var(--font-d); font-size: 1.02rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.rp-sum-eta { grid-column: 1 / -1; }
.rp-sum-eta dd { font-size: 1.5rem; color: var(--kurs); }
.rp-legs { list-style: none; padding: 2px 16px 14px; }
.rp-legs li {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0; font-size: .78rem; color: var(--ink-dim);
  border-top: 1px dashed rgba(157, 180, 192, .12);
  font-variant-numeric: tabular-nums;
}
.rp-legs li:first-child { border-top: 0; }
.rp-leg-no { color: var(--ink); font-weight: 600; width: 34px; flex: none; }
.rp-leg-mode {
  flex: none; font-size: .64rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 7px; border-radius: 6px; background: rgba(69, 177, 226, .16); color: var(--accent);
}
.rp-leg-mode.m-kreuz { background: rgba(127, 212, 168, .16); color: var(--kreuz); }
.rp-leg-mode.m-vorwind { background: rgba(255, 176, 87, .14); color: var(--kurs); }
.rp-leg-data { margin-left: auto; text-align: right; white-space: nowrap; }

/* ── Bootspanel ────────────────────────────────────────────── */
.rp-ys { font-size: .72rem; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.rp-classes { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 2px 12px 6px; }
.rp-class {
  text-align: left; padding: 8px 10px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--glass-soft);
  transition: border-color .2s, background .2s, scale .15s;
}
.rp-class:hover { border-color: rgba(69, 177, 226, .45); }
.rp-class:active { scale: .97; }
.rp-class[aria-checked="true"] { border-color: var(--kurs); background: rgba(255, 176, 87, .1); }
.rp-class b { display: block; font-family: var(--font-d); font-size: .84rem; font-weight: 650; }
.rp-class small { color: var(--ink-dim); font-size: .68rem; }
.rp-polar { padding: 8px 12px 14px; }
.rp-polar canvas { width: 100%; height: auto; display: block; }
.rp-polar figcaption { margin-top: 6px; font-size: .68rem; color: var(--ink-dim); text-align: center; }

/* ── Zeitleiste ────────────────────────────────────────────── */
.rp-time {
  position: fixed; z-index: 12; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom));
  translate: -50%; width: min(660px, calc(100vw - 660px));
  min-width: 340px;
  display: flex; gap: 12px; align-items: stretch;
  padding: 12px 16px 10px;
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(1.3); -webkit-backdrop-filter: blur(22px) saturate(1.3);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.rp-play {
  flex: none; width: 48px; border-radius: 12px; align-self: center; height: 48px;
  background: var(--kurs); color: #241503; display: grid; place-items: center;
  transition: scale .15s, background .2s, opacity .2s;
}
.rp-play:hover { scale: 1.06; }
.rp-play:active { scale: .95; }
.rp-play:disabled { opacity: .35; cursor: not-allowed; scale: 1; }
.rp-play svg { width: 22px; height: 22px; fill: currentColor; }
.rp-play .ico-pause { display: none; }
.rp-play.playing .ico-play { display: none; }
.rp-play.playing .ico-pause { display: block; }
.rp-time-body { flex: 1; min-width: 0; }
.rp-time-row { display: flex; align-items: baseline; gap: 10px; font-size: .8rem; }
.rp-time-label { text-transform: uppercase; letter-spacing: .12em; font-size: .64rem; color: var(--ink-dim); }
#time-out { font-family: var(--font-d); font-weight: 650; font-variant-numeric: tabular-nums; }
.rp-time-wind { color: var(--accent); font-variant-numeric: tabular-nums; }
.rp-clock {
  margin-left: auto; font-family: var(--font-d); font-weight: 700; color: var(--kurs);
  font-variant-numeric: tabular-nums;
}
#spark { width: 100%; display: block; margin: 4px 0 2px; }
#time-slider {
  width: 100%; appearance: none; height: 22px; background: transparent; cursor: pointer;
}
#time-slider::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: rgba(157, 180, 192, .25); }
#time-slider::-webkit-slider-thumb {
  appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--kurs); border: 2.5px solid #241503; margin-top: -6px;
  box-shadow: 0 0 0 4px rgba(255, 176, 87, .18);
}
#time-slider::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(157, 180, 192, .25); }
#time-slider::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--kurs); border: 2.5px solid #241503;
  box-shadow: 0 0 0 4px rgba(255, 176, 87, .18);
}

/* Windpartikel-Overlay (über GL-Canvas, unter Markern) */
.rp-windcanvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

/* ── Karten-Marker (DOM) ───────────────────────────────────── */
.rp-mark {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-d); font-size: .74rem; font-weight: 700;
  background: var(--kurs); color: #241503;
  border: 2px solid rgba(13, 27, 34, .9);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .5);
  cursor: pointer;
}
.rp-mark.is-start { background: var(--kreuz); }
.rp-mark.is-ziel { background: repeating-conic-gradient(#e8f1f6 0 25%, #1a2b34 0 50%) 50%/8px 8px; color: transparent; }
.rp-mark-label {
  position: absolute; left: 50%; top: -7px; translate: -50% -100%;
  white-space: nowrap; font-size: .7rem; font-weight: 550; color: var(--ink);
  text-shadow: 0 1px 3px #0d1b22, 0 0 6px #0d1b22;
  pointer-events: none;
}
.rp-boat-ghost { width: 34px; height: 34px; pointer-events: none; will-change: transform; }
.rp-boat-ghost svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }
.rp-windpt { pointer-events: none; text-align: center; color: var(--ink); }
.rp-windpt svg { width: 26px; height: 26px; display: block; margin: 0 auto; }
.rp-windpt small {
  font-size: .64rem; font-weight: 600; font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px #0d1b22, 0 0 6px #0d1b22;
}

/* ── Sonstiges ─────────────────────────────────────────────── */
.rp-disclaimer {
  position: fixed; z-index: 9; left: 14px; bottom: calc(12px + env(safe-area-inset-bottom));
  font-size: .64rem; letter-spacing: .04em; color: var(--ink-dim);
  background: var(--glass-soft); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 10px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
}
.rp-tabs { display: none; }

dialog {
  margin: auto; max-width: min(520px, calc(100vw - 32px));
  background: var(--deep-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 26px 20px; box-shadow: var(--shadow);
  font-size: .88rem; line-height: 1.55;
}
dialog::backdrop { background: rgba(4, 10, 14, .6); backdrop-filter: blur(4px); }
dialog h2 { font-family: var(--font-d); font-size: 1.15rem; margin-bottom: 12px; }
dialog p { margin-bottom: 10px; color: var(--ink-dim); }
dialog p strong { color: var(--ink); font-weight: 600; }
.rp-dlg-warn { padding: 10px 12px; border-radius: 10px; background: rgba(255, 176, 87, .09); border: 1px solid rgba(255, 176, 87, .25); }
.rp-dlg-src { font-size: .72rem; }
dialog form { text-align: right; margin-top: 14px; }

.rp-toast {
  position: fixed; z-index: 30; left: 50%; bottom: 104px; translate: -50% 16px;
  background: var(--deep-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 18px; font-size: .82rem; opacity: 0; pointer-events: none;
  transition: opacity .25s, translate .25s;
  box-shadow: var(--shadow);
}
.rp-toast.show { opacity: 1; translate: -50% 0; }

/* MapLibre-Chrome andocken */
.maplibregl-ctrl-bottom-right { z-index: 8; }
.maplibregl-ctrl-attrib {
  background: var(--glass-soft) !important; color: var(--ink-dim);
  border-radius: 8px 0 0 0; font-size: .6rem;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.maplibregl-ctrl-attrib a { color: var(--ink-dim); }

/* Fokus sichtbar */
:where(button, a, input, [tabindex]):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ── Mobil: Panels als Bottom-Sheets mit Tabs ──────────────── */
@media (max-width: 700px) {
  .rp-top { flex-wrap: wrap; row-gap: 8px; }
  .site-tabs { order: 10; width: 100%; }
  .site-tabs a { flex: 1; text-align: center; padding: 7px 2px; font-size: .72rem; }
  .rp-title { font-size: 1rem; }
  .rp-brand-name { display: none; }
  .rp-btn { padding: 6px 11px; font-size: .76rem; }

  .rp-panel {
    top: auto; left: 10px !important; right: 10px !important; width: auto;
    bottom: calc(64px + env(safe-area-inset-bottom));
    max-height: 46dvh;
    translate: 0 16px; opacity: 0; pointer-events: none;
    transition: translate .28s cubic-bezier(.3, 1.2, .4, 1), opacity .22s;
  }
  .rp-panel.open { translate: 0 0; opacity: 1; pointer-events: auto; }

  .rp-time {
    left: 10px; right: 10px; width: auto; min-width: 0; translate: 0;
    bottom: calc(64px + env(safe-area-inset-bottom));
    translate: 0 16px; opacity: 0; pointer-events: none;
    transition: translate .28s cubic-bezier(.3, 1.2, .4, 1), opacity .22s;
  }
  .rp-time.open { translate: 0 0; opacity: 1; pointer-events: auto; }

  .rp-tabs {
    display: flex; position: fixed; z-index: 20;
    left: 50%; translate: -50%; bottom: calc(10px + env(safe-area-inset-bottom));
    gap: 4px; padding: 4px;
    background: var(--glass); border: 1px solid var(--line); border-radius: 999px;
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
  }
  .rp-tabs button {
    padding: 8px 18px; border-radius: 999px; font-size: .8rem; font-weight: 550;
    color: var(--ink-dim); transition: background .2s, color .2s;
  }
  .rp-tabs button.active { background: var(--kurs); color: #241503; }

  .rp-disclaimer { left: 50%; translate: -50%; bottom: auto; top: calc(100px + env(safe-area-inset-top)); }
  .rp-classes { grid-template-columns: 1fr 1fr 1fr; }
  .rp-toast { bottom: 130px; }
}


/* ── Druck-Bahnblatt (PDF via Browser-Druckdialog) ─────────── */
.print-blatt { display: none; }

@page { size: A4 portrait; margin: 11mm; }

@media print {
  body { overflow: visible; background: #fff; }
  body > *:not(.print-blatt) { display: none !important; }
  .print-blatt {
    display: block; color: #16232b; font-family: var(--font-b);
    font-size: 10.5pt; line-height: 1.45;
  }
  .pb-kopf { display: flex; align-items: baseline; gap: 10px; border-bottom: 2.5px solid #16232b; padding-bottom: 6px; }
  .pb-kopf h1 { font-family: var(--font-d); font-size: 19pt; font-weight: 750; }
  .pb-kopf h1 span { color: #b96a00; font-weight: 400; }
  .pb-kopf p { margin-left: auto; font-size: 8.5pt; color: #5a6d78; text-align: right; }
  .pb-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 9px 0 10px; font-size: 9.5pt; }
  .pb-meta b { font-family: var(--font-d); }
  .pb-meta span { color: #5a6d78; }
  .pb-karte { width: 100%; border-radius: 6px; border: 1px solid #c6d2d9; display: block; }
  .print-blatt h2 {
    font-family: var(--font-d); font-size: 10pt; text-transform: uppercase;
    letter-spacing: .1em; color: #5a6d78; margin: 12px 0 4px;
  }
  .print-blatt table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
  .print-blatt th {
    text-align: left; font-size: 8pt; text-transform: uppercase; letter-spacing: .08em;
    color: #5a6d78; border-bottom: 1.5px solid #16232b; padding: 2px 8px 3px 0;
  }
  .print-blatt td { padding: 3px 8px 3px 0; border-bottom: 1px solid #dbe4e9; vertical-align: baseline; }
  .print-blatt td:last-child, .print-blatt th:last-child { text-align: right; padding-right: 0; }
  .pb-stb { color: #0b7a43; font-weight: 650; }
  .pb-bb { color: #b3372f; font-weight: 650; }
  .pb-link { margin-top: 9px; font-size: 7.5pt; color: #5a6d78; overflow-wrap: anywhere; }
  .pb-fuss { margin-top: 5px; font-size: 8pt; color: #5a6d78; border-top: 1px solid #dbe4e9; padding-top: 5px; }
  .pb-fuss strong { color: #b3372f; }
  .pb-karte, .print-blatt tr { break-inside: avoid; }
  .print-blatt h2 { break-after: avoid; }
}
