/* Nutobranie Ekipy. Bez zewnętrznych czcionek i bibliotek: gra ma działać offline, także z file:// */
:root {
    --bg: #05060a;
    --karta: #0e1018;
    --ramka: #232838;
    --tekst: #f4f6fb;
    --szary: #9aa3b8;
    --cyan: #22d3ee;
    --roz: #ec4899;
    --amber: #f59e0b;
    --ziel: #22c55e;
    --fiolet: #a855f7;
    --czerw: #ef4444;
    --runda: #22d3ee;
    --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, 'Roboto Mono', monospace;
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-r: env(safe-area-inset-right, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-l: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: radial-gradient(ellipse at 50% -10%, #141832 0%, var(--bg) 62%);
    color: var(--tekst);
    font-family: var(--font);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
img { display: block; }
.ukryty {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ---------- układ gry ---------- */
/* Góra to tylko runda i komunikaty. Wszystko inne jest pod planszą, obok padu. */
#app {
    position: absolute;
    inset: 0;
    display: grid;
    padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
        "gora gora"
        "scena scena"
        "tablica kciuk";
    touch-action: none;
}
#app.lewa {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
        "gora gora"
        "scena scena"
        "kciuk tablica";
}
/* Wysoki telefon: pod planszą jest tyle miejsca, że panel i pad idą jeden pod drugim. */
#app.wysoki, #app.wysoki.lewa {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto minmax(0, 1fr);
    grid-template-areas:
        "gora"
        "scena"
        "tablica"
        "kciuk";
}
#app.poziomo {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
        "salon scena pauza"
        "tytul scena kciuk"
        "tablica scena kciuk";
    column-gap: 8px;
}
/* Pad pod lewą ręką: panel przechodzi na prawą stronę, przyciski rogów zostają. */
#app.poziomo.lewa {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas:
        "salon scena pauza"
        "kciuk scena tytul"
        "kciuk scena tablica";
}

#gora { grid-area: gora; display: flex; align-items: center; min-width: 0; }
#app.poziomo #gora { display: contents; }

.rog {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: none;
    min-width: 48px;
    min-height: 48px;
    padding: 4px 10px;
    margin: 4px 6px;
    border-radius: 14px;
    border: 1px solid var(--ramka);
    background: rgba(14, 16, 24, .92);
    font-weight: 700;
    font-size: 13px;
}
.rog img { width: 24px; height: 24px; }
.rog.tekst { color: var(--cyan); }
#btn-salon { grid-area: salon; justify-self: start; }
#btn-pauza { grid-area: pauza; justify-self: end; }

#tytul {
    grid-area: tytul;
    position: relative;
    flex: 1;
    min-width: 0;
    min-height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 2px;
}
#hud-runda-t {
    max-width: 100%;
    font-size: 15px;
    font-weight: 800;
    color: var(--runda);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#postep {
    width: 100%;
    max-width: 180px;
    height: 6px;
    border-radius: 3px;
    background: #1c2130;
    overflow: hidden;
}
#postep-pasek {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--cyan), var(--fiolet), var(--roz));
    transform-origin: left center;
    transform: scaleX(0);
}
/* Komunikat wchodzi w miejsce nazwy rundy: nie zasłania akcji i nie przesuwa układu. */
#tabliczka {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1.5px solid var(--amber);
    background: #090b12;
    color: var(--amber);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.15;
    text-align: center;
    opacity: 0;
    transition: opacity .18s;
    pointer-events: none;
}
#tabliczka.widac { opacity: 1; }

#scena { grid-area: scena; display: flex; justify-content: center; align-items: flex-start; min-height: 0; }
#app.poziomo #scena { align-items: center; }
#plansza { position: relative; }
#plansza canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}
#plansza::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 2px;
    box-shadow: inset 0 0 0 0 transparent;
}
#plansza.moc::after { box-shadow: inset 0 0 0 2px var(--amber); }
#plansza.nadgodziny::after { box-shadow: inset 0 0 0 2px var(--czerw); }
#plansza.czysto #warstwa-tla { animation: migotanie .32s steps(2) infinite; }
@keyframes migotanie { 50% { opacity: .35; } }
#napis {
    position: absolute;
    top: 45%;
    left: 0;
    right: 0;
    text-align: center;
    transform: translateY(-50%);
    font-size: clamp(22px, 7vmin, 40px);
    font-weight: 800;
    color: var(--tekst);
    pointer-events: none;
}
#napis:empty { display: none; }
#napis > span {
    display: inline-block;
    padding: 6px 18px 8px;
    border-radius: 14px;
    background: rgba(5, 6, 10, .86);
}
#napis small { display: block; font-size: .55em; font-weight: 700; color: var(--runda); }

/* ---------- panel pod planszą ---------- */
#tablica {
    --portret: 64px;
    grid-area: tablica;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
        "portret wynik"
        "stan stan"
        "premia premia"
        "efekty efekty";
    align-content: center;
    gap: 5px 8px;
    min-width: 0;
    min-height: 0;
    padding: 6px 4px 6px 10px;
}
#app.lewa:not(.wysoki):not(.poziomo) #tablica { padding: 6px 10px 6px 4px; }
#portret-ramka {
    grid-area: portret;
    width: var(--portret);
    height: var(--portret);
    border-radius: 16px;
    border: 2px solid var(--runda);
    background: radial-gradient(circle at 50% 42%, #1a2036, #090b12 72%);
    overflow: hidden;
    transition: border-color .15s;
}
#portret-ramka.moc { border-color: var(--amber); }
#portret-ramka.strach, #portret-ramka.trafiony { border-color: var(--czerw); }
#portret { width: 100%; height: 100%; display: block; }
#wynik {
    grid-area: wynik;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    line-height: 1.1;
}
#hud-pkt {
    font-family: var(--mono);
    font-size: 27px;
    font-weight: 800;
    color: var(--tekst);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.maly { font-family: var(--mono); font-size: 12px; color: var(--szary); white-space: nowrap; }
#hud-rekord { color: var(--amber); font-weight: 700; }
#stan { grid-area: stan; display: flex; align-items: center; min-height: 28px; min-width: 0; }
#hud-zycia { display: flex; align-items: center; gap: 2px; }
#hud-zycia img { width: 28px; height: 28px; }
#hud-zegar { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 25px; color: var(--tekst); font-variant-numeric: tabular-nums; }
#hud-zegar img { width: 26px; height: 26px; }
#hud-zegar.alarm { color: var(--czerw); }
#premia { grid-area: premia; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
#premia-opis {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-height: 24px;
    font-size: 13px;
    font-weight: 800;
    color: var(--amber);
    white-space: nowrap;
}
#hud-premia, #hud-cel { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#hud-premia.alarm { color: var(--czerw); }
#hud-cel { color: var(--szary); font-weight: 700; }
#hud-cel:empty, #hud-premia:empty { display: none; }
#hud-bonusy { display: flex; align-items: center; gap: 3px; flex: none; margin-left: auto; }
#hud-bonusy img { width: 24px; height: 24px; }
#hud-bonusy img.czeka { opacity: .3; }
#hud-bonusy img.stracony { opacity: .16; filter: grayscale(1); }
#premia-tor { height: 9px; border-radius: 5px; background: #1c2130; overflow: hidden; }
#premia-pasek {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #fde68a);
    transform-origin: left center;
}
#premia-pasek.alarm { background: var(--czerw); }
#efekty { grid-area: efekty; display: flex; flex-wrap: nowrap; gap: 3px; min-height: 32px; pointer-events: none; }
.efekt {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 26px;
    height: 32px;
    border-radius: 9px;
    border: 1px solid var(--ramka);
    background: var(--karta);
}
.efekt img { width: 20px; height: 20px; }
.efekt i { display: block; width: 20px; height: 4px; border-radius: 2px; background: #1c2130; overflow: hidden; }
.efekt i b { display: block; height: 100%; background: var(--amber); transform-origin: left center; }

#app.wysoki #tablica, #tablica.szeroki {
    --portret: 86px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    grid-template-areas:
        "portret wynik stan"
        "portret premia premia";
    padding: 8px 12px 4px;
    column-gap: 12px;
}
#app.wysoki #hud-pkt, #tablica.szeroki #hud-pkt { font-size: 32px; }
#tablica.szeroki #efekty { grid-area: wynik; justify-self: end; align-self: center; min-height: 0; }
/* W wysokim układzie chipy efektów stoją obok padu, w wolnym rogu: pojawianie się ich nie rusza panelu. */
#app.wysoki #efekty {
    position: absolute;
    left: calc(var(--safe-l) + 10px);
    bottom: calc(var(--safe-b) + 10px);
    flex-direction: column;
    min-height: 0;
}
#app.wysoki.lewa #efekty { left: auto; right: calc(var(--safe-r) + 10px); }

#kciuk {
    grid-area: kciuk;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    min-width: 0;
    padding: 4px 8px 6px 4px;
}
#app.lewa:not(.poziomo):not(.wysoki) #kciuk { padding: 4px 4px 6px 8px; }
/* Pad leży bliżej wybranej ręki, ale nie w samym rogu: druga połowa ekranu nie zostaje pusta. */
#app.wysoki #kciuk { padding: 2px 8px 8px 60px; }
#app.wysoki.lewa #kciuk { padding: 2px 60px 8px 8px; }
#app.wysoki #strefa { width: 100%; }
#app.poziomo #kciuk { padding: 0 8px 6px; }
#strefa {
    flex: none;
    width: var(--szer, 180px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    gap: 6px;
    min-height: 0;
    padding: 6px;
    border-radius: 18px;
    border: 2px dashed #33405f;
    font-size: 13px;
    color: var(--szary);
    text-align: center;
    pointer-events: none;
    transition: opacity .6s;
}
#strefa img { width: 56px; height: 56px; opacity: .85; }
#strefa.zgaszona { opacity: .35; }

/* Pad to jeden krzyż: cała jego powierzchnia reaguje, więc palec może po nim jechać bez odrywania. */
#pad {
    --pole: 64px;
    position: relative;
    flex: none;
    display: grid;
    grid-template-columns: repeat(3, var(--pole));
    grid-template-rows: repeat(3, var(--pole));
    grid-template-areas: ". g ." "l . p" ". d .";
    touch-action: none;
}
#pad::before {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    border: 1px solid #1f2740;
    background: rgba(14, 18, 32, .75);
}
#pad::after {
    content: '';
    position: absolute;
    left: var(--pole);
    top: var(--pole);
    width: var(--pole);
    height: var(--pole);
    background: #161d32;
    pointer-events: none;
}
#pad button {
    position: relative;
    z-index: 1;
    padding: 0;
    border: 2px solid #3a4a70;
    background: #161d32;
    display: grid;
    place-items: center;
    touch-action: none;
}
#pad button:active, #pad button.wcisniety { background: #173a55; border-color: var(--cyan); }
#pad button.zapamietany { border-color: var(--amber); }
#pad img { width: 58%; height: 58%; pointer-events: none; opacity: .8; }
#pad button.idzie img, #pad button.wcisniety img { opacity: 1; }
#pad [data-k=gora] { grid-area: g; border-bottom: 0; border-radius: 16px 16px 0 0; }
#pad [data-k=dol] { grid-area: d; border-top: 0; border-radius: 0 0 16px 16px; }
#pad [data-k=dol] img { transform: rotate(180deg); }
#pad [data-k=lewo] { grid-area: l; border-right: 0; border-radius: 16px 0 0 16px; }
#pad [data-k=lewo] img { transform: rotate(-90deg); }
#pad [data-k=prawo] { grid-area: p; border-left: 0; border-radius: 0 16px 16px 0; }
#pad [data-k=prawo] img { transform: rotate(90deg); }
#pad.plaski { grid-template-rows: repeat(2, var(--pole)); grid-template-areas: ". g ." "l d p"; }
#pad.plaski::before, #pad.plaski::after { display: none; }
#pad.plaski button { border: 2px solid #3a4a70; border-radius: 16px; }
#pad-palec {
    position: absolute;
    z-index: 2;
    left: calc(var(--pole) * .08);
    top: calc(var(--pole) * 1.3);
    width: calc(var(--pole) * 1.15) !important;
    height: calc(var(--pole) * 1.15) !important;
    opacity: 1 !important;
    animation: stukanie 1s ease-in-out infinite;
}
@keyframes stukanie { 50% { transform: translate(8%, 10%) scale(.9); } }
#pad.ucz button[data-k=lewo], #pad.ucz button[data-k=prawo] { border-color: var(--cyan); animation: wolanie 1s ease-in-out infinite; }
@keyframes wolanie { 50% { background: #173a55; } }

/* Bardzo niski telefon: panel ustępuje, żeby nic nie wyszło poza ekran. */
#tablica.waski #hud-pkt.sredni { font-size: 20px; }
#tablica.waski #hud-pkt.dlugi { font-size: 16px; }
#tablica.waski #rekord-et { font-size: 0; }
#tablica.waski #rekord-et::before { content: 'Rek.'; font-size: 12px; }
/* Bardzo długi rekord zostaje samą liczbą: amber pod wynikiem i tak czyta się jako rekord. */
#tablica.waski .maly.dlugi #rekord-et { display: none; }
#tablica.ciasny { --portret: 48px; gap: 2px 6px; padding-top: 2px; padding-bottom: 2px; }
#tablica.ciasny #hud-pkt { font-size: 22px; }
#tablica.ciasny #stan { min-height: 22px; }
#tablica.ciasny #hud-zycia img { width: 22px; height: 22px; }
#tablica.ciasny #hud-zegar { font-size: 20px; }
#tablica.ciasny #premia-opis { min-height: 20px; font-size: 12px; }
#tablica.ciasny #hud-bonusy img { width: 20px; height: 20px; }
#tablica.ciasny #efekty { min-height: 0; }

/* poziomo: panel i pad po bokach planszy */
#app.poziomo #tytul { padding: 2px 10px 6px; min-height: 44px; }
#app.poziomo #tabliczka { inset: 0 8px 4px; }
#app.poziomo #postep { max-width: none; }
#app.poziomo #tablica {
    --portret: 92px;
    align-content: start;
    padding: 2px 6px 6px 10px;
    gap: 8px 12px;
}
#app.poziomo.lewa #tablica { padding: 2px 10px 6px 6px; }
#app.poziomo #tablica:not(.waski) #hud-pkt { font-size: 29px; }
#app.poziomo #tablica.waski { --portret: 62px; gap: 5px 8px; }

/* ---------- ekrany ---------- */
.ekran {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: calc(var(--safe-t) + 8px) calc(var(--safe-r) + 12px) calc(var(--safe-b) + 8px) calc(var(--safe-l) + 12px);
    background: rgba(5, 6, 10, .95);
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
}
#ekran-start { background: radial-gradient(ellipse at 50% -10%, #171c3a 0%, var(--bg) 62%); }
#ekran-pauza, #ekran-koniec { z-index: 12; }
#ekran-opcje { z-index: 13; }
#ekran-pomoc { z-index: 14; }

.rogi {
    position: absolute;
    top: var(--safe-t);
    left: var(--safe-l);
    right: var(--safe-r);
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}
.rogi > * { pointer-events: auto; }
.rogi-prawe { display: flex; }
.rogi-prawe .rog { margin-left: 0; padding: 4px 8px; }
.rogi-prawe img { width: 20px; height: 20px; }

.start {
    width: 100%;
    max-width: 480px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(7px, 1.5vh, 16px);
    margin: auto 0;
    padding-top: 50px;
}
.start-lewa, .start-prawa { display: flex; flex-direction: column; gap: clamp(6px, 1.6vh, 12px); min-width: 0; }
#logo { width: 100%; max-width: 420px; height: auto; margin: 0 auto; }
.opis { font-size: 14px; line-height: 1.4; color: #c7cede; text-align: center; }
.staty { display: flex; justify-content: center; gap: 10px; }
.staty > div {
    flex: 1;
    max-width: 180px;
    padding: 6px 10px;
    border-radius: 12px;
    border: 1px solid var(--ramka);
    background: var(--karta);
    text-align: center;
}
.staty span { display: block; font-size: 11px; color: var(--szary); }
.staty b { font-family: var(--mono); font-size: 19px; color: var(--amber); }

.wybor { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.etykieta { font-size: 12px; color: var(--szary); }
.etykieta b { color: var(--tekst); }
.etykieta-rzad { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; }
#btn-stroj {
    position: relative;
    flex: none;
    min-height: 36px;
    padding: 3px 12px;
    border-radius: 12px;
    border: 1px solid var(--ramka);
    background: var(--karta);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--amber);
}
/* Cel dotyku 44 px bez rozpychania wiersza menu. */
#btn-stroj::after { content: ''; position: absolute; inset: -5px 0; }
#btn-stroj[aria-pressed=true] { border-color: var(--amber); background: #231a07; }
#btn-stroj.zamkniety { color: var(--szary); }
#start-trud-opis { color: var(--szary); }
#postac-licznik { font-family: var(--mono); font-size: 11px; color: var(--szary); }
#tryby, #trudnosci { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.trudnosc {
    min-height: 44px;
    padding: 3px 4px;
    border-radius: 10px;
    border: 2px solid var(--ramka);
    background: var(--karta);
    font-size: 13.5px;
    font-weight: 700;
}
.trudnosc[aria-checked=true] { border-color: var(--ziel); background: #0a2616; }
.tryb {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 46px;
    padding: 3px 5px;
    border-radius: 10px;
    border: 2px solid var(--ramka);
    background: var(--karta);
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.1;
    text-align: left;
}
.tryb img { flex: none; width: 22px; height: 22px; }
.tryb[aria-checked=true] { border-color: var(--cyan); background: #0b2430; }
#postacie-box { position: relative; min-width: 0; }
#postacie {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 2px;
    scrollbar-width: none;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    scroll-behavior: smooth;
}
#postacie::-webkit-scrollbar { display: none; }
.postac {
    flex: none;
    width: 54px;
    height: 54px;
    padding: 2px;
    border-radius: 12px;
    border: 2px solid var(--ramka);
    background: var(--karta);
}
.postac { position: relative; }
/* Strzałka na krawędzi z wygaszeniem: widać, że za nią jest ciąg dalszy, a mysz i klawiatura też przewiną pasek. */
.przewin {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 44px;
    padding: 0;
    border: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    background: linear-gradient(90deg, rgba(5, 6, 10, 0), rgba(5, 6, 10, .96) 62%);
}
#postacie-prawo { right: -1px; }
#postacie-lewo { left: -1px; transform: scaleX(-1); }
.przewin img { width: 26px; height: 26px; transform: rotate(90deg); }
.postac img { width: 100%; height: 100%; }
.postac .stroj { position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px); }
.postac .stroj.zapowiedz { opacity: .28; }
.postac[aria-checked=true] { border-color: var(--cyan); background: #0b2430; }
#rundy { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.runda {
    position: relative;
    min-height: 46px;
    padding: 3px 0;
    border-radius: 10px;
    border: 2px solid var(--ramka);
    background: var(--karta);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-family: var(--mono);
    font-weight: 800;
    font-size: 15px;
}
.runda[aria-checked=true] { border-color: var(--amber); background: #231a07; }
.runda[aria-disabled=true] { color: #5b6478; }
.runda .gw { display: flex; gap: 1px; }
.runda .gw img { width: 10px; height: 10px; }
.runda > img { width: 16px; height: 16px; }

.przycisk {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 9px 16px;
    border-radius: 14px;
    border: 1px solid var(--ramka);
    background: #141827;
    font-weight: 700;
    font-size: 15px;
    position: relative;
    overflow: hidden;
}
.przycisk.glowny {
    min-height: 56px;
    border: 0;
    color: #06121a;
    font-size: 19px;
    font-weight: 800;
    background: linear-gradient(90deg, #22d3ee, #38bdf8 45%, #a855f7);
}
.przycisk.glowny img { width: 28px; height: 28px; filter: brightness(0); }
.przycisk.ciemny { background: transparent; color: var(--szary); }

.panel {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
    margin: auto 0;
    border-radius: 18px;
    border: 1px solid var(--ramka);
    background: var(--karta);
}
.panel h2 { font-size: 24px; text-align: center; }
.panel h3 { font-size: 15px; color: var(--cyan); margin-top: 4px; }
.panel p { font-size: 14px; line-height: 1.45; color: #c7cede; }
#koniec-info { text-align: center; }
#koniec-portret { width: 104px; height: 104px; margin: 0 auto -4px; }
#koniec-gwiazdki { display: flex; justify-content: center; gap: 8px; }
#koniec-gwiazdki img { width: 40px; height: 40px; }
.nagroda { text-align: center; font-weight: 800; color: var(--amber) !important; font-size: 14px; }
.uwaga { text-align: center; color: var(--amber) !important; }
.przycisk img { width: 22px; height: 22px; }
.przewijany #btn-opcje-zamknij { position: sticky; bottom: 8px; flex: none; box-shadow: 0 8px 0 8px var(--karta); }
#opcje-wiersze { display: flex; flex-direction: column; gap: 8px; }
.wiersz { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--szary); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
.seg button {
    min-height: 44px;
    padding: 2px 4px;
    border-radius: 11px;
    border: 2px solid var(--ramka);
    background: #141827;
    font-size: 13.5px;
    font-weight: 700;
}
.seg button[aria-checked=true] { border-color: var(--cyan); background: #0b2430; }
.seg button[aria-checked=true]::before { content: '✓ '; color: var(--cyan); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
#opcje-motywy { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 6px; }
.motyw {
    padding: 3px;
    border-radius: 12px;
    border: 2px solid var(--ramka);
    background: #141827;
    font-size: 12px;
    font-weight: 700;
    min-height: 44px;
}
.motyw img { width: 100%; height: 54px; object-fit: cover; border-radius: 8px; margin-bottom: 3px; }
.motyw[aria-checked=true] { border-color: var(--cyan); background: #0b2430; }
.motyw[aria-checked=true] span::before { content: '✓ '; color: var(--cyan); }
.nowy-rekord { text-align: center; font-weight: 800; font-size: 17px; color: var(--amber) !important; }
.lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #c7cede; }
.lista li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 8px; align-items: center; }
.lista img { width: 34px; height: 34px; }
.lista b { color: var(--tekst); }
.przewijany #btn-pomoc-zamknij { position: sticky; bottom: 0; flex: none; }

/* przerywka: Ekipa tańczy */
#ekran-przerywka { padding-top: calc(var(--safe-t) + 6px); }
.przerywka {
    width: 100%;
    max-width: 620px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: auto 0;
}
.prz-scena { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
#prz-tytul { font-size: clamp(20px, 5.4vmin, 28px); text-align: center; }
#taniec { width: 100%; aspect-ratio: 16 / 7; display: block; border-radius: 14px; border: 1px solid var(--ramka); background: #090b12; }
.prz-opis { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
#prz-gwiazdki { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
#prz-gwiazdki li {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    border-radius: 12px;
    border: 1px solid var(--ramka);
    background: var(--karta);
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
    color: #c7cede;
}
#prz-gwiazdki img { width: 30px; height: 30px; }
#prz-gwiazdki li.brak { color: var(--szary); }
#prz-punkty { font-family: var(--mono); font-size: 13px; text-align: center; color: var(--amber); }
#prz-dalej { font-size: 14px; text-align: center; color: var(--tekst); }
#prz-szum { font-size: 13px; text-align: center; color: #fda4af; }
#prz-czas {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 4px;
    width: 100%;
    background: rgba(6, 18, 26, .55);
    transform-origin: left center;
}

@media (orientation: landscape) and (max-height: 560px) {
    .start {
        max-width: 800px;
        grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
        grid-template-rows: minmax(0, 1fr) auto;
        align-items: start;
        gap: 6px 16px;
        margin: 0;
        padding-top: 0;
    }
    .start-lewa { grid-column: 1; grid-row: 1; padding-top: 46px; }
    .start-prawa { grid-column: 2; grid-row: 1 / span 2; padding-top: 46px; gap: 3px; }
    #btn-start { grid-column: 1; grid-row: 2; align-self: end; }
    #logo { max-width: 270px; }
    .opis { font-size: 12.5px; }
    .staty b { font-size: 16px; }
    .postac { width: 46px; height: 46px; }
    .tryb, .trudnosc { min-height: 44px; font-size: 12px; }
    .runda { min-height: 44px; }
    .etykieta-rzad { min-height: 30px; }
    .przycisk.glowny { min-height: 50px; }
    .przerywka { max-width: 780px; flex-direction: row; align-items: center; gap: 14px; }
    .prz-scena, .prz-opis { flex: 1 1 0; }
    #prz-gwiazdki img { width: 24px; height: 24px; }
    #prz-gwiazdki li { font-size: 11px; padding: 4px 2px; }
    .panel { max-width: 560px; padding: 12px 16px; gap: 7px; }
    #ekran-pauza .panel, #ekran-koniec .panel { display: grid; grid-template-columns: 1fr 1fr; }
    #ekran-pauza .panel h2, #ekran-koniec .panel h2, #koniec-nowy, #koniec-info, #ekran-koniec .staty { grid-column: 1 / -1; }
    #koniec-portret { display: none; }
    .przycisk { min-height: 44px; padding: 6px 12px; font-size: 14px; }
}

/* Bardzo niski ekran poziomo: Start nie może uciec poza ekran. */
@media (orientation: landscape) and (max-height: 340px) {
    .opis { display: none; }
    #logo { max-width: 190px; }
    .staty > div { display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 2px 8px; }
    .start-lewa, .start-prawa { gap: 2px; }
    .start-prawa .wybor:first-child .etykieta, #rundy-etykieta { display: none; }
}

/* Niski telefon pionowo: menu ma się zmieścić bez przewijania, więc logo i liczniki ustępują wyborom. */
@media (max-height: 720px) and (orientation: portrait) {
    .start { padding-top: 46px; gap: 6px; }
    .start-lewa, .start-prawa { gap: 5px; }
    #logo { max-width: 232px; }
    .opis { font-size: 12.5px; line-height: 1.25; }
    .staty > div { display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 2px 8px; }
    .staty b { font-size: 15px; }
    .etykieta-rzad { min-height: 30px; }
    .postac { width: 50px; height: 50px; }
    .tryb, .trudnosc, .runda { min-height: 44px; }
    .przycisk.glowny { min-height: 50px; }
}

@media (max-height: 600px) and (orientation: portrait) {
    .opis { display: none; }
}

@media (min-width: 900px) and (min-height: 640px) {
    .rog { min-width: 96px; }
}

@media (prefers-reduced-motion: reduce) {
    #plansza.czysto #warstwa-tla { animation: none; }
    #tabliczka, #strefa { transition: none; }
    #pad-palec, #pad.ucz button { animation: none !important; }
    #postacie { scroll-behavior: auto; }
}
.malo-blyskow #plansza.czysto #warstwa-tla { animation: none; }
.malo-blyskow #tabliczka, .malo-blyskow #strefa { transition: none; }
.malo-blyskow #pad-palec, .malo-blyskow #pad.ucz button { animation: none; }
