:root {
  --bg: #f6f3ee; --card: #fff; --ink: #26231f; --muted: #7b756c; --line: #e6e0d6;
  --ok: #86cf5b; --bad: #f2706b; --accent: #2f6fed;
  --c-geodle: #8fd05f; --c-decide: #f59bbb; --c-connections: #bfa3f7; --c-rankle-welt: #f8b868; --c-rankle-europa: #79bdf4;
  --radius: 18px; --shadow: 0 3px 0 rgba(38, 35, 31, .12);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1b1a18; --card: #2a2825; --ink: #f1ece4; --muted: #a49d92; --line: #3b3834; --shadow: 0 3px 0 rgba(0, 0, 0, .4); }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
#app { max-width: 560px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 14px 24px; }
h1 { font-size: 30px; margin: 4px 0 0; letter-spacing: -.5px; }
h2 { margin: 6px 0; font-size: 22px; }
h3 { margin: 0 0 8px; font-size: 17px; }
h4 { margin: 12px 0 4px; font-size: 14px; color: var(--muted); }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; } .grow { flex: 1; }
.loading { margin-top: 40vh; }
.error { color: var(--bad); min-height: 1.2em; margin: 6px 0; font-size: 14px; }
.page-head { margin: 4px 2px 14px; } .page-head p { margin: 2px 0 0; }

/* Bottom-Navigation */
.nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 4px; background: var(--card);
  border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
.nav a { flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; border-radius: 12px; }
.nav a span { font-size: 22px; line-height: 1.1; }
.nav a.active { color: var(--accent); }

/* Buttons & Formulare */
.btn { font: inherit; font-weight: 700; border: 0; background: var(--card); color: var(--ink); padding: 11px 16px; border-radius: 14px; box-shadow: var(--shadow); cursor: pointer; text-align: center; display: inline-block; }
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-danger { color: var(--bad); }
.btn.wide { width: 100%; margin-top: 10px; display: block; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.field { width: 100%; font: inherit; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); color: var(--ink); margin: 5px 0; }
.field:focus, .search-input:focus { outline: none; border-color: var(--accent); }
.inline { display: flex; gap: 8px; align-items: center; } .inline .field { margin: 0; }
.seg { display: flex; background: var(--bg); border-radius: 14px; padding: 4px; margin-bottom: 10px; }
.seg button { flex: 1; font: inherit; font-weight: 700; border: 0; background: none; color: var(--muted); padding: 8px; border-radius: 11px; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* Karten & Listen */
.card { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.list, .card { overflow: hidden; }
.row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.row:first-of-type { border-top: 0; } h3 + .row, h4 + .row { border-top: 0; }
.row.me { font-weight: 800; background: color-mix(in srgb, var(--accent) 8%, transparent); margin: 0 -14px; padding: 8px 14px; }
.pos { width: 26px; text-align: center; font-weight: 800; }
.tag { background: var(--line); border-radius: 8px; padding: 1px 7px; font-size: 11px; }
.link { padding: 4px 0; }
.statgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.stat { background: var(--bg); border-radius: 14px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 700; } .stat b { font-size: 17px; overflow-wrap: anywhere; }
details summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 4px 0; }
.hint { background: #fff4c9; color: #5d4a00; border-radius: 14px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.hint .x { border: 0; background: none; font-size: 16px; }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #26231f; color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 50; transition: opacity .4s; }
.toast.out { opacity: 0; }

/* Startseite */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile-wrap { display: flex; flex-direction: column; gap: 8px; }
.tile-wrap:first-child { grid-column: span 2; }
.mode-tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; min-height: 140px; padding: 14px 10px;
  border-radius: 22px; background: var(--mc, #ccc); color: #26231f; box-shadow: 0 4px 0 rgba(0, 0, 0, .15); }
.mode-tile:active { transform: translateY(3px); box-shadow: none; }
.mode-icon { font-size: 44px; line-height: 1; } .mode-tile b { font-size: 19px; } .mode-tile small { font-weight: 700; opacity: .7; }
.done-badge { position: absolute; top: 10px; right: 10px; width: 26px; height: 26px; border-radius: 50%; background: #26231f; color: #fff; display: grid; place-items: center; font-size: 14px; }
.tile-actions { display: flex; gap: 8px; }
.mini { flex: 1; display: flex; align-items: center; justify-content: center; white-space: nowrap; text-align: center; font-weight: 700; font-size: 13px; padding: 8px 4px; border-radius: 14px; background: var(--mc, #ccc); color: #26231f; box-shadow: 0 3px 0 rgba(0, 0, 0, .15); }
[data-mode="geodle"] { --mc: var(--c-geodle); } [data-mode="decide"] { --mc: var(--c-decide); } [data-mode="connections"] { --mc: var(--c-connections); }
[data-mode="rankle-welt"] { --mc: var(--c-rankle-welt); } [data-mode="rankle-europa"] { --mc: var(--c-rankle-europa); }

/* Kopfzeile in Spielen */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.topbar .back { font-weight: 800; padding: 6px 4px; min-width: 70px; }
.topbar .title { flex: 1; text-align: center; display: flex; flex-direction: column; line-height: 1.2; }
.topbar .title small { color: var(--muted); }
.topbar > b { flex: 1; text-align: center; }
.game .topbar { border-bottom: 4px solid var(--mc); padding-bottom: 8px; }
.result-box { margin-top: 18px; }
.result-card { background: var(--mc, var(--card)); color: #26231f; border-radius: var(--radius); padding: 14px; text-align: center; box-shadow: var(--shadow); margin-bottom: 12px; }
.result-card small { font-weight: 700; opacity: .7; } .result-card h2 { margin: 2px 0 10px; } .result-card .btnrow { justify-content: center; }
.result-card .btn { color: #26231f; }
.friends-day { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.friends-day:empty { display: none; }

/* Flaggen */
.flag { width: 36px; height: 24px; object-fit: cover; border-radius: 4px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); flex: none; background: #ddd; }
.flag.big { width: 150px; height: 100px; object-fit: contain; background: none; box-shadow: none; filter: drop-shadow(0 0 1px rgba(0, 0, 0, .5)); }
.flag.huge { display: block; margin: 4px auto; width: 150px; height: 90px; object-fit: contain; background: none; box-shadow: none; filter: drop-shadow(0 0 1px rgba(0, 0, 0, .5)); }
.flag.small { width: 30px; height: 20px; }

/* Suche */
.search { position: relative; margin: 10px 0; }
.search-ico { position: absolute; left: 14px; top: 13px; }
.search-input { width: 100%; font: inherit; padding: 13px 14px 13px 42px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); color: var(--ink); font-size: 17px; }
.suggest { display: none; position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; background: var(--card); border-radius: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); z-index: 20; overflow: hidden; }
.suggest.open { display: block; }
.suggest-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; border: 0; border-top: 1px solid var(--line); background: none; font: inherit; color: var(--ink); text-align: left; }
.suggest-item:first-child { border-top: 0; }

/* Geodle */
.geodle-top { display: flex; justify-content: space-between; align-items: center; }
.geodle-top .stat { background: none; padding: 0; } .geodle-top .stat b { font-size: 22px; }
.gcard { background: var(--card); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; box-shadow: var(--shadow); }
.gcard.win { outline: 3px solid var(--ok); } .gcard.reveal { background: var(--c-geodle); color: #26231f; }
.gcard-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; } .gcard-head b { flex: 1; font-size: 17px; }
.tiles3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.tile { border-radius: 12px; padding: 7px 4px; text-align: center; display: flex; flex-direction: column; gap: 1px; min-height: 52px; justify-content: center; border: 2px solid var(--line); }
.tile small { font-size: 11px; font-weight: 700; opacity: .75; } .tile b { font-size: 15px; }
.tile.ok { background: var(--ok); border-color: var(--ok); color: #17310a; } .tile.bad { background: var(--bad); border-color: var(--bad); color: #3a0805; }
.arr { font-size: 11px; }

/* Decide */
.decide-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.hearts { font-size: 24px; letter-spacing: 3px; } .decide-cat { font-weight: 800; font-size: 17px; }
.decide-board { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dcard { width: 100%; background: var(--card); border-radius: var(--radius); padding: 10px; text-align: center; box-shadow: var(--shadow); border: 3px solid transparent; display: flex; flex-direction: column; align-items: center; }
.dcard.right { border-color: var(--ok); } .dcard.wrong { border-color: var(--bad); }
.dvalue { font-size: 24px; font-weight: 800; }
.vs { font-weight: 900; font-size: 20px; }
.choice { display: flex; gap: 10px; width: 100%; } .choice .btn { flex: 1; padding: 14px; font-size: 18px; }
.btn-up { background: var(--ok); color: #17310a; } .btn-down { background: var(--bad); color: #3a0805; }
.endcard { text-align: center; padding: 30px 0; }

/* Connections */
.conn-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0; }
.ccard { aspect-ratio: 1 / 1; padding: 4px; border: 3px solid transparent; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); color: var(--ink); font: inherit; min-width: 0; }
.ccard.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--card)); }
.cc { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; min-width: 0; }
.cc-name small { font-size: 10px; font-weight: 700; color: var(--muted); } .cc-name b { font-size: clamp(10px, 3.1vw, 13px); line-height: 1.15; overflow-wrap: break-word; hyphens: auto; }
.cc-flag { width: 100%; height: auto; max-height: 100%; object-fit: contain; background: none; box-shadow: none; }
.cc-shape, .shape { width: 100%; height: 100%; fill: #78c850; stroke: none; }
.conn-solved { display: flex; flex-direction: column; gap: 6px; }
.solved-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; color: #26231f; }
.solved-row b { flex: 1; } .solved-row small { font-weight: 700; }
.g0 { background: #f9df6d; } .g1 { background: #a0c35a; } .g2 { background: #b0c4ef; } .g3 { background: #ba81c5; }
.conn-controls { display: flex; flex-direction: column; gap: 10px; align-items: center; margin-top: 6px; }
.conn-controls .stat { background: none; align-items: center; }
.dots { display: flex; gap: 6px; } .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--line); } .dot.on { background: var(--ink); }

/* Rankle */
.rankle-head { text-align: center; } .scorebox { background: var(--mc); color: #26231f; border-radius: var(--radius); padding: 10px; margin-bottom: 10px; }
.scorebox small { display: block; font-weight: 700; opacity: .7; } .scorebox b { font-size: 40px; line-height: 1; }
.rankle-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.rrow { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); border: 0; font: inherit; color: var(--ink); text-align: left; width: 100%; }
button.rrow:active { transform: translateY(2px); box-shadow: none; }
.rrow .rl { flex: 1; font-weight: 700; } .rrow .ri { font-size: 20px; } .rrow.filled { background: color-mix(in srgb, var(--mc) 25%, var(--card)); }
.rk { min-width: 48px; text-align: right; } .pt { color: var(--muted); font-size: 13px; font-weight: 700; min-width: 40px; text-align: right; }
.rankle-result h3 { margin: 18px 0 0; }

/* Kalender */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 10px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 14px; }
.dow { text-align: center; font-size: 12px; font-weight: 800; color: var(--muted); }
.day { aspect-ratio: 1; border-radius: 12px; background: var(--card); display: flex; align-items: center; justify-content: center; position: relative; font-weight: 700; box-shadow: var(--shadow); }
.day.empty { background: none; box-shadow: none; } .day.off { opacity: .35; box-shadow: none; background: none; }
.day.done { background: var(--mc); color: #26231f; } .day.today { outline: 3px solid var(--ink); }
.day i { position: absolute; right: 4px; top: 1px; font-size: 11px; font-style: normal; }
