:root {
  --ink: #2b2238;
  --muted: #6b6478;
  --bg: #eef2f9;
  --card: #ffffff;
  --line: #dde3ee;
  --red: #d7262e;
  --red-d: #b51f26;
  --green: #2f8a57;
  --gold: #f4bd1a;
  --night: #1d2a5c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(43, 34, 56, .06), 0 4px 16px rgba(43, 34, 56, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--green); }
h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.2; }
h2 { font-size: 1.15rem; font-weight: 800; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Kopf */
.top { background: var(--night); color: #fff; }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.15rem; }

/* Knöpfe */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 700;
  cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.2;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover:not(:disabled) { background: var(--red-d); }
.btn-tt { background: #fe2c55; color: #fff; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-ghost { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1.5px #b9c2d3; }
.btn-sm { padding: 6px 10px; font-size: .85rem; border-radius: 8px; }
.btn-block { width: 100%; }
.top .btn-tt { padding: 8px 12px; font-size: .9rem; }

/* Zahlen */
.stats { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 12px; margin-top: 16px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat-label { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-num { font-size: 2rem; font-weight: 900; line-height: 1.1; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-num small { font-size: 1.1rem; color: var(--muted); font-weight: 800; }
.stat-sub { font-size: .85rem; color: var(--muted); }
.bar { height: 10px; background: #e7ebf3; border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.bar-in { height: 100%; width: 0; background: var(--red); border-radius: 99px; transition: width .6s ease; }

/* Layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; margin-top: 16px; align-items: start; }
.side { display: grid; gap: 16px; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }

/* Karte */
.map-card { position: sticky; top: 12px; }
.map {
  position: relative; height: min(78vh, 900px); border-radius: var(--radius); overflow: hidden;
  background: var(--night); box-shadow: var(--shadow); touch-action: pan-y; cursor: grab; outline: none;
  user-select: none; -webkit-user-select: none;
}
.map:focus-visible { box-shadow: 0 0 0 3px var(--gold); }
.map.dragging { cursor: grabbing; }
.map-inner { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.map-inner svg { display: block; }
.map-inner .haus { cursor: pointer; }
.map-inner .haus:hover, .map-inner .haus:focus { filter: brightness(1.08); outline: none; }
.map-inner .stern { animation: blink 3.2s ease-in-out infinite; }
@keyframes blink { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.map-inner .rauch circle { animation: rauch 4s ease-in-out infinite; }
@keyframes rauch { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@media (prefers-reduced-motion: reduce) { .map-inner .stern, .map-inner .rauch circle { animation: none; } }
.map-tools { position: absolute; right: 10px; top: 10px; display: grid; gap: 6px; }
.tool {
  width: 40px; height: 40px; border-radius: 10px; border: 0; background: rgba(255, 255, 255, .95); color: var(--ink);
  font: 800 20px/1 system-ui, sans-serif; cursor: pointer; box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}
.tool-txt { font-size: 12px; }
.map-jump { position: absolute; left: 10px; bottom: 10px; right: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 0; border-radius: 99px; padding: 7px 12px; background: rgba(255, 255, 255, .95); color: var(--ink);
  font: 700 13px/1 system-ui, sans-serif; cursor: pointer; box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}
.chip#jump-me { background: var(--gold); }
.live {
  position: absolute; left: 10px; top: 10px; display: flex; align-items: center; gap: 6px; padding: 5px 10px;
  border-radius: 99px; background: rgba(0, 0, 0, .35); color: #fff; font: 700 12px/1 system-ui, sans-serif;
}
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: #5ce08a; }
.live.off .dot { background: #f0b429; }
.popup {
  position: absolute; left: 10px; bottom: 52px; width: min(320px, calc(100% - 70px));
  background: #fff; border-radius: 12px; padding: 14px 16px; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); cursor: default;
}
.popup h3 { font-size: 1.05rem; margin: 0 0 4px; word-break: break-all; }
.popup .x { position: absolute; right: 8px; top: 6px; border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
.find { display: flex; gap: 8px; margin-top: 10px; }
.find input { flex: 1; }

/* Formulare */
.form { display: grid; gap: 8px; }
.form label, legend { font-weight: 700; font-size: .9rem; }
input, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
input:focus, textarea:focus { outline: none; border-color: #7e8bb0; box-shadow: 0 0 0 3px rgba(126, 139, 176, .2); }
textarea { resize: vertical; min-height: 84px; }
.row { display: flex; gap: 8px; align-items: center; }
.row input { flex: 1; min-width: 0; }
.row-end { justify-content: space-between; }
.msg { margin: 0; font-size: .92rem; min-height: 0; }
.msg:empty { display: none; }
.msg.err { color: var(--red-d); }
.msg.ok { color: var(--green); }
fieldset { border: 0; padding: 0; margin: 0 0 6px; }
legend { margin-bottom: 6px; }

.steps { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 10px; align-items: flex-start; }
.steps li > span {
  flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: .85rem;
}
.steps .btn { margin-top: 6px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; margin: 12px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.login { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.login summary { cursor: pointer; font-weight: 700; font-size: .92rem; }
.login .form { margin-top: 10px; }

.result { border-radius: 12px; padding: 12px 14px; margin-top: 4px; }
.result.ok { background: #e8f6ee; }
.result.wait { background: #fff6dc; }
.result b { display: block; margin-bottom: 2px; }

.me-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.me-head h2 { word-break: break-all; }
.keybox { margin-top: 12px; background: #f4f6fb; border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.key { display: flex; align-items: center; gap: 8px; }
.key code { flex: 1; font: 800 1.25rem/1 ui-monospace, Consolas, monospace; letter-spacing: .08em; background: #fff; border: 1.5px dashed #b9c2d3; border-radius: 8px; padding: 10px; text-align: center; }

/* Hausgestaltung */
.preview { border-radius: 12px; overflow: hidden; margin-bottom: 12px; background: var(--night); }
.preview svg { display: block; width: 100%; height: auto; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.sw { width: 36px; height: 36px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--line); cursor: pointer; padding: 0; }
.sw[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opt {
  border: 1.5px solid var(--line); background: #fff; color: var(--ink); border-radius: 99px; padding: 7px 12px;
  font: 600 .88rem/1.1 system-ui, sans-serif; cursor: pointer;
}
.opt[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.opt:disabled { opacity: .45; cursor: default; }

/* Abstimmung */
.poll { display: grid; gap: 8px; }
.pollopt {
  position: relative; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; overflow: hidden; font: inherit; color: inherit; text-align: left;
}
button.pollopt { cursor: pointer; }
button.pollopt:hover:not(:disabled) { border-color: #b9c2d3; }
.pollopt.mine { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.pollopt .fill { position: absolute; left: 0; top: 0; bottom: 0; background: #eef2f9; z-index: 0; transition: width .5s ease; }
.pollopt > *:not(.fill) { position: relative; z-index: 1; }
.pollopt .letter { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 99px; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 900; font-size: .8rem; letter-spacing: .03em; }
.pollopt { grid-template-columns: auto 1fr auto; }
.pollopt .lab { font-weight: 800; }
.pollopt .cnt { font-weight: 800; font-variant-numeric: tabular-nums; }
.pollopt .sub { display: block; font-size: .78rem; color: var(--muted); font-weight: 500; }
.built { margin-top: 12px; font-size: .88rem; color: var(--muted); }
.built:empty { display: none; }

/* Wünsche */
.wishes { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.wishes li { background: #f4f6fb; border-radius: 10px; padding: 10px 12px; font-size: .92rem; }
.wishes .st { display: block; font-size: .78rem; color: var(--muted); margin-top: 2px; }
.wishes .st.video { color: var(--green); font-weight: 700; }

/* Info */
.info { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-top: 16px; }
.howto { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: .95rem; }
.howto b { display: block; }
.neu { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.neu li { display: flex; justify-content: space-between; gap: 10px; font-size: .92rem; }
.neu button { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--ink); cursor: pointer; text-align: left; word-break: break-all; }
.neu button:hover { color: var(--red); }

.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-top: 24px; padding-bottom: 32px; font-size: .85rem; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 50; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); max-width: calc(100% - 32px);
}

/* Oben: Haus suchen */
.hero { margin-top: 18px; }
.hero h1 { font-size: 1.6rem; font-weight: 900; margin: 0 0 4px; }
.hero p { margin: 0 0 10px; }
.hero .find { margin-top: 0; max-width: 520px; }
.hero .msg { margin-top: 8px; }
.find-hit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.map-hint { margin: 6px 2px 0; display: none; }
@media (hover: none) { .map-hint { display: block; } }

/* Kommentar-Code */
.codebox { background: #fff8e1; border-radius: 12px; padding: 12px 14px; display: grid; gap: 10px; }
.code-row { display: flex; align-items: center; gap: 10px; }
.code { flex: 1; text-align: center; font: 900 1.9rem/1 ui-monospace, Consolas, monospace; letter-spacing: .08em; background: #fff; border: 2px dashed var(--gold); border-radius: 10px; padding: 12px; color: var(--ink); }
.code-wait { display: flex; gap: 8px; align-items: flex-start; font-size: .88rem; color: var(--muted); }
.spin { flex: none; width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; border: 2.5px solid #e7ebf3; border-top-color: var(--green); animation: drehen 1s linear infinite; }
@keyframes drehen { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

/* Spiele, Kalender, Berufe */
.spiel { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.spiel:first-of-type { border-top: 0; padding-top: 0; }
.spiel > div { display: grid; gap: 2px; }
.advent { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.tuer { aspect-ratio: 1; border-radius: 10px; border: 2px solid var(--ink); background: #2f8a57; color: #fff; font: 900 1.05rem/1 system-ui, sans-serif; cursor: pointer; display: grid; place-items: center; padding: 0; position: relative; }
.tuer:nth-child(3n) { background: #d7262e; }
.tuer:nth-child(4n) { background: #3d7fc4; }
.tuer:disabled { opacity: .45; cursor: default; }
.tuer.heute { box-shadow: 0 0 0 3px var(--gold); animation: wackeln 2.4s ease-in-out infinite; }
@keyframes wackeln { 0%, 90%, 100% { transform: none; } 93% { transform: rotate(-4deg); } 96% { transform: rotate(4deg); } }
@media (prefers-reduced-motion: reduce) { .tuer.heute { animation: none; } }
.tuer.offen { background: #fff8e1; color: var(--ink); border-style: dashed; font-size: .62rem; line-height: 1.15; padding: 2px; text-align: center; }
.berufe { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.beruf { border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 10px; text-align: left; font: inherit; color: inherit; cursor: pointer; display: grid; gap: 2px; }
.beruf[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); background: #f4f6fb; }
.beruf b::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--fb, #ccc); margin-right: 6px; }
.berufe-stand { display: grid; gap: 8px; }
.bstand { display: grid; grid-template-columns: 130px 1fr auto; gap: 8px; align-items: center; font-size: .88rem; }
.bstand .bar { margin: 0; height: 12px; }
.mt2 { margin-top: 18px; }
.popup .besuch { margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.flug-overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

/* Navigation */
.subnav { display: flex; gap: 6px; margin-top: 12px; overflow-x: auto; scrollbar-width: none; align-items: center; -webkit-overflow-scrolling: touch; }
@media (max-width: 980px) { .subnav { -webkit-mask-image: linear-gradient(to right, #000 88%, transparent); mask-image: linear-gradient(to right, #000 88%, transparent); padding-right: 32px !important; } }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { flex: none; padding: 8px 14px; border-radius: 99px; background: #fff; color: var(--ink); text-decoration: none; font-weight: 700; font-size: .9rem; box-shadow: var(--shadow); }
.subnav a:hover { background: #f4f6fb; }
.nav-coins { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 99px; background: var(--ink); color: #fff; font-size: .95rem; }
.coin { width: 18px; height: 18px; flex: none; }

/* Coins */
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover:not(:disabled) { background: #e5ad0c; }
.coins-box { margin-top: 12px; background: #fff8e1; border-radius: 12px; padding: 12px 14px; }
.coins-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.coins-n { display: flex; align-items: center; gap: 6px; font-size: 1.6rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.coins-n .coin { width: 24px; height: 24px; }
.coins-how { margin-top: 8px; font-size: .88rem; }
.coins-how summary { cursor: pointer; font-weight: 700; }
.coins-how ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 3px; }
.coin-log { list-style: none; margin: 8px 0 0; padding: 0; font-size: .82rem; display: grid; gap: 2px; }
.coin-log li { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.coin-log b { color: var(--green); }
.coin-log b.minus { color: var(--red-d); }

/* Shop im Haus-Editor */
.opt .preis { display: inline-flex; align-items: center; gap: 3px; margin-left: 4px; font-weight: 800; }
.opt .preis .coin { width: 14px; height: 14px; }
.opt.zu { border-style: dashed; color: var(--muted); }
.opt.zu::before { content: ""; display: inline-block; width: 9px; height: 10px; margin-right: 5px; border: 2px solid currentColor; border-radius: 2px; border-top-width: 4px; vertical-align: -1px; }
.ausbau { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #f4f6fb; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: .9rem; }
.ausbau b { display: block; }

/* Rangliste */
.side-stack { display: grid; gap: 16px; align-content: start; }
.rang { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; counter-reset: rang; }
.rang li { display: flex; align-items: center; gap: 10px; font-size: .92rem; counter-increment: rang; }
.rang li::before { content: counter(rang); width: 24px; height: 24px; border-radius: 50%; background: #eef2f9; display: grid; place-items: center; font-weight: 800; font-size: .8rem; flex: none; }
.rang li:nth-child(1)::before { background: var(--gold); }
.rang li:nth-child(2)::before { background: #d7dce6; }
.rang li:nth-child(3)::before { background: #e8b88a; }
.rang button { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--ink); cursor: pointer; text-align: left; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rang .n { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Spiel */
.modal { position: fixed; inset: 0; background: rgba(20, 16, 34, .7); z-index: 60; display: grid; place-items: center; padding: 12px; }
.modal-in { position: relative; width: min(440px, 100%); height: min(680px, calc(100dvh - 24px)); border-radius: 16px; overflow: hidden; box-shadow: 0 10px 40px rgba(0, 0, 0, .4); background: #1d2a5c; }
.modal canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.modal .x { position: absolute; right: 8px; top: 52px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .9); font-size: 22px; line-height: 1; cursor: pointer; }
.game-over { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; background: rgba(29, 42, 92, .8); color: #fff; padding: 24px; }
.game-over h3 { font-size: 1.6rem; margin: 0 0 6px; }
.game-over p { margin: 0 0 16px; }

/* Unterseiten */
.page { max-width: 760px; margin: 24px auto 40px; }
.page h1 { font-size: 1.8rem; }
.page h2 { margin-top: 1.4rem; }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .map-card { position: static; }
  .map { height: 62vh; }
  .info { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .stats { grid-template-columns: 1fr 1fr 1fr; }
  .subnav { position: sticky; top: 0; z-index: 30; margin: 12px 0 0; padding: 8px 16px; background: rgba(238, 242, 249, .94); backdrop-filter: blur(6px); max-width: none; }
  .subnav a { box-shadow: none; border: 1.5px solid var(--line); padding: 7px 12px; }
  [id^="card-"], #map { scroll-margin-top: 64px; }
}
@media (max-width: 560px) {
  .top-in { height: 54px; }
  .brand { font-size: 1rem; }
  .map { height: 46vh; }
  .hero h1 { font-size: 1.35rem; }
  .ausbau { flex-direction: column; align-items: stretch; }
  .sw { width: 40px; height: 40px; }
  .opt { padding: 9px 12px; }
  .stats { grid-template-columns: 1fr 1fr 1fr; }
  .stat-main { grid-column: 1 / -1; }
  .stat { padding: 12px; }
  .stat-label { font-size: .7rem; }
  .stat-main { grid-column: 1 / -1; }
  .stat-num { font-size: 1.6rem; }
  .howto { grid-template-columns: 1fr; }
  .top .btn-tt { font-size: .8rem; padding: 7px 10px; }
  .card { padding: 16px; }
}

.rang li.muted::before { display: none; }
