/* =========================================================
   DISC MASTERS – game.css (v2)
   Mobile: pionowo, cały ekran. PC: poziomo, max 1200px.
   ========================================================= */

:root {
    --bg: #050914;
    --bg2: #0a1430;
    --panel: rgba(8, 16, 38, .90);
    --cyan: #00e5ff;
    --blue: #2f7bff;
    --gold: #ffc83d;
    --green: #3dff8a;
    --red: #ff4466;
    --text: #e8f1ff;
    --muted: #8fa3c7;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

body {
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    color: var(--text);
    background: radial-gradient(1100px 600px at 15% -10%, rgba(47, 123, 255, .25), transparent 60%),
                radial-gradient(900px 500px at 100% 110%, rgba(0, 229, 255, .18), transparent 60%),
                linear-gradient(180deg, var(--bg2), var(--bg));
    background-attachment: fixed;
    display: flex;
    justify-content: center;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.game-container {
    width: 100%;
    max-width: 1200px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px;
    overflow: hidden;
}

/* ===== HUD ===== */
.hud {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 6px 12px;
    border: 1px solid rgba(0, 229, 255, .25);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: 0 0 20px rgba(0, 229, 255, .15);
    flex-shrink: 0;
}
.hud-box { display: flex; flex-direction: column; }
.hud-center { align-items: center; }
.hud-right { align-items: flex-end; }
.hud-label { font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.hud-value {
    font-size: 1.45rem; font-weight: 800; color: var(--cyan);
    text-shadow: 0 0 10px rgba(0, 229, 255, .6);
    font-variant-numeric: tabular-nums;
    display: inline-block;
    transform-origin: left center;
}
.timer {
    font-size: 2rem; font-weight: 900; color: #fff;
    text-shadow: 0 0 12px rgba(47, 123, 255, .9);
    font-variant-numeric: tabular-nums;
}
/* ===== STATYSTYKI (mobile: pasek, PC: panel boczny) ===== */
.stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    height: 34px;               /* stała wysokość – brak skoków układu */
    padding: 0 10px;
    background: rgba(8, 16, 38, .6);
    border-radius: 10px;
    font-size: .8rem;
    color: var(--muted);
    flex-shrink: 0;
    overflow: hidden;
    white-space: nowrap;
}
.stat { display: flex; align-items: baseline; gap: 5px; }
.stat-label { font-size: .65rem; letter-spacing: .08em; text-transform: uppercase; }
.stat b { color: #fff; font-variant-numeric: tabular-nums; }
.stat-mult b { color: var(--gold); min-width: 2.2ch; }
.stat-discs { display: flex; align-items: center; gap: 8px; }
.dc { display: inline-flex; align-items: center; gap: 3px; }
.dc b { color: #fff; font-variant-numeric: tabular-nums; min-width: 1.6ch; }

.mute-btn {
    font-size: 1rem;
    background: transparent;
    border: 1px solid rgba(143, 163, 199, .4);
    border-radius: 999px;
    width: 30px; height: 26px;
    color: var(--text);
    cursor: pointer;
    line-height: 1;
    flex: 0 0 auto;
}

.progress {
    height: 6px; border-radius: 999px; overflow: hidden;
    background: rgba(143, 163, 199, .2);
    border: 1px solid rgba(0, 229, 255, .2);
    flex-shrink: 0;
}
.progress-bar {
    height: 100%; width: 100%;
    background: linear-gradient(90deg, var(--blue), var(--cyan));
    transition: width .1s linear;
}

/* ===== ARENA – wypełnia całą wolną przestrzeń ===== */
.arena {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    border-radius: 16px;
    border: 2px solid rgba(0, 229, 255, .3);
    background: rgba(4, 8, 21, .85);
    box-shadow: 0 0 30px rgba(0, 0, 0, .8), inset 0 0 40px rgba(47, 123, 255, .15);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.board {
    position: relative;
    --cs: 40px;
    overflow: hidden;
    border-radius: 12px;
    touch-action: none;
    background:
        conic-gradient(rgba(255,255,255,.045) 25%, transparent 0 50%, rgba(255,255,255,.045) 0 75%, transparent 0)
        0 0 / calc(var(--cs) * 2) calc(var(--cs) * 2);
    flex: 0 0 auto;
}

/* ===== PŁYTY ===== */
.tile {
    position: absolute;
    left: 0; top: 0;
    width: var(--cs);
    height: var(--cs);
    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform;
    cursor: grab;
    touch-action: none;
}
.tile.held { cursor: grabbing; }

.disc {
    position: relative;
    width: 86%;
    height: 86%;
    border-radius: 50%;
    box-shadow: 0 3px 8px rgba(0,0,0,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: transform .15s ease;
}
.tile.held .disc { transform: scale(1.12); }
.disc::after {
    content: "";
    position: absolute;
    left: 50%; top: 50%; transform: translate(-50%,-50%);
    width: 22%; height: 22%;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #1a2a5a, #040812 85%);
    border: 2px solid rgba(255,255,255,.55);
    box-shadow: inset 0 0 4px rgba(0,0,0,.8), 0 0 3px rgba(255,255,255,.2);
}
.disc-label {
    position: absolute;
    top: 17%;
    font-size: calc(var(--cs) * .16);
    font-weight: 900;
    letter-spacing: .03em;
    pointer-events: none;
    z-index: 2;
}
.mini-disc { display: inline-block; width: 13px; height: 13px; border-radius: 50%; vertical-align: middle; }

.disc.cd, .mini-disc.cd {
    background: conic-gradient(#1a3a2a, #2ecc71, #a8e6cf, #27ae60, #1abc9c, #16a085, #1a3a2a);
    box-shadow: 0 0 10px rgba(46, 204, 113, .45), 0 3px 8px rgba(0,0,0,.5);
}
.disc.cd .disc-label { color: #0a1f14; }

/* MD MiniDisc - kwadratowe pudełko z płytą w środku - grafika jak w grze */
.disc.md {
    width: 88%; height: 88%; border-radius: 6px;
    background: linear-gradient(135deg, #2a2a3a 0%, #3a3a5a 15%, #4a4a6a 15%, #3a3a5a 20%, #2a2a3a 25%, #4a4a6a 100%);
    border: 2px solid #9b8cff;
    box-shadow: 0 0 14px rgba(155,140,255,.6), inset 0 0 12px rgba(0,0,0,.7), 0 3px 8px rgba(0,0,0,.5);
    position: relative; overflow: hidden;
}
.disc.md::before {
    content: ""; position: absolute; width: 72%; height: 72%; border-radius: 50%;
    background: conic-gradient(#5a4ab0, #9b8cff, #c4b5ff, #7a5cff, #5a4ab0);
    left: 50%; top: 54%; transform: translate(-50%,-50%);
    box-shadow: 0 0 8px rgba(155,140,255,.8);
}
.disc.md::after {
    content: ""; position: absolute; width: 18%; height: 22%; border-radius: 2px;
    background: linear-gradient(#888, #ccc 50%, #888); border: 1px solid #aaa;
    left: 50%; top: 8%; transform: translateX(-50%);
    box-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.disc.md .disc-label { position: absolute; bottom: 12%; top: auto; font-size: calc(var(--cs) * .13); color: #fff; text-shadow: 0 0 4px #000, 0 0 8px #9b8cff; z-index: 2; }
.mini-disc.md { background: conic-gradient(#5a4ab0, #9b8cff, #c4b5ff, #7a5cff, #5a4ab0); box-shadow: 0 0 8px rgba(155,140,255,.6); }
.tile.bonus-md .disc.md { animation: mdPulse .5s ease-in-out infinite !important; box-shadow: 0 0 18px rgba(155,140,255,.9), 0 0 32px rgba(155,140,255,.5), inset 0 0 12px rgba(0,0,0,.7) !important; }
.tile.bonus-md::before { border-radius: 8px; border-color: #9b8cff; animation: mdRing .8s ease-out infinite; }
@keyframes mdPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
@keyframes mdRing { 0% { transform: scale(.85); opacity: .9; } 100% { transform: scale(1.5); opacity: 0; } }
.md-beam { position: absolute; background: linear-gradient(90deg, transparent, #9b8cff 30%, #fff 50%, #9b8cff 70%, transparent); box-shadow: 0 0 20px #9b8cff, 0 0 40px #7a5cff; pointer-events: none; z-index: 8; }
.md-beam.h { height: 6px; width: 100%; top: 50%; }
.md-beam.v { width: 6px; height: 100%; left: 50%; background: linear-gradient(180deg, transparent, #9b8cff 30%, #fff 50%, #9b8cff 70%, transparent); }
.md-flash { position: absolute; width: 36px; height: 36px; background: radial-gradient(circle, #fff 0%, #c4b5ff 25%, #9b8cff 55%, transparent 75%); border-radius: 8px; pointer-events: none; z-index: 9; box-shadow: 0 0 30px #9b8cff; }



/* BLACK - czarna płyta utrudniacz */
.disc.black-disc {
    width: 86%; height: 86%;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #2a2a2a, #0a0a0a 60%, #000 100%);
    border: 2px solid #333;
    box-shadow: 0 0 14px rgba(0,0,0,.9), inset 0 0 12px rgba(255,255,255,.08), 0 3px 10px rgba(0,0,0,.8);
    position: relative;
}
.disc.black-disc::before {
    content: "";
    position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
    width: 78%; height: 78%; border-radius: 50%;
    background: conic-gradient(#111, #222, #0a0a0a, #2a2a2a, #111);
    opacity: 0.9;
}
.disc.black-disc::after {
    content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
    width: 22%; height: 22%; border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #333, #000 80%);
    border: 2px solid #222;
    box-shadow: inset 0 0 4px rgba(0,0,0,.9);
}
.disc.black-disc .disc-label {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
    font-size: calc(var(--cs) * .28); color: #555; z-index: 2;
    text-shadow: 0 0 4px #000;
}
.tile.black-tile { z-index: 4; cursor: not-allowed; }
.tile.black-tile .disc { animation: blackPulse 1.2s ease-in-out infinite; }
@keyframes blackPulse {
    0%,100% { transform: scale(1); box-shadow: 0 0 14px rgba(0,0,0,.9), inset 0 0 12px rgba(255,255,255,.08); }
    50% { transform: scale(1.06); box-shadow: 0 0 22px rgba(80,80,80,.6), inset 0 0 12px rgba(255,255,255,.12); }
}

/* HD-DVD – ciemna bordowa płyta bonusowa */
.disc.hddvd, .mini-disc.hddvd {
    background: conic-gradient(#2a0410, #6d0d26, #9b1b3c, #3d0715, #7a1230, #2a0410);
    box-shadow: 0 0 14px rgba(190, 30, 70, .7), inset 0 0 10px rgba(0,0,0,.6);
    border: 2px solid rgba(255, 90, 120, .55);
}
.disc.hddvd .disc-label { color: #ffd9e0; font-size: calc(var(--cs) * .12); text-shadow: 0 0 4px #000; }
.tile.bonus { z-index: 3; }
.tile.bonus .disc { animation: bonusPulse .7s ease-in-out infinite; }
@keyframes bonusPulse {
    0%,100% { transform: scale(1); box-shadow: 0 0 12px rgba(190,30,70,.7), inset 0 0 10px rgba(0,0,0,.6); }
    50%     { transform: scale(1.12); box-shadow: 0 0 26px rgba(255,60,100,.95), inset 0 0 10px rgba(0,0,0,.6); }
}
.tile.bonus::before {
    content: "";
    position: absolute; inset: 4%;
    border-radius: 50%;
    border: 2px solid #ff4d6d;
    pointer-events: none;
    animation: bonusRing 1s ease-out infinite;
}
@keyframes bonusRing {
    0%   { transform: scale(.9); opacity: .9; }
    100% { transform: scale(1.6); opacity: 0; }
}
.shockwave {
    position: absolute;
    border-radius: 50%;
    border: 4px solid #ffb347;
    box-shadow: 0 0 30px #ff5a2a, inset 0 0 30px #ff5a2a;
    pointer-events: none;
    z-index: 7;
}
.disc.dvd, .mini-disc.dvd {
    background: conic-gradient(#4a0a0a, #e53935, #ffb4a8, #c62828, #ff6659, #b71c1c, #ff9a8a, #4a0a0a);
    box-shadow: 0 0 10px rgba(255, 70, 70, .45), 0 3px 8px rgba(0,0,0,.5);
}
.disc.dvd .disc-label { color: #2b0606; }
.disc.bluray, .mini-disc.bluray { background: conic-gradient(#0a3cff, #5fb4ff, #8a2be2, #00dfff, #0a3cff); }
.disc.bluray .disc-label { color: #fff; text-shadow: 0 0 3px #000; }
.disc.uhd, .mini-disc.uhd {
    background: conic-gradient(#ffcc33, #fff0a0, #b8860b, #ffe27a, #ffcc33);
    box-shadow: 0 0 12px rgba(255, 200, 61, .6);
}
.disc.uhd .disc-label { color: #3d2b00; }
.disc.ld, .mini-disc.ld { background: conic-gradient(#ffffff, #b0c4de, #e6e6fa, #708090, #ffffff); }
.disc.ld { width: 92%; height: 92%; }
.disc.ld .disc-label { color: #111; }

/* zaznaczenie i podpowiedź */
.tile.selected::before {
    content: "";
    position: absolute; inset: 3%;
    border-radius: 12px;
    background: rgba(0, 229, 255, .22);
    box-shadow: inset 0 0 10px var(--cyan);
}
.tile.selected .disc { animation: pulseSelect .8s ease-in-out infinite; }
@keyframes pulseSelect { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.tile.hint .disc { animation: hintPulse 1s ease-in-out infinite; }
@keyframes hintPulse {
    0%,100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.14); filter: brightness(1.5) drop-shadow(0 0 6px #fff); }
}

/* animacje płyt */
.disc.matching { animation: matchPop .28s ease-out forwards; z-index: 5; }
@keyframes matchPop {
    0%   { transform: scale(1); opacity: 1; filter: brightness(1); }
    45%  { transform: scale(1.3) rotate(20deg); opacity: 1; filter: brightness(1.9); }
    100% { transform: scale(0) rotate(90deg); opacity: 0; }
}
.disc.shake { animation: shake .2s ease-in-out; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.disc.reshuffle { animation: reshuffle .5s ease-in-out; }
@keyframes reshuffle {
    0%   { transform: scale(1) rotate(0); }
    45%  { transform: scale(0) rotate(180deg); }
    55%  { transform: scale(0) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

.particle {
    position: absolute;
    width: 7px; height: 7px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 8;
    box-shadow: 0 0 6px currentColor;
}
.pop {
    position: absolute;
    z-index: 9;
    pointer-events: none;
    font-weight: 900;
    font-size: 1.1rem;
    color: #fff;
    text-shadow: 0 0 8px var(--cyan), 0 2px 3px #000;
    white-space: nowrap;
}
.pop.big { color: var(--gold); font-size: 1.4rem; text-shadow: 0 0 12px var(--gold), 0 2px 3px #000; }

.combo-flash {
    position: absolute;
    top: 45%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: 900;
    white-space: nowrap;
    color: var(--gold);
    text-shadow: 0 0 20px var(--gold), 0 0 40px #ff0;
    pointer-events: none;
    z-index: 20;
    animation: comboFloat .9s ease-out forwards;
}
.combo-flash.small { font-size: 1.2rem; color: var(--cyan); text-shadow: 0 0 14px var(--cyan); }
@keyframes comboFloat {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(.5); }
    20%  { opacity: 1; transform: translate(-50%, -60%) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -140%) scale(1); }
}

/* ===== OVERLAY + PAGER ===== */
.overlay {
    position: absolute;
    inset: 0;
    z-index: 30;
    background: rgba(3, 7, 18, .95);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    cursor: default;
}
.overlay.hidden { display: none; }
.overlay { padding: 8px; }
.panel { width: 100%; margin: auto; text-align: center; }

/* Pager – jeden ekran naraz (przesuwany palcem, strzałkami lub zakładkami) */
.panel.pager {
    flex: 1 1 auto; min-height: 0;
    max-width: none; margin: 0;
    display: grid; align-content: center;
    overflow-x: auto; overflow-y: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior: contain;
    touch-action: pan-x pan-y;
    scrollbar-width: none;
}
.pager::-webkit-scrollbar { display: none; }
.pager-start { grid-template-columns: repeat(4, 100%); grid-auto-flow: column; grid-auto-columns: 100%; }
.pager-end   { grid-template-columns: repeat(2, 100%); }
.pg { min-width: 0; padding: 0 8px; align-self: center; scroll-snap-align: start; scroll-snap-stop: always; }
.pager-start .pg-rank  { grid-column: 1; }
.pager-start .pg-main  { grid-column: 2; }
.pager-start .pg-rules { grid-column: 3; }
.pager-start .pg-bonus { grid-column: 4; }
.pager-end .pg-rank    { grid-column: 1; }
.pager-end .pg-result  { grid-column: 2; }

.pager-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 8px; padding-top: 8px; flex: 0 0 auto; }
.pager-tabs button {
    font: inherit; font-size: .72rem; font-weight: 700; letter-spacing: .12em;
    color: var(--muted); background: transparent;
    border: 1px solid rgba(143, 163, 199, .4);
    border-radius: 999px; padding: 5px 14px; cursor: pointer;
}
.pager-tabs button.active {
    color: #031022; background: var(--cyan); border-color: var(--cyan);
    box-shadow: 0 0 12px rgba(0, 229, 255, .6);
}

/* Ekrany z opisami nośników */
.disc-card {
    text-align: center; background: rgba(0,0,0,.3);
    border-radius: 14px; padding: 14px 16px;
    border: 1px solid rgba(0,229,255,.2);
    max-width: 380px; width: 100%; margin: 0 auto;
}
.disc-big { display: block; width: 54px; height: 54px; margin: 0 auto 8px; border-radius: 50%; position: relative; }
.disc-big.cd     { background: conic-gradient(#1a3a2a, #2ecc71, #a8e6cf, #27ae60, #1abc9c, #16a085, #1a3a2a); box-shadow: 0 0 14px rgba(46,204,113,.5); }
.disc-big.dvd    { background: conic-gradient(#4a0a0a, #e53935, #ffb4a8, #c62828, #ff6659, #b71c1c, #ff9a8a, #4a0a0a); box-shadow: 0 0 14px rgba(255,70,70,.5); }
.disc-big.bluray { background: conic-gradient(#0a3cff, #5fb4ff, #8a2be2, #00dfff, #0a3cff); box-shadow: 0 0 14px rgba(95,180,255,.5); }
.disc-big.uhd    { background: conic-gradient(#ffcc33, #fff0a0, #b8860b, #ffe27a, #ffcc33); box-shadow: 0 0 14px rgba(255,200,61,.6); }
.disc-big.ld     { background: conic-gradient(#ffffff, #b0c4de, #e6e6fa, #708090, #ffffff); box-shadow: 0 0 14px rgba(230,230,250,.5); }
.disc-big.hddvd  { background: conic-gradient(#2a0410, #6d0d26, #9b1b3c, #3d0715, #7a1230, #2a0410); box-shadow: 0 0 14px rgba(190,30,70,.7); }
/* poprawione kółko - idealnie w środku dla wszystkich płyt okrągłych */
.disc-big::after {
    content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
    width: 22%; height: 22%; border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #1a2a5a, #040812 85%);
    border: 2px solid rgba(255,255,255,.55);
    box-shadow: inset 0 0 6px rgba(0,0,0,.9), 0 0 4px rgba(255,255,255,.25);
}
.disc-big.md {
    border-radius: 8px;
    background: linear-gradient(135deg, #2a2a3a, #3a3a5a 18%, #4a4a6a 18%, #3a3a5a 22%, #2a2a3a 28%, #3a3a5a 100%);
    border: 2px solid #9b8cff;
    box-shadow: 0 0 16px rgba(155,140,255,.7), inset 0 0 10px rgba(0,0,0,.6);
    overflow: hidden;
}
.disc-big.md::before {
    content: ""; position: absolute; width: 62%; height: 62%; left: 50%; top: 54%; transform: translate(-50%,-50%);
    border-radius: 50%;
    background: conic-gradient(#5a4ab0, #9b8cff, #c4b5ff, #7a5cff, #5a4ab0);
    box-shadow: 0 0 10px rgba(155,140,255,.8);
}
.disc-big.md::after {
    content: ""; position: absolute; width: 36%; height: 16%; left: 50%; top: 10%; transform: translateX(-50%);
    background: linear-gradient(#888, #ccc 50%, #888); border: 1px solid #aaa; border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,.6);
}
/* MD w historii - taka sama grafika jak w grze: kwadratowe pudełko z płytą */

.disc-card h3 { color: var(--cyan); font-size: 1.05rem; margin-bottom: 4px; }
.disc-meta { font-size: .72rem; letter-spacing: .06em; color: var(--gold); margin-bottom: 8px; }
.disc-text { text-align: justify; text-justify: inter-word; hyphens: auto; -webkit-hyphens: auto; font-size: .78rem; line-height: 1.5; color: var(--muted); }

/* Strzałki lewo/prawo – tylko na PC (na telefonie przesuwa się palcem) */
.pager-arrow {
    display: none;
    position: absolute; top: 50%; transform: translateY(-50%);
    z-index: 2;
    flex-direction: column; align-items: center; gap: 6px;
    background: none; border: 0;
    color: var(--muted); font: inherit;
    cursor: pointer; padding: 8px;
    transition: color .15s ease, transform .15s ease;
}
.pager-arrow.prev { left: 16px; }
.pager-arrow.next { right: 16px; }
.pager-arrow[hidden] { display: none !important; }
.pager-arrow .pa-icon {
    width: 52px; height: 52px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: 2.2rem; line-height: 1; padding-bottom: 4px;
    color: var(--cyan);
    border: 1px solid rgba(0, 229, 255, .45);
    background: rgba(8, 16, 38, .7);
    box-shadow: 0 0 14px rgba(0, 229, 255, .25);
    transition: background .15s ease, box-shadow .15s ease;
}
.pager-arrow .pa-label { font-size: .68rem; font-weight: 700; letter-spacing: .14em; }
.pager-arrow:hover { color: #fff; }
.pager-arrow:hover .pa-icon { background: rgba(0, 229, 255, .22); box-shadow: 0 0 20px rgba(0, 229, 255, .55); }
.pager-arrow.prev:active { transform: translateY(-50%) translateX(-3px); }
.pager-arrow.next:active { transform: translateY(-50%) translateX(3px); }

.title { font-size: 2rem; font-weight: 900; letter-spacing: .08em; color: #fff; margin-bottom: 6px; }
.title span { color: var(--cyan); }
.title-link {
    display: inline-flex; align-items: center; justify-content: center; gap: .3em;
    color: inherit; text-decoration: none; white-space: nowrap;
    transition: text-shadow .15s ease;
}
.title-link:hover, .title-link:focus-visible { text-shadow: 0 0 14px rgba(0, 229, 255, .7); }
.title-text { font-weight: inherit; }
.title-disc {
    flex: 0 0 auto;
    width: 1.7em; height: 1.7em;
    border-radius: 50%;
    background: conic-gradient(#0a3cff, #5fb4ff, #8a2be2, #00dfff, #ffcc33, #0a3cff);
    box-shadow: 0 0 18px rgba(95, 180, 255, .65), 0 0 36px rgba(0, 229, 255, .35);
    display: grid; place-items: center;
    animation: titleDiscSpin 2.8s linear infinite, titleDiscGlow 1.8s ease-in-out infinite alternate;
    position: relative;
}
.title-disc::after {
    content: ""; width: 22%; height: 22%; border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #1a2a5a, #040812 70%);
    border: 2px solid rgba(255,255,255,.55);
    box-shadow: inset 0 0 6px rgba(0,0,0,.9), 0 0 4px rgba(255,255,255,.3);
    position: relative; z-index: 1;
}
@keyframes titleDiscSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes titleDiscGlow {
    0% { box-shadow: 0 0 18px rgba(95,180,255,.65), 0 0 36px rgba(0,229,255,.25); filter: brightness(1); }
    100% { box-shadow: 0 0 26px rgba(95,180,255,.9), 0 0 50px rgba(0,229,255,.5), 0 0 70px rgba(47,123,255,.25); filter: brightness(1.15); }
}
.title-link:hover .title-disc { animation-duration: 0.9s, 0.6s; }
@keyframes titleDiscSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes titleDiscGlow {
    0% { box-shadow: 0 0 18px rgba(95,180,255,.65), 0 0 36px rgba(0,229,255,.25); filter: brightness(1); }
    100% { box-shadow: 0 0 26px rgba(95,180,255,.9), 0 0 50px rgba(0,229,255,.5), 0 0 70px rgba(47,123,255,.25); filter: brightness(1.15); }
}
.title-link:hover .title-disc { animation-duration: 0.9s, 0.6s; }
.lead { margin: 0 auto 14px; font-size: .85rem; color: var(--muted); max-width: 320px; }

.btn {
    width: 100%; max-width: 280px;
    margin: 12px 0; padding: 14px;
    font: inherit; font-size: 1.05rem; font-weight: 900;
    color: #031022; border: 0; border-radius: 999px;
    background: linear-gradient(135deg, var(--cyan), var(--blue));
    box-shadow: 0 0 20px rgba(0, 229, 255, .5);
    cursor: pointer;
    transition: transform .12s ease;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .6; }

.name-field { margin: 10px auto; width: 100%; max-width: 260px; }
.name-field label { display: block; font-size: .72rem; color: var(--muted); margin-bottom: 4px; }
.name-field input {
    width: 100%; padding: 11px; border-radius: 999px;
    border: 1px solid rgba(0, 229, 255, .4);
    background: rgba(8, 16, 38, .8);
    color: #fff; text-align: center; font-size: 1rem;
    user-select: text; -webkit-user-select: text;
}
.name-field .req { color: var(--red); }
.name-error { color: var(--red); font-size: .8rem; min-height: 1.2em; }
.name-error[hidden] { display: none; }

.ranking { width: 100%; max-width: 380px; margin: 6px auto 0; border-collapse: separate; border-spacing: 0; font-size: .78rem; }
.ranking th { color: var(--muted); padding: 4px; border-bottom: 1px solid rgba(255,255,255,.1); }
.ranking td { padding: 5px 3px; }
.ranking tr.my-rank {
    background: linear-gradient(90deg, rgba(61, 255, 138, .38), rgba(61, 255, 138, .18)) !important;
    border: 1px solid rgba(61, 255, 138, .65) !important;
    box-shadow: 0 0 16px rgba(61, 255, 138, .5), inset 0 0 12px rgba(61, 255, 138, .22) !important;
    color: #d6ffe6 !important; font-weight: 800;
    animation: myRankPulse 1.8s ease-in-out infinite alternate;
}
.ranking tr.my-rank td { color: #e0ffe8 !important; text-shadow: 0 0 10px rgba(61, 255, 138, .9) !important; font-weight: 800; }
.ranking tr.my-rank td:first-child { border-radius: 10px 0 0 10px; }
.ranking tr.my-rank td:last-child { border-radius: 0 10px 10px 0; }
@keyframes myRankPulse {
  0% { box-shadow: 0 0 12px rgba(61,255,138,.4), inset 0 0 8px rgba(61,255,138,.15); }
  100% { box-shadow: 0 0 22px rgba(61,255,138,.65), inset 0 0 14px rgba(61,255,138,.25); }
}
.sub { font-size: .9rem; color: var(--cyan); margin: 8px 0; }

.rules-box {
    text-align: left; background: rgba(0,0,0,.3);
    border-radius: 14px; padding: 14px 16px;
    font-size: .8rem; line-height: 1.5; color: var(--muted);
    border: 1px solid rgba(0,229,255,.2);
    max-width: 380px; width: 100%; margin: 0 auto;
}
.rules-box h3 { color: var(--cyan); font-size: 1rem; margin-bottom: 8px; text-align: center; }
.rules-box ul { padding-left: 18px; }
.rules-box li { margin-bottom: 6px; }
.rules-box strong { color: var(--text); }

.gameover { font-size: 1.8rem; color: var(--red); }
.final strong { color: var(--cyan); font-size: 1.6rem; }
.final-best { margin: 4px 0; color: var(--muted); }
.summary-discs { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 6px; margin: 10px 0; font-size: .8rem; }
.save-status { min-height: 1.3em; margin: 6px 0; font-size: .85rem; color: var(--muted); }

.site-footer { display: none; }
.footer-link {
    display: inline-flex; align-items: center; gap: 7px;
    color: var(--muted); text-decoration: none;
    transition: color .15s ease;
}
.footer-link .mini-disc { width: 12px; height: 12px; flex: 0 0 auto; }
.footer-link:hover, .footer-link:focus-visible { color: var(--cyan); }

/* ===== MOBILE (≤799px) – pionowo, cały ekran ===== */
@media (max-width: 799px) {
    .pager-tabs { gap: 5px; }
    .pager-tabs button { padding: 4px 9px; font-size: .62rem; letter-spacing: .06em; }
    .game-container { max-width: none; padding: 4px; gap: 4px; }
    .arena { border-radius: 12px; }

    .pg .title { font-size: clamp(1.7rem, 8vw, 2.2rem); }
    .btn { padding: 12px; font-size: 1rem; }
    .rules-box { font-size: .78rem; padding: 12px; }
    .ranking { font-size: .72rem; }
    .gameover { font-size: 1.6rem; }
    .final strong { font-size: 1.4rem; }
}

@media (max-width: 799px) and (max-height: 640px) {
    .hud { padding: 3px 10px; }
    .hud-value { font-size: 1.2rem; }
    .timer { font-size: 1.6rem; }
    .stats { height: 30px; font-size: .72rem; }
    .title { font-size: 1.5rem; }
    .lead { font-size: .75rem; margin-bottom: 6px; }
}

/* ===== DESKTOP (≥800px) – poziomo, max 1200px ===== */
@media (min-width: 800px) {
    body { align-items: center; padding: 12px; }

    .game-container {
        display: grid;
        grid-template-columns: 220px minmax(0, 1fr);
        grid-template-rows: auto auto minmax(0, 1fr) auto;
        grid-template-areas:
            "hud hud"
            "prog prog"
            "side arena"
            "foot foot";
        gap: 12px;
        max-width: 1200px;
        height: min(100%, 820px);
        padding: 12px;
    }
    .hud { grid-area: hud; padding: 10px 22px; }
    .hud-value { font-size: 2rem; }
    .timer { font-size: 2.6rem; }
    .progress { grid-area: prog; height: 8px; }

    .stats {
        grid-area: side;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 12px;
        height: auto;
        padding: 14px;
        font-size: .95rem;
        border: 1px solid rgba(0, 229, 255, .18);
        border-radius: 14px;
        overflow: visible;
    }
    .stat {
        justify-content: space-between;
        align-items: center;
        padding: 10px 12px;
        background: rgba(255, 255, 255, .04);
        border-radius: 10px;
    }
    .stat b { font-size: 1.3rem; }
    .stat-discs {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 10px 12px;
        background: rgba(255, 255, 255, .04);
        border-radius: 10px;
    }
    .dc { justify-content: space-between; }
    .dc .mini-disc { width: 22px; height: 22px; }
    .dc b { font-size: 1.1rem; text-align: right; }
    .mute-btn { width: 100%; height: 38px; font-size: 1.2rem; margin-top: auto; border-radius: 10px; }

    .arena { grid-area: arena; width: auto; height: auto; }

    .site-footer {
        display: block; grid-area: foot;
        text-align: center; font-size: .65rem; color: var(--muted);
    }

    /* ekran startowy/końcowy: jedna strona naraz, strzałki po bokach */
    .overlay { padding: 20px 110px 14px; }
    .pager-arrow { display: flex; }
    .pg { padding: 0 12px; }

    .title { font-size: 2.6rem; }
    .lead { font-size: .95rem; max-width: 400px; }
    .disc-card { max-width: 700px; padding: 22px 28px; }
    .disc-text { font-size: .95rem; }
    .rules-box { max-width: 700px; font-size: .95rem; padding: 22px 28px; }
    .rules-box h3 { font-size: 1.3rem; }
    .ranking { max-width: 700px; font-size: .92rem; }
    .ranking td { padding: 7px 4px; }
    .sub { font-size: 1.1rem; }
    .gameover { font-size: 2.2rem; }
    .final strong { font-size: 1.9rem; }
}


@media (max-width: 799px) {
    .shockwave {
        border-width: 6px;
        box-shadow: 0 0 40px #ff5a2a, 0 0 20px #ffb347, inset 0 0 30px #ff5a2a;
    }
    .tile {
        transition: transform 0.22s ease-out;
    }
    .particle {
        width: 9px;
        height: 9px;
        box-shadow: 0 0 8px currentColor;
    }
    .disc.matching {
        animation-duration: 0.42s;
    }
}

.explosion-flash {
    position: absolute; width: 24px; height: 24px; border-radius: 50%;
    background: radial-gradient(circle, #fff 0%, #ffe27a 20%, #ff8a2a 45%, #ff2a2a 70%, transparent 75%);
    box-shadow: 0 0 30px #fff, 0 0 60px #ff8a2a, 0 0 90px #ff2a2a; pointer-events: none; z-index: 9;
}
.particle.big { width: 10px; height: 10px; }
.spark { position: absolute; width: 2px; height: 12px; background: linear-gradient(#fff, #ffb347); border-radius: 2px; pointer-events: none; z-index: 8; box-shadow: 0 0 6px #fff; }
.disc.exploding { animation: explodePop .46s cubic-bezier(.22,.75,.28,1) forwards !important; }
@keyframes explodePop {
    0% { transform: scale(1) rotate(0deg); filter: brightness(1); }
    30% { transform: scale(1.45) rotate(12deg); filter: brightness(2) drop-shadow(0 0 10px currentColor); }
    100% { transform: scale(0) rotate(45deg); opacity: 0; filter: brightness(1.5); }
}
.shockwave { position: absolute; border-radius: 50%; pointer-events: none; z-index: 7; will-change: transform, opacity; }


/* ===== MOBILE PERFORMANCE & AUDIO FIXES ===== */
.tile {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}
.disc {
    will-change: transform, filter;
    backface-visibility: hidden;
}
.particle, .pop, .combo-flash, .shockwave, .explosion-flash, .md-beam, .md-flash {
    will-change: transform, opacity;
    backface-visibility: hidden;
}
@media (max-width: 799px) {
    /* Wyłączenie zasobożernych animacji ciągłych na urządzeniach mobilnych - 60 FPS */
    .tile.bonus .disc, .tile.bonus-md .disc, .tile.black-tile .disc {
        animation: none !important;
    }
    .shockwave { border-width: 2px !important; }
    .disc, .disc-big, .mini-disc { box-shadow: 0 2px 6px rgba(0,0,0,.4) !important; }
    .disc::after, .disc-big::after { box-shadow: none !important; }
    .pager { -webkit-overflow-scrolling: touch; scroll-behavior: smooth; }
    .panel { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
    /* Dodatkowo - tytuł bez pulsowania na mobile */
    .title-disc { animation: none !important; }
}

/* ===== PASTELOWY PRZYCISK DEMO ===== */
.btn.btn-demo{
    display:inline-flex; align-items:center; justify-content:center;
    background: linear-gradient(135deg, #ffd6e7 0%, #ffe8d6 20%, #fff2b8 40%, #d6f5d6 60%, #d6e7ff 80%, #e2d6ff 100%);
    color:#4a3450; 
    border:1.5px solid rgba(255,255,255,.9);
    box-shadow: 0 0 18px rgba(255,214,231,.55), 0 4px 12px rgba(0,0,0,.2);
    text-decoration:none;
    margin-top:0;
    font-size:1rem;
    letter-spacing:.04em;
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.btn.btn-demo:hover{
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 0 24px rgba(255,214,231,.75), 0 6px 16px rgba(0,0,0,.25);
    filter: brightness(1.05);
}
.btn.btn-demo:active{ transform:scale(.97); }
.start-btns{display:flex; flex-direction:column; align-items:center; gap:10px; margin-top:8px;}

.btn.btn-secondary{
    display:inline-flex; align-items:center; justify-content:center;
    width:100%; max-width:280px;
    margin:8px 0 0; padding:12px 16px;
    font-size:.9rem; font-weight:700;
    color:var(--text);
    background: rgba(255,255,255,.08);
    border:1px solid rgba(143,163,199,.35);
    border-radius:12px;
    text-decoration:none;
    box-shadow: 0 2px 0 rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.08);
    transition: transform .08s ease, background .12s ease;
}
.btn.btn-secondary:hover{ background: rgba(255,255,255,.13); }
.btn.btn-secondary:active{ transform: translateY(2px); box-shadow: 0 0 0 rgba(0,0,0,.3); }


/* ===== SUPER BONUS - zniszczenie czarnej i MD - DUŻY BIAŁY 2s+ ===== */
.super-bonus{
    position:absolute; left:50%; top:50%;
    transform:translate(-50%,-50%);
    z-index: 100;
    display:flex; flex-direction:column; align-items:center; gap:2px;
    padding: 22px 36px;
    border-radius: 24px;
    background: radial-gradient(130% 130% at 50% 10%, rgba(255,255,255,0.98), rgba(255,240,180,0.92) 45%, rgba(255,180,0,0.88) 75%, rgba(200,100,0,0.9));
    border: 4px solid #fff;
    box-shadow: 0 0 20px rgba(255,255,255,0.9), 0 0 50px #ffd700, 0 0 100px #ff8a00, 0 12px 40px rgba(0,0,0,0.7), inset 0 0 30px rgba(255,255,255,0.8);
    pointer-events:none;
    text-align:center;
    will-change: transform, opacity, filter;
}
.super-bonus .sb-title{
    font-size: 3rem; font-weight: 950; letter-spacing: .08em; line-height:1;
    color: #ffffff;
    text-shadow: 0 3px 0 #c07a00, 0 0 12px #fff, 0 0 30px #ffd700, 0 2px 20px rgba(0,0,0,0.5);
    animation: sbPulse .6s ease-in-out infinite alternate;
}
.super-bonus .sb-points{
    font-size: 3.4rem; font-weight: 950; line-height:1;
    color: #fff;
    text-shadow: 0 4px 0 #b86c00, 0 0 15px #fff, 0 0 35px #ffd700;
    margin: 2px 0;
}
.super-bonus .sb-sub{
    font-size: 1.15rem; font-weight: 900; line-height:1.2; letter-spacing:.04em;
    color: #3a1f00;
    text-shadow: 0 1px 0 rgba(255,255,255,0.9), 0 0 10px rgba(255,255,255,0.6);
    margin-top:4px;
}
@keyframes sbPulse{
    from{ transform: scale(1); filter: brightness(1); }
    to{ transform: scale(1.04); filter: brightness(1.15); }
}
@media (max-width: 799px){
    .super-bonus{ padding: 16px 20px; border-radius: 18px; }
    .super-bonus .sb-title{ font-size: 2rem; }
    .super-bonus .sb-points{ font-size: 2.4rem; }
    .super-bonus .sb-sub{ font-size: .9rem; }
}

}


/* FIX: zielony ranking na mobile */
@media (max-width: 799px) {
    .ranking tr.my-rank {
        background: linear-gradient(90deg, rgba(61, 255, 138, .34), rgba(61, 255, 138, .16)) !important;
        display: table-row !important;
    }
}
