:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --band: #f8fafc;
  --accent: #0b6bcb;
  --accent-soft: #e0efff;
  --ok-bg: #dcfce7; --ok-text: #166534;
  --warn-bg: #fee2e2; --warn-text: #991b1b;
  --note-bg: #fef3c7; --note-text: #92400e;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 12px rgba(15, 23, 42, .04);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --card: #1e293b;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --line: #334155;
    --band: #243146;
    --accent: #60a5fa;
    --accent-soft: #1e3a5f;
    --ok-bg: #14532d; --ok-text: #bbf7d0;
    --warn-bg: #7f1d1d; --warn-text: #fecaca;
    --note-bg: #713f12; --note-text: #fde68a;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 1100px; margin: 0 auto; padding: 12px 16px 24px; }
h1 { font-size: 1.5rem; margin: 0 0 12px; }
h2 { font-size: 1.15rem; margin: 20px 0 10px; }
a { color: var(--accent); }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ── Prehod med zavihki ob potegu s prstom (brskalniki brez podpore stran samo zamenjajo) ── */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
html:active-view-transition-type(swipe-next)::view-transition-old(root) { animation: 180ms ease-in both slide-out-left; }
html:active-view-transition-type(swipe-next)::view-transition-new(root) { animation: 180ms ease-out both slide-in-right; }
html:active-view-transition-type(swipe-prev)::view-transition-old(root) { animation: 180ms ease-in both slide-out-right; }
html:active-view-transition-type(swipe-prev)::view-transition-new(root) { animation: 180ms ease-out both slide-in-left; }
@keyframes slide-out-left { to { transform: translateX(-100%); } }
@keyframes slide-in-right { from { transform: translateX(100%); } }
@keyframes slide-out-right { to { transform: translateX(100%); } }
@keyframes slide-in-left { from { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
}

/* ── Glava in navigacija ── */
.top {
  max-width: 1100px; margin: 0 auto; padding: 12px 16px 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { font-size: 1.25rem; font-weight: 700; color: var(--text); text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.langs { display: flex; gap: 4px; flex-shrink: 0; }
.langs button { padding: 4px 9px; font-size: .8rem; font-weight: 600; }
.tabs { max-width: 1100px; margin: 0 auto; padding: 0 16px; display: flex; gap: 6px; overflow-x: auto; }
.tabs a {
  padding: 8px 14px; border-radius: 999px; text-decoration: none; white-space: nowrap;
  color: var(--text); background: var(--card); border: 1px solid var(--line); font-weight: 600; font-size: .95rem;
}
.tabs a.active { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .tabs a.active { color: #0f172a; } }
footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 8px 16px 24px; }

/* ── Gumbi in obrazci ── */
button {
  font: inherit; cursor: pointer; padding: 9px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
}
button:hover { border-color: var(--accent); }
button.primary, .langs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { button.primary, .langs button.active { color: #0f172a; } }
button.wide, button.pick { width: 100%; }
button.pick { text-align: left; margin-bottom: 8px; padding: 12px 14px; }
input, select, textarea {
  font: inherit; width: 100%; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
textarea { resize: vertical; margin-bottom: 12px; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row input { flex: 1; min-width: 0; width: auto; }
.row.spread { justify-content: space-between; align-items: center; }

/* ── Kartice ── */
.card { background: var(--card); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card.narrow { max-width: 560px; margin: 24px auto; }
.card h2:first-child, .card h1:first-child { margin-top: 0; }

/* ── Trenutno ── */
.updated { text-align: center; color: var(--muted); font-size: .9rem; margin: 4px 0 10px; }
.metrics { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.metric { flex: 1 1 170px; background: var(--card); border-radius: 14px; padding: 12px; text-align: center; box-shadow: var(--shadow); }
.metric-label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.metric-value { font-size: 1.6rem; font-weight: 700; color: var(--accent); line-height: 1.3; }
.metric-sub { font-size: .85rem; color: var(--muted); }
.alert { padding: 12px; border-radius: 12px; text-align: center; font-weight: 600; margin-bottom: 14px; }
.alert.ok { background: var(--ok-bg); color: var(--ok-text); }
.alert.warn { background: var(--warn-bg); color: var(--warn-text); }
.alert.note { background: var(--note-bg); color: var(--note-text); }
.captain { border-left: 6px solid var(--accent); background: var(--accent-soft); line-height: 1.6; }
.captain p { margin: 0; }
.thinking { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* ── Graf ── */
.chart-card { padding: 12px; }
.chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.chart { position: relative; min-width: 1000px; }
.chart svg { display: block; width: 100%; height: auto; touch-action: pan-x pan-y; }
.chart text { font-family: inherit; text-anchor: middle; fill: var(--muted); }
.chart .c-axis { font-size: 13px; text-anchor: start; }
.chart .c-axis[text-anchor="end"] { text-anchor: end; }
.chart .c-day { font-size: 14px; font-weight: 700; fill: var(--text); }
.chart .c-date { font-size: 12px; }
.chart .c-hour { font-size: 11px; }
.chart .c-icon { font-size: 16px; }
.chart .c-kt { font-size: 12px; fill: var(--text); }
.chart .c-rain-label { font-size: 11px; fill: #3b82f6; }
.c-band { fill: var(--band); }
.c-grid { stroke: var(--line); stroke-width: 1; }
.c-dash { stroke-dasharray: 3 3; }
.c-rain { fill: #3b82f6; opacity: .7; }
.c-temp { fill: none; stroke: #e11d48; stroke-width: 3; stroke-linecap: round; }
.c-gust { fill: none; stroke: url(#g-gust); stroke-width: 3.5; stroke-linecap: round; }
.c-arrow { fill: var(--muted); }
.c-guide { stroke: var(--muted); stroke-width: 1; pointer-events: none; }
.chart-tip {
  position: absolute; top: 56px; pointer-events: none; white-space: nowrap;
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font-size: .85rem; line-height: 1.45; box-shadow: 0 4px 14px rgba(15, 23, 42, .18);
}
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 8px 4px 0; font-size: .9rem; font-weight: 600; }
.lg { display: inline-block; width: 18px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.lg-temp { background: #e11d48; }
.lg-gust { background: linear-gradient(90deg, #eab308, #a855f7); }
.lg-rain { background: #3b82f6; opacity: .7; height: 10px; width: 10px; }

/* ── Graf gladine morja ── */
.chart .c-moon { font-size: 15px; }
.chart .c-strip { font-size: 12px; text-anchor: start; }
.chart .c-day .c-date { font-weight: 400; fill: var(--muted); }
.c-zero { stroke: var(--muted); stroke-width: 1; }
.c-level { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.c-astro { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 4; }
.c-up { fill: #f59e0b; opacity: .4; }
.c-down { fill: #38bdf8; opacity: .4; }
.c-jugo { fill: #f97316; opacity: .8; }
.c-burja { fill: #0ea5e9; opacity: .8; }
.c-now { stroke: #e11d48; stroke-width: 2; pointer-events: none; }
.c-now-dot { fill: #e11d48; stroke: var(--card); stroke-width: 2; pointer-events: none; }
.chart .c-now-label { font-size: 13px; font-weight: 700; fill: #e11d48; }
.chart-card h2 { margin: 2px 4px 8px; }
.small { font-size: .85rem; margin: 8px 4px 0; }
.lg-level { background: var(--accent); }
.lg-astro { background: none; border-top: 2px dashed var(--muted); height: 0; }
.lg-up, .lg-down, .lg-jugo, .lg-burja { width: 10px; height: 10px; }
.lg-up { background: #f59e0b; opacity: .5; }
.lg-down { background: #38bdf8; opacity: .5; }
.lg-jugo { background: #f97316; }
.lg-burja { background: #0ea5e9; }

/* ── Napoved po urah ── */
.day { padding: 0; overflow: hidden; margin-bottom: 8px; }
.day summary {
  cursor: pointer; padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 4px 16px;
  align-items: center; justify-content: space-between; list-style: none;
}
.day summary::-webkit-details-marker { display: none; }
.day summary::before { content: "▸"; color: var(--muted); margin-right: -8px; }
.day[open] summary::before { content: "▾"; }
.day-name { font-weight: 700; flex: 1; }
.day-sum { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: .92rem; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 600; background: var(--band); }
th, td { padding: 7px 12px; white-space: nowrap; }
tbody tr + tr td { border-top: 1px solid var(--line); }
tr.night td { background: var(--band); }
td.icon { font-size: 1.15rem; padding: 4px; text-align: center; }
td.temp { font-weight: 700; }
.arrow { display: inline-block; width: 1.2em; text-align: center; margin-right: 4px; color: var(--muted); font-weight: 700; }
.t-cold { color: #2563eb; } .t-mild { color: #16a34a; } .t-warm { color: #ea580c; } .t-hot { color: #dc2626; } .t-extreme { color: #9333ea; }
@media (prefers-color-scheme: dark) {
  .t-cold { color: #60a5fa; } .t-mild { color: #4ade80; } .t-warm { color: #fb923c; } .t-hot { color: #f87171; } .t-extreme { color: #c084fc; }
}

/* ── Straža sidra ── */
.anchor { max-width: 560px; margin-left: auto; margin-right: auto; text-align: center; }
.a-status { font-weight: 600; margin: 0 0 10px; padding: 9px; border-radius: 10px; background: var(--band); }
.a-status.ok { background: var(--ok-bg); color: var(--ok-text); }
.a-status.note { background: var(--note-bg); color: var(--note-text); }
.a-status.warn { background: var(--warn-bg); color: var(--warn-text); }
.a-dist { font-size: 4.2rem; font-weight: 800; line-height: 1.05; color: var(--accent); }
.a-dist small { font-size: 1.6rem; }
.a-stats { display: flex; justify-content: space-around; gap: 8px; margin: 10px 0; }
.a-stats b { display: block; font-size: 1.15rem; }
.a-stats span { font-size: .8rem; color: var(--muted); }
#a-plot { display: block; width: 100%; max-width: 420px; aspect-ratio: 1; margin: 4px auto 12px; background: var(--band); border-radius: 14px; }
.a-ring { fill: none; stroke: #e11d48; stroke-width: 1; stroke-dasharray: 4 3; }
.a-ring.off { stroke: var(--muted); }
.a-label { font-size: 7px; fill: var(--muted); text-anchor: middle; }
.a-anchor { font-size: 13px; text-anchor: middle; }
.a-track { fill: none; stroke: var(--accent); stroke-width: 1.2; stroke-linejoin: round; stroke-linecap: round; }
.a-acc { fill: var(--accent); opacity: .15; }
.a-boat { fill: var(--accent); stroke: var(--card); stroke-width: 1.2; }
.a-alarm { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 0 0 12px; }
.a-alarm button { min-width: 44px; font-weight: 700; }
.a-toggle { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
input[type="checkbox"] { width: 20px; height: 20px; padding: 0; }
button.big { padding: 15px; font-size: 1.15rem; font-weight: 700; margin-bottom: 8px; }
.a-overlay {
  position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px; text-align: center; font-size: 1.5rem; font-weight: 700;
  background: #b91c1c; color: #fff; animation: a-flash 1s steps(2, jump-none) infinite;
}
.a-overlay b { font-size: 4rem; line-height: 1; }
.a-overlay button { font-size: 1.3rem; font-weight: 700; padding: 16px 28px; border: none; background: #fff; color: #7f1d1d; }
@keyframes a-flash { 50% { background: #7f1d1d; } }

@media (max-width: 480px) {
  main { padding: 10px 10px 20px; }
  .metric { flex-basis: 40%; }
  .metric-value { font-size: 1.35rem; }
  /* Tabela mora na telefonu stati brez vodoravnega drsenja, sicer poteg po njej ne preklopi zavihka. */
  table { font-size: .86rem; }
  th, td { padding: 6px 4px; }
  th:first-child, td:first-child { padding-left: 10px; }
  td.icon { padding: 4px 0; }
  .arrow { width: 1em; margin-right: 1px; }
}
