#wo-ort-snake-game-root {
    position: relative;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #2c3e50;
    width: 100%;
    max-width: 100%;
    min-width: 320px;
    min-height: 320px;
    background: #ffffff;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    border: 3px solid #4f883d;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.omni-save-result-section {
    max-width: 400px;
    margin: 18px auto 0;
    padding: 20px;
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    text-align: center;
}

.omni-save-checkbox-label {
    display: block;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    color: #4f883d;
}

.omni-save-checkbox-label input {
    margin-right: 8px;
    transform: scale(1.2);
    vertical-align: middle;
}

.omni-learner-name-field {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.omni-learner-name-field > label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin-bottom: 8px;
    text-align: center;
}

.omni-learner-name-input {
    width: 100%;
    padding: 18px 20px;
    font-size: 16px;
    line-height: 1.45;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 54px;
}

.omni-learner-name-input:focus {
    outline: none;
    border-color: #4f883d;
    box-shadow: 0 0 0 3px rgba(79, 136, 61, 0.15);
}

.omni-learner-name-input:disabled {
    background: #f0f0f0;
    cursor: not-allowed;
}

.omni-save-result-btn {
    display: block;
    width: 100%;
    padding: 14px 24px;
    margin: 8px 0 12px;
    background: linear-gradient(135deg, #4f883d 0%, #3e6c31 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.omni-save-result-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 136, 61, 0.3);
}

.omni-save-result-btn.saved {
    background-color: #4f883d !important;
    cursor: default;
}

.omni-save-result-btn:disabled {
    opacity: 0.7;
}

.omni-privacy-note {
    margin: 0 0 10px;
    font-size: 12px;
    color: #1e1e1e;
    font-style: italic;
    text-align: center;
}

.omni-save-result-message {
    margin-top: 15px;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 500;
    text-align: center;
}

.omni-save-result-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.omni-save-result-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@media (max-width: 600px) {
    .omni-save-result-section {
        max-width: 100%;
        padding: 15px;
    }
}

/* === TOOLBAR NA GÓRZE === */
#wo-ort-snake-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(248,250,252,0.95) 0%, rgba(255,255,255,0.98) 100%);
    border-radius: 12px;
    box-shadow: 
        0 4px 15px rgba(0,0,0,0.08),
        inset 0 1px 0 rgba(255,255,255,0.8);
    backdrop-filter: blur(10px);
    padding: 14px 24px;
    margin: 0 auto 20px auto;
    width: 100%;
    max-width: 600px;
    min-width: 320px;
    font-size: 1.1em;
    font-family: 'Inter', sans-serif;
    gap: 20px;
    border: 2px solid rgba(79,136,61,0.2);
    flex-wrap: wrap;
    box-sizing: border-box;
}

#wo-ort-snake-toolbar > span, #wo-ort-snake-toolbar > button {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    white-space: nowrap;
    font-size: 1em;
}

#wo-ort-snake-toolbar button {
    background: rgba(79,136,61,0.1);
    border: 1px solid rgba(79,136,61,0.2);
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
    color: #4f883d;
    font-weight: 600;
}

#wo-ort-snake-toolbar button:hover {
    background: rgba(79,136,61,0.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79,136,61,0.2);
}

#wo-ort-snake-timer, #wo-ort-snake-word-counter {
    font-weight: 700;
    color: #2c3e50;
    font-size: 1em;
}

/* === SŁOWO DO UZUPEŁNIENIA - POPRAWIONE STYLE === */
#wo-ort-snake-word-challenge-outer {
    width: 100%;
    max-width: 600px;
    margin: 0 auto 20px auto;
    text-align: center;
    z-index: 5;
    position: relative;
}

#wo-ort-snake-word-challenge {
    font-size: 1.2em;
    font-weight: 400;
    color: #2c3e50;
    margin: 0;
    min-height: 70px;
    text-align: center;
    letter-spacing: 0.3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 18px 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border-radius: 15px;
    box-shadow: 
        0 6px 20px rgba(0,0,0,0.08),
        inset 0 1px 0 rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(79,136,61,0.3);
    animation: wordChallengePulse 0.5s ease;
    line-height: 1.4;
}

#wo-ort-snake-word-challenge .wo-ort-challenge-title {
    color: #333333;
    font-weight: 400;
    font-size: 0.9em;
    margin-bottom: 8px;
    display: block;
    text-transform: none;
}

#wo-ort-snake-word-challenge .wo-ort-challenge-word {
    color: #4f883d;
    font-weight: 800;
    font-size: 1.8em;
    letter-spacing: 1.5px;
    display: block;
    text-shadow: 0 1px 2px rgba(79,136,61,0.1);
}

@keyframes wordChallengePulse {
    0% { transform: scale(0.98); opacity: 0.9; }
    100% { transform: scale(1); opacity: 1; }
}

/* === OBSZAR GRY === */
#wo-ort-snake-game-area {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: auto;
    margin: 0 auto 20px auto;
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#wo-ort-snake-game-area > div {
    position: relative;
    width: 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#wo-ort-snake-canvas {
    display: block;
    border: 4px solid #4f883d;
    background: linear-gradient(45deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 14px;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    min-width: 320px;
    min-height: 320px;
    max-width: 550px;
    max-height: 550px;
    box-sizing: border-box;
    transition: filter 0.3s ease;
    margin: 0 auto;
}

/* === OVERLAY STARTOWY === */
#wo-ort-snake-start-overlay {
    position: absolute;
    left: 0; top: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255,255,255,0.96) 0%, rgba(248,250,252,0.98) 100%);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.5s ease;
}

#wo-ort-snake-title {
    font-size: 2.4em;
    font-weight: 800;
    background: linear-gradient(135deg, #4f883d 0%, #35712a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 32px;
    text-align: center;
    animation: titlePulse 0.8s ease-out 2;
}

@keyframes titlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.wo-ort-snake-btn {
    font-size: 1.3em;
    font-weight: 700;
    padding: 16px 32px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #4f883d 0%, #35712a 100%);
    color: #fff;
    cursor: pointer;
    box-shadow: 
        0 8px 25px rgba(79,136,61,0.4),
        inset 0 1px 0 rgba(255,255,255,0.2);
    transition: all 0.3s ease;
    margin-top: 10px;
    position: relative;
    overflow: hidden;
}

.wo-ort-snake-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 12px 35px rgba(79,136,61,0.5),
        inset 0 1px 0 rgba(255,255,255,0.3);
}

.wo-ort-snake-btn:active {
    transform: translateY(0) scale(1.02);
}

/* === ODLICZANIE === */
#wo-ort-snake-countdown {
    position: absolute;
    left: 0; top: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 25;
    background: linear-gradient(135deg, rgba(255,255,255,0.96) 0%, rgba(248,250,252,0.98) 100%);
    backdrop-filter: blur(10px);
    font-size: 3.5em;
    font-weight: 900;
    color: #4f883d;
    border-radius: 14px;
    animation: countdownPulse 0.8s ease;
}

@keyframes countdownPulse {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* === KOMUNIKAT KOŃCA GRY === */
#wo-ort-snake-gameover {
    display: none;
    position: absolute;
    left: 0; top: 0; right: 0; bottom: 0;
    z-index: 30;
    background: linear-gradient(135deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,1) 100%);
    backdrop-filter: blur(15px);
    border-radius: 14px;
    text-align: center;
    box-shadow: 
        0 10px 30px rgba(0,0,0,0.15),
        inset 0 1px 0 rgba(255,255,255,0.8);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    font-size: 1.2em;
    color: #2c3e50;
    padding: 30px;
    animation: gameOverSlideIn 0.5s ease;
    border: 2px solid rgba(79,136,61,0.1);
}

@keyframes gameOverSlideIn {
    0% { 
        opacity: 0; 
        transform: scale(0.9) translateY(-20px); 
    }
    100% { 
        opacity: 1; 
        transform: scale(1) translateY(0); 
    }
}

#wo-ort-snake-gameover h3 {
    font-size: 2.2em;
    font-weight: 800;
    margin-bottom: 20px;
    animation: titleBounce 0.6s ease;
}

@keyframes titleBounce {
    0% { transform: scale(0.8) translateY(-10px); opacity: 0; }
    60% { transform: scale(1.1) translateY(0); }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* Różne kolory dla różnych typów komunikatów */
#wo-ort-snake-gameover.success h3 {
    background: linear-gradient(135deg, #4f883d 0%, #35712a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#wo-ort-snake-gameover.error h3 {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#wo-ort-snake-gameover.normal h3 {
    background: linear-gradient(135deg, #4f883d 0%, #35712a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#wo-ort-snake-gameover p {
    font-size: 1.2em;
    margin-bottom: 20px;
    line-height: 1.6;
    color: #64748b;
    font-weight: 500;
    animation: fadeInUp 0.7s ease 0.2s both;
}

@keyframes fadeInUp {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

#wo-ort-snake-congrats {
    color: #4f883d;
    font-weight: 700;
    font-size: 1.3em;
    display: none;
    margin-bottom: 20px;
    padding: 10px 20px;
    background: linear-gradient(135deg, rgba(79,136,61,0.1) 0%, rgba(53,113,42,0.1) 100%);
    border-radius: 10px;
    border: 2px solid rgba(79,136,61,0.2);
    animation: successGlow 0.9s ease 3 alternate;
}

@keyframes successGlow {
    0% { box-shadow: 0 4px 15px rgba(79,136,61,0.2); }
    100% { box-shadow: 0 8px 25px rgba(79,136,61,0.4); }
}

#wo-ort-snake-restart {
    padding: 12px 28px;
    margin: 10px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #4f883d 0%, #35712a 100%);
    color: #ffffff;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 6px 20px rgba(79,136,61,0.3),
        inset 0 1px 0 rgba(255,255,255,0.2);
    animation: fadeInUp 0.8s ease 0.4s both;
    position: relative;
    overflow: hidden;
}

#wo-ort-snake-restart:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 8px 25px rgba(79,136,61,0.4),
        inset 0 1px 0 rgba(255,255,255,0.3);
}

#wo-ort-snake-restart:active {
    transform: translateY(-1px) scale(1.02);
}

/* === WSKAZÓWKI STEROWANIA === */
#wo-ort-snake-hints {
    margin: 0 auto 10px auto;
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(248,250,252,0.95) 0%, rgba(255,255,255,0.98) 100%);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    color: #475569;
    text-align: center;
    width: 100%;
    max-width: 600px;
    box-shadow: 
        0 6px 20px rgba(0,0,0,0.08),
        inset 0 1px 0 rgba(255,255,255,0.8);
    position: relative;
    z-index: 1;
    border: 2px solid rgba(79,136,61,0.2);
    box-sizing: border-box;
}

#wo-ort-snake-hints > strong {
    display: block;
    font-size: 1.2em;
    font-weight: 800;
    color: #2c3e50;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wo-ort-snake-controls-buttons {
    display: grid;
    grid-template-areas:
        ". up ."
        "left down right";
    grid-template-columns: repeat(3, 70px);
    grid-template-rows: repeat(2, 70px);
    gap: 8px;
    justify-content: center;
    align-items: center;
    margin: 0 auto 12px auto;
    max-width: 240px;
}

.wo-ort-snake-control-btn {
    width: 70px;
    height: 70px;
    border-radius: 14px;
    border: 2px solid rgba(79,136,61,0.25);
    background: linear-gradient(135deg, #4f883d 0%, #35712a 100%);
    color: #fff;
    font-size: 32px;
    font-weight: 800;
    box-shadow:
        0 6px 18px rgba(79,136,61,0.35),
        inset 0 1px 0 rgba(255,255,255,0.2);
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.2s ease, filter 0.2s ease;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wo-ort-snake-control-btn[data-dir="up"] { grid-area: up; }
.wo-ort-snake-control-btn[data-dir="left"] { grid-area: left; }
.wo-ort-snake-control-btn[data-dir="down"] { grid-area: down; }
.wo-ort-snake-control-btn[data-dir="right"] { grid-area: right; }

.wo-ort-snake-control-btn:hover,
.wo-ort-snake-control-btn:focus {
    transform: translateY(-1px);
    box-shadow:
        0 12px 28px rgba(79,136,61,0.4),
        inset 0 1px 0 rgba(255,255,255,0.3);
    outline: none;
}

.wo-ort-snake-control-btn:active {
    transform: translateY(1px);
    filter: brightness(0.95);
}

.wo-ort-snake-control-btn--ghost {
    display: none !important;
}

.wo-ort-snake-controls-note {
    font-size: 0.95em;
    color: #64748b;
    margin-top: 6px;
}

/* === UKRYWANIE ELEMENTÓW === */
.wo-ort-snake-hidden {
    display: none !important;
}

/* === POPUP PODSUMOWANIA === */
.wo-ort-popup {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}
.wo-ort-popup.is-visible {
    opacity: 1;
    pointer-events: auto;
}
.wo-ort-popup-inner {
    position: relative;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 6px 32px #2222;
    padding: 32px 30px 26px;
    min-width: 280px;
    max-width: 90vw;
    text-align: center;
    animation: wo-ort-popup-in 0.5s cubic-bezier(.6,2,.4,1);
}
@keyframes wo-ort-popup-in {
    0% { transform: scale(.85) translateY(32px); opacity:0; }
    100% { transform: scale(1) translateY(0); opacity:1; }
}
.wo-ort-popup-title {
    font-size: 2.1em;
    font-weight: 700;
    color: #4f883d;
    margin: 0 0 10px;
}
.wo-ort-popup-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 22px;
    text-align: left;
}
.wo-ort-popup-summary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 1.05em;
    color: #111827;
}
.wo-ort-popup-summary-label { font-weight: 600; }
.wo-ort-popup-summary-value { font-weight: 700; color: #4f883d; }
.wo-ort-popup-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.wo-ort-popup-btn {
    background: #4f883d;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 30px;
    font-size: 1.05em;
    cursor: pointer;
    box-shadow: 0 1px 4px #4f883d33;
    transition: background .2s;
}
.wo-ort-popup-btn:hover { background: #6bb94a; }
.wo-ort-popup-btn--outline {
    background: #fff;
    color: #4f883d;
    border: 2px solid #4f883d;
    box-shadow: none;
}
.wo-ort-popup-btn--outline:hover { background: #f1f5f9; }
.wo-ort-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    border: 1px solid rgba(0,0,0,0.12);
    background: #fff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    color: #4a4a4a;
    font-size: 18px;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    z-index: 3;
}
.wo-ort-popup-close:hover { background: rgba(255,255,255,0.9); }

/* === ANIMACJE GLOBALNE === */
@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* === RESPONSIVE === */
@media (max-width: 700px) {
    #wo-ort-snake-game-root {
        padding: 16px;
        border-radius: 16px;
    }
    
    #wo-ort-snake-word-challenge-outer,
    #wo-ort-snake-toolbar,
    #wo-ort-snake-game-area,
    #wo-ort-snake-hints {
        max-width: 100%;
        width: 100%;
    }
    
    #wo-ort-snake-toolbar {
        padding: 12px 16px;
        font-size: 1em;
        gap: 12px;
        justify-content: space-around;
        margin-bottom: 16px;
    }
    
    #wo-ort-snake-title {
        font-size: 2em;
        margin-bottom: 20px;
    }
    
    .wo-ort-snake-btn {
        font-size: 1.1em;
        padding: 14px 24px;
    }
    
    #wo-ort-snake-word-challenge {
        font-size: 1.1em;
        min-height: 60px;
        padding: 14px 18px;
    }
    
    #wo-ort-snake-word-challenge .wo-ort-challenge-title {
        font-size: 0.9em;
    }
    
    #wo-ort-snake-word-challenge .wo-ort-challenge-word {
        font-size: 1.5em;
    }
    
    #wo-ort-snake-canvas {
        min-width: 280px;
        min-height: 280px;
    }
    
    #wo-ort-snake-hints {
        padding: 16px 20px;
        margin: 0 auto 8px auto;
    }
    
    #wo-ort-snake-hints > strong {
        font-size: 1.1em;
        margin-bottom: 12px;
    }
    
    .wo-ort-snake-controls-grid {
        gap: 10px 16px;
        max-width: 320px;
    }
    
    .wo-ort-snake-control-item {
        font-size: 1em;
        gap: 6px;
    }
    
    #wo-ort-snake-hints .key {
        padding: 6px 10px;
        min-width: 28px;
        height: 28px;
        font-size: 0.9em;
    }
    
    #wo-ort-snake-gameover {
        padding: 20px 16px;
    }
    
    #wo-ort-snake-gameover h3 {
        font-size: 1.8em;
    }
    
    #wo-ort-snake-gameover p {
        font-size: 1.1em;
    }
}

/* Jeszcze mniejsze ekrany */
@media (max-width: 400px) {
    .wo-ort-snake-controls-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .wo-ort-snake-control-item {
        justify-content: center;
    }
    
    #wo-ort-snake-canvas {
        min-width: 260px;
        min-height: 260px;
    }
}

/* === FULLSCREEN === */
:fullscreen #wo-ort-snake-game-root,
:-webkit-full-screen #wo-ort-snake-game-root {
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 20px !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: #ffffff;
    border-radius: 0;
    border: none;
    box-sizing: border-box;
    overflow-y: auto;
}

:fullscreen #wo-ort-snake-game-area,
:-webkit-full-screen #wo-ort-snake-game-area {
    width: 100%;
    max-width: 80vmin;
    height: auto;
}

:fullscreen #wo-ort-snake-canvas,
:-webkit-full-screen #wo-ort-snake-canvas {
    max-width: 70vmin;
    max-height: 70vmin;
    width: auto !important;
    height: auto !important;
}

:fullscreen #wo-ort-snake-toolbar,
:-webkit-full-screen #wo-ort-snake-toolbar,
:fullscreen #wo-ort-snake-word-challenge-outer,
:-webkit-full-screen #wo-ort-snake-word-challenge-outer,
:fullscreen #wo-ort-snake-hints,
:-webkit-full-screen #wo-ort-snake-hints {
    max-width: 80vmin;
}
