/* =========================================================
   Tag – Design nach bitzlibesser.ch
   Syne für Titel · Poppins für Text · Poppins Black Kursiv fürs Wordmark
   ========================================================= */

@font-face { font-family: "Poppins"; font-weight: 400; font-style: normal; font-display: swap; src: url(fonts/poppins-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-style: normal; font-display: swap; src: url(fonts/poppins-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-style: normal; font-display: swap; src: url(fonts/poppins-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 900; font-style: italic; font-display: swap; src: url(fonts/poppins-latin-900-italic.woff2) format("woff2"); }
@font-face { font-family: "Syne"; font-weight: 700; font-style: normal; font-display: swap; src: url(fonts/syne-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Syne"; font-weight: 800; font-style: normal; font-display: swap; src: url(fonts/syne-latin-800-normal.woff2) format("woff2"); }

:root {
  --f-text: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --f-head: "Syne", "Poppins", sans-serif;

  --white: #ffffff;
  --ink: #000014;
  --navy: #00325a;
  --sky: #8cd2ff;
  --red: #e11414;
  --grey: #898989;
  --line: #dfdfdf;
  --soft: #f3f4f6;

  --bg: var(--white);
  --text: var(--ink);
  --muted: var(--grey);
  --accent: var(--navy);
  --catcher: var(--red);
  --runner: var(--sky);

  --radius: 20px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabs-h: calc(64px + var(--safe-bottom));
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font-family: var(--f-text); font-size: 15px; line-height: 1.5; letter-spacing: -.2px; overscroll-behavior: none; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

#app { min-height: 100%; padding: calc(var(--safe-top) + 18px) 20px calc(var(--safe-bottom) + 28px); max-width: 560px; margin: 0 auto; }
body.has-tabs #app { padding-bottom: calc(var(--tabs-h) + 24px); }

/* ---------- Typo ---------- */
.logo { font-family: "Poppins", sans-serif; font-weight: 900; font-style: italic; font-size: 76px; letter-spacing: -2px; line-height: .9; margin: 0; color: var(--ink); }
.logo span { color: var(--sky); }
h1 { font-family: var(--f-head); font-weight: 700; font-size: 34px; line-height: 1.08; letter-spacing: -1.2px; margin: 4px 0 18px; }
/* Abschnitts-Label wie "05 / SERVICES" */
h2 { font-family: var(--f-text); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--grey); margin: 32px 0 12px; display: flex; align-items: center; gap: 10px; }
h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }

/* ---------- Bausteine ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 10px; }
.stack > * + * { margin-top: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; border: 2px solid var(--navy); border-radius: 20px; padding: 15px 18px;
  font-weight: 600; font-size: 16px; letter-spacing: -.4px;
  background: var(--white); color: var(--navy); transition: transform .08s, opacity .2s, background .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .35; }
.btn.primary { background: var(--navy); color: var(--white); }
.btn.danger { background: var(--red); border-color: var(--red); color: var(--white); }
.btn.good { background: var(--navy); color: var(--white); }
.btn.ghost { border-color: var(--line); color: var(--ink); }
.btn.small { padding: 8px 14px; font-size: 13.5px; width: auto; border-radius: 14px; border-width: 1.5px; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btns2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.field { width: 100%; background: var(--soft); border: 1.5px solid transparent; border-radius: 18px; padding: 15px 18px; font-size: 16px; outline: none; transition: border-color .2s, background .2s; }
.field:focus { border-color: var(--navy); background: var(--white); }
.field::placeholder { color: #b3b3b3; }
.code-input { text-align: center; font-family: "Poppins"; font-style: italic; font-weight: 900; font-size: 28px; letter-spacing: 8px; text-transform: uppercase; }
label.lbl { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--grey); margin: 16px 0 7px 4px; }

/* Pills wie die Tags auf der Website */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--soft); color: var(--ink); white-space: nowrap; }
.pill.catcher { background: rgba(225,20,20,.1); color: var(--red); }
.pill.runner { background: rgba(140,210,255,.35); color: var(--navy); }
.pill.off { background: var(--soft); color: var(--grey); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.on { background: #2bb673; box-shadow: 0 0 0 3px rgba(43,182,115,.18); }
.dot.offline { background: var(--line); }

/* ---------- Startseite ---------- */
.hero {
  margin: calc((var(--safe-top) + 18px) * -1) -20px 0; padding: calc(var(--safe-top) + 60px) 20px 150px;
  background: linear-gradient(to bottom, rgba(0,50,90,.45) 0%, rgba(0,50,90,.2) 45%, rgba(255,255,255,0) 68%, #fff 100%), url(icons/sky.jpg) center top / cover no-repeat;
  min-height: 46vh; display: flex; flex-direction: column; justify-content: flex-end;
}
.hero .logo { font-family: "Poppins", sans-serif; font-weight: 900; font-style: italic; letter-spacing: -2px; margin: 0; color: var(--white); font-size: 100px; text-shadow: 0 4px 30px rgba(0,50,90,.25); }
.hero .logo span { color: var(--white); }
.hero p { margin: 10px 0 0; color: var(--white); font-family: var(--f-head); font-weight: 700; font-size: 22px; letter-spacing: -.6px; text-shadow: 0 2px 16px rgba(0,50,90,.3); }
.start-form { margin-top: -70px; position: relative; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--grey); font-size: 12px; margin: 22px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.hint { margin-top: 26px; padding: 16px; border-radius: var(--radius); background: var(--soft); font-size: 13.5px; }
.byline { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 36px; color: var(--grey); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.byline img { height: 22px; width: auto; filter: invert(1) brightness(.05); }

/* ---------- Lobby ---------- */
.codebox { text-align: center; padding: 24px 18px 18px; background: var(--ink); border: 0; color: var(--white); }
.codebox .muted { color: rgba(255,255,255,.55); }
.codebox .code { font-family: "Poppins", sans-serif; font-style: italic; font-weight: 900; font-size: 46px; letter-spacing: 6px; margin: 2px 0 16px; }
.codebox .btn.primary { background: var(--sky); border-color: var(--sky); color: var(--ink); }
.team { border-left: 5px solid var(--c, var(--navy)); }
.team .name { font-family: var(--f-head); font-weight: 700; font-size: 20px; letter-spacing: -.6px; }
.team ul { list-style: none; margin: 10px 0 0; padding: 0; }
.team li { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.team li .x { margin-left: auto; background: none; border: 0; color: var(--grey); font-size: 12px; padding: 4px 6px; text-decoration: underline; }
.settings-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; font-size: 12.5px; }
.settings-summary .muted { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.settings-summary b { display: block; font-size: 15px; font-weight: 600; color: var(--ink); }

/* ---------- Spiel-Header ---------- */
.gamebar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 22px; letter-spacing: -.5px; }
.rolebadge { padding: 5px 12px; border-radius: 99px; font-weight: 900; font-style: italic; font-size: 13px; letter-spacing: .3px; text-transform: uppercase; }
.rolebadge.catcher { background: var(--red); color: var(--white); }
.rolebadge.runner { background: var(--sky); color: var(--ink); }
.iconbtn { background: var(--white); border: 1.5px solid var(--line); border-radius: 14px; width: 42px; height: 42px; display: grid; place-items: center; flex: none; color: var(--ink); }
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn.on { border-color: #2bb673; color: #2bb673; }
.iconbtn.warn { border-color: var(--red); color: var(--red); }

/* ---------- Challenges ---------- */
.challenge { padding: 24px 20px 20px; background: var(--ink); color: var(--white); border: 0; }
.challenge .pts { font-family: "Poppins"; font-size: 44px; font-weight: 900; font-style: italic; color: var(--sky); line-height: 1; }
.challenge .desc { font-family: var(--f-head); font-size: 24px; line-height: 1.18; letter-spacing: -.7px; font-weight: 700; margin: 16px 0 22px; white-space: pre-line; }
.challenge .muted { color: rgba(255,255,255,.55); }
.challenge .pill { background: rgba(140,210,255,.2); color: var(--sky); }
.challenge .btn.ghost { background: transparent; border-color: rgba(255,255,255,.3); color: var(--white); }
.challenge .btn.primary, .challenge .btn.good { background: var(--sky); border-color: var(--sky); color: var(--ink); }
.bigdraw { aspect-ratio: 1.55; display: grid; place-items: center; text-align: center; border: 0; border-radius: var(--radius); width: 100%; color: var(--ink);
  background: linear-gradient(to bottom, rgba(255,255,255,.05), rgba(255,255,255,.7)), url(icons/sky.jpg) center 30% / cover; box-shadow: inset 0 0 0 1px var(--line); }
.bigdraw b { font-family: var(--f-head); font-weight: 700; font-size: 28px; letter-spacing: -.8px; display: block; margin-top: 6px; }
.bigdraw svg { color: var(--navy) !important; }
.bigdraw:active { transform: scale(.98); }
.blocked { text-align: center; padding: 28px 18px; }
.blocked .timer { font-size: 44px; color: var(--red); }
.hist li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.hist li:last-child { border-bottom: 0; }
.hist ul { list-style: none; margin: 0; padding: 0; }
.hist .r { margin-left: auto; font-weight: 700; white-space: nowrap; }

/* ---------- Scoreboard ---------- */
.score-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.score-row:last-child { border-bottom: 0; }
.score-row .rank { width: 22px; font-weight: 700; color: var(--grey); text-align: center; font-size: 13px; }
.score-row .name { font-family: var(--f-head); font-weight: 700 !important; font-size: 17px; letter-spacing: -.4px; }
.score-row .pts { font-size: 28px; font-weight: 900; font-style: italic; font-variant-numeric: tabular-nums; }
.score-row.me .name::after { content: " (du)"; color: var(--grey); font-family: var(--f-text); font-weight: 400; font-size: 13px; letter-spacing: 0; }
.feed { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
.feed li { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed time { color: var(--grey); font-variant-numeric: tabular-nums; flex: none; font-size: 12px; padding-top: 1px; }

/* Gewinner-Karte im Polaroid-Stil */
.polaroid { background: var(--white); padding: 14px 14px 22px; border-radius: 6px; box-shadow: 0 18px 50px rgba(0,0,20,.18), 0 2px 6px rgba(0,0,20,.08); transform: rotate(-2.5deg); margin: 18px 10px 10px; }
.polaroid .photo { border-radius: 2px; padding: 34px 10px; text-align: center; color: var(--white); background: linear-gradient(to bottom, rgba(0,50,90,.15), rgba(0,50,90,.45)), url(icons/sky.jpg) center / cover; }
.polaroid .photo .big { font-family: var(--f-head); font-weight: 800; font-size: clamp(20px, 6.2vw, 30px); overflow-wrap: break-word; line-height: 1.05; letter-spacing: -1px; text-shadow: 0 2px 20px rgba(0,50,90,.4); }
.polaroid .cap { margin-top: 14px; font-size: 12.5px; color: var(--grey); }
.polaroid .cap b { display: block; font-family: var(--f-head); color: var(--ink); font-size: 20px; letter-spacing: -.5px; }

/* ---------- Karte ---------- */
#mapWrap { position: fixed; inset: 0; bottom: var(--tabs-h); z-index: 1; }
#map { position: absolute; inset: 0; background: #e9eef3; }
#mapOverlay { position: absolute; inset: 0; padding: calc(var(--safe-top) + 10px) 12px 0; pointer-events: none; z-index: 500; }
#mapOverlay > * { pointer-events: auto; }
.map-top { position: relative; z-index: 700; display: flex; gap: 8px; align-items: center; background: rgba(255,255,255,.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-radius: 18px; padding: 8px 10px; box-shadow: 0 4px 20px rgba(0,0,20,.1); }
.map-info { margin-top: 8px; display: inline-block; background: rgba(255,255,255,.92); border-radius: 99px; padding: 5px 12px; font-size: 12px; font-weight: 600; box-shadow: 0 2px 10px rgba(0,0,20,.08); }
.map-catch { position: absolute; right: 12px; bottom: 14px; z-index: 500; }
.map-catch .btn { box-shadow: 0 8px 26px rgba(225,20,20,.35); padding: 16px 22px; }
.map-recenter { position: absolute; left: 12px; bottom: 14px; z-index: 500; }
.map-recenter .iconbtn { box-shadow: 0 4px 16px rgba(0,0,20,.12); }
.lock { position: absolute; inset: 0; z-index: 600; display: grid; place-items: center; text-align: center; color: var(--white);
  background: linear-gradient(to bottom, rgba(0,0,20,.25), rgba(0,0,20,.75)), url(icons/sky.jpg) center / cover; }
.lock .muted { color: rgba(255,255,255,.75); }
.lock .timer { font-family: "Poppins"; font-style: italic; font-weight: 900; font-size: 64px; color: var(--white); }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { background: rgba(255,255,255,.7) !important; font-size: 10px; }
.mk { position: relative; }
.mk .b { width: 22px; height: 22px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,20,.35); }
.mk .l { position: absolute; left: 50%; top: 26px; transform: translateX(-50%); white-space: nowrap; background: var(--ink); color: #fff; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; }
.mk .l small { font-weight: 400; color: rgba(255,255,255,.65); }
.mk.stale .b { opacity: .45; border-style: dashed; }
.mk.me .b { background: var(--red); border-color: #fff; width: 16px; height: 16px; }

/* ---------- Tabs ---------- */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; height: var(--tabs-h); padding-bottom: var(--safe-bottom); background: rgba(255,255,255,.95); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); display: flex; z-index: 900; }
#tabs button { flex: 1; background: none; border: 0; color: var(--grey); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; font-weight: 600; }
#tabs button svg { width: 24px; height: 24px; }
#tabs button.active { color: var(--navy); }

/* ---------- Sheet / Overlays ---------- */
#sheet { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,20,.45); display: flex; align-items: flex-end; justify-content: center; }
#sheet .panel { width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; background: var(--white); border-radius: 26px 26px 0 0; padding: 22px 20px calc(var(--safe-bottom) + 22px); animation: up .22s ease-out; }
#sheet h1 { font-size: 28px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.set-row .t { font-weight: 600; }
.set-row .d { font-size: 11.5px; color: var(--grey); }
.set-row select { background: var(--soft); border: 0; border-radius: 12px; padding: 9px 12px; font-size: 14px; max-width: 46%; }

#toast { position: fixed; left: 50%; transform: translateX(-50%); top: calc(var(--safe-top) + 12px); z-index: 2000; background: var(--ink); color: var(--white); padding: 12px 18px; border-radius: 18px; font-weight: 600; font-size: 14px; max-width: 92vw; box-shadow: 0 12px 34px rgba(0,0,20,.3); }
#toast.err { background: var(--red); }

.reveal { position: fixed; inset: 0; z-index: 1500; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; color: var(--white); animation: pop .4s ease-out; }
.reveal.catcher { background: radial-gradient(circle at 50% 40%, #a30d0d, #000014 75%); }
.reveal.runner { background: linear-gradient(to bottom, rgba(0,50,90,.1), rgba(0,50,90,.55)), url(icons/sky.jpg) center / cover; }
.reveal .muted { color: rgba(255,255,255,.75); font-family: var(--f-head); font-weight: 700; font-size: 18px; }
.reveal .big { font-family: "Poppins"; font-size: 60px; font-weight: 900; font-style: italic; letter-spacing: -1.5px; margin: 4px 0 10px; text-shadow: 0 4px 30px rgba(0,0,20,.25); }
.reveal p { max-width: 320px; color: rgba(255,255,255,.9); }
.reveal .btn { max-width: 320px; margin-top: 28px; background: var(--white); border-color: var(--white); color: var(--ink); }
@keyframes pop { from { opacity: 0; transform: scale(1.08); } }

#pocket { position: fixed; inset: 0; z-index: 3000; background: #000; color: #333; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; user-select: none; -webkit-user-select: none; }
#pocket p { font-family: var(--f-head); font-size: 18px; font-weight: 700; margin: 0 0 8px; }
#pocket small { font-size: 13px; line-height: 1.6; }
