/* =========================================================
   Karreespeck: Jump – gemeinsames Stylesheet
   Wird von allen Spielseiten und Hubs geladen.
   ========================================================= */

@font-face { font-family: "Poppins"; font-weight: 400; font-display: swap; src: url("../fonts/poppins-regular.woff") format("woff"); }
@font-face { font-family: "Poppins"; font-weight: 500; font-display: swap; src: url("../fonts/poppins-medium.woff") format("woff"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-display: swap; src: url("../fonts/poppins-bold.woff") format("woff"); }

:root {
    --ink: #161936;          /* Grundfläche */
    --ink-2: #1e2247;        /* Panels */
    --ink-3: #2a2f60;        /* Tasten, Zeilen */
    --ink-4: #383e7a;        /* Hover */
    --line: rgba(255, 255, 255, .09);
    --text: #f4f2ff;
    --muted: #a3a7d4;
    --accent: #ff5722;       /* Karreespeck-Orange */
    --accent-deep: #b93a10;
    --gold: #ffc83d;
    --good: #35d07f;
    --good-deep: #1d8a52;
    --danger: #ff5470;
    --radius-lg: 22px;
    --radius-md: 14px;
    --radius-sm: 9px;
    --font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}
.kj--gamepad { --accent: #13a10e; --accent-deep: #0b5f08; }

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0; width: 100%; height: 100%;
    background: var(--ink); color: var(--text);
    font-family: var(--font); font-size: 15px; line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.emo { font-family: var(--emoji); font-style: normal; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- Tasten im "Keycap"-Stil ---------- */
.key {
    --k-bg: var(--ink-3); --k-edge: #14172f;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 0 14px;
    background: var(--k-bg); color: var(--text);
    border: 0; border-radius: var(--radius-sm);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 4px 0 var(--k-edge);
    font-weight: 500; text-decoration: none; cursor: pointer;
    transform: translateY(0); transition: transform .08s, box-shadow .08s, background .15s;
    user-select: none;
}
.key:hover { background: var(--ink-4); }
.key:active, .key.is-pressed { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 1px 0 var(--k-edge); }
.key:disabled { cursor: default; opacity: .55; transform: none; }
.key--icon { width: 46px; padding: 0; font-size: 21px; font-family: var(--emoji); }
.key--accent { --k-bg: var(--accent); --k-edge: var(--accent-deep); color: #fff; font-weight: 700; }
.key--accent:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.key--good { --k-bg: var(--good); --k-edge: var(--good-deep); color: #06281a; font-weight: 700; }
.key--good:hover { background: color-mix(in srgb, var(--good) 88%, #fff); }
.key--wide { width: 100%; min-height: 52px; font-size: 17px; }
.key--danger:hover { background: var(--danger); }

/* ---------- Tag-Badges ---------- */
.tag-badge {
    display: inline-block; padding: 3px 9px; border-radius: 6px;
    font-size: 12px; font-weight: 700; letter-spacing: .02em; line-height: 1.4;
    white-space: nowrap; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}

/* =========================================================
   SPIELSEITE
   ========================================================= */
body.kj-game { overflow: hidden; user-select: none; -webkit-user-select: none; display: flex; flex-direction: column; }

.hud {
    position: relative; z-index: 100; flex: 0 0 auto;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
    height: 76px; padding: 0 22px;
    background: linear-gradient(180deg, var(--ink-2), color-mix(in srgb, var(--ink-2) 70%, var(--ink)));
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 30px rgba(4, 5, 20, .35);
}
.hud::after { /* Akzentlinie */
    content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px;
    background: var(--accent); opacity: .9;
}
.hud__side { display: flex; align-items: center; gap: 22px; min-width: 0; }
.hud__side--right { justify-content: flex-end; }
.hud__center { text-align: center; line-height: 1; }

.player-chip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.player-chip__dot {
    flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px;
    background: var(--player, #ff5722);
    box-shadow: inset 0 -4px 0 rgba(0,0,0,.25), inset 0 2px 0 rgba(255,255,255,.25);
    position: relative;
}
.player-chip__dot::before, .player-chip__dot::after {
    content: ""; position: absolute; top: 9px; width: 8px; height: 8px; border-radius: 3px; background: #fff;
    box-shadow: inset 2px 2px 0 1px #fff, inset -1px -1px 0 2px #111;
}
.player-chip__dot::before { left: 7px; } .player-chip__dot::after { right: 7px; }
.player-chip__name { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.stat { display: flex; flex-direction: column; line-height: 1.15; }
.stat__label { font-size: 12px; color: var(--muted); }
.stat__val { font-size: 17px; font-weight: 700; white-space: nowrap; }
.stat__val--gold { color: var(--gold); }

.score { font-size: 38px; font-weight: 700; letter-spacing: -.01em; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.35); }
.score.is-bump { animation: bump .18s ease-out; }
@keyframes bump { 50% { transform: scale(1.08); } }
.runcoins { margin-top: 5px; font-size: 13px; color: var(--gold); font-weight: 500; }

.btn-row { display: flex; gap: 10px; align-items: center; }

/* ---------- Spielfläche ---------- */
.stage {
    position: relative; flex: 1 1 auto; min-height: 0;
    display: flex; align-items: center; justify-content: center;
    padding: 18px;
    background:
        radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
        var(--ink);
    touch-action: none;
}
.frame {
    position: relative; border-radius: var(--radius-lg); overflow: hidden;
    box-shadow: 0 0 0 4px rgba(255,255,255,.9), 0 0 0 9px rgba(255,255,255,.07), 0 30px 70px rgba(0,0,0,.55);
    background: #fff;
}
#gameCanvas { display: block; width: 100%; height: 100%; touch-action: none; }

/* Game-Over-Karte (über dem Canvas) */
.gameover {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(14, 16, 40, .45); backdrop-filter: blur(2px);
    animation: fade .2s ease-out;
}
.gameover__card {
    width: min(84%, 300px); padding: 22px 22px 18px; text-align: center;
    background: var(--ink-2); border-radius: var(--radius-lg);
    box-shadow: 0 0 0 1px var(--line), 0 24px 60px rgba(0,0,0,.5);
    animation: pop .28s cubic-bezier(.2, 1.4, .4, 1);
}
.gameover__title { margin: 0; font-size: 26px; font-weight: 700; }
.gameover__score { margin: 6px 0 2px; font-size: 54px; font-weight: 700; line-height: 1; color: var(--gold); }
.gameover__coins { color: var(--muted); }
.gameover__record { display: inline-block; margin-top: 10px; padding: 4px 10px; border-radius: 99px; background: var(--good); color: #06281a; font-weight: 700; font-size: 13px; }
.gameover__hint { margin: 14px 0 12px; font-size: 13px; color: var(--muted); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }

/* Start-Hinweis (Mobile) */
.start-overlay {
    position: absolute; inset: 0; z-index: 5;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    background: rgba(14, 16, 40, .5); cursor: pointer; text-align: center; padding: 20px;
}
.start-overlay__msg {
    padding: 14px 26px; border-radius: 99px; background: var(--accent); color: #fff;
    font-size: 21px; font-weight: 700; box-shadow: 0 5px 0 var(--accent-deep);
    animation: breathe 1.6s ease-in-out infinite; pointer-events: none;
}
.start-overlay__sub { color: #fff; font-size: 14px; opacity: .85; pointer-events: none; }
@keyframes breathe { 50% { transform: scale(1.05); } }

/* ---------- Overlays / Sheets ---------- */
.overlay {
    position: fixed; inset: 0; z-index: 2000;
    display: flex; align-items: center; justify-content: center; padding: 20px;
    background: rgba(8, 9, 26, .72); backdrop-filter: blur(6px);
    animation: fade .15s ease-out;
}
.sheet {
    width: min(480px, 100%); max-height: min(86vh, 760px);
    display: flex; flex-direction: column;
    background: var(--ink-2); border-radius: var(--radius-lg);
    box-shadow: 0 0 0 1px var(--line), 0 30px 80px rgba(0,0,0,.6);
    animation: pop .22s cubic-bezier(.2, 1.3, .4, 1);
    overflow: hidden;
}
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.sheet__title { margin: 0; font-size: 21px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.sheet__meta { font-weight: 700; color: var(--gold); white-space: nowrap; }
.sheet__body { padding: 14px 20px; overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; }
.sheet__foot { padding: 14px 20px 18px; border-top: 1px solid var(--line); }
.sheet__body::-webkit-scrollbar { width: 10px; }
.sheet__body::-webkit-scrollbar-thumb { background: var(--ink-4); border-radius: 10px; border: 3px solid var(--ink-2); }

/* Shop */
.shop-cat { margin: 14px 0 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.shop-cat:first-child { margin-top: 2px; }
.shop-note { margin: -4px 0 8px; font-size: 12px; color: var(--muted); }
.shop-item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 10px 10px 12px; margin-bottom: 8px;
    background: var(--ink-3); border-radius: var(--radius-md);
}
.shop-item.is-active { box-shadow: inset 0 0 0 2px var(--good); }
.shop-item .key { min-height: 38px; font-size: 14px; flex: 0 0 auto; }
.price { font-variant-numeric: tabular-nums; }
.shop-item .key.is-short { --k-bg: #3a3352; color: var(--muted); }
.shop-plain { color: var(--muted); font-size: 14px; }

/* Bestenliste */
.leaderboard-list { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.leaderboard-list li {
    display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: var(--radius-sm);
}
.leaderboard-list li:nth-child(odd) { background: rgba(255,255,255,.035); }
.leaderboard-list li.is-me { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.lb-rank { font-weight: 700; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.lb-rank--1 { color: #ffd700; } .lb-rank--2 { color: #d6d9e6; } .lb-rank--3 { color: #e09a5b; }
.lb-name { min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 500; }
.lb-name--1 { color: #ffd700; } .lb-name--2 { color: #d6d9e6; } .lb-name--3 { color: #e09a5b; }
.lb-score { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.2; }
.lb-score small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.lb-empty { text-align: center; color: var(--muted); padding: 24px 0; }
.lb-mine { margin-top: 4px; color: var(--muted); font-size: 14px; text-align: center; }

/* Design-Einstellungen */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-of-type { border-bottom: 0; }
.setting-row label { font-weight: 500; }
.swatch { position: relative; width: 64px; height: 40px; border-radius: 10px; overflow: hidden; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25), 0 3px 0 #14172f; }
.swatch input[type="color"] { position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px); border: 0; padding: 0; cursor: pointer; background: none; }
.design-preview { display: block; width: 100%; height: 120px; border-radius: var(--radius-md); margin-bottom: 6px; }
.setting-actions { display: flex; gap: 10px; margin-top: 12px; }
.logout-inline { display: block; margin-top: 14px; text-align: center; color: var(--danger); font-weight: 700; text-decoration: none; }

/* Toast */
.toast {
    position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom)); z-index: 3000;
    transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
    padding: 12px 18px; border-radius: 99px; background: #fff; color: var(--ink);
    font-weight: 700; box-shadow: 0 12px 30px rgba(0,0,0,.35);
    transition: transform .2s, opacity .2s, visibility 0s .2s; visibility: hidden;
    max-width: calc(100% - 32px); text-align: center;
}
.toast.is-on { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition: transform .2s, opacity .2s, visibility 0s; }
.toast--bad { background: var(--danger); color: #fff; }

/* ---------- Gamepad-Variante ---------- */
.pad-select {
    display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px;
    background: var(--ink-3); border-radius: var(--radius-sm); box-shadow: 0 3px 0 #14172f;
}
.pad-select select { background: transparent; border: 0; color: var(--text); padding: 6px 4px; max-width: 230px; outline: none; font-size: 13px; }
.pad-select select option { background: var(--ink-2); }
.pad-hints { display: flex; gap: 12px; font-size: 12px; color: var(--muted); margin-top: 8px; justify-content: flex-end; flex-wrap: wrap; }
.pad-btn { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 4px; border-radius: 50%; color: #111; font-weight: 700; font-size: 11px; vertical-align: -5px; box-shadow: 0 2px 0 rgba(0,0,0,.4); }
.pad-btn--a { background: #4caf50; } .pad-btn--b { background: #f44336; } .pad-btn--x { background: #2196f3; } .pad-btn--y { background: #ffeb3b; }
.pad-btn--menu { background: #cfd3ea; border-radius: 6px; width: 24px; }
.mouse-logout { position: absolute; right: 22px; top: calc(100% + 10px); font-size: 12px; color: var(--muted); text-decoration: none; opacity: .7; }
.mouse-logout:hover { opacity: 1; color: var(--danger); }

/* ---------- Mobile-Variante ---------- */
.kj--mobile .hud {
    height: calc(58px + var(--safe-top)); padding: var(--safe-top) 10px 0;
    grid-template-columns: auto 1fr auto; gap: 8px;
}
.kj--mobile .hud__side { gap: 6px; }
.kj--mobile .key--icon { width: 42px; min-height: 40px; font-size: 19px; }
.kj--mobile .mscore { display: flex; align-items: baseline; justify-content: center; gap: 12px; }
.kj--mobile .mscore__score { font-size: 26px; font-weight: 700; line-height: 1; }
.kj--mobile .mscore__coins { font-size: 14px; font-weight: 700; color: var(--gold); }
.kj--mobile .stage { padding: 0 0 var(--safe-bottom); background: var(--ink); }
.kj--mobile .frame { border-radius: 0; box-shadow: none; }
.kj--mobile .overlay { padding: 12px; align-items: flex-end; }
.kj--mobile .sheet { max-height: 88vh; border-radius: var(--radius-lg) var(--radius-lg) var(--radius-md) var(--radius-md); }

/* ---------- Responsiv (Desktop-HUD) ---------- */
@media (max-width: 980px) {
    .hud { padding: 0 14px; gap: 10px; }
    .hud__side { gap: 14px; }
    .stat__label { display: none; }
    .score { font-size: 30px; }
    .key--icon { width: 42px; }
    .key--text-sm .key__txt { display: none; }
}
@media (max-width: 720px) {
    .kj--desktop .hud, .kj--gamepad .hud { grid-template-columns: auto 1fr auto; height: auto; padding: 10px 12px; }
    .kj--desktop .hud__side--left .player-chip__name, .kj--gamepad .player-chip__name { display: none; }
    .kj--desktop .hud__center { order: 0; }
    .pad-hints { display: none; }
    .stage { padding: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =========================================================
   HUB / LOGIN
   ========================================================= */
body.kj-hub {
    min-height: 100%; height: auto; display: flex; align-items: center; justify-content: center;
    padding: 40px 16px calc(40px + var(--safe-bottom));
    background:
        radial-gradient(ellipse at 50% -10%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 55%),
        var(--ink);
}
.hub { width: min(440px, 100%); }
.wordmark { margin: 0 0 26px; text-align: center; line-height: .95; }
.wordmark__top { display: block; font-size: 46px; font-weight: 700; letter-spacing: -.02em; color: #fff; text-shadow: 0 4px 0 var(--accent-deep), 0 0 0 transparent; }
.wordmark__sub {
    display: inline-block; margin-top: 10px; padding: 5px 14px; border-radius: 99px;
    background: var(--accent); color: #fff; font-size: 17px; font-weight: 700;
    transform: rotate(-3deg); box-shadow: 0 4px 0 var(--accent-deep);
}
/* kleine springende Figur über dem Schriftzug */
.hopper { display: block; width: 46px; height: 46px; margin: 0 auto 14px; border-radius: 12px; background: var(--accent); position: relative; box-shadow: inset 0 -5px 0 rgba(0,0,0,.25), inset 0 3px 0 rgba(255,255,255,.25); animation: hop 1.1s cubic-bezier(.3,0,.5,1) infinite alternate; }
.hopper::before, .hopper::after { content: ""; position: absolute; top: 12px; width: 11px; height: 11px; border-radius: 3px; background: #fff; box-shadow: inset 3px 3px 0 1px #fff, inset -2px -2px 0 3px #111; }
.hopper::before { left: 9px; } .hopper::after { right: 9px; }
@keyframes hop { from { transform: translateY(0) scaleY(.92); } to { transform: translateY(-16px) scaleY(1.04); } }

.card { background: var(--ink-2); border-radius: var(--radius-lg); padding: 26px 24px; box-shadow: 0 0 0 1px var(--line), 0 30px 70px rgba(0,0,0,.45); }
.card__title { margin: 0 0 6px; font-size: 22px; font-weight: 700; }
.notice { margin: 0 0 18px; padding: 12px 14px; border-radius: var(--radius-md); background: color-mix(in srgb, var(--gold) 13%, transparent); color: #ffe7a8; font-size: 14px; }
.notice a { color: var(--gold); font-weight: 700; }
.error, .pk-error { margin: 0 0 14px; padding: 10px 14px; border-radius: var(--radius-md); background: color-mix(in srgb, var(--danger) 20%, transparent); color: #ffd0d8; font-weight: 500; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; color: var(--muted); }
.field input {
    width: 100%; height: 50px; padding: 0 14px; border-radius: var(--radius-sm);
    background: var(--ink); border: 2px solid var(--ink-3); color: var(--text); font-size: 17px;
}
.field input:focus { outline: none; border-color: var(--accent); }
.stack { display: grid; gap: 14px; }
.link-row { margin-top: 16px; text-align: center; color: var(--muted); font-size: 14px; }
.link-row a { color: var(--text); font-weight: 700; }

.greeting { text-align: center; margin: 0 0 22px; }
.greeting h1 { margin: 0; font-size: 30px; }
.greeting strong { color: var(--accent); }
.greeting p { margin: 6px 0 0; color: var(--muted); }
.greeting .warn { margin-top: 12px; display: inline-block; padding: 6px 12px; border-radius: 99px; background: var(--ink-3); color: var(--gold); font-size: 13px; font-weight: 500; }

.platforms { display: grid; gap: 12px; }
.plat {
    --pc: var(--accent);
    display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 14px;
    padding: 14px 16px; border-radius: var(--radius-md); text-decoration: none;
    background: var(--ink-2); box-shadow: inset 4px 0 0 var(--pc), 0 0 0 1px var(--line), 0 5px 0 #11132b;
    transition: transform .12s, background .15s, box-shadow .12s;
}
.plat:hover { transform: translateY(-2px); background: var(--ink-3); }
.plat:active { transform: translateY(3px); box-shadow: inset 4px 0 0 var(--pc), 0 0 0 1px var(--line), 0 1px 0 #11132b; }
.plat__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; font-size: 26px; font-family: var(--emoji); background: color-mix(in srgb, var(--pc) 22%, transparent); }
.plat__title { font-weight: 700; font-size: 16px; line-height: 1.25; }
.plat__sub { font-size: 13px; color: var(--muted); }
.plat__go { color: var(--pc); font-size: 22px; font-weight: 700; }
.plat--beta { --pc: #ffd60a; }
.plat--client { --pc: #ff3b3b; }
.plat--download { --pc: #d98bff; }
.plat--desktop { --pc: #ff5722; }
.plat--mobile { --pc: #2f9bff; }
.plat--xbox { --pc: #13a10e; }
.pill { display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 6px; background: #ffd60a; color: #2b2300; font-size: 11px; font-weight: 700; vertical-align: 2px; }
.logout-link { display: block; width: max-content; margin: 26px auto 0; color: var(--muted); text-decoration: none; font-size: 14px; }
.logout-link:hover { color: var(--danger); }

/* Feinschliff Gamepad-HUD */
.kj--gamepad .hud { height: 86px; }
.kj--gamepad .pad-hints { margin-top: 10px; align-items: center; }
.kj--gamepad .pad-hints > span { display: inline-flex; align-items: center; }
.kj--gamepad .pad-btn { vertical-align: 0; }

/* =========================================================
   Querformat (Desktop): Spielfeld füllt den Bildschirm
   ========================================================= */
.kj--wide .stage { padding: 0; background: var(--ink); }
.kj--wide .frame { border-radius: 0; box-shadow: none; }
.runfinds { margin-left: 10px; }

.toast--good { background: var(--good); color: #06281a; }
.pad-btn--lb { background: #cfd3ea; border-radius: 6px; width: 26px; font-size: 10px; }

/* ---------- Segment-Tabs ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; margin: 12px 0; background: var(--ink); border-radius: 12px; }
.seg button { min-height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 500; cursor: pointer; }
.seg button:hover { color: var(--text); }
.seg button[aria-selected="true"] { background: var(--ink-3); color: var(--text); font-weight: 700; box-shadow: 0 2px 0 #14172f; }

/* ---------- Farb-Palette ---------- */
.sheet--design, .sheet--inv { width: min(560px, 100%); }
.palette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.swatch-btn {
    position: relative; aspect-ratio: 1; border: 0; padding: 0; cursor: pointer; border-radius: 10px;
    background: var(--sw); box-shadow: inset 0 0 0 2px rgba(255,255,255,.14), 0 3px 0 #14172f;
    transition: transform .1s;
}
.swatch-btn:hover { transform: translateY(-2px); }
.swatch-btn:not(.is-owned)::after { /* gesperrt: leicht abgedunkelt */
    content: ""; position: absolute; inset: 0; border-radius: inherit; background: rgba(14,16,40,.16);
}
.swatch-btn__price {
    position: absolute; left: 50%; bottom: 3px; transform: translateX(-50%); z-index: 1;
    padding: 0 5px; border-radius: 5px; background: rgba(14,16,40,.85); color: var(--gold);
    font-size: 10px; font-weight: 700; line-height: 15px;
}
.swatch-btn__tag { position: absolute; left: 50%; bottom: 3px; transform: translateX(-50%); padding: 0 4px; border-radius: 5px; background: rgba(14,16,40,.85); color: #fff; font-size: 9px; line-height: 14px; }
.swatch-btn.is-current { box-shadow: 0 0 0 3px var(--ink-2), 0 0 0 5px #fff; }
.swatch-btn.is-preview { box-shadow: 0 0 0 3px var(--ink-2), 0 0 0 5px var(--gold); }

.buybar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-md); background: color-mix(in srgb, var(--gold) 14%, var(--ink-3)); }
.buybar span { font-weight: 500; }
.buybar__btns { display: flex; gap: 8px; }
.buybar .key, .custom .key { min-height: 40px; }
.key.is-short { --k-bg: #3a3352; color: var(--muted); }

.custom { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.custom__title { margin: 0 0 10px; font-size: 15px; }
.custom__locked p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.custom__open { display: grid; grid-template-columns: 170px 1fr; gap: 18px; align-items: center; }
.wheel { width: 170px; height: 170px; touch-action: none; cursor: crosshair; border-radius: 50%; }
.custom__side { display: grid; gap: 10px; }
.custom__label { font-size: 13px; color: var(--muted); }
.value-slider { width: 100%; height: 26px; touch-action: none; cursor: pointer; }
.hexrow__chip { display: inline-block; padding: 4px 10px; border-radius: 8px; background: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .04em; }

/* ---------- Inventar ---------- */
.inv-top { display: grid; grid-template-columns: 110px 1fr; gap: 16px; align-items: center; }
.inv-preview { width: 110px; border-radius: var(--radius-md); background: var(--ink); }
.inv-slots { display: grid; gap: 8px; }
.inv-slot { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; min-height: 46px; border-radius: 10px; background: var(--ink-3); }
.inv-slot__label { font-size: 12px; color: var(--muted); }
.inv-slot__name { font-weight: 700; }
.inv-slot__off { min-height: 34px; font-size: 13px; }
.inv-hint { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.inv-card {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 8px 6px 8px; border: 0; border-radius: 12px; cursor: pointer; text-align: center;
    background: var(--ink-3); color: var(--text);
    box-shadow: inset 0 -3px 0 var(--rar), 0 3px 0 #14172f;
    transition: transform .1s;
}
.inv-card:hover { transform: translateY(-2px); }
.inv-card__icon { width: 64px; height: 64px; }
.inv-card__name { font-size: 12px; font-weight: 700; line-height: 1.2; min-height: 2.4em; display: flex; align-items: center; }
.inv-card__rar { font-size: 10px; color: var(--rar); font-weight: 500; }
.inv-card__count { position: absolute; top: 6px; right: 6px; padding: 0 5px; border-radius: 6px; background: var(--ink); font-size: 11px; font-weight: 700; }
.inv-card__eq { position: absolute; top: 6px; left: 6px; padding: 0 5px; border-radius: 6px; background: var(--good); color: #06281a; font-size: 10px; font-weight: 700; }
.inv-card.is-locked { background: color-mix(in srgb, var(--ink-3) 60%, var(--ink)); }
.inv-card.is-locked .inv-card__name { color: var(--muted); }
.inv-card.is-equipped { box-shadow: inset 0 0 0 2px var(--good), inset 0 -3px 0 var(--rar), 0 3px 0 #14172f; }

/* Funde auf der Game-Over-Karte */
.go-finds { margin-top: 12px; display: grid; gap: 6px; text-align: left; }
.go-find { display: flex; align-items: center; gap: 10px; padding: 4px 8px; border-radius: 10px; background: var(--ink-3); }
.go-find__icon { width: 40px; height: 40px; flex: 0 0 auto; }
.go-find small { color: var(--muted); }
.go-finds__wait, .go-finds__bonus { margin: 0; font-size: 13px; color: var(--gold); text-align: center; }

@media (max-width: 520px) {
    .palette { grid-template-columns: repeat(6, 1fr); }
    .custom__open { grid-template-columns: 1fr; justify-items: center; }
    .custom__side { width: 100%; }
    .inv-top { grid-template-columns: 80px 1fr; }
    .inv-preview { width: 80px; }
    .inv-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Musik: "Läuft gerade" ---------- */
.now-playing {
    position: absolute; left: 14px; bottom: 14px; z-index: 4; max-width: calc(100% - 28px);
    display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px; border-radius: 99px;
    background: rgba(22, 25, 54, .88); color: #fff; font-size: 13px; font-weight: 500;
    box-shadow: 0 6px 18px rgba(0,0,0,.3); pointer-events: none;
    animation: np-in .3s ease-out; transition: opacity .35s, transform .35s;
}
.now-playing span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-playing.is-out { opacity: 0; transform: translateY(8px); }
@keyframes np-in { from { opacity: 0; transform: translateY(8px); } }
.kj--mobile .now-playing { bottom: calc(14px + var(--safe-bottom)); }
@media (max-width: 1360px) { .key--text-sm .key__txt { display: none; } .key--text-sm { width: 46px; padding: 0; } }

/* =========================================================
   Halloween-Event
   ========================================================= */
.event-pill {
    display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 99px;
    background: color-mix(in srgb, #ff7518 18%, var(--ink-3)); color: #ffd7b5;
    font-size: 13px; font-weight: 500; white-space: nowrap; line-height: 1.2;
    box-shadow: inset 0 0 0 1px rgba(255,117,24,.35);
}
.event-pill .emo { font-size: 18px; }
.event-pill .num { font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.event-pill.is-live { background: #ff7518; color: #2a0d00; box-shadow: 0 3px 0 #9a3412; }
.event-pill.is-live .num { color: #2a0d00; }
.event-pill--floating { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 6; box-shadow: 0 6px 18px rgba(0,0,0,.3); }

.kj--halloween { --accent: #ff7518; --accent-deep: #9a3412; }
.kj--halloween.kj--gamepad { --accent: #ff7518; --accent-deep: #9a3412; }
.kj--halloween .hud { background: linear-gradient(180deg, #2a1745, #1d1436); }
.kj--halloween .hud::after { background: linear-gradient(90deg, #ff7518, #a855f7, #ff7518); }
.kj--halloween .stage { background: radial-gradient(ellipse at 50% 0%, rgba(255,117,24,.16), transparent 60%), #140f26; }

.inv-tab--hw .inv-tab__count { font-size: 11px; opacity: .75; margin-left: 2px; }
.inv-tab--hw.is-live { color: #ffb072; }
.inv-tab--hw.is-live[aria-selected="true"] { background: #ff7518; color: #2a0d00; box-shadow: 0 2px 0 #9a3412; }
.inv-card.is-claimable { box-shadow: inset 0 0 0 2px #ff7518, 0 3px 0 #14172f; }
.inv-card.is-claimable .inv-card__rar { color: #ffb072; font-weight: 700; }

.event-banner {
    display: flex; align-items: center; gap: 12px; margin: -6px 0 18px; padding: 12px 16px; border-radius: var(--radius-md);
    background: color-mix(in srgb, #ff7518 14%, var(--ink-2)); box-shadow: inset 0 0 0 1px rgba(255,117,24,.35); color: #ffd7b5; font-size: 14px;
}
.event-banner strong { color: #fff; }
.event-banner small { color: #ffb98a; }
.event-banner__icon { font-size: 30px; }
.event-banner.is-live { background: linear-gradient(135deg, #3a1d5c, #5a2410); }

@media (max-width: 720px) {
    .kj--desktop .event-pill .event-pill__text > span:first-child, .kj--gamepad .event-pill .event-pill__text > span:first-child { display: none; }
}

/* =========================================================
   Adminseite
   ========================================================= */
.admin { width: min(560px, 100%); }
.admin .card + .card { margin-top: 16px; }
.admin-status { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--ink); margin: 10px 0 14px; }
.admin-status__dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.admin-status.is-on .admin-status__dot { background: #ff7518; box-shadow: 0 0 0 4px rgba(255,117,24,.25); }
.admin-meta { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.mode-list { display: grid; gap: 8px; margin: 0 0 16px; padding: 0; border: 0; }
.mode-opt { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; padding: 12px 14px; border-radius: var(--radius-md); background: var(--ink-3); cursor: pointer; }
.mode-opt input { margin: 3px 0 0; accent-color: #ff7518; width: 18px; height: 18px; }
.mode-opt strong { display: block; }
.mode-opt small { color: var(--muted); }
.mode-opt:has(input:checked) { box-shadow: inset 0 0 0 2px #ff7518; }
.flash { margin: 0 0 14px; padding: 10px 14px; border-radius: var(--radius-md); background: color-mix(in srgb, var(--good) 20%, transparent); color: #c9f7dd; font-weight: 500; }
.admin-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; color: var(--muted); font-size: 14px; }
.admin-top a { color: var(--text); }
.admin pre { white-space: pre-wrap; background: var(--ink); padding: 12px; border-radius: 10px; font-size: 12px; color: #d9dcf2; }
.toast { border-radius: 18px; }
.kj--mobile .event-pill--floating { top: 6px; padding: 4px 10px 4px 6px; font-size: 12px; }
.kj--mobile .event-pill--floating .emo { font-size: 15px; }

/* =========================================================
   Login: automatische Registrierung, Passkeys, angemeldet bleiben
   ========================================================= */
.notice--soft { background: color-mix(in srgb, var(--good) 12%, transparent); color: #c9f7dd; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); cursor: pointer; user-select: none; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.or { display: flex; align-items: center; gap: 12px; margin: 16px 0 12px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.passkey-btn { gap: 10px; }
.passkey-hint { margin: 8px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
.passkey-login .pk-error { margin-top: 10px; }
.welcome-flash { margin: 0 0 18px; }

/* Konto-Bereich */
.account-card { margin-top: 18px; background: var(--ink-2); border-radius: var(--radius-md); box-shadow: 0 0 0 1px var(--line); }
.account-card summary { cursor: pointer; padding: 14px 16px; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 10px; }
.account-card summary::-webkit-details-marker { display: none; }
.account-card summary::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform .15s; }
.account-card[open] summary::after { transform: rotate(180deg); }
.account-card .account-panel { padding: 0 16px 16px; }
.account-h { margin: 14px 0 4px; font-size: 15px; }
.account-h:first-child { margin-top: 2px; }
.account-muted { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.account-empty { margin: 0 0 12px; padding: 12px; border-radius: 10px; background: var(--ink); color: var(--muted); font-size: 14px; text-align: center; }
.pk-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.pk-list li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-radius: 10px; background: var(--ink-3); }
.pk-main small { display: block; color: var(--muted); font-size: 12px; }
.pk-del { min-height: 34px; font-size: 13px; }
.account-panel .key--wide { margin-top: 4px; }
.account-panel .flash, .account-panel .pk-error { margin: 10px 0 0; }
.account-open { margin-top: 14px; }
.player-chip--btn { border: 0; background: none; padding: 0; color: inherit; cursor: pointer; text-align: left; font: inherit; }
button.player-chip { display: flex; }
button.player-chip:hover .player-chip__name { text-decoration: underline; text-underline-offset: 3px; }
button.player-chip__dot { cursor: pointer; }

/* =========================================================
   Hintergrundbilder
   ========================================================= */
.scene-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.scene-card {
    position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 5px 5px 7px;
    border: 0; border-radius: 12px; background: var(--ink-3); color: var(--text); cursor: pointer; text-align: center;
    box-shadow: 0 3px 0 #14172f; transition: transform .1s;
}
.scene-card:hover { transform: translateY(-2px); }
.scene-card__img { display: block; width: 100%; aspect-ratio: 2 / 3; border-radius: 8px; object-fit: cover; background: var(--sw, var(--ink)); }
.scene-card--none .scene-card__img { box-shadow: inset 0 0 0 2px rgba(255,255,255,.15); }
.scene-card__name { font-size: 12px; font-weight: 700; line-height: 1.2; }
.scene-card__price { font-size: 11px; color: var(--gold); }
.scene-card.is-owned .scene-card__price { color: var(--good); }
.scene-card:not(.is-owned):not(.scene-card--none) .scene-card__img { filter: saturate(.75) brightness(.85); }
.scene-card.is-current { box-shadow: 0 0 0 2px var(--ink-2), 0 0 0 4px #fff; }
.scene-card.is-preview { box-shadow: 0 0 0 2px var(--ink-2), 0 0 0 4px var(--gold); }
@media (max-width: 520px) { .scene-grid { grid-template-columns: repeat(3, 1fr); } }
.kj--mobile .toast { font-size: 14px; padding: 10px 16px; }
