:root { --bg: #121213; --text: #ffffff; --key: #818384; --border: #3a3a3c; --absent: #3a3a3c; --present: #b59f3b; --correct: #538d4e; --modal: #1a1a1b; --danger: #e74c3c; --overlay: rgba(0,0,0,0.85); }
        body.light-mode { --bg: #ffffff; --text: #000000; --key: #d3d6da; --border: #d3d6da; --absent: #787c7e; --present: #c9b458; --correct: #6aaa64; --modal: #ffffff; --overlay: rgba(255,255,255,0.95); }

        * { box-sizing: border-box; }
        html { min-height: 100%; overflow-x: hidden; overscroll-behavior-x: none; }
        body { 
            font-family: 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); margin: 0; padding: 0; 
            display: block; width: 100%; min-height: 100dvh; 
            user-select: none; -webkit-user-select: none; transition: background 0.3s, color 0.3s; 
        }

        .game-shell { min-height: 100dvh; height: 100dvh; display: flex; flex-direction: column; align-items: center; position: relative; overflow: hidden; }

        .header {
            width: 100%; padding: 0 10px; border-bottom: 1px solid var(--border);
            display: flex; align-items: center; gap: 8px;
            height: 60px; flex-shrink: 0; z-index: 10;
        }
        .header-left { display: flex; align-items: center; flex: 1 1 auto; min-width: 0; }
        .header-right { display: flex; align-items: center; gap: 6px; justify-content: flex-end; flex: 0 0 auto; min-width: max-content; }

        .mode-switch-btn {
            flex: 0 1 auto; width: auto; max-width: 180px; min-width: 0;
            background: linear-gradient(135deg, var(--present) 0%, #d4af37 100%);
            color: #000; border: 2px solid rgba(255,255,255,0.5);
            padding: 6px 8px; border-radius: 9px;
            font-weight: 800; font-size: 0.68rem; cursor: pointer;
            display: flex; gap: 4px; align-items: center; justify-content: center;
            box-shadow: 0 2px 8px rgba(212,175,55,0.3);
            text-transform: uppercase; white-space: nowrap; transition: transform 0.1s;
            overflow: hidden;
        }
        .mode-switch-btn:hover { transform: scale(1.05); }
        .mode-label-small { font-size: 0.6rem; opacity: 0.7; margin-right: 2px; }

        .icon-btn-styled {
            background: transparent; border: 2px solid var(--correct); color: var(--text);
            border-radius: 10px; width: 38px; height: 38px; min-width: 38px; display: flex; justify-content: center; align-items: center;
            font-size: 1.1rem; cursor: pointer; transition: 0.2s; font-weight: bold; padding: 0;
        }
        .icon-btn-styled:hover { background: var(--correct); color: white; transform: translateY(-2px); }
        .icon-btn-styled.danger { border-color: var(--danger); color: var(--danger); }
        .icon-btn-styled.danger:hover { background: var(--danger); color: white; }
        .icon-btn-styled.lang { border-color: #3498db; }
        .icon-btn-styled.lang:hover { background: #3498db; color: white; }

        #board-container { 
            display: flex; justify-content: center; align-items: center; flex: 1; 
            width: 100%; overflow: hidden; position: relative; min-height: 0; padding: 10px;
        }
        #board { 
            display: grid; 
            grid-template-rows: repeat(6, 1fr); 
            grid-template-columns: repeat(5, 1fr); 
            gap: 5px; 
            width: 100%; max-width: 380px; aspect-ratio: 5/6; max-height: 100%; margin: 0 auto;
        }
        
        .tile { 
            width: 100%; height: 100%; border: 2px solid var(--border); 
            display: flex; justify-content: center; align-items: center; 
            font-size: 2rem; font-weight: bold; text-transform: uppercase; 
            background-color: transparent; 
            transition: border-color 0.1s, color 0.1s, background-color 0.1s;
            cursor: pointer;
        }
        
        .tile[data-state='correct'] { background-color: var(--correct) !important; border-color: var(--correct) !important; color: white !important; }
        .tile[data-state='present'] { background-color: var(--present) !important; border-color: var(--present) !important; color: white !important; }
        .tile[data-state='absent'] { background-color: var(--absent) !important; border-color: var(--absent) !important; color: white !important; }
        .tile.selected { border-color: var(--text); background-color: rgba(128,128,128,0.15); }
        
        .tile[data-state='active'] { border-color: var(--text); animation: pop 0.1s ease-in-out forwards; }
        .tile.flip { animation: flip 0.6s ease-in forwards; }
        
        @keyframes pop { 50% { transform: scale(1.15); } }
        @keyframes flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }

        .shake { animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both; border-color: var(--danger) !important; color: var(--danger) !important; }
        @keyframes shake { 
            10%, 90% { transform: translate3d(-2px, 0, 0); } 
            20%, 80% { transform: translate3d(4px, 0, 0); } 
            30%, 50%, 70% { transform: translate3d(-6px, 0, 0); } 
            40%, 60% { transform: translate3d(6px, 0, 0); } 
        }

        #keyboard { width: 100%; max-width: 500px; padding: 5px; flex-shrink: 0; margin-bottom: 40px; z-index: 5; }
        .kb-row { display: flex; width: 100%; margin: 0 auto 5px; touch-action: manipulation; justify-content: center; }
        .key { flex: 1; height: 52px; margin: 0 3px; border-radius: 6px; border: none; font-weight: bold; font-size: 1.15rem; cursor: pointer; background: var(--key); color: var(--text); touch-action: manipulation; transition: 0.2s; }
        .key:active { transform: scale(0.95); }
        .key.correct { background: var(--correct); color:#fff; } .key.present { background: var(--present); color:#fff; } .key.absent { background: #111 !important; color:#fff !important; }

        .modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--overlay); z-index: 100; display: none; justify-content: center; align-items: center; padding: 15px; backdrop-filter: blur(5px); }
        .modal-overlay.show { display: flex; animation: fadeIn 0.2s; }
        @keyframes fadeIn { from{opacity:0} to{opacity:1} }
        
        .modal-content { background: var(--modal); border: 1px solid var(--border); padding: 20px; border-radius: 16px; max-width: 600px; width: 100%; max-height: 90vh; overflow-y: auto; text-align: center; position: relative; box-shadow: 0 10px 30px rgba(0,0,0,0.5); animation: slideUp 0.3s; }
        @keyframes slideUp { from{transform:translateY(30px); opacity:0} to{transform:translateY(0); opacity:1} }
        
        .close-btn { position: absolute; top: 10px; right: 15px; font-size: 2rem; line-height: 1; background: none; border: none; color: var(--text); cursor: pointer; padding: 0; z-index: 10; }

        .toast { 
            position: absolute; top: 5px; left: 50%; transform: translateX(-50%); 
            background: var(--text); color: var(--bg); padding: 8px 16px; border-radius: 8px; 
            font-weight: 800; font-size: 0.8rem; opacity: 0; transition: 0.3s; pointer-events: none; z-index: 999; 
            box-shadow: 0 4px 15px rgba(0,0,0,0.3); text-transform: uppercase; white-space: nowrap;
        }
        .toast.visible { opacity: 1; transform: translateX(-50%) translateY(5px); }

        .time-bonus {
            position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%);
            font-size: 3rem; font-weight: 900; color: var(--correct);
            text-shadow: 0 0 10px rgba(0,0,0,0.8); opacity: 0; pointer-events: none; z-index: 50;
        }
        .time-bonus.animate { animation: floatUp 1.2s ease-out forwards; }
        @keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 0) scale(0.5); } 20% { opacity: 1; transform: translate(-50%, -20px) scale(1.2); } 100% { opacity: 0; transform: translate(-50%, -80px) scale(1); } }
        
        .footer-news { width: 100%; background: var(--border); font-size: 0.75rem; text-align: center; padding: 10px; position: absolute; bottom: 0; z-index: 10; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: bold; letter-spacing: 0.5px; }
        #timer-box { font-weight: bold; color: var(--present); font-size: 1.1rem; }
        
        .btn { background: var(--correct); color: #fff; border: none; padding: 12px; border-radius: 8px; font-size: 0.95rem; width: 100%; margin-top: 10px; cursor: pointer; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; transition: 0.2s; }
        .btn:hover { opacity: 0.9; transform: translateY(-2px); }
        .btn-sec { background: var(--key); color: var(--text); margin-top: 8px; }
        .btn-mode { background: linear-gradient(135deg, var(--present) 0%, #d4af37 100%); color: #000; margin-top: 8px; border: 1px solid rgba(255,255,255,0.4); }

        .tut-container { display: flex; flex-direction: column; gap: 10px; } 
        .tut-main { flex: 1; text-align: center; }
        .tut-sidebar { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 5px; }
        .tut-sidebar h3 { margin: 0 0 5px 0; color: var(--present); font-size: 0.8rem; text-align: left; text-transform: uppercase; letter-spacing: 1px; }
        
        .tut-mode-btn { 
            background: rgba(128,128,128,0.1); border: 1px solid var(--border); color: var(--text); 
            padding: 8px 12px; border-radius: 8px; cursor: pointer; text-align: left; transition: 0.2s;
            display: flex; flex-direction: column; gap: 1px;
        }
        .tut-mode-btn:hover { border-color: var(--correct); background: rgba(83,141,78,0.15); transform: translateX(3px); }
        .tm-title { font-weight: 800; font-size: 0.85rem; }
        .tm-desc { font-size: 0.7rem; opacity: 0.8; line-height: 1.2; display: block; }

        .tutorial-row { display: flex; gap: 5px; justify-content: center; margin: 8px 0; }
        .tutorial-tile { width: 32px; height: 32px; display: flex; justify-content: center; align-items: center; font-weight: 800; font-size: 1.1rem; border: 2px solid var(--border); }
        #info-anim .tutorial-row { justify-content: center !important; margin: 15px 0; }
        #info-anim .tutorial-tile { width: 40px; height: 40px; font-size: 1.4rem; }

        .mode-list { display: flex; flex-direction: column; gap: 8px; margin-top: 5px; }
        .mode-item { background: rgba(128,128,128,0.1); border: 2px solid var(--border); padding: 12px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; gap: 15px; text-align: left; transition: 0.2s; }
        .mode-item:hover { border-color: var(--correct); transform: scale(1.02); }
        .mode-item.active { border-color: var(--correct); background: rgba(83,141,78,0.15); }
        .mi-icon { font-size: 1.6rem; }
        .mi-title { display: block; font-weight: 800; font-size: 1rem; margin-bottom: 2px; }
        .mi-desc { display: block; font-size: 0.75rem; opacity: 0.8; line-height: 1.2; }

        .stats-selector { width: 100%; padding: 10px; margin-bottom: 15px; background: var(--bg); color: var(--text); border: 2px solid var(--border); border-radius: 8px; font-size: 0.95rem; font-weight: bold; cursor: pointer; }
        .stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
        .stat-box { background: rgba(128,128,128,0.1); padding: 10px; border-radius: 10px; border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; gap: 2px; }
        .sb-label { font-size: 0.7rem; text-transform: uppercase; opacity: 0.7; letter-spacing: 1px; }
        .sb-val { font-size: 1.5rem; font-weight: 800; color: var(--present); }
        .dist-row { display: flex; align-items: center; margin-bottom: 5px; font-size: 0.8rem; font-weight: bold; }
        .dist-label { width: 15px; }
        .dist-bar-container { flex: 1; margin-left: 8px; }
        .dist-bar { background-color: var(--absent); color: white; text-align: right; padding: 2px 6px; min-width: 20px; border-radius: 4px; font-size: 0.75rem; }
        .dist-bar.highlight { background-color: var(--correct); }

        .rules-list { text-align: left; font-size: 0.95rem; line-height: 1.5; }
        .rules-list p { margin-bottom: 10px; }

        @media (max-width: 500px) {
            #board { max-width: min(340px, 88vw); }
            .tile { font-size: 1.7rem; }
            .key { height: 46px; font-size: 1rem; margin: 0 2px; }
            .header { height: 52px; padding: 0 6px; gap: 5px; }
            .header-left { flex: 1 1 auto; min-width: 0; }
            .header-right { flex: 0 0 auto; gap: 4px; }
            .mode-switch-btn {
                max-width: 100%; min-width: 0; padding: 6px 7px; font-size: 0.65rem; gap: 3px;
            }
            .mode-switch-btn #cur-mode-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
            .mode-label-small { flex-shrink: 0; font-size: 0.48rem; }
            .icon-btn-styled { width: 31px; height: 31px; min-width: 31px; border-width: 1px; border-radius: 7px; font-size: 0.88rem; }
            #hud-timer { font-size: 0.72rem; white-space: nowrap; }
            #timer-box { font-size: 0.85rem; }
            .replay-btn { top: 6px; min-width: 145px; padding: 8px 12px; font-size: 0.78rem; }
        }

        @media (max-width: 370px) {
            .header { padding: 0 4px; gap: 4px; }
            .header-right { gap: 3px; }
            .mode-switch-btn { padding: 5px 6px; font-size: 0.60rem; }
            .mode-switch-btn #cur-mode-icon { font-size: 0.95rem !important; }
            .icon-btn-styled { width: 29px; height: 29px; min-width: 29px; font-size: 0.80rem; }
            .key { height: 42px; font-size: 0.9rem; margin: 0 1px; }
        }
            .replay-btn {
            position: absolute;
            top: 10px;
            left: 50%;
            transform: translateX(-50%);
            width: auto;
            min-width: 170px;
            margin: 0;
            padding: 9px 16px;
            z-index: 20;
            display: none;
        }
        .replay-btn:hover { transform: translateX(-50%) translateY(-2px); }

        .daily-locked {
            opacity: 0.55;
            cursor: not-allowed !important;
        }

.seo-heading { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

        /* Widoczna treść poradnikowa pod grą. Pozostaje poza obszarem aplikacji,
           dzięki czemu plansza i klawiatura zachowują dotychczasowy układ. */
        .page-guide { width: 100%; background: var(--bg); border-top: 1px solid var(--border); padding: 42px 18px 56px; user-select: text; -webkit-user-select: text; }
        .guide-inner { max-width: 800px; margin: 0 auto; }
        .page-guide h2 { margin: 0 0 15px; font-size: 1.45rem; line-height: 1.25; }
        .page-guide h3 { margin: 28px 0 9px; font-size: 1.08rem; line-height: 1.3; }
        .page-guide p, .page-guide li { font-size: 1rem; line-height: 1.65; }
        .page-guide p { margin: 0 0 13px; }
        .page-guide ul, .page-guide ol { margin: 0 0 14px; padding-left: 1.25rem; }
        .page-guide a { color: var(--present); font-weight: 700; }
        .page-guide .lead { color: var(--text); font-size: 1.08rem; }
        .page-guide .example { padding: 16px; border: 1px solid var(--border); border-left: 4px solid var(--correct); border-radius: 6px; margin: 16px 0; }
        .page-guide .faq { margin-top: 30px; }
        .page-guide details { border-bottom: 1px solid var(--border); padding: 12px 0; }
        .page-guide summary { cursor: pointer; font-weight: 700; line-height: 1.45; }
        .page-guide details p { margin: 9px 0 0; }
        .related-tools { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0 !important; }
        .related-tools a { display: inline-block; padding: 8px 11px; border: 1px solid var(--border); border-radius: 6px; text-decoration: none; }
        @media (max-width: 500px) { .page-guide { padding: 32px 16px 44px; } .page-guide h2 { font-size: 1.3rem; } .page-guide p, .page-guide li { font-size: 0.96rem; } }

        /* Prywatność i dokumenty prawne — wykorzystują te same kolory, promienie i rytm co gra. */
        .legal-footer { margin-top: 38px; padding-top: 18px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; font-size: 0.9rem; }
        .legal-footer a { text-decoration: none; }
        .privacy-status { position: fixed; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
        .privacy-banner { position: fixed; z-index: 300; right: 18px; bottom: 18px; width: min(560px, calc(100% - 36px)); display: flex; gap: 18px; align-items: center; padding: 18px; color: var(--text); background: var(--modal); border: 1px solid var(--border); border-left: 4px solid var(--present); border-radius: 10px; box-shadow: 0 12px 38px rgba(0,0,0,.45); user-select: text; -webkit-user-select: text; }
        .privacy-banner h2, .privacy-modal h2 { margin: 0 0 7px; font-size: 1.15rem; }
        .privacy-banner p, .privacy-modal p { margin: 0; font-size: .9rem; line-height: 1.5; }
        .privacy-banner a, .legal-document a { color: var(--present); font-weight: 700; }
        .privacy-copy { flex: 1 1 250px; }
        .privacy-actions { display: flex; flex: 0 1 auto; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
        .privacy-button { min-height: 40px; padding: 8px 12px; border-radius: 8px; border: 2px solid var(--correct); background: transparent; color: var(--text); font: inherit; font-weight: 800; cursor: pointer; }
        .privacy-button:hover, .privacy-button:focus-visible { transform: translateY(-1px); outline: 2px solid var(--present); outline-offset: 2px; }
        .privacy-primary { background: var(--correct); color: #fff; }
        .privacy-secondary { border-color: var(--border); }
        .privacy-overlay { position: fixed; z-index: 320; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(0,0,0,.78); }
        .privacy-overlay[hidden], .privacy-banner[hidden] { display: none; }
        .privacy-modal { position: relative; width: min(620px, 100%); max-height: min(680px, calc(100dvh - 36px)); overflow: auto; padding: 26px; background: var(--modal); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 16px 45px rgba(0,0,0,.5); user-select: text; -webkit-user-select: text; }
        .privacy-close { position: absolute; top: 10px; right: 12px; width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font-size: 1.5rem; cursor: pointer; }
        .privacy-close:focus-visible { outline: 2px solid var(--present); }
        .privacy-category { display: flex; align-items: center; gap: 18px; margin-top: 18px; padding: 15px 0; border-top: 1px solid var(--border); }
        .privacy-category > div { flex: 1; }
        .privacy-category h3 { margin: 0 0 4px; font-size: 1rem; }
        .privacy-always { white-space: nowrap; color: var(--present); font-size: .8rem; font-weight: 800; }
        .privacy-switch { display: inline-flex; align-items: center; cursor: pointer; }
        .privacy-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
        .privacy-switch span { width: 48px; height: 27px; border-radius: 99px; border: 2px solid var(--border); background: var(--absent); transition: .18s ease; }
        .privacy-switch span::after { content: ''; display: block; width: 19px; height: 19px; margin: 2px; border-radius: 50%; background: #fff; transition: .18s ease; }
        .privacy-switch input:checked + span { background: var(--correct); border-color: var(--correct); }
        .privacy-switch input:checked + span::after { transform: translateX(19px); }
        .privacy-switch input:focus-visible + span { outline: 2px solid var(--present); outline-offset: 3px; }
        .privacy-save { width: 100%; margin-top: 20px; }
        .legal-document { width: 100%; min-height: 100dvh; background: var(--bg); color: var(--text); user-select: text; -webkit-user-select: text; }
        .legal-header { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); }
        .legal-brand { color: var(--text); text-decoration: none; font-weight: 900; letter-spacing: .06em; }
        .legal-header a:not(.legal-brand) { color: var(--present); font-weight: 800; }
        .legal-content { max-width: 800px; margin: 0 auto; padding: 42px 18px 56px; }
        .legal-content h1 { margin: 0 0 10px; font-size: clamp(1.7rem, 5vw, 2.3rem); }
        .legal-content h2 { margin: 34px 0 10px; font-size: 1.25rem; }
        .legal-content p, .legal-content li { line-height: 1.65; }
        .legal-content ul { padding-left: 1.25rem; }
        .legal-updated { color: var(--present); font-weight: 700; }
        @media (max-width: 640px) { .privacy-banner { right: 12px; bottom: 12px; width: calc(100% - 24px); gap: 14px; padding: 16px; } .privacy-actions { width: 100%; justify-content: stretch; } .privacy-button { flex: 1 1 30%; } .privacy-category { align-items: flex-start; } .legal-header { padding-inline: 14px; } }
