        /* Kolory marki (z logo). Tryb jasny nadpisuje je niżej (.theme-light). */
        :root {
            --brand-bg: #140d22;
            --brand-text: #fff6e8;
            --brand-muted: #b7a9c8;
            --brand-link: #cbbedb;
            --brand-line: #2e2540;
            --brand-accent: #e8782f;
            --brand-accent-deep: #b9472a;
            --brand-accent-ink: #1a0f24;
            --brand-yellow: #f2b544;
            --brand-icon-bg: rgba(232, 120, 47, 0.16);
            --tile-bg: #1c1430;
            --card-deck-bg: #fff6e8;
            --card-deck-ink: #1a0f24;
            --card-deck-label: #8c3d17;
            --card-deck-icon: #c4501f;
            --card-deck-unit: #5a4a68;
            --card-game-bg: #3b2560;
            --card-game-shadow: #24163c;
            --card-game-soft: #d9ccea;
        }
* {
            font-family: 'Outfit', sans-serif;
            -webkit-tap-highlight-color: transparent;
            user-select: none;
            -webkit-user-select: none;
        }
        /* Nagłówki: Outfit w najgrubszej odmianie, lekko ściśnięty */
        .brand-title,
        main h2,
        h1,
        #modal-title,
        #pre-team-name {
            font-weight: 900;
            letter-spacing: -0.02em;
        }
        input, textarea, select {
            user-select: text;
            -webkit-user-select: text;
        }
        /* Min. 16px - iOS Safari nie powiększa widoku przy fokusie pola */
        input[type="text"], input[type="search"], input:not([type]), textarea, select {
            font-size: max(16px, 1em) !important;
        }
        html, body {
            width: 100%;
            height: 100%;
            height: 100vh;
            height: 100dvh;
            max-height: 100vh;
            max-height: 100dvh;
            margin: 0;
            padding: 0;
            overflow: hidden;
            overscroll-behavior: none;
            box-sizing: border-box;
        }
        body {
            background-color: var(--brand-bg);
            background-image:
                none;
            color: var(--brand-text);
            touch-action: manipulation;
            padding-top: env(safe-area-inset-top);
            padding-bottom: env(safe-area-inset-bottom);
            padding-left: env(safe-area-inset-left);
            padding-right: env(safe-area-inset-right);
        }
        .scrollable-y {
            overflow-y: auto !important;
            -webkit-overflow-scrolling: touch !important;
            touch-action: pan-y !important;
            overscroll-behavior-y: contain;
        }
        .scrollable-y * {
            touch-action: pan-y;
        }
        #screen-settings {
            height: 100%;
            max-height: 100%;
        }
        #settings-scroll-container {
            height: 100%;
            flex: 1 1 0%;
            min-height: 0;
        }
        
        /* Bez widocznych pasków przewijania w całej aplikacji.
           Długie listy (ustawienia, talie) nadal przewijają się palcem i kółkiem myszy. */
        * {
            scrollbar-width: none;
        }
        *::-webkit-scrollbar {
            display: none;
            width: 0;
            height: 0;
        }

        /* Animations */
        @keyframes float {
            0%, 100% { transform: translateY(0px) rotate(-1deg); }
            50% { transform: translateY(-8px) rotate(1deg); }
        }
        .animate-float {
            animation: float 4s ease-in-out infinite;
        }

        /* Synchronized Danger Flash for Last 5s */
        @keyframes danger-tick-flash {
            0% { 
                box-shadow: inset 0 0 75px 25px rgba(239, 68, 68, 0.65);
                background-color: rgba(185, 28, 28, 0.4);
            }
            100% { 
                box-shadow: inset 0 0 0 0 rgba(239, 68, 68, 0);
                background-color: rgba(22, 12, 38, 0);
            }
        }
        .danger-tick-flash {
            animation: danger-tick-flash 0.65s cubic-bezier(0.1, 0.9, 0.2, 1) forwards !important;
        }

        @keyframes timer-bump {
            0% { transform: scale(1.3); }
            100% { transform: scale(1); }
        }
        .timer-bump {
            animation: timer-bump 0.32s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
        }

        @keyframes card-in {
            0% { opacity: 0; transform: scale(0.88) translateY(15px); }
            100% { opacity: 1; transform: scale(1) translateY(0); }
        }
        .card-animate {
            animation: card-in 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }

        /* Swipe Gestures on Word Card */
        #word-card {
            /* none: Android Chrome nie przerywa swipe (pointercancel) próbą przewijania */
            touch-action: none;
            user-select: none;
            -webkit-user-select: none;
            will-change: transform, box-shadow, border-color;
            transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s ease, border-color 0.22s ease;
        }
        #word-card.is-dragging {
            transition: none !important;
            cursor: grabbing !important;
        }
        .swipe-badge {
            position: absolute;
            top: 14px;
            padding: 5px 12px;
            border-radius: 9999px;
            font-size: 11px;
            font-weight: 900;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            pointer-events: none;
            opacity: 0;
            transform: scale(0.8);
            transition: opacity 0.12s ease, transform 0.12s ease;
            z-index: 30;
        }
        .swipe-badge-guess {
            right: 12px;
            background: rgba(16, 185, 129, 0.95);
            color: #ffffff;
            box-shadow: 0 4px 15px rgba(16, 185, 129, 0.5);
            border: 1.5px solid rgba(255, 255, 255, 0.8);
        }
        .swipe-badge-skip {
            left: 12px;
            background: rgba(245, 158, 11, 0.95);
            color: #ffffff;
            box-shadow: 0 4px 15px rgba(245, 158, 11, 0.5);
            border: 1.5px solid rgba(255, 255, 255, 0.8);
        }

        /* Blur dla ukrywania hasła */
        #word-card #play-current-word {
            transition: filter 0.2s ease;
        }
        #word-card #word-content {
            flex: 1 1 0%;
            min-height: 0;
            width: 100%;
        }
        #word-card #play-current-word {
            flex: 1 1 0%;
            max-width: 100%;
            min-height: 0;
            display: flex;
            flex-wrap: wrap;
            align-content: center;
            justify-content: center;
            gap: 0 0.25em;
            font-size: clamp(2.7rem, 10.35vw, 4.84rem);
            line-height: 1.04;
        }
        #word-card #play-current-word .word-card-token {
            display: inline-block;
            white-space: nowrap;
        }
        #word-card.hidden-word #play-current-word {
            filter: blur(14px);
        }

        @media (max-width: 639px) {
            body [class~="text-xs"] {
                font-size: 0.8625rem;
            }
        }
        body [class~="text-xs"]:not([class~="sm:text-sm"]) {
            font-size: 0.8625rem;
        }
        body [class~="text-[9px]"] {
            font-size: 10.35px;
        }
        body [class~="text-[10px]"] {
            font-size: 11.5px;
        }
        body [class~="text-[11px]"] {
            font-size: 12.65px;
        }

        /* Confetti */
        .confetti-piece {
            position: fixed;
            top: -20px;
            z-index: 9999;
            pointer-events: none;
            animation: confetti-fall linear forwards;
        }
        @keyframes confetti-fall {
            0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
            100% { transform: translateY(105vh) rotate(720deg); opacity: 0; }
        }

        /* 3D Button Effects */
        .btn-3d {
            transition: all 0.1s ease;
        }
        .btn-3d:active {
            transform: translateY(4px);
        }

        /* ==========================================
           MENU GŁÓWNE: pasek u góry, logo i napis, dwie karty (talia, gra), przyciski
           ========================================== */
        /* Menu nigdy się nie przewija - zamiast tego zmniejsza się zawartość (fitMenuToScreen) */
        #screen-menu {
            overflow: hidden;
            /* większy odstęp od dolnej krawędzi; pasek gestów iPhone'a obsługuje padding body (env(safe-area-inset-bottom)) */
            padding: 0 0.25rem 1.15rem;
        }
        /* --menu-fit (domyślnie 1) zmniejsza zawartość menu, gdy ekran jest za niski - patrz fitMenuToScreen() */
        .menu-topbar,
        .menu-hero,
        .menu-cards,
        .menu-actions {
            zoom: var(--menu-fit, 1);
        }
        .menu-topbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.55rem 0.35rem 0;
            font-size: 1rem;
            font-weight: 700;
        }
        .menu-topbar button {
            color: var(--brand-link);
        }
        .menu-topbar a {
            color: var(--brand-text);
        }
        .account-avatar {
            display: grid;
            place-items: center;
            width: 2.3rem;
            height: 2.3rem;
            border-radius: 9999px;
            background: var(--brand-accent);
            color: var(--brand-accent-ink);
            font-size: 0.9rem;
            font-weight: 900;
            letter-spacing: 0.02em;
        }
        .menu-hero {
            text-align: center;
            margin-top: 1.3rem;
        }
        .menu-logo {
            display: block;
            width: 95px;
            height: 95px;
            margin: 0 auto 1.25rem;
            border-radius: 22%;
        }
        .brand-title {
            color: var(--brand-text);
            font-size: clamp(4.07rem, 19.25vw, 4.785rem);
            line-height: 0.92;
            letter-spacing: -0.035em;
        }
        .brand-title span {
            display: block;
        }
        .brand-title span:last-child {
            color: #e97e31;
            background: linear-gradient(90deg, #e97e31, #f0aa40);
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        /* Lont z iskrą pod napisem */
        .brand-fuse {
            display: block;
            width: 150px;
            height: 26px;
            margin: 0.7rem auto 0;
        }
        .brand-fuse .spark {
            transform-origin: 138px 9px;
            animation: fuse-spark 0.9s ease-in-out infinite alternate;
        }
        @keyframes fuse-spark {
            from { transform: scale(0.85) rotate(-8deg); }
            to { transform: scale(1.1) rotate(8deg); }
        }
        .brand-tagline {
            margin-top: 0.7rem;
            color: var(--brand-link);
            font-size: 1.125rem;
            font-weight: 600;
        }
        .brand-tagline b {
            color: var(--brand-text);
            font-weight: 800;
        }

        /* Karty tworzą jedną grupę z przyciskami na dole ekranu (strefa kciuka); wolne miejsce zostaje pod logo */
        .menu-cards {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 1rem;
            margin-top: auto;
            padding: 1rem 0.45rem 0;
        }
        .menu-card {
            display: flex;
            flex-direction: column;
            min-height: 13.2rem;
            min-width: 0;
            padding: 1.05rem 1rem 0.95rem;
            border-radius: 1.3rem;
            text-align: left;
            cursor: pointer;
            transition: transform 0.12s ease, box-shadow 0.12s ease;
        }
        .menu-card-deck {
            background: var(--card-deck-bg);
            color: var(--card-deck-ink);
            transform: rotate(-3deg);
            box-shadow: 0 7px 0 -1px var(--brand-accent);
        }
        .menu-card-game {
            background: var(--card-game-bg);
            color: #fff6e8;
            transform: rotate(2.5deg);
            box-shadow: 0 7px 0 -1px var(--card-game-shadow);
        }
        .menu-card-deck:active {
            transform: rotate(-3deg) translateY(4px);
            box-shadow: 0 3px 0 -1px var(--brand-accent);
        }
        .menu-card-game:active {
            transform: rotate(2.5deg) translateY(4px);
            box-shadow: 0 3px 0 -1px var(--card-game-shadow);
        }
        .menu-card-head {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
        }
        .menu-card-head .ico {
            font-size: 1.4rem;
        }
        .menu-card-label {
            font-size: 0.8rem;
            font-weight: 800;
            letter-spacing: 0.14em;
            text-transform: uppercase;
        }
        .menu-card-deck .menu-card-label { color: var(--card-deck-label); }
        .menu-card-deck .menu-card-head .ico { color: var(--card-deck-icon); }
        .menu-card-game .menu-card-label { color: var(--card-game-soft); }
        .menu-card-game .menu-card-head .ico { color: var(--brand-yellow); }
        .menu-card-number {
            margin-top: 1.4rem;
            font-size: 3.7rem;
            font-weight: 900;
            line-height: 1;
            letter-spacing: -0.04em;
        }
        .menu-card-unit {
            margin-top: 0.15rem;
            font-size: 1.05rem;
            font-weight: 700;
        }
        .menu-card-deck .menu-card-unit { color: var(--card-deck-unit); }
        .menu-card-game .menu-card-unit { color: var(--card-game-soft); }
        .menu-card-foot {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.35rem;
            margin-top: auto;
            padding-top: 1rem;
            font-size: 1.05rem;
            font-weight: 800;
        }
        .menu-card-foot > .ico {
            width: 1.9rem;
            height: 1.9rem;
            padding: 0.4rem;
            border-radius: 9999px;
            stroke-width: 2.6;
            box-sizing: border-box;
        }
        .menu-card-deck .menu-card-foot > .ico {
            background: rgba(26, 15, 36, 0.08);
            color: var(--card-deck-ink);
        }
        .menu-card-game .menu-card-foot > .ico {
            background: rgba(255, 246, 232, 0.16);
            color: #fff6e8;
        }
        .menu-card-foot > span {
            min-width: 0;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .menu-actions {
            padding-top: 2.6rem;
        }
        #start-game-btn {
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.8rem;
            padding: 1.1rem;
            border-radius: 1.4rem;
            background: var(--brand-accent);
            color: var(--brand-accent-ink);
            font-size: 1.45rem;
            font-weight: 900;
            letter-spacing: -0.01em;
            box-shadow: 0 6px 0 var(--brand-accent-deep);
        }
        #start-game-btn:active {
            box-shadow: 0 2px 0 var(--brand-accent-deep);
        }
        .menu-secondary {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.9rem;
            margin-top: 1.15rem;
        }
        .menu-tile {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 0.45rem;
            padding: 0.9rem 0.5rem;
            border-radius: 1.3rem;
            border: 1px solid var(--brand-line);
            background: var(--tile-bg);
            color: var(--brand-text);
            font-size: 1rem;
            font-weight: 800;
            transition: border-color 0.15s;
        }
        .menu-tile .ico {
            font-size: 1.35rem;
            color: var(--brand-yellow);
        }
        .menu-tile:hover {
            border-color: var(--brand-accent);
        }

        /* Ikony SVG (zestaw w index.html, <symbol id="i-...">) */
        .ico {
            width: 1.2em;
            height: 1.2em;
            flex: none;
            display: inline-block;
            vertical-align: -0.22em;
            fill: none;
            stroke: currentColor;
            stroke-width: 2;
            stroke-linecap: round;
            stroke-linejoin: round;
        }

        /* Tekst na pomarańczowych przyciskach: ciemny (biały na pomarańczu byłby mało czytelny) */
        .bg-violet-600,
        .bg-violet-500,
        .bg-fuchsia-600,
        .bg-gradient-to-r.from-violet-600 {
            color: var(--brand-accent-ink);
        }
        /* Zielone przyciski zatwierdzenia: jednolity kolor zamiast gradientu, biały tekst (kontrast 4.9:1) */
        .bg-gradient-to-r.from-emerald-500 {
            background-image: none;
            background-color: #16835d;
        }

        #word-card {
            background: #1c1430;
            border-width: 1px;
            border-color: #2e2540;
            box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3);
        }
        #guess-word-btn {
            background-image: none;
            background-color: #16835d;
            box-shadow: 0 3px 0 #0d5b41;
        }

        button:focus-visible,
        [role="button"]:focus-visible {
            outline: 2px solid var(--brand-yellow);
            outline-offset: 3px;
        }

        @media (prefers-reduced-motion: reduce) {
            .animate-float {
                animation: none;
            }
            *,
            *::before,
            *::after {
                scroll-behavior: auto !important;
                animation-duration: 0.01ms !important;
                animation-iteration-count: 1 !important;
                transition-duration: 0.01ms !important;
            }
        }
        /* Menu na niższych ekranach: mniejsze logo, napis i karty, żeby wszystko zmieściło się bez przewijania */
        @media (max-height: 860px) {
            .menu-logo { width: 85px; height: 85px; margin-bottom: 1.1rem; }
            .menu-hero { margin-top: 0.9rem; }
            .menu-card { min-height: 11rem; }
            .brand-title { font-size: clamp(3.85rem, 18.15vw, 4.4rem); }
        }
        @media (max-height: 760px) {
            .menu-hero { margin-top: 0.4rem; }
            .menu-logo { width: 75px; height: 75px; margin-bottom: 0.95rem; }
            .brand-title { font-size: clamp(3.575rem, 16.5vw, 4.18rem); }
            .brand-tagline { margin-top: 0.5rem; }
            .brand-fuse { margin-top: 0.5rem; }
            .menu-cards { padding-top: 0.75rem; }
            .menu-card { min-height: 10.4rem; }
            .menu-card-number { margin-top: 0.55rem; font-size: 3.1rem; }
            .menu-card-foot { padding-top: 0.7rem; }
            .menu-actions { padding-top: 2rem; }
            #start-game-btn { padding: 0.95rem; font-size: 1.35rem; }
            .menu-secondary { margin-top: 0.9rem; }
            .menu-tile { padding: 0.7rem 0.5rem; }
        }
        @media (max-height: 680px) {
            .menu-hero { margin-top: 1rem; }
            .menu-logo { display: none; }
            .brand-title { font-size: clamp(3.245rem, 15.4vw, 3.74rem); }
            .menu-card { min-height: 9.4rem; padding: 0.9rem 0.9rem 0.8rem; }
            .menu-card-number { margin-top: 0.6rem; font-size: 2.8rem; }
            .menu-card-foot { padding-top: 0.6rem; }
            .menu-tile { flex-direction: row; padding: 0.65rem 0.5rem; }
            #start-game-btn { padding: 0.85rem; }
        }
        @media (max-height: 600px) {
            .menu-topbar { padding-top: 0.3rem; }
            .brand-title { font-size: clamp(2.86rem, 14.3vw, 3.245rem); }
            .brand-tagline { font-size: 1.05rem; margin-top: 0.35rem; }
            .brand-fuse { width: 120px; height: 21px; margin-top: 0.35rem; }
            .menu-cards { padding-top: 0.6rem; }
            .menu-card { min-height: 8.6rem; }
            .menu-card-number { font-size: 2.3rem; margin-top: 0.4rem; }
            .menu-card-foot { padding-top: 0.45rem; }
            .menu-actions { padding-top: 1.4rem; }
            .menu-secondary { margin-top: 0.7rem; }
        }
        /* Komputer: nagłówek, karty i przyciski wyśrodkowane w pionie jako jedna grupa */
        /* Laptopy: logo trochę mniejsze, żeby z lontem całe menu mieściło się bez przewijania */
        @media (min-width: 640px) and (max-height: 900px) {
            .menu-card { min-height: 10rem; }
            .menu-card-number { margin-top: 0.8rem; }
            .menu-logo { width: 72px; height: 72px; margin-bottom: 0.85rem; }
            .brand-title { font-size: 3.9rem; }
        }
        @media (min-width: 640px) and (max-height: 760px) {
            .menu-logo { width: 58px; height: 58px; margin-bottom: 0.7rem; }
            .brand-title { font-size: 3.4rem; }
        }
        @media (min-width: 640px) {
            .menu-hero { margin-top: auto; }
            .menu-cards { margin-top: 0; }
            .menu-actions { margin-top: 0; margin-bottom: auto; }
        }

        /* ==========================================
           LONT ZAMIAST PASKA CZASU: sznurek skraca się, iskra wędruje do bomby
           ========================================== */
        .fuse-timer {
            display: flex;
            align-items: center;
            gap: 0.4rem;
            margin-top: 0.35rem;
        }
        .fuse-bomb {
            width: 1.9rem;
            height: 1.9rem;
            flex: none;
        }
        .fuse-track {
            position: relative;
            flex: 1;
            height: 6px;
            border-radius: 9999px;
            background: repeating-linear-gradient(90deg, rgba(168, 118, 62, 0.28) 0 2px, transparent 2px 7px);
        }
        #play-timer-bar {
            position: relative;
            height: 100%;
            border-radius: 9999px;
            background: repeating-linear-gradient(90deg, #e0a458 0 7px, #a8763e 7px 10px);
            transition: width 0.2s linear;
        }
        .fuse-spark {
            position: absolute;
            right: -11px;
            top: 50%;
            width: 22px;
            height: 22px;
            margin-top: -11px;
            color: #fbbf24;
            filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.9));
            animation: fuse-spark-flicker 0.35s ease-in-out infinite alternate;
        }
        @keyframes fuse-spark-flicker {
            from { transform: scale(0.8) rotate(-12deg); }
            to { transform: scale(1.15) rotate(12deg); }
        }
        .danger-tick-flash .fuse-spark {
            color: #f97316;
            filter: drop-shadow(0 0 10px rgba(249, 115, 22, 1));
        }

        /* Maskotka (bomba z minami) na ekranach przejściowych */
        .mascot {
            display: block;
            margin: 0 auto;
            width: 4.25rem;
            height: 4.25rem;
        }
        .mascot-lg {
            width: 5.5rem;
            height: 5.5rem;
        }

        /* Ustawienia jako lista z separatorami zamiast stosu kart */
        #settings-scroll-container > div[class*="rounded-3xl"],
        #game-setup-scroll-container > div[class*="rounded-3xl"] {
            background: transparent !important;
            border-width: 0 0 1px !important;
            border-radius: 0 !important;
            box-shadow: none !important;
            padding-left: 0.25rem;
            padding-right: 0.25rem;
            padding-top: 0.25rem;
        }
        #settings-scroll-container > div[class*="rounded-3xl"]:hover,
        #game-setup-scroll-container > div[class*="rounded-3xl"]:hover {
            background: transparent !important;
        }

        /* ==========================================
           EKRAN „JAK GRAĆ?” (js/game/rules.js) - kolor rundy w --rules-color
           ========================================== */
        #screen-rules { --rules-color: #f2b544; }
        #screen-rules[data-color="orange"] { --rules-color: #ef8a3c; }
        #screen-rules[data-color="pink"] { --rules-color: #f0668c; }
        .rules-topbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.6rem 0.4rem 0;
            flex: none;
        }
        .rules-label {
            color: var(--rules-color);
            font-size: 0.85rem;
            font-weight: 800;
            letter-spacing: 0.12em;
            text-transform: uppercase;
        }
        #rules-skip-btn {
            color: var(--brand-link);
            font-weight: 800;
            font-size: 0.95rem;
            padding: 0.25rem 0;
        }
        .rules-slide {
            flex: 1 1 auto;
            min-height: 0;
            display: flex;
            flex-direction: column;
            justify-content: center;
            justify-content: safe center;
            padding: 0.75rem 0.4rem;
        }
        .rules-content {
            zoom: var(--rules-fit, 1);
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
            animation: rules-in 0.25s ease-out;
        }
        .rules-content.from-right { animation-name: rules-in-right; }
        .rules-content.from-left { animation-name: rules-in-left; }
        @keyframes rules-in { from { opacity: 0; } to { opacity: 1; } }
        @keyframes rules-in-right { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
        @keyframes rules-in-left { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }

        .rules-ring {
            /* koło maleje na niskich ekranach, żeby reszta karty nie musiała się zmniejszać */
            --ring: clamp(4.5rem, calc(100dvh - 37rem), 13.5rem);
            width: var(--ring);
            height: var(--ring);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            background: var(--tile-bg);
            border: 3px solid var(--rules-color);
            box-shadow: 0 0 0 14px color-mix(in srgb, var(--tile-bg) 55%, transparent),
                        0 0 70px 10px color-mix(in srgb, var(--rules-color) 22%, transparent);
            color: var(--rules-color);
            margin: min(0.9rem, 2dvh) 0 min(2.2rem, 4dvh);
        }
        .rules-ring .ico { width: 38%; height: 38%; stroke-width: 1.7; }
        .rules-title {
            color: var(--brand-text);
            font-size: 2.6rem;
            font-weight: 900;
            line-height: 1.05;
            letter-spacing: -0.02em;
        }
        .rules-lead {
            color: var(--brand-muted);
            font-size: 1.1rem;
            line-height: 1.45;
            margin-top: 0.7rem;
            max-width: 21rem;
        }
        .rules-example,
        .rules-tip {
            width: 100%;
            text-align: left;
            background: var(--tile-bg);
            border: 1px solid var(--brand-line);
            border-radius: 1.1rem;
            padding: 0.85rem 1.1rem;
            margin-top: 1.4rem;
        }
        .rules-example-head { color: var(--brand-muted); font-size: 0.85rem; }
        .rules-example-head b { color: var(--brand-text); font-weight: 800; }
        .rules-example-text {
            color: var(--brand-text);
            font-size: 1.15rem;
            font-weight: 800;
            line-height: 1.3;
            margin-top: 0.3rem;
        }
        .rules-list {
            width: 100%;
            text-align: left;
            margin-top: 1.1rem;
            display: flex;
            flex-direction: column;
            gap: 0.6rem;
            color: var(--brand-text);
            font-size: 0.98rem;
            font-weight: 600;
        }
        .rules-list li { display: flex; align-items: flex-start; gap: 0.7rem; }
        .rules-list .ico { color: var(--rules-color); margin-top: 0.05rem; }
        .rules-list li.is-no { color: var(--brand-muted); }
        .rules-list li.is-no .ico { color: var(--brand-muted); }
        .rules-tip {
            display: flex;
            align-items: flex-start;
            gap: 0.9rem;
            color: var(--brand-text);
            font-size: 1rem;
            font-weight: 600;
            line-height: 1.4;
        }
        .rules-tip + .rules-tip { margin-top: 0.9rem; }
        .rules-tip .ico { color: var(--brand-yellow); margin-top: 0.15rem; }

        .rules-swipe {
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin: min(0.6rem, 1.5dvh) 0 min(2.2rem, 4dvh);
        }
        .rules-swipe-side {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.9rem;
            color: var(--brand-muted);
            font-weight: 800;
            font-size: 1rem;
            width: 6rem;
        }
        .rules-swipe-side .ico { width: 2.2rem; height: 2.2rem; }
        .rules-swipe-side.is-yes { color: var(--brand-accent); }
        .rules-flip { transform: scaleX(-1); }
        .rules-swipe-card {
            height: clamp(6.5rem, calc(100dvh - 38rem), 12rem);
            aspect-ratio: 11 / 15;
            flex: none;
            border-radius: 1.2rem;
            background: var(--card-deck-bg);
            box-shadow: 0 8px 0 var(--brand-accent), 0 20px 40px rgba(0, 0, 0, 0.35);
            transform: rotate(4deg);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 0.8rem;
            gap: 0.4rem;
        }
        .rules-swipe-card span {
            color: var(--card-deck-label, #8c3d17);
            font-size: 0.7rem;
            font-weight: 800;
            letter-spacing: 0.14em;
            text-transform: uppercase;
        }
        .rules-swipe-card b {
            color: #190f24;
            font-size: 1.35rem;
            font-weight: 900;
            line-height: 1.1;
        }

        .rules-footer { flex: none; padding: 0 0.4rem 0.4rem; }
        .rules-dots {
            display: flex;
            justify-content: center;
            gap: 0.45rem;
            margin-bottom: 1.4rem;
        }
        .rules-dots span {
            width: 0.5rem;
            height: 0.5rem;
            border-radius: 999px;
            background: var(--brand-line);
            transition: width 0.2s, background 0.2s;
        }
        .rules-dots span.is-active { width: 1.5rem; background: var(--rules-color); }
        #rules-next-btn {
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.7rem;
            padding: 1.05rem;
            border-radius: 1.4rem;
            background: var(--brand-accent);
            color: var(--brand-accent-ink);
            font-size: 1.35rem;
            font-weight: 900;
            box-shadow: 0 6px 0 var(--brand-accent-deep);
        }
        #rules-next-btn:active { box-shadow: 0 2px 0 var(--brand-accent-deep); }
        /* Telefon poziomo: brak miejsca na grafikę - zostaje sam opis */
        @media (orientation: landscape) and (max-height: 500px) {
            .rules-ring, .rules-swipe { display: none; }
            .rules-dots { margin-bottom: 0.7rem; }
            #rules-next-btn { padding: 0.7rem; font-size: 1.15rem; }
            .rules-topbar { padding-top: 0.2rem; }
        }
        .theme-light .rules-ring,
        .theme-light .rules-example,
        .theme-light .rules-tip { box-shadow: 0 4px 14px rgba(140, 61, 23, 0.08); }
        .theme-light .rules-ring { box-shadow: 0 0 50px 6px color-mix(in srgb, var(--rules-color) 25%, transparent); }
        .theme-light #screen-rules { --rules-color: #d98a0c; }
        .theme-light #screen-rules[data-color="orange"] { --rules-color: #d9631f; }
        .theme-light #screen-rules[data-color="pink"] { --rules-color: #d63d6a; }

        /* ==========================================
           TRYB JASNY (beta): kremowe tło, białe karty, ciemny przycisk startu - kolory z projektu.
           Kolory klas Tailwind nadpisuje css/theme-light.css (generowany).
           ========================================== */
        .theme-light {
            --brand-text: #1e1230;
            --brand-muted: #5e4d6e;
            --brand-link: #5e4d6e;
            --brand-line: #eedfcc;
            --brand-icon-bg: rgba(232, 120, 48, 0.14);
            --brand-yellow: #f2b545;
            --tile-bg: #ffffff;
            --card-deck-bg: #ffe7d2;
            --card-deck-ink: #190f24;
            --card-deck-label: #8c3d17;
            --card-deck-icon: #c44f1f;
            --card-deck-unit: #5b4a68;
        }
        .theme-light body {
            background-color: #fff4e4;
            background-image: none;
            color: #1e1230;
        }
        /* Karty i panele: białe z delikatnym, ciepłym cieniem */
        .theme-light .bg-slate-900,
        .theme-light .bg-slate-900\/80,
        .theme-light .bg-slate-900\/90,
        .theme-light .bg-slate-900\/95 {
            box-shadow: 0 1px 2px rgba(30, 18, 48, 0.05), 0 4px 14px rgba(120, 70, 30, 0.06);
        }
        .theme-light .brand-title {
            color: #1e1230;
        }
        .theme-light .brand-title span:last-child {
            color: #d9631f;
            background: linear-gradient(90deg, #d9631f, #d6741f);
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        /* 3. Karta "Gra": jasna lawenda z ciemnym tekstem i fioletowym akcentem (podobna waga jak brzoskwiniowa Talia) */
        .theme-light .menu-card-game {
            background: #ede4fa;
            color: #1e1230;
            box-shadow: 0 7px 0 -1px #c9b6ec;
        }
        .theme-light .menu-card-game:active {
            box-shadow: 0 3px 0 -1px #c9b6ec;
        }
        .theme-light .menu-card-game .menu-card-label,
        .theme-light .menu-card-game .menu-card-unit {
            color: #5b3f8c;
        }
        .theme-light .menu-card-game .menu-card-head .ico {
            color: #6d3fc0;
        }
        .theme-light .menu-card-game .menu-card-foot > .ico {
            background: rgba(30, 18, 48, 0.08);
            color: #1e1230;
        }
        /* 2. "Zaczynamy!" zostaje pomarańczowy jak w trybie ciemnym (ten sam kolor akcji w obu motywach) */
        /* 5. Lont i iskra: ciemniejsze, żeby było je widać na kremowym tle */
        .theme-light .brand-fuse > path:first-of-type {
            stroke: #8a5a26;
        }
        .theme-light .brand-fuse > path:nth-of-type(2) {
            stroke: #c08236;
            opacity: 0.8;
        }
        .theme-light .brand-fuse .spark path {
            fill: #e09a12;
        }
        .theme-light .fuse-spark {
            color: #e09a12;
        }
        /* Kafelki "Z kapelusza" i "Ustawienia": białe, bez ramki, z cieniem */
        .theme-light .menu-tile {
            background: #ffffff;
            border-color: transparent;
            box-shadow: 0 1px 2px rgba(30, 18, 48, 0.05), 0 3px 10px rgba(120, 70, 30, 0.08);
            color: #1e1230;
        }
        .theme-light .menu-tile .ico {
            color: #c44f1f;
        }
        .theme-light #word-card {
            background: #ffffff;
            border-color: #eedfcc;
            box-shadow: 0 2px 4px rgba(30, 18, 48, 0.05), 0 18px 40px rgba(120, 70, 30, 0.12);
        }
        .theme-light .danger-tick-flash {
            animation-name: danger-tick-flash-light !important;
        }
        @keyframes danger-tick-flash-light {
            0% {
                box-shadow: inset 0 0 75px 25px rgba(239, 68, 68, 0.5);
                background-color: rgba(254, 202, 202, 0.75);
            }
            100% {
                box-shadow: inset 0 0 0 0 rgba(239, 68, 68, 0);
                background-color: rgba(255, 244, 228, 0);
            }
        }
        /* Ekran gry w jasnych motywach: "Dobrze!" wygląda jak w trybie ciemnym,
           "Pomiń" w stonowanej, ceglastej czerwieni z białym tekstem (kontrast 5.5:1) */
        .theme-light #guess-word-btn .text-emerald-100 {
            color: rgb(209 250 229);
        }
        .theme-light #skip-word-btn {
            background-color: #b4443c;
            border-color: #9c3a33;
            color: #ffffff;
            box-shadow: 0 4px 0 #8a2f29;
        }
        .theme-light #skip-word-btn:active {
            background-color: #9c3a33;
        }
        .theme-light #skip-word-btn .text-slate-400 {
            color: #ffffff;
            opacity: 0.92;
        }
        /* "Cofnij": białe tło z ciemnopomarańczowym napisem (7.3:1);
           nieaktywny jest szary, ale czytelny (bez półprzezroczystości) */
        .theme-light #undo-btn {
            background-color: #ffffff;
            border-color: #c2410c;
            color: #9a3412;
        }
        .theme-light #undo-btn:disabled {
            opacity: 1;
            background-color: rgba(255, 255, 255, 0.6);
            border-color: #eedfcc;
            color: #6e5e7c;
        }
        .theme-light button:focus-visible,
        .theme-light [role="button"]:focus-visible,
        .theme-light .menu-card:focus-visible {
            outline-color: #ea580c;
        }

        /* ==========================================
           TRYB POZIOMY (telefon trzymany poziomo): treść w dwóch kolumnach zamiast jednej długiej.
           Uwaga: każdy ekran ma też klasę .hidden, gdy jest ukryty - dlatego :not(.hidden).
           ========================================== */
        @media (orientation: landscape) and (max-height: 560px) {
            main {
                max-width: 960px !important;
                padding-top: 0.5rem !important;
                padding-bottom: 0.5rem !important;
            }

            /* Menu: logo i napis po lewej, karty i przyciski po prawej */
            #screen-menu:not(.hidden) {
                display: grid;
                grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.2fr);
                grid-template-rows: auto minmax(0, 1fr) auto;
                column-gap: 2rem;
            }
            .menu-topbar { grid-column: 1 / span 2; grid-row: 1; }
            .menu-hero { grid-column: 1; grid-row: 2 / span 2; align-self: center; margin: 0; }
            .menu-cards { grid-column: 2; grid-row: 2; align-self: end; margin: 0; padding-top: 0.4rem; }
            .menu-actions { grid-column: 2; grid-row: 3; margin: 0; padding-top: 0.9rem; }
            .menu-logo { display: block; width: 63px; height: 63px; margin-bottom: 0.65rem; }
            .brand-title { font-size: clamp(3.135rem, 9.57vw, 4.07rem); }
            .menu-card { min-height: 0; padding: 0.7rem 0.85rem; }
            .menu-card-number { margin-top: 0.2rem; font-size: 2.2rem; }
            .menu-card-foot { padding-top: 0.4rem; }
            .menu-tile { flex-direction: row; padding: 0.5rem; }
            #start-game-btn { padding: 0.7rem; font-size: 1.2rem; }
            .menu-secondary { margin-top: 0.6rem; }

            /* Ekran gry: karta z hasłem po lewej, czas i przyciski po prawej */
            #screen-play:not(.hidden) {
                display: grid;
                grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
                grid-template-rows: auto minmax(0, 1fr);
                column-gap: 0.9rem;
                row-gap: 0.5rem;
                padding: 0.4rem 0.5rem;
            }
            #screen-play > :nth-child(1) {
                grid-column: 2;
                grid-row: 1;
            }
            #screen-play > :nth-child(2) {
                grid-column: 1;
                grid-row: 1 / span 2;
                padding: 0;
                margin: 0;
            }
            #screen-play > :nth-child(3) {
                grid-column: 2;
                grid-row: 2;
                align-self: end;
            }
            #word-card {
                max-height: none !important;
                min-height: 0 !important;
            }
            #word-card #play-current-word {
                font-size: clamp(2.4rem, 11vh, 4.2rem);
            }

            /* Ekran przed turą: zasady rundy po lewej, drużyna i start po prawej */
            #screen-pre-turn:not(.hidden) {
                display: grid;
                grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
                grid-template-rows: minmax(0, 1fr) auto;
                gap: 0.75rem 1.5rem;
                align-items: center;
            }
            #screen-pre-turn > :nth-child(1) {
                grid-column: 1;
                grid-row: 1 / span 2;
            }
            #screen-pre-turn > :nth-child(2) {
                grid-column: 2;
                grid-row: 1;
                margin: 0;
                padding: 0;
            }
            #screen-pre-turn > :nth-child(3) {
                grid-column: 2;
                grid-row: 2;
            }
            #pre-team-card {
                padding: 1rem;
            }

            /* Podsumowania, koniec gry i "Z kapelusza": lista po lewej, nagłówek i przyciski po prawej */
            #screen-turn-recap:not(.hidden),
            #screen-game-over:not(.hidden),
            #screen-salatka:not(.hidden) {
                display: grid;
                grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
                grid-template-rows: minmax(0, 1fr) auto;
                gap: 0.75rem 1.5rem;
                padding-top: 0.25rem;
                padding-bottom: 0.25rem;
            }
            #screen-turn-recap > :nth-child(1),
            #screen-game-over > :nth-child(1),
            #screen-salatka > :nth-child(1) {
                grid-column: 2;
                grid-row: 1;
                align-self: center;
            }
            #screen-turn-recap > :nth-child(2),
            #screen-game-over > :nth-child(2),
            #screen-salatka > :nth-child(2) {
                grid-column: 1;
                grid-row: 1 / span 2;
                min-height: 0;
                margin: 0;
                padding-top: 0;
                padding-bottom: 0;
                overflow-y: auto;
            }
            #screen-turn-recap > :nth-child(3),
            #screen-game-over > :nth-child(3),
            #screen-salatka > :nth-child(3) {
                grid-column: 2;
                grid-row: 2;
            }
            #recap-list-container {
                max-height: none;
            }
            #screen-round-summary:not(.hidden) {
                display: grid;
                grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
                grid-template-rows: auto minmax(0, 1fr) auto;
                gap: 0.6rem 1.5rem;
                padding-top: 0.25rem;
                padding-bottom: 0.25rem;
            }
            #screen-round-summary > :nth-child(1) {
                grid-column: 2;
                grid-row: 1;
            }
            #screen-round-summary > :nth-child(2) {
                grid-column: 1;
                grid-row: 1 / span 3;
                margin: 0;
                padding: 0;
                overflow-y: auto;
            }
            #screen-round-summary > :nth-child(3) {
                grid-column: 2;
                grid-row: 2;
                margin: 0;
                align-self: center;
            }
            #screen-round-summary > :nth-child(4) {
                grid-column: 2;
                grid-row: 3;
            }

            /* Ustawienia i talie: dolny "Gotowe" znika (ten sam przycisk jest w nagłówku), więcej miejsca na treść */
            #screen-settings > :last-child,
            #screen-game-setup > :last-child,
            #screen-decks > :last-child {
                display: none;
            }

            .mascot,
            .mascot-lg {
                width: 3rem;
                height: 3rem;
            }

            /* Talie: więcej kolumn */
            #decks-grid {
                grid-template-columns: repeat(4, minmax(0, 1fr));
            }
        }

        @media (orientation: landscape) and (max-height: 300px) {
            .menu-logo { display: none; }
        }
