/* Schottland-Karte – mobil zuerst, hell und dunkel. */

:root {
  --bg: #f6f5f1;
  --panel: #ffffff;
  --panel-2: #f0eee8;
  --line: #dcd8cf;
  --text: #1d2422;
  --muted: #6a7370;
  --accent: #7b4397;
  --done: #c2185b;
  --todo: #64748b;
  --now: #e8590c;
  --photo: #2b8a3e;
  --shadow: 0 1px 2px rgba(20, 24, 26, 0.08), 0 6px 18px rgba(20, 24, 26, 0.06);
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12171a;
    --panel: #1a2024;
    --panel-2: #222a2f;
    --line: #2f3a40;
    --text: #e7eae7;
    --muted: #93a09c;
    --accent: #c08bdc;
    --done: #f0508a;
    --todo: #7c8b99;
    --now: #ff8a3d;
    --photo: #51cf66;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }

a { color: var(--accent); }

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 12px 40px;
  display: grid;
  gap: 12px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card > .pad { padding: 14px 16px; }

/* ---------------------------------------------------------------- Kopf ---- */

header.top {
  display: grid;
  gap: 10px;
  padding: 16px;
  background: linear-gradient(150deg, var(--panel) 0%, var(--panel-2) 100%);
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.countdown {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.countdown .value {
  font-variant-numeric: tabular-nums;
  font-size: clamp(30px, 9vw, 46px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.countdown .label { color: var(--muted); font-size: 14px; }

.countdown.done .value { color: var(--photo); }

.statusline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 14px;
  color: var(--muted);
}

.statusline strong { color: var(--text); font-weight: 600; }

/* ------------------------------------------------------------ Fortschritt -- */

.progress {
  display: grid;
  gap: 6px;
}

.bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  overflow: hidden;
}

.bar > i {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--accent), var(--done));
  border-radius: 999px;
  transition: width 0.6s ease;
}

.bar-legend {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.bar-legend span:last-child { text-align: right; white-space: nowrap; }

/* ------------------------------------------------------------------ Karte -- */

#map {
  height: min(62vh, 560px);
  width: 100%;
  background: var(--panel-2);
}

.leaflet-container { font: inherit; background: var(--panel-2); }

.pin-now {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--now);
  border: 3px solid #fff;
  box-shadow: 0 0 0 3px rgba(232, 89, 12, 0.35), 0 2px 6px rgba(0, 0, 0, 0.4);
}

.pin-now.stale { background: var(--todo); box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.3); }

.pin-stage {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--todo);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.pin-stage.reached { background: var(--done); }

.pin-photo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  background-size: cover;
  background-position: center;
  background-color: var(--panel-2);
}

.pin-hover {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
}

.leaflet-popup-content { margin: 10px 12px; font-size: 14px; }
.leaflet-popup-content b { display: block; margin-bottom: 2px; }

/* --------------------------------------------------------------- Profil ---- */

.profile-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 16px 0;
  gap: 12px;
}

.profile-read {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-height: 20px;
}

#profile { display: block; width: 100%; height: 170px; touch-action: pan-y; }

#profile .area-done { fill: var(--done); opacity: 0.28; }
#profile .area-todo { fill: var(--todo); opacity: 0.16; }
#profile .ridge { fill: none; stroke: var(--text); stroke-width: 1.2; opacity: 0.55; }
#profile .grid-line { stroke: var(--line); stroke-width: 1; }
#profile .stage-sep { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
#profile .axis-text { fill: var(--muted); font-size: 10px; }
#profile .stage-text { fill: var(--muted); font-size: 10px; }
#profile .now-line { stroke: var(--now); stroke-width: 2; }
#profile .now-dot { fill: var(--now); stroke: #fff; stroke-width: 2; }
#profile .cursor-line { stroke: var(--accent); stroke-width: 1.5; }

/* --------------------------------------------------------------- Etappen --- */

table.stages {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.stages th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  padding: 4px 8px;
}

table.stages td { padding: 8px; border-top: 1px solid var(--line); vertical-align: top; }
table.stages tr.current { background: color-mix(in oklab, var(--accent) 12%, transparent); }
table.stages tr.past td:first-child { color: var(--muted); }
table.stages .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.stages .note { color: var(--muted); font-size: 13px; }
.tick { color: var(--done); }

/* ---------------------------------------------------------------- Aktion --- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

button, .btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 16px;
  cursor: pointer;
  min-height: 44px;
}

button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: 0.55; cursor: default; }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Im Dunkelmodus ist der Akzent hell – dort trägt dunkle Schrift besser. */
@media (prefers-color-scheme: dark) {
  button.primary { color: #17111d; }
}

button.danger { color: var(--done); }

input[type="text"], input[type="password"], textarea {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  width: 100%;
  min-height: 44px;
}

input:focus-visible, button:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.hint { font-size: 13px; color: var(--muted); }

.notice {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.notice.warn { border-color: var(--now); }
.notice.error { border-color: var(--done); color: var(--done); }
.notice.ok { border-color: var(--photo); }

/* --------------------------------------------------------------- Galerie --- */

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

.gallery figure { margin: 0; position: relative; }

.gallery img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
  cursor: pointer;
  background: var(--panel-2);
}

.gallery figcaption {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

dialog.lightbox {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 96vw;
  max-height: 96vh;
}

dialog.lightbox::backdrop { background: rgba(0, 0, 0, 0.85); }

dialog.lightbox img {
  max-width: 96vw;
  max-height: 82vh;
  border-radius: 10px;
  display: block;
}

dialog.lightbox .meta {
  color: #fff;
  font-size: 14px;
  padding: 8px 4px 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

dialog.lightbox .meta button { background: rgba(255, 255, 255, 0.15); border-color: transparent; color: #fff; }

/* ----------------------------------------------------------------- Login --- */

.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card { width: min(380px, 100%); }
.login-card form { display: grid; gap: 10px; }
.login-card h1 { font-size: 22px; }
.login-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 6px; }

footer.credits {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 4px 8px 0;
  line-height: 1.6;
}

.queue-badge {
  font-size: 13px;
  color: var(--now);
  font-weight: 600;
}

@media (min-width: 760px) {
  #map { height: 520px; }
  .wrap { padding: 20px 20px 60px; gap: 16px; }
}
