/**
 * Styl dla poziomu II - Węże Świata
 * Mechanika word-pool (bez ilustracji)
 */

.level2-game {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: url('../images/backgrounds/level2.png') no-repeat center / cover;
    color: #333;
}

.level2-game .game-header {
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.level2-game .game-stats {
    display: flex;
    gap: 30px;
    justify-content: center;
}

.level2-game .stat-item {
    display: flex;
    gap: 10px;
    align-items: center;
}

.level2-game .label {
    font-weight: 600;
    color: #555;
}

.level2-game .value {
    font-size: 1.2em;
    font-weight: bold;
    color: #2196F3;
}

/* Obszar gry - zmieniamy grid na block layout dla poziomu 2 */
.level2-game .game-content {
    display: block;
    gap: 0;
}

/* Unified game box - wszystko w jednym kontenerze */
.unified-game-box {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    margin: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* Pula słów */
.word-pool-container {
    padding: 0;
    margin: 20px 0;
    background: transparent;
    box-shadow: none;
}

.word-pool-container h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.3em;
}

.word-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.word-button {
    padding: 12px 20px;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 500;
    color: #333;
    transition: all 0.3s ease;
}

.word-button:hover {
    background: #e0e0e0;
    border-color: #2196F3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.word-button:active {
    transform: translateY(0);
}

.word-button.selected {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.word-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Wybrane słowa */
.selected-words-container {
    padding: 0;
    margin: 20px 0;
    background: transparent;
    box-shadow: none;
}

.selected-words-container h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.3em;
}

.selected-words {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.selected-word {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: #f9f9f9;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.selected-word:hover {
    border-color: #2196F3;
    background: #f0f8ff;
}

.word-number {
    font-weight: bold;
    color: #2196F3;
    min-width: 25px;
}

.selected-word .word-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1.1em;
    background: white;
}

.selected-word .word-input:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.remove-word {
    background: #f44336;
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 1.2em;
    font-weight: bold;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-word:hover {
    background: #d32f2f;
    transform: scale(1.1);
}

/* Snake visualization */
.level2-game .snake-visualization-container {
    padding: 0;
    margin: 0 0 20px 0;
    background: transparent;
    box-shadow: none;
}

.level2-game .snake-visualization {
    position: relative;
    width: 100%;
    height: 400px;
    background: #fafafa;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.level2-game .snake-svg {
    width: 100%;
    height: 100%;
}

/* Warstwy węża z Poziomu I */
.snake-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.snake-sketch {
    filter: grayscale(100%) contrast(1.1);
    opacity: 0.9;
}

.snake-colored-mask {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    overflow: hidden;
    transition: width 0.6s ease;
}

.snake-realistic {
    filter: none;
}

/* Progress bar */
.snake-progress {
    margin-top: 15px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #8BC34A 100%);
    transition: width 0.5s ease;
}

.progress-text {
    font-weight: 600;
    color: #555;
}

/* Game controls */
.level2-game .game-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0 0 0;
    flex-wrap: wrap;
}

.level2-game .game-controls button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.level2-game .submit-btn {
    background: #4CAF50;
    color: white;
}

.level2-game .submit-btn:hover:not(:disabled) {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.level2-game .submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.level2-game .hint-btn {
    background: #2196F3;
    color: white;
}

.level2-game .hint-btn:hover {
    background: #1976D2;
    transform: translateY(-2px);
}

.level2-game .restart-btn {
    background: #ff9800;
    color: white;
}

.level2-game .restart-btn:hover {
    background: #f57c00;
    transform: translateY(-2px);
}

/* Feedback */
.feedback-area {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: auto;
    max-width: 90%;
    margin: 0;
    display: none; /* Ukryte domyślnie */
}

.feedback-message {
    padding: 15px 25px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 1.1em;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    min-width: 300px;
}

.feedback-message.success {
    background: #c8e6c9;
    color: #2e7d32;
    border: 2px solid #4CAF50;
}

.feedback-message.error {
    background: #ffcdd2;
    color: #c62828;
    border: 2px solid #f44336;
}

.feedback-message.info {
    background: #b3e5fc;
    color: #01579b;
    border: 2px solid #2196F3;
}

/* Instructions */
.level2-game .example {
    margin-top: 15px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
    border-left: 4px solid #2196F3;
}

.level2-game .example strong {
    color: #333;
    display: block;
    margin-bottom: 8px;
}

.level2-game {
    display: block;
    min-height: auto;
    padding: 0;
    background: transparent !important;
    color: inherit;
}

.level2-game .game-content {
    padding: 0 24px 40px;
}

.level2-grid {
    grid-template-columns: 220px minmax(640px, 1fr) 320px !important;
    gap: 18px !important;
}

.level2-word-pool.left-rail {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 14px;
    min-height: 100%;
}

.level2-word-pool .rail-title {
    color: #ffe600;
    font-size: 1.05rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.level2-word-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-height: 520px;
    overflow-y: auto;
    padding-right: 4px;
    align-items: stretch;
}

.level2-word-list .word-button {
    width: 100%;
    padding: 10px 12px;
    font-size: 1rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.92);
    color: #1f1f1f;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.level2-word-list .word-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.level2-word-list .word-button.selected {
    background: #4CAF50;
    color: #fff;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.controls-panel {
    gap: 16px;
}

.controls-panel .level2-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.controls-panel .level2-stats span {
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    padding: 6px 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.controls-panel .level2-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    gap: 10px;
}

.controls-panel .control-btn {
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.controls-panel .control-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
}

.controls-panel .control-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.level2-stage {
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: center;
    padding: 0 12px 8px;
}

.level2-stage .snake-stage-inner {
    width: 100%;
    display: flex;
    flex-direction: column;
    margin-top: 200px;
    gap: 16px;
    align-items: center;
}

.level2-stage .snake-visualization.level2 {
    width: 100%;
    max-width: 560px;
    height: 420px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.level2-stage .snake-visualization.level2 svg {
    width: 100%;
    height: 100%;
}

.level2-stage .level2-panels {
    display: flex;
    gap: 18px;
    width: 100%;
    max-width: 760px;
    align-items: stretch;
}

.level2-panel-card {
    flex: 1;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    color: #fff;
    max-height: 260px;
}

.level2-panel-card h4,
.level2-panel-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffe600;
    margin: 0;
}

.level2-panel-card p,
.level2-panel-card li,
.level2-panel-card span {
    color: #f5f5f5;
    font-size: 0.95rem;
}

.level2-panel-card .instruction-steps {
    margin: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.selected-words {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 170px;
    overflow-y: auto;
    padding-right: 4px;
}

.selected-word {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 8px 10px;
}

.selected-word .word-number {
    color: #ffe600;
    font-weight: 700;
}

.selected-word .word-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    font-weight: 600;
    border-radius: 8px;
    padding: 6px 10px;
}

.selected-word .remove-word {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.selected-word .remove-word:hover {
    background: rgba(244, 67, 54, 0.85);
    transform: scale(1.05);
}

.level2-game .snake-progress {
    margin-top: 0;
    width: 100%;
    max-width: 560px;
}

.level2-game .snake-progress .progress-text {
    color: #ffe600;
    font-weight: 700;
}

.level2-right .system-buttons {
    margin-top: 18px;
}

.level2-right .end-game-btn {
    margin-top: 14px;
}

.sys-btn.is-active {
    outline: 2px solid #ffe600;
    outline-offset: 2px;
}

.levels-box .level-card.current {
    box-shadow: 0 0 0 3px rgba(255, 230, 0, 0.35);
}

@media (max-width: 1024px) {
    .level2-grid {
        grid-template-columns: 1fr;
    }
    .level2-word-pool.left-rail {
        order: 2;
        max-width: 100%;
    }
    .level2-stage {
        order: 1;
    }
    .level2-right {
        order: 3;
    }
    .level2-panels {
        flex-direction: column;
        max-width: 100%;
    }
    .selected-words {
        max-height: 200px;
    }
    .controls-panel .level2-controls {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }
}

@media (max-width: 640px) {
    .level2-stage .snake-visualization.level2 {
        height: 360px;
    }
    .level2-stage .snake-progress,
    .level2-stage .level2-panels {
        max-width: 100%;
    }
    .controls-panel .level2-controls {
        grid-template-columns: 1fr;
    }
}

/* Modal summary */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    width: min(90vw, 520px);
    padding: 16px 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.modal-body p { margin: 8px 0; }

.close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

.level2-game .word-chain {
    display: block;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #2196F3;
    padding: 8px;
    background: white;
    border-radius: 4px;
    margin-top: 8px;
}

/* Responsywność */
@media (max-width: 768px) {
    .word-pool {
        justify-content: center;
    }
    
    .word-button {
        flex: 0 0 calc(50% - 10px);
    }
    
    .level2-game .game-controls {
        flex-direction: column;
    }
    
    .level2-game .game-controls button {
        width: 100%;
    }
}


