:root {
  --bg: #14101f;
  --bg2: #1f1830;
  --card: #2a2140;
  --text: #f4f0ff;
  --muted: #a89cc4;
  --accent: #ff5fa2;
  --accent2: #ffb347;
  --ok: #4ade80;
  --radius: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: radial-gradient(ellipse at top left, #3b1f5c 0%, var(--bg) 55%) fixed;
}

h1, h2, h3 { margin: 0 0 .5em; }
.title {
  font-size: clamp(2.2rem, 6vw, 4.5rem);
  font-weight: 900;
  letter-spacing: -.02em;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.muted { color: var(--muted); }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

button, .button {
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 999px;
  padding: .8em 1.6em;
  cursor: pointer;
  color: #1a1026;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  text-decoration: none;
  display: inline-block;
}
button.secondary { background: var(--bg2); color: var(--text); border: 1px solid #4a3d66; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.small { padding: .35em .9em; font-size: .85rem; }

input {
  font: inherit;
  width: 100%;
  padding: .8em 1em;
  border-radius: 12px;
  border: 1px solid #4a3d66;
  background: var(--bg2);
  color: var(--text);
}
input:focus { outline: 2px solid var(--accent); border-color: transparent; }

.error { color: #ff8a8a; min-height: 1.4em; }

/* ---------- Startseite ---------- */
.landing {
  max-width: 720px;
  margin: 0 auto;
  padding: 10vh 1.5rem;
  display: grid;
  gap: 1.5rem;
}
.landing .row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .landing .row { grid-template-columns: 1fr; } }

/* ---------- Host ---------- */
.host {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
  min-height: 100vh;
}
.host aside { display: grid; gap: 1rem; align-content: start; }
.qr { background: #fff; border-radius: var(--radius); padding: .75rem; }
.qr img { width: 100%; display: block; }
.code { font-size: 3rem; font-weight: 900; letter-spacing: .2em; text-align: center; }
.join-url { word-break: break-all; text-align: center; font-size: .9rem; }

.players { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.players li {
  display: flex; align-items: center; gap: .6rem;
  background: var(--bg2); border-radius: 12px; padding: .5rem .75rem;
}
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.players .offline { opacity: .45; }
.players .name { flex: 1; font-weight: 600; }

.stage { display: grid; gap: 1.5rem; align-content: start; }
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.game-card { display: grid; gap: .75rem; }
.badge { font-size: .75rem; padding: .2em .7em; border-radius: 999px; background: #4a3d66; justify-self: start; }

table.ranking { width: 100%; border-collapse: collapse; font-size: 1.3rem; }
table.ranking th { text-align: left; color: var(--muted); font-weight: 600; font-size: .9rem; padding: .5rem .75rem; }
table.ranking td { padding: .7rem .75rem; border-top: 1px solid #3a2f55; }
table.ranking td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.ranking tr.first td { font-weight: 800; }
.place { font-weight: 900; width: 3em; }

.toolbar { display: flex; gap: .75rem; flex-wrap: wrap; }

@media (max-width: 900px) { .host { grid-template-columns: 1fr; } }

/* ---------- Handy ---------- */
.phone {
  max-width: 480px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  display: grid;
  gap: 1.25rem;
}
.phone .me { display: flex; align-items: center; gap: .75rem; font-size: 1.3rem; font-weight: 700; }
.phone .me .dot { width: 22px; height: 22px; }
.status { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); }
.status .led { width: 8px; height: 8px; border-radius: 50%; background: #ff8a8a; }
.status.online .led { background: var(--ok); }
.big-msg { font-size: 1.4rem; font-weight: 700; text-align: center; padding: 2rem 1rem; }
.hidden { display: none !important; }

/* ---------- Unterseiten (z. B. Strava) ---------- */
.page { max-width: 1100px; margin: 0 auto; padding: 1.5rem; display: grid; gap: 1.25rem; }
.page-head { display: grid; gap: .25rem; }
.page a { color: var(--accent2); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }
.form { display: grid; gap: .75rem; }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.steps li { margin-bottom: .4rem; }
code { background: var(--bg2); padding: .1em .4em; border-radius: 6px; color: var(--text); }
details summary { cursor: pointer; color: var(--muted); }
.small-text { font-size: .85rem; }
.flash { border-left: 4px solid var(--ok); }
.flash.error-card { border-left-color: #ff8a8a; }
.accounts { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.accounts li { display: flex; align-items: center; gap: .6rem; background: var(--bg2); border-radius: 12px; padding: .6rem .75rem; }
.acc-main { flex: 1; min-width: 0; }
#map { height: 60vh; min-height: 360px; border-radius: 12px; margin-top: .5rem; background: #0e0b16; }

.progress { height: 8px; border-radius: 999px; background: var(--bg2); overflow: hidden; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .2s; }
.accounts .badge { margin-left: .4rem; vertical-align: middle; }

.page.narrow { max-width: 640px; }
textarea {
  font: inherit; width: 100%; padding: .8em 1em; border-radius: 12px; resize: vertical;
  border: 1px solid #4a3d66; background: var(--bg2); color: var(--text);
}
textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.field { display: grid; gap: .35rem; }
.field > span { font-weight: 600; }
.grid2.tight { gap: .75rem; }

/* ---------- Spiel 1: Karte ---------- */
.game { display: grid; gap: 1rem; }
.game-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; }
.game-head h1 { font-size: clamp(1.6rem, 3vw, 2.6rem); margin: 0; }
.game-meta { text-align: right; }
.timer { font-size: 2.4rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.timer.small { font-size: 1.3rem; }
.timer.urgent { color: #ff8a8a; }
.game-map { height: 68vh; min-height: 420px; border-radius: var(--radius); background: #0e0b16; }
.setup { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: .75rem; align-items: end; }
@media (max-width: 1100px) { .setup { grid-template-columns: 1fr 1fr; } }
select { font: inherit; width: 100%; padding: .8em 1em; border-radius: 12px; border: 1px solid #4a3d66; background: var(--bg2); color: var(--text); }
.dot.inline { display: inline-block; margin-right: .5rem; vertical-align: middle; }
.target-pin { font-size: 30px; line-height: 34px; text-align: center; color: #ffe14d; text-shadow: 0 0 6px #000, 0 0 2px #000; }
.leaflet-tooltip.pin-label { background: rgba(20,16,31,.85); color: #fff; border: 0; border-radius: 8px; font-weight: 700; box-shadow: none; }
.leaflet-tooltip.pin-label::before { display: none; }
.drawing { cursor: crosshair; touch-action: none; }

.phone-game { display: grid; gap: .75rem; }
.game-bar { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .9rem 1rem; }
.phone-map { height: 58vh; min-height: 320px; border-radius: var(--radius); background: #0e0b16; }
.phone-map.drawing { outline: 3px solid var(--accent); }
.pg-actions { display: grid; gap: .6rem; }
.pg-actions:empty { display: none; }
.pg-actions .done-msg { grid-column: 1 / -1; }
.pg-actions { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
.pg-actions > button:only-of-type { grid-column: 1 / -1; }
.result-big { font-size: 2.2rem; font-weight: 900; }

.wrapped-preview { max-width: 100%; max-height: 60vh; border-radius: 12px; justify-self: center; }
pre { white-space: pre-wrap; font-size: .8rem; color: var(--muted); }
.flow-banner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-left: 4px solid var(--accent); }
