/*
 * ╔════════════════════════════════════════════════════════════════════════════╗
 * ║    ____             __    __           ____                                ║
 * ║   | __ )   _   _   / _|  / _|  _   _  | __ )    ___    __ _   _ __         ║
 * ║   |  _ \  | | | | | |_  | |_  | | | | |  _ \   / _ \  / _` | | '__|        ║
 * ║   | |_) | | |_| | |  _| |  _| | |_| | | |_) | |  __/ | (_| | | |           ║
 * ║   |____/   \__,_| |_|   |_|    \__, | |____/   \___|  \__,_| |_|           ║
 * ║                                |___/                                       ║
 * ║                                                                            ║
 * ║   ʕ•ᴥ•ʔ  Crafted with honey & code by BuffyBear                            ║
 * ║          https://www.buffybear.de/                                         ║
 * ╟────────────────────────────────────────────────────────────────────────────╢
 * ║   Projekt : Online Memory 1.2.0                                            ║
 * ║   Datei   : assets/css/game.css                                            ║
 * ║   (c) 2026 BuffyBear · https://www.buffybear.de/ · Alle Rechte vorbehalten ║
 * ╚════════════════════════════════════════════════════════════════════════════╝
 */
/* =====================================================================
   OnlineMemory – Spiel-Stylesheet (Kern)
   Themes (themes/<name>/theme.css) werden danach geladen und überschreiben
   vor allem die Variablen in :root – siehe docs/THEMES.md.
   ===================================================================== */

:root {
    /* --- Farben & Flächen ------------------------------------------- */
    --bg-1: #141a3a;
    --bg-2: #2a1650;
    --bg-3: #0c2a4a;
    --body-bg:
        radial-gradient(1200px 700px at 15% 10%, rgba(99, 102, 241, .35), transparent 60%),
        radial-gradient(900px 600px at 90% 90%, rgba(236, 72, 153, .22), transparent 60%),
        radial-gradient(800px 500px at 80% 10%, rgba(20, 184, 166, .18), transparent 60%),
        linear-gradient(160deg, var(--bg-1), var(--bg-2) 55%, var(--bg-3));
    --panel: rgba(255, 255, 255, .075);
    --panel-strong: rgba(255, 255, 255, .12);
    --panel-blur: 10px;
    --hover: rgba(255, 255, 255, .18);
    --line: rgba(255, 255, 255, .14);
    --text: #f4f6ff;
    --muted: #aab1d6;
    --accent: #ffc83d;
    --accent-2: #ff8a3d;
    --on-accent: #2a1600;              /* Textfarbe auf Akzentflächen */
    --good: #34d399;
    --bad: #f87171;
    --input-bg: rgba(0, 0, 0, .25);
    --select-bg: #1d2350;
    --modal-bg: linear-gradient(160deg, #262d63, #1b1640);
    --overlay-bg: rgba(6, 8, 25, .7);
    --stage-backdrop: radial-gradient(ellipse at center, rgba(10, 12, 35, .55), rgba(5, 6, 20, .85));
    --radius: 18px;
    --font: "Nunito", "Segoe UI Rounded", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --heading-font: var(--font);
    /* --- Logo (Buchstaben-Kärtchen) ------------------------------------ */
    --logo-tile-bg: linear-gradient(160deg, #fff, #e6e9ff);
    --logo-colors: #2747b5, #e11d48, #059669, #d97706, #7c3aed, #0891b2;   /* wird von game.js gelesen */
    /* --- Spielfeld & Karten ------------------------------------------- */
    --board-bg: rgba(255, 255, 255, .045);
    --board-ring: rgba(255, 255, 255, .08);
    --board-radius: .22;                 /* Faktor der Kartengröße */
    --card-radius: 9%;
    --card-back-border: rgba(255, 255, 255, .9);
    --card-front-bg: #fff;
    --card-shadow: rgba(0, 0, 0, .4);
    --hud-side: left;                    /* left | right | top – Position des Spieler-Panels */
    /* --- intern (vom Spiel gesetzt) ----------------------------------- */
    --card: 80px;
    --gap: 6px;
    --pc: #ffc83d;
    --pc-a: rgba(255, 200, 61, .3);
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--body-bg);
    background-color: var(--bg-1);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    user-select: none;
    -webkit-user-select: none;
    overflow-x: hidden;
}

body.in-game { overflow: hidden; }

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { -webkit-user-drag: none; }

.screen { display: none; }
.screen.active { display: block; }

/* ----------------------------------------------------------- Buttons --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4em;
    padding: .7em 1.2em;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel-strong);
    font-weight: 700;
    transition: transform .15s, background .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); background: var(--hover); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--on-accent); border: 0;
    box-shadow: 0 8px 24px rgba(255, 150, 50, .35), inset 0 -3px 0 rgba(0, 0, 0, .15);
}
.btn.primary:hover { box-shadow: 0 12px 30px rgba(255, 150, 50, .5), inset 0 -3px 0 rgba(0, 0, 0, .15); }
.btn.ghost { background: transparent; }
.btn.big { font-size: 1.25rem; padding: .85em 1.6em; }
.btn:disabled { opacity: .5; pointer-events: none; }

.icon-btn {
    width: 42px; height: 42px; flex: none;
    display: grid; place-items: center;
    border-radius: 12px; border: 1px solid var(--line);
    background: var(--panel-strong);
    transition: transform .15s, background .2s;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .2); }

/* -------------------------------------------------------------- Menü --- */
#screen-menu { min-height: 100vh; padding: 24px 16px 40px; position: relative; }
#screen-menu.active { display: flex; flex-direction: column; align-items: center; }

.menu-floaters { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.menu-floaters i {
    position: absolute; top: -20vh;
    width: var(--s); height: var(--s);
    border-radius: 10%;
    background: center / cover no-repeat;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
    opacity: .22;
    animation: drift var(--d) linear infinite;
    animation-delay: var(--delay);
}
@keyframes drift {
    from { transform: translate(0, 0) rotate(var(--r0)); }
    to   { transform: translate(var(--dx), 140vh) rotate(var(--r1)); }
}

.menu-header, .menu-grid, .menu-footer { position: relative; z-index: 1; }
.menu-header { text-align: center; margin: 8px 0 22px; }

.logo {
    margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .18em .12em;
    font-size: clamp(28px, 5.2vw, 60px); font-weight: 900; letter-spacing: 0;
    perspective: 600px;
}
.logo .tile {
    width: 1.05em; height: 1.3em;
    display: inline-grid; place-items: center;
    border-radius: .16em;
    background: var(--logo-tile-bg);
    color: var(--c, #2747b5);
    box-shadow: 0 .08em 0 rgba(0, 0, 0, .25), 0 .2em .5em rgba(0, 0, 0, .3);
    animation: tileIn .7s cubic-bezier(.2, .9, .3, 1.3) both, tileBob 4s ease-in-out infinite;
    animation-delay: var(--i), calc(var(--i) + .8s);
}
.logo { column-gap: .45em; }   /* Abstand zwischen Wörtern */
.logo .word { display: inline-flex; gap: .12em; white-space: nowrap; }
@media (max-width: 520px) { .logo { font-size: clamp(22px, 8.4vw, 40px); } }
@keyframes tileIn {
    from { transform: rotateY(180deg) translateY(-.6em) scale(.6); opacity: 0; }
    to   { transform: rotateY(0) translateY(0) scale(1); opacity: 1; }
}
@keyframes tileBob {
    0%, 100% { transform: translateY(0) rotate(0); }
    50%      { transform: translateY(-.06em) rotate(-2deg); }
}
.tagline { color: var(--muted); margin: 12px 0 0; font-size: 1.05rem; }

.menu-grid {
    width: 100%; max-width: 1120px;
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px;
}
@media (max-width: 880px) { .menu-grid { grid-template-columns: minmax(0, 1fr); } }

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 18px 22px 22px;
    backdrop-filter: blur(var(--panel-blur));
    -webkit-backdrop-filter: blur(var(--panel-blur));
    box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
    animation: panelIn .6s .15s both cubic-bezier(.2, .8, .2, 1);
}
.panel + .panel { animation-delay: .28s; }
@keyframes panelIn { from { opacity: 0; transform: translateY(24px); } }

.panel h2 { font-size: 1.15rem; margin: 6px 0 12px; display: flex; align-items: center; gap: 10px; }
.panel h2:not(:first-child) { margin-top: 22px; }
.panel h3 { font-size: .95rem; color: var(--muted); margin: 18px 0 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.num {
    width: 28px; height: 28px; border-radius: 50%;
    display: inline-grid; place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent);
    font-size: .9rem; font-weight: 900;
}

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg button {
    padding: 14px 12px; border-radius: 16px;
    border: 2px solid var(--line); background: var(--panel);
    font-weight: 800; font-size: 1.05rem;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    transition: all .2s;
}
.seg button small { font-weight: 600; font-size: .78rem; color: var(--muted); }
.seg-ico { font-size: 1.7rem; line-height: 1.1; }
.seg button:hover { border-color: rgba(255, 255, 255, .35); transform: translateY(-2px); }
.seg button.active {
    border-color: var(--accent);
    background: linear-gradient(160deg, rgba(255, 200, 61, .22), rgba(255, 138, 61, .12));
    box-shadow: 0 0 0 4px rgba(255, 200, 61, .15);
}
.seg.small button { padding: 8px 10px; font-size: .95rem; border-radius: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    padding: 9px 14px; border-radius: 999px;
    border: 2px solid var(--line); background: var(--panel);
    font-weight: 800; transition: all .2s;
    display: inline-flex; align-items: baseline; gap: 6px;
}
.chip small { color: var(--muted); font-weight: 700; }
.chip:hover { border-color: rgba(255, 255, 255, .35); }
.chip.active { border-color: var(--accent); background: rgba(255, 200, 61, .2); }
.chip:disabled { opacity: .4; cursor: not-allowed; }
.chips.small { margin: 12px 0; }
.chips.small .chip { padding: 6px 12px; font-size: .9rem; }

/* Motiv-Vorlagen als Kacheln mit 2×2-Vorschau */
.set-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.set-opt {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 8px 8px 10px; border-radius: 16px;
    border: 2px solid var(--line); background: var(--panel);
    font-weight: 800; text-align: center; transition: all .2s;
}
.set-opt:hover { border-color: rgba(255, 255, 255, .35); transform: translateY(-2px); }
.set-opt.active { border-color: var(--accent); background: rgba(255, 200, 61, .16); box-shadow: 0 0 0 4px rgba(255, 200, 61, .12); }
.set-thumbs {
    width: 100%; aspect-ratio: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
    padding: 4px; border-radius: 12px; background: rgba(0, 0, 0, .2);
}
.set-thumbs i { border-radius: 8px; background: #fff center / cover no-repeat; box-shadow: 0 2px 5px rgba(0, 0, 0, .3); }
.set-opt:hover .set-thumbs i:nth-child(odd) { transform: rotate(-4deg); }
.set-opt:hover .set-thumbs i:nth-child(even) { transform: rotate(4deg); }
.set-thumbs i { transition: transform .25s; }
.set-name { font-size: .92rem; line-height: 1.2; }
.set-opt small { color: var(--muted); font-weight: 700; font-size: .75rem; }

/* Schwierigkeitsgrade als Kachelreihe (bricht nur um, wenn der Platz nicht reicht) */
.diff-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
@media (max-width: 520px) { .diff-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.diff-opt {
    position: relative; min-width: 0;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 10px 6px 9px; border-radius: 16px;
    border: 2px solid var(--line); background: var(--panel);
    font-weight: 800; text-align: center; transition: all .2s;
}
.diff-opt:hover:not(:disabled) { border-color: rgba(255, 255, 255, .35); transform: translateY(-2px); }
.diff-opt.active {
    border-color: var(--accent);
    background: linear-gradient(160deg, rgba(255, 200, 61, .22), rgba(255, 138, 61, .1));
    box-shadow: 0 0 0 4px rgba(255, 200, 61, .12);
}
.diff-opt:disabled { opacity: .42; cursor: not-allowed; }
/* Mini-Raster: zeigt die Spielfeldgröße als Punktmuster */
.diff-grid {
    --dot: #cfd5ff;
    width: 40px; height: 40px; padding: 4px; margin-bottom: 3px;
    border-radius: 8px; background-color: rgba(0, 0, 0, .28);
    background-image: radial-gradient(circle, var(--dot) 46%, transparent 52%);
    background-origin: content-box; background-clip: content-box; background-repeat: repeat;
    background-size: calc(100% / var(--c)) calc(100% / var(--r));
    transition: transform .25s;
}
.diff-opt.active .diff-grid { --dot: var(--accent); }
.diff-opt:hover:not(:disabled) .diff-grid { transform: rotate(-6deg) scale(1.06); }
.diff-name { max-width: 100%; font-size: .95rem; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.diff-size { font-size: .72rem; color: var(--muted); font-weight: 700; white-space: nowrap; }
.diff-badge { margin-top: 2px; padding: 1px 7px; border-radius: 999px; font-size: .64rem; font-weight: 800; white-space: nowrap; }
.diff-badge.fill { background: rgba(255, 200, 61, .16); border: 1px solid rgba(255, 200, 61, .4); color: #ffe2a0; }
.diff-badge.no { background: rgba(248, 113, 113, .16); border: 1px solid rgba(248, 113, 113, .4); color: #ffc9c9; }

/* Meldung, wenn keine Motiv-Vorlage existiert */
.diff-hint {
    margin: 10px 0 0; padding: 8px 12px; border-radius: 12px;
    background: rgba(248, 113, 113, .14); border: 1px solid rgba(248, 113, 113, .45);
    font-size: .85rem; font-weight: 700; color: #ffd6d6;
}
.diff-hint[hidden] { display: none; }

.cover-list { display: flex; flex-wrap: wrap; gap: 10px; }

/* Design-Auswahl (nur wenn im Backend für Spieler freigegeben) */
.theme-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.theme-opt {
    display: flex; flex-direction: column; gap: 6px; padding: 6px 6px 8px; border-radius: 14px;
    border: 2px solid var(--line); background: var(--panel); font-weight: 800; font-size: .85rem; transition: all .2s;
}
.theme-opt:hover { border-color: rgba(255, 255, 255, .35); transform: translateY(-2px); }
.theme-opt.active { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(255, 200, 61, .12); }
.theme-thumb { aspect-ratio: 16 / 10; border-radius: 9px; background: var(--input-bg) center / cover no-repeat; }
.cover-opt {
    width: 62px; height: 62px; padding: 0; border-radius: 12px;
    border: 3px solid transparent; background: center / cover no-repeat;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .3);
    transition: transform .2s, border-color .2s;
}
.cover-opt:hover { transform: translateY(-3px) rotate(-3deg); }
.cover-opt.active { border-color: var(--accent); transform: scale(1.06); }

.options { display: grid; gap: 10px; }
.opt {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
    font-weight: 700; cursor: pointer;
}
.opt select {
    background: var(--select-bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-weight: 700;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i {
    width: 48px; height: 28px; border-radius: 999px; background: rgba(255, 255, 255, .2);
    position: relative; transition: background .2s; flex: none;
}
.switch i::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
    background: #fff; transition: transform .25s cubic-bezier(.3, 1.4, .5, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, .3);
}
.switch input:checked + i { background: var(--good); }
.switch input:checked + i::after { transform: translateX(20px); }

body.mode-single .multi-only { display: none !important; }

/* Spieler-Konfiguration */
.player-list { display: grid; gap: 10px; margin-bottom: 12px; }
.player-row {
    display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
    padding: 10px 12px; border-radius: 16px;
    background: var(--panel); border: 1px solid var(--line);
    border-left: 6px solid var(--pc);
}
.player-row.enter { animation: rowIn .35s both cubic-bezier(.2, .8, .2, 1); }
.muted { color: var(--muted); }
@keyframes rowIn { from { opacity: 0; transform: translateX(-16px) scale(.97); } }
.player-row.removing { animation: rowOut .25s forwards; }
@keyframes rowOut { to { opacity: 0; transform: translateX(30px) scale(.95); } }

.avatar-btn {
    width: 64px; height: 64px; border-radius: 50%; padding: 0;
    border: 4px solid var(--pc); background: #fff center / cover no-repeat;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
    position: relative; transition: transform .2s;
}
.avatar-btn:hover { transform: scale(1.07) rotate(-4deg); }
.avatar-btn::after {
    content: "✎"; position: absolute; right: -4px; bottom: -4px;
    width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
    background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 900;
}
.player-main { display: grid; gap: 8px; min-width: 0; }
.player-main input[type=text] {
    width: 100%; padding: 8px 12px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--input-bg);
    font-weight: 800; font-size: 1.05rem; user-select: text; -webkit-user-select: text;
}
.player-main input[type=text]:focus { outline: 2px solid var(--pc); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.swatch {
    width: 24px; height: 24px; border-radius: 50%; padding: 0; border: 2px solid rgba(255, 255, 255, .5);
    background: var(--sc); transition: transform .15s;
}
.swatch:hover { transform: scale(1.18); }
.swatch.active { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--sc); transform: scale(1.1); }
.swatch.used:not(.active) { opacity: .35; }
.swatch-custom {
    width: 24px; height: 24px; border-radius: 50%; overflow: hidden; position: relative;
    background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red);
    border: 2px solid rgba(255, 255, 255, .5); cursor: pointer;
}
.swatch-custom input { position: absolute; inset: -6px; opacity: 0; cursor: pointer; }
.row-remove {
    width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line);
    background: transparent; color: var(--muted); font-size: 1rem;
}
.row-remove:hover { background: rgba(248, 113, 113, .25); color: #fff; }

.menu-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.menu-actions .btn.primary { flex: 1 1 220px; }
/* Fußzeile (Inhalt & Ausrichtung im Backend) */
.menu-footer {
    width: 100%; max-width: 1120px; margin-top: 18px; padding: 0 4px;
    color: var(--muted); font-size: .85rem; line-height: 1.5;
}
.menu-footer[hidden] { display: none; }
.menu-footer.align-left { text-align: left; }
.menu-footer.align-center { text-align: center; }
.menu-footer.align-right { text-align: right; }
.menu-footer a { color: var(--accent); font-weight: 700; text-decoration: none; border-bottom: 1px dotted currentColor; }
.menu-footer a:hover { color: #fff; }

/* ------------------------------------------------------------- Spiel --- */
/* Kein eigener Stacking-Kontext, damit das HUD über der Großansicht liegen kann */
#screen-game.active { display: block; }

#board-wrap {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
}
#board {
    display: grid;
    grid-template-columns: repeat(var(--cols), var(--card));
    grid-auto-rows: var(--card);
    gap: var(--gap);
    padding: var(--pad, 10px);
    border-radius: calc(var(--card) * var(--board-radius));
    background: var(--board-bg);
    box-shadow: 0 0 0 2px var(--board-ring), 0 30px 80px rgba(0, 0, 0, .35);
    transition: box-shadow .5s, background .5s;
}
body.mode-multi #board {
    box-shadow: 0 0 0 3px var(--pc), 0 0 50px var(--pc-a), 0 30px 80px rgba(0, 0, 0, .35);
}
#board.hurry { animation: hurry 1s ease-in-out infinite; }
@keyframes hurry {
    50% { box-shadow: 0 0 0 4px #ef4444, 0 0 60px rgba(239, 68, 68, .55), 0 30px 80px rgba(0, 0, 0, .35); }
}

/* Karte */
.card {
    width: var(--card); height: var(--card);
    position: relative;
    perspective: calc(var(--card) * 8);
    border-radius: var(--card-radius);
    cursor: pointer;
}
.card-inner {
    position: absolute; inset: 0;
    transform-style: preserve-3d;
    border-radius: inherit;
    transition: transform .55s cubic-bezier(.3, .7, .25, 1), opacity .4s;
}
.card.is-up .card-inner { transform: rotateY(180deg); }
.card.no-trans .card-inner { transition: none !important; }
.face {
    position: absolute; inset: 0;
    border-radius: inherit;
    overflow: hidden;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    box-shadow: 0 calc(var(--card) * .03) calc(var(--card) * .08) var(--card-shadow);
}
.face.back {
    background: #2747b5 center / cover no-repeat;
    border: max(1.5px, calc(var(--card) * .025)) solid var(--card-back-border);
}
.face.back::after {               /* leichter Glanz */
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, .28), transparent 45%);
}
.face.front {
    transform: rotateY(180deg);
    background: var(--card-front-bg);
    border: max(1.5px, calc(var(--card) * .03)) solid var(--card-front-bg);
}
.face.front img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 6%; }

#board.can-play .card:not(.is-up):not(.is-gone):hover .card-inner {
    transform: translateY(-5%) rotate(-1.5deg);
}
#board.can-play .card:not(.is-up):not(.is-gone):hover .face.back {
    box-shadow: 0 calc(var(--card) * .1) calc(var(--card) * .2) rgba(0, 0, 0, .45), 0 0 0 3px var(--pc);
}
.card.is-up, .card.is-gone { cursor: default; }
.card.is-lifted { visibility: hidden; }
.card.is-gone .card-inner { opacity: 0; transform: rotateY(180deg) scale(.6); }
.card.is-gone::after {
    content: ""; position: absolute; inset: 8%;
    border: 2px dashed rgba(255, 255, 255, .13); border-radius: 12%;
    animation: fadeIn .6s both;
}
.card.match-pop .card-inner { animation: matchPop .6s ease-out; }
@keyframes matchPop {
    0% { transform: rotateY(180deg) scale(1); }
    40% { transform: rotateY(180deg) scale(1.14); }
    100% { transform: rotateY(180deg) scale(1); }
}
.card.match-pop .face.front { box-shadow: 0 0 0 4px var(--accent), 0 0 30px var(--accent); }
.card.shake { animation: shake .45s; }
@keyframes shake {
    20% { transform: translateX(-6%) rotate(-2deg); }
    40% { transform: translateX(6%) rotate(2deg); }
    60% { transform: translateX(-4%); }
    80% { transform: translateX(3%); }
}

/* Fliegende Karten */
#fly-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.card.floater {
    position: fixed; margin: 0;
    pointer-events: none;
    will-change: transform;
}
.card.floater .face { box-shadow: 0 calc(var(--card) * .08) calc(var(--card) * .18) rgba(0, 0, 0, .55); }
.card.floater.glow .face.front {
    box-shadow: 0 0 0 calc(var(--card) * .025) var(--accent), 0 0 calc(var(--card) * .25) rgba(255, 200, 61, .85);
    animation: glowPulse 1.2s ease-in-out infinite;
}
@keyframes glowPulse { 50% { box-shadow: 0 0 0 calc(var(--card) * .035) #fff4c2, 0 0 calc(var(--card) * .35) rgba(255, 200, 61, 1); } }
.card.floater.wrong .face.front { box-shadow: 0 0 0 calc(var(--card) * .02) var(--bad), 0 calc(var(--card) * .08) calc(var(--card) * .18) rgba(0, 0, 0, .55); }

.spark {
    position: fixed; width: 10px; height: 10px; margin: -5px 0 0 -5px;
    border-radius: 50%; pointer-events: none; z-index: 70;
    background: var(--c);
    box-shadow: 0 0 10px var(--c);
}
.spark.star { border-radius: 0; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); width: 18px; height: 18px; margin: -9px 0 0 -9px; }

/* Großansicht */
#stage {
    position: fixed; inset: 0; z-index: 50;
    visibility: hidden; opacity: 0;
    transition: opacity .3s, visibility 0s .3s;
    cursor: pointer;
}
#stage.show { visibility: visible; opacity: 1; transition: opacity .3s; }
.stage-backdrop {
    position: absolute; inset: 0;
    background: var(--stage-backdrop);
    backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
}
.stage-text {
    position: absolute; left: 0; right: 0; top: var(--msg-top, 80%);
    text-align: center; z-index: 61; pointer-events: none; padding: 0 16px;
}
#stage-msg {
    font-size: clamp(24px, 4vw, 48px); font-weight: 900;
    text-shadow: 0 4px 20px rgba(0, 0, 0, .6);
    min-height: 1.2em;
}
#stage-msg.good { color: var(--accent); animation: msgPop .5s cubic-bezier(.2, 1.4, .4, 1); }
#stage-msg.bad { color: #ffd2d2; animation: msgPop .4s; }
@keyframes msgPop { from { transform: scale(.4); opacity: 0; } }
#stage-hint {
    margin-top: 6px; color: var(--muted); font-weight: 700;
    animation: hintPulse 1.6s ease-in-out infinite;
}
@keyframes hintPulse { 50% { opacity: .45; } }

/* HUD (Spieler in der Ecke) */
#hud {
    position: fixed; top: 16px; left: 16px; z-index: 55;   /* bleibt über der Großansicht sichtbar */
    width: clamp(210px, 19vw, 290px);
    max-height: calc(100vh - 32px);
    display: flex; flex-direction: column; gap: 10px;
}
.hud-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hud-diff {
    margin-left: auto; padding: 6px 10px; border-radius: 10px;
    background: var(--panel); border: 1px solid var(--line);
    font-size: .8rem; font-weight: 800; color: var(--muted); white-space: nowrap;
}
#hud-body { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; overflow-x: visible; padding: 4px; margin: -4px; }

.hud-player {
    --pc: #888;
    position: relative;
    display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
    padding: 10px 12px; border-radius: 16px;
    background: var(--panel); border: 1px solid var(--line);
    border-left: 6px solid var(--pc);
    transition: transform .35s cubic-bezier(.2, 1.3, .4, 1), background .3s, box-shadow .3s, opacity .3s;
}
body.mode-multi .hud-player:not(.active) { opacity: .72; }
.hud-player.active {
    transform: scale(1.04);
    background: linear-gradient(135deg, var(--pc-a), rgba(255, 255, 255, .06));
    box-shadow: 0 0 0 2px var(--pc), 0 10px 30px var(--pc-a);
    opacity: 1;
}
.hud-avatar {
    width: 50px; height: 50px; border-radius: 50%;
    border: 3px solid var(--pc); background: #fff center / cover no-repeat;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .35);
}
.hud-player.active .hud-avatar { animation: avatarBounce 1.6s ease-in-out infinite; }
@keyframes avatarBounce { 50% { transform: translateY(-3px) rotate(-5deg); } }
.hud-name { font-weight: 900; font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-sub { font-size: .78rem; color: var(--muted); font-weight: 700; }
.hud-badge {
    display: none; font-size: .68rem; font-weight: 900; text-transform: uppercase; letter-spacing: .05em;
    background: var(--pc); color: #111; padding: 1px 7px; border-radius: 999px; margin-left: 4px; vertical-align: middle;
}
.hud-player.active .hud-badge { display: inline-block; }
.hud-pairs {
    font-size: 1.9rem; font-weight: 900; min-width: 1.6em; text-align: center;
    color: var(--text); text-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.hud-pairs.bump { animation: bump .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes bump { 40% { transform: scale(1.6); color: var(--accent); } }
.hud-player .hud-avatar.bump { animation: avatarGet .6s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes avatarGet { 40% { transform: scale(1.25) rotate(8deg); box-shadow: 0 0 0 4px var(--accent), 0 0 24px var(--accent); } }
.hud-timer {
    grid-column: 1 / -1; height: 7px; border-radius: 4px;
    background: rgba(255, 255, 255, .14); overflow: hidden; display: none;
}
.hud-player.active .hud-timer.on { display: block; }
.hud-timer i { display: block; height: 100%; width: 100%; background: var(--pc); border-radius: inherit; }
.hud-timer.warn i { background: #ef4444; }
.hud-time {
    position: absolute; right: 10px; top: -9px;
    font-size: .75rem; font-weight: 900; padding: 1px 7px; border-radius: 999px;
    background: #111a; border: 1px solid var(--line); display: none;
}
.hud-player.active .hud-time.on { display: block; }
.hud-time.warn { background: #ef4444; animation: bump .5s; }

.hud-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat {
    padding: 10px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
}
.stat b { display: block; font-size: 1.6rem; font-weight: 900; line-height: 1.1; }
.stat span { font-size: .75rem; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.stat.wide { grid-column: 1 / -1; }
.progress { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .12); overflow: hidden; margin-top: 6px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); width: 0; transition: width .5s; }

/* Hochformat: HUD oben als Leiste */
body.layout-tall #hud { width: auto; left: 16px; right: 16px; max-height: none; }
/* Spieler-Panel rechts (Theme: --hud-side: right) – game.js setzt body[data-hud] aus der CSS-Variable */
body[data-hud="right"]:not(.layout-tall) #hud { left: auto; right: 16px; }
body[data-hud="right"]:not(.layout-tall) .hud-tools { flex-direction: row-reverse; }
body[data-hud="right"]:not(.layout-tall) .hud-diff { margin-left: 0; margin-right: auto; }

h1, h2, h3, .logo { font-family: var(--heading-font); }
body.layout-tall #hud-body { flex-direction: row; flex-wrap: wrap; overflow: visible; }
body.layout-tall .hud-player { flex: 1 1 150px; padding: 6px 10px; gap: 8px; }
body.layout-tall .hud-avatar { width: 36px; height: 36px; }
body.layout-tall .hud-pairs { font-size: 1.4rem; }
body.layout-tall .hud-stats { flex: 1 1 100%; grid-template-columns: repeat(3, 1fr); }
body.layout-tall .stat { padding: 6px 10px; }
body.layout-tall .stat b { font-size: 1.15rem; }
body.layout-tall .stat.wide { grid-column: auto; }

/* Toast (Spielerwechsel etc.) */
#toast {
    position: fixed; left: 50%; top: 18px; z-index: 80;
    transform: translate(-50%, -260%);
    opacity: 0;
    padding: 10px 22px; border-radius: 999px;
    font-weight: 900; font-size: 1.1rem;
    background: var(--tc, #333); color: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
    text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
    transition: transform .4s cubic-bezier(.2, 1.3, .4, 1), opacity .3s;
    pointer-events: none; white-space: nowrap;
    display: flex; align-items: center; gap: 10px;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }
#toast img { width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 2px solid #fff; }

#confetti { position: fixed; inset: 0; z-index: 1000; pointer-events: none; width: 100%; height: 100%; }

/* ------------------------------------------------------- Overlays ------ */
.overlay {
    position: fixed; inset: 0; z-index: 200;
    display: none; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
    background: rgba(8, 10, 30, .75); backdrop-filter: blur(6px);
}
.overlay.show { display: flex; }
.loader { display: flex; gap: 10px; perspective: 300px; }
.loader span {
    width: 34px; height: 46px; border-radius: 6px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    animation: loaderFlip 1.2s ease-in-out infinite;
}
.loader span:nth-child(2) { animation-delay: .15s; }
.loader span:nth-child(3) { animation-delay: .3s; }
@keyframes loaderFlip { 50% { transform: rotateY(180deg); background: #fff; } }
#loading-text { font-weight: 800; color: var(--muted); }

.modal {
    position: fixed; inset: 0; z-index: 150;
    display: none; align-items: center; justify-content: center;
    padding: 16px;
    background: var(--overlay-bg); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.modal.show { display: flex; animation: fadeIn .25s; }
.modal-box {
    position: relative;
    width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto;
    padding: 24px 26px;
    border-radius: 24px;
    background: var(--modal-bg);
    border: 1px solid var(--line);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
    animation: popIn .4s cubic-bezier(.2, 1.3, .4, 1);
    user-select: text;
}
.modal-box.wide { max-width: 760px; }
.modal-box.small { max-width: 400px; }
.modal-box h2 { margin: 0 0 14px; }
.modal-close {
    position: absolute; right: 14px; top: 14px; width: 36px; height: 36px; border-radius: 50%;
    border: 1px solid var(--line); background: var(--panel);
}
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }
@keyframes popIn { from { transform: scale(.85) translateY(20px); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } }

.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 12px; }
.avatar-opt {
    aspect-ratio: 1; border-radius: 50%; padding: 0; border: 4px solid transparent;
    background: #fff center / cover no-repeat; box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
    transition: transform .2s, border-color .2s; position: relative;
}
.avatar-opt:hover { transform: scale(1.1) rotate(-5deg); }
.avatar-opt.active { border-color: var(--accent); }
.avatar-opt.used::after {
    content: attr(data-used); position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
    font-size: .62rem; font-weight: 900; padding: 1px 6px; border-radius: 999px; background: var(--uc, #555); color: #fff;
    white-space: nowrap; max-width: 110%; overflow: hidden; text-overflow: ellipsis;
}

/* Bestenliste */
.hs-table table { width: 100%; border-collapse: collapse; }
.hs-table th, .hs-table td { padding: 8px 8px; text-align: left; }
.hs-table th { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.hs-table tbody tr { border-top: 1px solid var(--line); animation: rowIn .3s both; }
.hs-table .r { text-align: right; font-variant-numeric: tabular-nums; }
.hs-table .rank { font-weight: 900; width: 2.6em; }
.hs-table .who { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.hs-table .who img, .hs-table .who .noav {
    width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--pc); background: #fff; flex: none;
}
.hs-table tr.me td { background: rgba(255, 200, 61, .15); }
.hs-empty { text-align: center; color: var(--muted); padding: 30px 0; }

.hs-link { display: inline-block; margin: -6px 0 6px; font-size: .85rem; font-weight: 700; color: var(--accent); text-decoration: none; }
.hs-link:hover { color: #fff; }

/* Bestenliste als eigene Seite (highscore/) */
.hs-page {
    position: relative; z-index: 1;
    max-width: 980px; margin: 0 auto; padding: 24px 16px 40px;
    display: flex; flex-direction: column; gap: 18px;
}
.hs-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; }
.hs-head h1 { margin: 0; font-size: clamp(26px, 4.4vw, 46px); font-weight: 900; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.hs-head h1 small { font-size: .42em; color: var(--muted); font-weight: 800; }
.hs-cup { display: inline-block; animation: trophy 1.2s cubic-bezier(.2, 1.4, .4, 1) both; }
.hs-page .panel { padding: 20px 22px; }
.hs-page .hs-table td { padding: 10px 10px; font-size: 1.05rem; }
.hs-page .hs-table .who img, .hs-page .hs-table .who .noav { width: 42px; height: 42px; }
.hs-page .hs-table tr.top td { background: rgba(255, 200, 61, .07); }
.hs-page .hs-table .rank { font-size: 1.25rem; }
.hs-meta { margin: 10px 0 0; text-align: right; color: var(--muted); font-size: .8rem; }
a.btn { color: var(--text); text-decoration: none; }

/* Bestenliste auf schmalen Bildschirmen: Datum ausblenden, kompakter, notfalls seitlich scrollen */
.hs-table { overflow-x: auto; }
@media (max-width: 560px) {
    .hs-table th:last-child, .hs-table td:last-child { display: none; }
    .hs-table td, .hs-page .hs-table td { padding: 7px 4px; font-size: .92rem; }
    .hs-table th { padding: 6px 4px; font-size: .62rem; letter-spacing: 0; }
    .hs-page .panel { padding: 14px 12px; }
    .hs-table .who { gap: 6px; }
    .hs-page .hs-table .who img, .hs-page .hs-table .who .noav { width: 32px; height: 32px; }
}
.hs-page .menu-footer { max-width: none; margin-top: 0; }

/* Spielende */
.end-head { text-align: center; }
.end-trophy { font-size: 64px; display: inline-block; animation: trophy 1.2s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes trophy { 0% { transform: scale(0) rotate(-30deg); } 60% { transform: scale(1.25) rotate(8deg); } }
.end-head h2 { font-size: 1.8rem; margin: 6px 0 4px; }
.end-head p { color: var(--muted); margin: 0 0 16px; font-weight: 700; }
.end-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.end-stats .stat { text-align: center; }
.end-rank {
    margin-top: 14px; text-align: center; font-weight: 900; font-size: 1.1rem;
    padding: 10px; border-radius: 14px; background: rgba(255, 200, 61, .15); border: 1px solid rgba(255, 200, 61, .4);
}
.podium { display: grid; gap: 8px; }
.podium-row {
    display: grid; grid-template-columns: 2.2em auto 1fr auto; gap: 12px; align-items: center;
    padding: 8px 12px; border-radius: 14px; background: var(--panel); border-left: 6px solid var(--pc);
    animation: rowIn .4s both;
}
.podium-row.win { background: linear-gradient(135deg, var(--pc-a), rgba(255, 255, 255, .06)); box-shadow: 0 0 0 2px var(--pc); }
.podium-row .place { font-size: 1.4rem; font-weight: 900; text-align: center; }
.podium-row img { width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--pc); background: #fff; }
.podium-row .nm { font-weight: 900; }
.podium-row .nm small { display: block; color: var(--muted); font-weight: 700; }
.podium-row .pp { font-size: 1.6rem; font-weight: 900; }

@media (prefers-reduced-motion: reduce) {
    .menu-floaters, .logo .tile { animation: none !important; }
}
/* ╚══ ʕ•ᴥ•ʔ  BuffyBear · https://www.buffybear.de/ · Ende von assets/css/game.css ╝ */
