.hud-bottom { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; gap: 12px; z-index: 10; }
.hud-box { width: 58px; height: 46px; background: rgba(255,255,255,0.9); border-radius: 8px; display: grid; place-items: center; box-shadow: 0 4px 10px rgba(0,0,0,.2); }
.hud-box.wide { width: 86px; }
.hud-label { font-size: .72rem; color: #333; opacity: .85; line-height: 1; }
.hud-value { font-weight: 800; color: #2b2b2b; }
/**
 * Główny plik stylów dla gry edukacyjnej o wężach
 * Zgodny z wymaganiami dostępności WCAG 2.1
 */

/* Reset i podstawowe style */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    line-height: 1.5;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: transparent; /* tło ustawiane jest przez JS jako jungle */
    color: #333;
    height: 100vh;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* Skip link dla czytników ekranu */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
    border-radius: 4px;
}

.skip-link:focus {
    top: 6px;
}

/* Główny kontener gry */
.game-container {
    max-width: 100%;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
}

/* Tło jungle pod całą aplikacją - wypełnia kontener */
.menu-background,
.level-background {
    position: fixed;
    inset: 0;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    z-index: -1; /* tło pod treścią */
    pointer-events: none;
}

/* Tło dla pierwszego widoku (ekran startowy) ustawione w CSS */
.main-menu .menu-background {
    background-image: url('../images/grafika/bg_start_logo.png');
    pointer-events: none;
}

/* Ekran ładowania */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    color: white;
    font-size: 1.2rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Menu główne */
.main-menu {
    background: transparent; /* bez tła */
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    box-shadow: none; /* bez cienia */
    margin: 200px 0 60px 0; /* jeszcze niżej na stronie */
}

/* Kamienna karta zgodna z ekranem startowym */
.menu-panel {
    background: url('../images/grafika/popup_1240.png') no-repeat center / contain;
    padding: 60px 40px 80px 40px; /* więcej miejsca na dół */
    max-width: 1100px;
    margin: 0 auto;
    color: #fff;
}

.menu-title-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.menu-title {
    font-size: 2.6rem;
    color: #ffe600;
    font-weight: 800;
    text-shadow: 2px 2px 0 #333;
}

.menu-intro h2 {
    font-size: 1.8rem;
    color: #ffe600;
    margin-bottom: 12px;
    text-shadow: 1px 1px 0 #2a3a2a;
}

.menu-intro p {
    font-size: 1.1rem;
    color: #fff;
    max-width: 760px;
    margin: 0 auto 24px auto;
}

.menu-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    max-width: 480px;
    margin: 0 auto 26px auto;
}

.menu-primary { display: flex; justify-content: center; margin: 18px 0 0 0; }
/* menu-aux usunięte – zgodnie z makietą tylko 3 przyciski */

.menu-header h1 {
    font-size: 2.5rem;
    color: #ffe600;
    margin-bottom: 10px;
    font-weight: 700;
    text-shadow: 2px 2px 0 #333;
}

.menu-header p {
    font-size: 1.2rem;
    color: #fff;
    margin-bottom: 40px;
    text-shadow: 1px 1px 0 #2a3a2a;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 300px;
    margin: 0 auto;
}

.menu-btn {
    padding: 0;
    font-size: 1.1rem;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease;
    font-weight: 900;
    letter-spacing: .2px;
    line-height: 1;
}

.menu-btn.primary {
    width: 380px;
    height: 96px;
    background: url('../images/grafika/btn_out_490.png') no-repeat center / contain;
    color: #2b2b2b;
    font-weight: 900;
    font-size: 1.8rem;
    text-shadow: 0 2px 0 rgba(0,0,0,.35);
}

.menu-btn.secondary {
    width: 220px;
    height: 72px;
    background: url('../images/grafika/btn_out_330.png') no-repeat center / contain;
    color: #2b2b2b;
    border: none;
    font-size: 1.25rem;
    text-shadow: 0 2px 0 rgba(0,0,0,.35);
}

/* usunięte dodatkowe warianty – nieużywane na ekranie startowym */

.menu-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

.menu-btn:focus {
    outline: 3px solid #ffd700;
    outline-offset: 2px;
}

.menu-btn:active {
    transform: translateY(0);
}

/* Wybór poziomu */
.level-select {
    background: url('../images/grafika/popup_1240.png') no-repeat center / cover;
    border-radius: 0;
    padding: 40px;
    box-shadow: none;
    backdrop-filter: none;
    background-color: transparent !important;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 40px;
    max-width: 1200px;
    width: 100%;
}

.level-card {
    width: 100%;
    height: 400px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    transition: transform 0.3s ease;
    cursor: pointer;
    border: none;
    padding: 0;
    margin: 0;
    position: relative;
}

.level-card:hover {
    transform: scale(1.05);
}

.level-card:focus {
    outline: 3px solid #ffd700;
    outline-offset: 4px;
}

/* Minimalistyczny overlay z nazwą i statusem - wyśrodkowany */
.level-card .level-info {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 0;
    background: none;
    color: #fff;
    text-align: center;
}

.level-card .level-title {
    color: #0b0c0b;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.level-card .level-subtitle {
    margin-top: 4px;
    font-size: 0.9rem;
    opacity: 0.95;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.level-card.available {
    cursor: pointer;
}

.level-card.locked {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Interfejs gry */
.game-interface {
    background: url('../images/grafika/popup_1240.png') no-repeat center / contain;
    border-radius: 20px;
    padding: 30px;
    box-shadow: none;
    backdrop-filter: none;
    background-color: transparent !important;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #ecf0f1;
}

.game-info {
    display: flex;
    gap: 20px;
    font-weight: 600;
}

.game-info span {
    background: rgba(0,0,0,0.4);
    padding: 8px 15px;
    border-radius: 20px;
    color: #fff;
}

.game-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    background: url('../images/grafika/btn_out_330.png') no-repeat center / cover;
    color: #ffe600;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.control-btn:focus {
    outline: 3px solid #ffd700;
    outline-offset: 2px;
}

/* Obszar gry */
.game-content { margin-bottom: 20px; }

/* NOWA, stabilna siatka poziomu 1 */
.level1-grid {
    display: grid !important;
    grid-template-columns: 180px minmax(720px, 1fr) 380px !important;
    gap: 14px !important;
    align-items: start;
    margin-left: -20px; /* przylega do krawędzi ekranu mimo paddingu kontenera */
    margin-right: -20px;
}

/* Lewy pion – kompaktowy, pionowe ikony */
.left-rail {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    padding: 12px 10px;
    width: 160px;
    background: rgba(0,0,0,0.75); /* półprzezroczysty czarny jak na makiecie */
    min-height: 100vh;
}
.left-rail .rail-icons { width: 100%; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.left-rail .image-item {
    width: 112px;
    height: 92px;
    background: rgba(255,255,255,0.9);
    border: 2px solid rgba(0,0,0,0.15);
    border-radius: 12px;
    padding: 6px;
    display: grid;
    place-items: center;
    cursor: pointer;
    position: relative;
    z-index: 1;
}
.left-rail .image-item:nth-child(n+2) { margin-top: -10px; }
.left-rail .image-item:nth-child(odd) { align-self: flex-start; margin-left: -14px; }
.left-rail .image-item:nth-child(even) { align-self: flex-end; margin-right: -14px; }
.left-rail .image-item img { width: 96px; height: 82px; object-fit: contain; }
.left-rail .image-item:hover { filter: brightness(1.05); transform: translateY(-1px); }
.left-rail .image-tooltip {
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.3;
    min-width: 160px;
    max-width: 220px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}
.left-rail .image-tooltip::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 8px;
    border-style: solid;
    border-color: transparent rgba(0,0,0,0.85) transparent transparent;
}
.left-rail .image-item:hover .image-tooltip,
.left-rail .image-item:focus .image-tooltip,
.left-rail .image-item:focus-visible .image-tooltip {
    opacity: 1;
}
.info-btn { width: 88px; height: 88px; border: none; background: transparent; padding: 0; cursor: pointer; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.35)); transition: transform 0.2s ease, filter 0.2s ease; display: grid; place-items: center; border-radius: 50%; }
.info-btn img { width: 100%; height: 100%; object-fit: contain; }
.info-btn:hover, .info-btn:focus { transform: translateY(-2px) scale(1.02); filter: drop-shadow(0 4px 6px rgba(0,0,0,0.4)); outline: none; }
.info-btn:focus-visible { outline: 3px solid #ffd700; outline-offset: 4px; }

/* Centralna scena węża */
.snake-container, .snake-stage { position: relative; min-height: 540px; display: grid; place-items: center; }
.snake-stage-title { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); background: url('../images/grafika/bg_start_logo.png') no-repeat center/contain; width: 420px; height: 86px; display: grid; place-items: center; color: #ffe600; font-weight: 800; text-shadow: 2px 2px 0 #333; }
.snake-stage-inner { width: 100%; height: 100%; display: grid; place-items: center; }

/* Prawy panel – jak w makiecie */
.right-rail { width: 320px; display: flex; flex-direction: column; gap: 16px; padding: 10px; background: rgba(0,0,0,0.75); border-radius: 8px 0 0 8px; }
/* Timer jak kamienna tablica */
.timer-box { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    background: url('../images/grafika/bg_time.png') no-repeat center center / cover; 
    color: #333; 
    padding: 10px 16px; 
    height: 94px;
    border-radius: 8px;
    position: relative
}

.timer-box span:first-child { 
    font-weight: bold;
    color: #2b2b2b;
    font-size: 1.6rem;
    position: absolute;
    left: 57px;
    top: 35px;
}
.timer-display { 
    font-weight: 900;
    color: #ffe600;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 2rem;
    letter-spacing: 1px;
    min-width: 80px;
    text-align: center;
    position: absolute;
    right: 47px;
    top: 24px;
}
/* Karty poziomów */
.levels-box { display: flex; flex-direction: column; gap: 18px; }
.levels-box .level-card {
    height: 175px; /* domyślnie */
    top: -20px;
    border-radius: 18px;
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    color: #222;
    text-shadow: 0 1px 0 rgba(255,255,255,.6);
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover; /* pełna szerokość, bez zmniejszania */
    position: relative;
}
.levels-box .level-card:nth-child(1) { background: url('../images/grafika/bg_level_01.png') no-repeat center/contain; }
.levels-box .level-card:nth-child(2) { background-image: url('../images/grafika/bg_level_02_inactive.png') no-repeat center/contain; filter: grayscale(10%); height: 220px; top: -50px; background-position: center top; }
.levels-box .level-card:nth-child(3) { background-image: url('../images/grafika/bg_level_03_inactive.png') no-repeat center/contain; filter: grayscale(10%); height: 235px; top: -70px; background-position: center top; }
.levels-box .level-card:nth-child(3) .level-title { top: 65px; }

/* Tytuł poziomu w stylu z makiety */
.level-title { 
    position: absolute;
    top: 65px;
    left: 0;
    right: 0;
    width: 100%;
    text-align: center;
    font-weight: 900;
    font-size: 1.2rem;
    color: #2b2b2b;
    text-shadow: 0 1px 0 rgba(255,255,255,.8);
}

/* Rząd gwiazdek */
.stars-row { 
    position: absolute; 
    left: 0; right: 0; 
    top: 100px; 
    display: flex; 
    justify-content: center; 
    align-items: center;
    gap: 10px; 
    flex-wrap: wrap;
    max-width: 240px;
    margin: 0 auto;
}
.stars-row-2 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 10px;
    max-width: 240px;
    margin: 0 auto;
    justify-items: center;
    align-items: center;
}
.stars-row-3 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 3px;
    max-width: 240px;
    margin: 0 auto;
    justify-items: center;
    align-items: center;
}
.star { width: 28px; height: 28px; background-size: contain; background-repeat: no-repeat; display: inline-block; filter: drop-shadow(0 1px 0 rgba(0,0,0,.25)); flex: 0 0 36px; }
.star.full { background-image: url('../images/grafika/star_01.png'); }
.star.empty { background-image: url('../images/grafika/star_02.png'); opacity: .9; }
.levels-box .level-card.disabled { opacity: .9; }
/* Przyciski systemowe – kamienne kafle */
.system-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 4px 6px; }
.sys-btn { width: 68px; height: 68px; border: none; background: transparent; cursor: pointer; justify-self: center; filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); }
.btn-help { background: url('../images/grafika/btn_help.png') no-repeat center/contain; }
.btn-sound { background: url('../images/grafika/btn_sound.png') no-repeat center/contain; }
.btn-settings { background: url('../images/grafika/btn_setting.png') no-repeat center/contain; }
.end-game-btn { background: url('../images/grafika/btn_out_490.png') no-repeat center/cover; color: #4a4a4a; border: none; padding: 14px; border-radius: 12px; font-weight: 900; width: 100%; font-size: 1.8rem; letter-spacing: 0.5px; }
/* Wizualizacja węża */
.snake-visualization {
    text-align: center;
    border-radius: 15px;
    padding: 10px;
    min-height: 520px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.snake-visualization img {
    max-width: 100%;
    height: auto;
    transition: all 0.5s ease;
}

.snake-realistic {
    position: absolute;
    opacity: 0;
    transition: opacity 1s ease;
}

.snake-realistic.show {
    opacity: 1;
}

.snake-scene {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Nowa warstwa SVG z literami / segmentami */
.letters-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }

.letters-svg { width: 100%; height: 100%; display: block; }

.letter-input-svg {
    width: 100%;
    height: 100%;
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    background: transparent;
    border: none;
    color: #222;
}

.letter-input-svg:focus {
    outline: 2px solid #ffd700;
}

/* Lewy pion */
.left-rail { display: flex; flex-direction: column; gap: 12px; width: 220px; padding-left: 20px; align-items: center; }
.left-rail .rail-icons { display: flex; flex-direction: column; gap: 12px; width: 100%; align-items: center; }
.left-rail .image-item { padding: 6px; width: 110px; margin: 0; background: transparent; border: none; position: relative; }
.left-rail .image-item img { width: 84px; height: 84px; object-fit: contain; display: block; }

/* Prawy panel */
.right-rail { display: flex; flex-direction: column; gap: 14px; width: 360px; }
.levels-box { display: flex; flex-direction: column; gap: 14px; }
.level-card { height: 150px; border-radius: 12px; padding: 12px 16px; display: flex; flex-direction: column; justify-content: center; background: url('../images/grafika/bg_level_01.png') no-repeat center / cover; color: #263238; }
.level-card.disabled { filter: grayscale(100%); opacity: .6; }
.system-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sys-btn { width: 62px; height: 62px; border: none; background: transparent; cursor: pointer; justify-self: center; }
.btn-help { background: url('../images/grafika/btn_help.png') no-repeat center / contain; }
.btn-sound { background: url('../images/grafika/btn_sound.png') no-repeat center / contain; }
.btn-settings { background: url('../images/grafika/btn_setting.png') no-repeat center / contain; }
.end-game-btn { background: url('../images/grafika/btn_out_490.png') no-repeat center / cover; color: #4a4a4a; border: none; padding: 12px; border-radius: 10px; font-weight: 900; width: 100%; font-size: 1.6rem; letter-spacing: 0.5px; }

/* Removed experimental right/left rails to restore stable two-column layout */

/* Obszar gry poziomu 1 */
.level1-game-area {
    background: rgba(0,0,0,0.25);
    border-radius: 15px;
    padding: 20px;
}

.images-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.image-item {
    background: rgba(255,255,255,0.9);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.image-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.image-item:focus {
    outline: 3px solid #ffd700;
    outline-offset: 2px;
}

.image-item.selected {
    border-color: #27ae60;
    background: #d4edda;
}

.image-item img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.word-hint {
    font-weight: 800;
    color: #2e7d32;
}

/* Sekcje węża */
.snake-sections {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.snake-section {
    background: rgba(255,255,255,0.9);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    border: 2px solid #dee2e6;
    transition: all 0.3s ease;
}

.snake-section.completed {
    border-color: #27ae60;
    background: #d4edda;
}

.snake-section input {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 6px;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    background: transparent;
}

.snake-section input:focus {
    outline: 2px solid #667eea;
    background: #f8f9fa;
}

/* Przycisk sprawdzenia */
.submit-btn {
    width: 100%;
    background: url('../images/grafika/btn_out_490.png') no-repeat center / cover;
    color: #ffe600;
    border: none;
    padding: 15px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(39, 174, 96, 0.3);
}

.submit-btn:focus {
    outline: 3px solid #ffd700;
    outline-offset: 2px;
}

.submit-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* Instrukcje */
.instructions {
    background: url('../images/grafika/bg_time.png') no-repeat center / cover;
    border-radius: 10px;
    padding: 20px;
    border-left: none;
}

.instructions h3 {
    color: #1976d2;
    margin-bottom: 10px;
}

.instructions p {
    color: #424242;
    line-height: 1.6;
}

/* Panel dostępności */
.accessibility-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    max-width: 300px;
}

.accessibility-panel h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.accessibility-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.accessibility-controls label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
}

.accessibility-controls input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

/* Panel debugowania */
.debug-panel {
    position: fixed;
    top: 20px;
    left: 20px;
    background: url('../images/grafika/bg_cave.png') no-repeat center / cover;
    color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    max-width: 300px;
}

.debug-panel h3 {
    margin-bottom: 15px;
    color: #ecf0f1;
}

.debug-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.debug-buttons button {
    background: #34495e;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.debug-buttons button:hover {
    background: #2c3e50;
}

/* Panel logów */
.logs-panel {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: #2c3e50;
    color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.logs-content {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    line-height: 1.4;
    margin-bottom: 15px;
    background: #1a252f;
    padding: 15px;
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
}

/* Wirtualna klawiatura */
.virtual-keyboard {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: url('../images/backgrounds/menu_jungle.png') center/cover no-repeat;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    max-width: 600px;
}

.keyboard-layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.keyboard-row {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.key {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
    min-width: 40px;
}

.key:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.key:focus {
    outline: 3px solid #ffd700;
    outline-offset: 2px;
}

.key:active {
    transform: translateY(0);
    background: #667eea;
    color: white;
}

.key.special {
    background: #667eea;
    color: white;
    min-width: 60px;
}

/* Przyciski zamknięcia */
.close-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.close-btn:focus {
    outline: 3px solid #ffd700;
    outline-offset: 2px;
}

.export-btn, .clear-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-right: 10px;
    transition: all 0.3s ease;
}

.export-btn:hover, .clear-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* Animacje */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

.slide-in {
    animation: slideIn 0.3s ease;
}

/* Focus indicators for accessibility */
*:focus {
    outline: 3px solid #ffd700;
    outline-offset: 2px;
}

/* High contrast mode */
.high-contrast {
    filter: contrast(150%) brightness(120%);
}

.high-contrast .game-container {
    background: #000;
    color: #fff;
}

.high-contrast .main-menu,
.high-contrast .level-select,
.high-contrast .game-interface {
    background: #000;
    color: #fff;
    border: 2px solid #fff;
}

/* Large text mode */
.large-text {
    font-size: 1.2rem;
}

.large-text .menu-header h1 {
    font-size: 3rem;
}

.large-text .level-select h2 {
    font-size: 2.5rem;
}

.large-text .menu-btn {
    font-size: 1.3rem;
    padding: 20px 35px;
}

/* Globalne obrazy – nie rozciągaj na sztywno, tylko ograniczaj do kontenera */
img { max-width: 100%; height: auto; }

/* =========================
   Level completion screen
   ========================= */
.completion-screen {
    position: relative;
    min-height: 100vh;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 32px;
    color: #1f1c18;
}

.completion-decoration {
    position: absolute;
    top: -40px;
    left: 0;
    width: 30%;
    pointer-events: none;
    z-index: 0;
}

.completion-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 36px;
    align-items: start;
}

.completion-main {
    height: 100vh;
    position: relative;
    z-index: 1;
}

.completion-actions {
    margin-top: 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: absolute;
    left: 24px;
    bottom: 120px;
    align-items: flex-start;
}

.completion-btn {
    position: relative;
    min-width: 240px;
    border: none;
    padding: 26px 32px 30px;
    font-weight: 800;
    font-size: 1.15rem;
    text-transform: uppercase;
    color: #2a231b;
    letter-spacing: 0.5px;
    text-align: left;
    background: url('../images/grafika/btn_out_330.png') center center / contain no-repeat;
    cursor: pointer;
    transition: none;
    box-shadow: none;
    text-shadow: 0 2px 0 rgba(255, 255, 255, 0.45);
}

.completion-btn:hover,
.completion-end-btn:hover {
    transform: none;
    box-shadow: none;
}

.completion-gallery {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.completion-gallery .gallery-image {
    position: absolute;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.completion-gallery .gallery-image-1 {
    width: 100%;
    max-width: 270px;
    top: 300px;
    left: 15%;
}

.completion-gallery .gallery-image-2 {
    width: 100%;
    max-width: 290px;
    top: 300px;
    right: 15%;
}

.completion-gallery .gallery-image-3 {
    width: 100%;
    max-width: 290px;
    bottom: 1%;
    left: 20%;
}

.completion-gallery .gallery-image-4 {
    width: 100%;
    max-width: 300px;
    bottom: 1%;
    right: 12%;
}

.completion-gallery .info-btn {
    position: absolute;
    bottom: 8%;
    width: 92px;
    height: 92px;
    pointer-events: auto;
}

.completion-gallery .info-btn:first-of-type {
    left: 320px;
    bottom: 320px;
}

.completion-gallery .info-btn:last-of-type {
    left: 47%;
    bottom: 220px;
}

.completion-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.completion-logo {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 30%;
    margin: auto;
    z-index: 3;
    pointer-events: none;
}

.completion-logo img {
    display: block;
    width: 100%;
    height: auto;
}

.completion-snake-name {
    text-align: center;
}

.completion-snake-name h2 {
    font-size: clamp(2rem, 2.8vw, 3rem);
    font-weight: 800;
    color: #2f1e0e;
    margin-bottom: 8px;
}

.completion-snake-name p {
    font-size: 1.1rem;
    color: #5b4029;
    font-weight: 600;
}

.completion-right {
    display: flex;
    flex-direction: column;
    gap: 22px;
    position: sticky;
    top: 28px;
    right: 0;
    align-self: start;
    z-index: 2;
}
.congrats-level-card {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.congrats-level-card.completed {
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.25);
}

.congrats-level-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.25);
}

.congrats-level-card.disabled {
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
    box-shadow: none;
    filter: grayscale(70%);
}

.completion-end-btn {
    margin-top: 16px;
    align-self: stretch;
}

.completion-secondary-btn:hover {
    text-decoration: none;
}

.info-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1200;
}

.info-modal.show {
    display: flex;
}

.info-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.info-modal-content {
    position: relative;
    background: rgba(18, 28, 18, 0.95);
    border: 3px solid rgba(255, 230, 0, 0.6);
    border-radius: 18px;
    padding: 24px 24px 32px;
    max-width: min(820px, 90vw);
    max-height: min(720px, 85vh);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.info-modal-content img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.15);
}

.info-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: rgba(0, 0, 0, 0.45);
    color: #ffe600;
    border: none;
    font-size: 2rem;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform 0.2s ease, background 0.2s ease;
}

.info-modal-close:hover,
.info-modal-close:focus {
    background: rgba(0, 0, 0, 0.65);
    transform: scale(1.05);
    outline: none;
}

.info-modal-close:focus-visible {
    outline: 3px solid #ffe600;
    outline-offset: 3px;
}

@media (max-width: 1280px) {
    .completion-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .completion-logo {
        position: static;
        transform: none;
        margin: 0 auto;
    }

    .completion-right {
        position: static;
        top: auto;
        grid-column: span 2;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .completion-right .timer-box {
        flex: 1 1 220px;
    }

    .completion-right .levels-box {
        flex: 1 1 220px;
    }

    .completion-right .system-buttons {
        flex: 1 1 160px;
        justify-content: flex-start;
    }
}

@media (max-width: 960px) {
    .completion-screen {
        padding: 36px 28px 40px;
    }

    .completion-logo {
        width: clamp(160px, 40vw, 220px);
        margin-bottom: 12px;
    }

    .completion-grid {
        grid-template-columns: 1fr;
    }

    .completion-right {
        position: static;
        top: auto;
        flex-direction: column;
    }

    .completion-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .completion-btn {
        flex: 1 1 220px;
    }

    .left-rail .image-tooltip {
        left: 50%;
        top: calc(100% + 12px);
        transform: translate(-50%, 0);
        text-align: center;
    }

    .left-rail .image-tooltip::before {
        left: 50%;
        top: -8px;
        transform: translateX(-50%);
        border-color: transparent transparent rgba(0,0,0,0.85) transparent;
    }

    .completion-gallery .info-btn {
        width: 80px;
        height: 80px;
        left: 50%;
        transform: translateX(-50%);
        bottom: 10%;
    }

    .completion-gallery .info-btn:first-of-type {
        bottom: 18%;
    }

    .completion-gallery .info-btn:last-of-type {
        bottom: 4%;
    }
}

@media (max-width: 640px) {
    .completion-actions {
        flex-direction: column;
    }

    .completion-btn,
    .completion-end-btn {
        width: 100%;
    }

    .completion-right .system-buttons {
        justify-content: center;
    }

    .completion-gallery .info-btn {
        width: 72px;
        height: 72px;
        left: 50%;
        transform: translateX(-50%);
        margin-left: 0;
    }

    .completion-gallery .info-btn:first-of-type {
        bottom: 12%;
    }

    .completion-gallery .info-btn:last-of-type {
        bottom: 4%;
    }
}