/* Kod Macerası - Savaş Oyunu */

.main-kod-macerasi {
    max-width: 1200px;
}

/* Karakter Oluşturma Modal */
.char-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.char-modal.show {
    opacity: 1;
    visibility: visible;
}

.char-modal-content {
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    border: 3px solid #e94560;
    border-radius: 20px;
    padding: 2rem;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 0 40px rgba(233, 69, 96, 0.4);
}

.char-modal-content h2 {
    font-family: 'Cinzel', serif;
    color: #e94560;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.char-subtitle {
    color: #94a3b8;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.char-form label {
    display: block;
    color: #a5b4fc;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-align: left;
}

.char-form input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid #3d3d5c;
    border-radius: 10px;
    background: #0f0f1a;
    color: #e2e8f0;
    margin-bottom: 1rem;
}

.char-form input[type="text"]:focus {
    outline: none;
    border-color: #e94560;
}

.char-avatars {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 1rem 0;
}

.avatar-option {
    cursor: pointer;
    text-align: center;
}

.avatar-option input {
    display: none;
}

.avatar-preview {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    border: 3px solid #3d3d5c;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.avatar-warrior { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.avatar-knight { background: linear-gradient(135deg, #64748b, #475569); }
.avatar-archer { background: linear-gradient(135deg, #10b981, #059669); }

.avatar-option input:checked + .avatar-preview {
    border-color: #e94560;
    box-shadow: 0 0 15px rgba(233, 69, 96, 0.6);
    transform: scale(1.1);
}

.avatar-option span {
    font-size: 0.8rem;
    color: #94a3b8;
}

.btn-begin {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #e94560, #c73e54);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.2s;
}

.btn-begin:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(233, 69, 96, 0.5);
}

/* Hero Header */
.hero-header {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.hero-name-badge {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-weight: 700;
}

.hero-sword-badge {
    background: #1e293b;
    color: #94a3b8;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.hero-sword-badge.has-sword { color: #10b981 !important; }

.level-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.level-bar select {
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    padding: 0.4rem 0.8rem;
    border: 2px solid var(--primary);
    border-radius: 12px;
    background: white;
    cursor: pointer;
}

.level-progress {
    font-size: 0.9rem;
    color: var(--text-light);
}

.btn-hint {
    font-size: 1.25rem;
    padding: 0.4rem 0.6rem;
    background: #fef3c7;
    border: 2px solid var(--secondary);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-hint:hover {
    background: #fde68a;
    transform: scale(1.1);
}

/* Layout */
.kod-macerasi-layout {
    display: grid;
    grid-template-columns: 280px 1fr 220px;
    gap: 1rem;
    padding: 1rem;
    align-items: start;
}

@media (max-width: 900px) {
    .kod-macerasi-layout {
        grid-template-columns: 1fr;
    }
}

/* Kod Paneli */
.code-panel {
    background: linear-gradient(180deg, #1e1e2e 0%, #252536 100%);
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    border: 2px solid #3d3d5c;
}

.code-panel h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #a5b4fc;
}

.code-hint {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 0.75rem;
}

.code-hint kbd {
    padding: 0.1rem 0.4rem;
    background: #3d3d5c;
    border-radius: 4px;
    font-size: 0.75rem;
}

.quick-commands {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.cmd-btn {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.6rem;
    background: #3d3d5c;
    color: #c4b5fd;
    border: 1px solid #6366f1;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.cmd-btn:hover {
    background: #4f46e5;
    color: white;
    transform: translateY(-1px);
}

.code-editor-wrap {
    position: relative;
    margin-bottom: 0.75rem;
    background: #0f0f1a;
    border-radius: 12px;
}

.code-editor-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: auto;
    pointer-events: none;
    border-radius: 12px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.code-editor-backdrop::-webkit-scrollbar {
    display: none;
}

.code-editor-backdrop .ghost {
    color: #64748b;
    opacity: 0.6;
}

.code-editor {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 180px;
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    line-height: 1.5;
    background: transparent;
    color: transparent;
    border: 2px solid #3d3d5c;
    border-radius: 12px;
    resize: vertical;
    caret-color: #e2e8f0;
}

.code-editor::placeholder {
    color: #64748b;
}

.code-editor-wrap:focus-within .code-editor {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.5);
}

.code-editor::placeholder {
    color: #64748b;
}

.code-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: auto;
}

.speed-control label {
    font-size: 0.85rem;
    color: #94a3b8;
}

.speed-control select {
    font-family: 'Nunito', sans-serif;
    padding: 0.25rem 0.5rem;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    background: #1e1e2e;
    color: #e2e8f0;
    font-size: 0.85rem;
}

.btn-run {
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    padding: 0.6rem 1.2rem;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-run:hover {
    background: #059669;
    transform: scale(1.05);
}

.btn-run:disabled {
    background: #475569;
    cursor: not-allowed;
    transform: none;
}

.btn-reset {
    font-family: 'Nunito', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.6rem 1rem;
    background: #475569;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reset:hover {
    background: #64748b;
}

.command-reference {
    font-size: 0.8rem;
    color: #94a3b8;
    border-top: 1px solid #3d3d5c;
    padding-top: 0.75rem;
}

.command-reference h4 {
    font-size: 0.85rem;
    color: #a5b4fc;
    margin-bottom: 0.5rem;
}

.command-reference code {
    background: #1e1e2e;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    color: #c4b5fd;
    font-size: 0.75rem;
}

.command-reference p {
    margin: 0.25rem 0;
}

/* Oyun Paneli - Dungeon Teması */
.game-panel {
    background: linear-gradient(180deg, #2d2d2d 0%, #1a1a1a 100%);
    border-radius: 4px;
    padding: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.05);
    border: 3px solid #5c4033;
}

.game-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: linear-gradient(180deg, #4a3728 0%, #3d2e22 100%);
    border-bottom: 2px solid #5c4033;
}

.btn-levels, .btn-menu {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.4rem 0.8rem;
    background: #3d2e22;
    color: #d4a574;
    border: 2px solid #5c4033;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-levels:hover, .btn-menu:hover {
    background: #4a3728;
    color: #f5d0a9;
}

.level-name {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: #d4a574;
    margin: 0;
}

.game-goal {
    font-size: 0.85rem;
    margin: 0.75rem 1rem;
    font-weight: 600;
    color: #c9b896;
}

.game-grid-wrap {
    padding: 1rem;
    background: #1a1510;
    display: flex;
    justify-content: center;
}

.dungeon-frame {
    position: relative;
    background: 
        linear-gradient(90deg, rgba(92,64,51,0.3) 1px, transparent 1px),
        linear-gradient(rgba(92,64,51,0.3) 1px, transparent 1px),
        linear-gradient(180deg, #252020 0%, #1a1510 100%);
    background-size: 8px 8px, 8px 8px, 100% 100%;
    padding: 12px;
    border: 4px solid #5c4033;
    border-radius: 4px;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.5);
    display: inline-block;
}

/* Konuşma Balonu - CodeCombat tarzı */
.speech-bubble {
    position: absolute;
    transform: translate(-50%, -100%);
    padding: 0.4rem 0.8rem;
    background: white;
    color: #1a1a1a;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border: 2px solid #e5e7eb;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 10;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: white;
}

.speech-bubble.visible {
    opacity: 1;
}

.game-grid {
    display: grid;
    gap: 2px;
    border-radius: 2px;
    overflow: hidden;
    background: #2d2520;
}

.game-cell {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: linear-gradient(135deg, #3d3530 0%, #2d2520 100%);
    border: 1px solid rgba(92,64,51,0.4);
    transition: all 0.2s;
}

.game-cell.hero {
    background: linear-gradient(135deg, #4a6fa5 0%, #3d5a80 100%);
    box-shadow: 0 0 12px rgba(74, 111, 165, 0.6), inset 0 1px 0 rgba(255,255,255,0.2);
    border-color: #5c8bc7;
}

.game-cell.goal {
    background: linear-gradient(135deg, #d4a574 0%, #c4956a 100%);
    box-shadow: inset 0 0 10px rgba(212, 165, 116, 0.4);
    border-color: #e5c9a0;
}

.game-cell.obstacle {
    background: linear-gradient(135deg, #4a4a4a 0%, #353535 100%);
    border-color: #5c5c5c;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.4);
}

.game-cell.enemy {
    background: linear-gradient(135deg, #5c2424 0%, #3d1818 100%);
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
    border-color: #8b3a3a;
}

.game-cell.sword {
    background: linear-gradient(135deg, #2d4a3d 0%, #1e3d30 100%);
    border-color: #3d6b5a;
    animation: sword-cell-pulse 1.5s ease-in-out infinite;
}

@keyframes sword-cell-pulse {
    0%, 100% { box-shadow: 0 0 0 rgba(13, 148, 136, 0.3); }
    50% { box-shadow: 0 0 15px rgba(13, 148, 136, 0.6); }
}

.game-cell.visited {
    background: #1e3a5f;
}

@keyframes gem-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.9; }
}

.game-grid-wrap {
    margin: 0 auto;
    display: flex;
    justify-content: center;
}

.game-feedback {
    min-height: 36px;
    margin-top: 0.75rem;
    padding: 0.6rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    text-align: center;
}

.game-feedback.success {
    background: #d1fae5;
    color: #065f46;
}

.game-feedback.error {
    background: #fee2e2;
    color: #991b1b;
}

.game-feedback:empty {
    display: none;
}

.game-stats {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    min-height: 20px;
}

/* Görev Paneli */
.mission-panel {
    background: linear-gradient(180deg, #2d2d2d 0%, #1a1a1a 100%);
    border-radius: 4px;
    padding: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 2px solid #5c4033;
}

.mission-panel h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #d4a574;
}

.mission-desc {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
    color: #c9b896;
}

.mission-tips {
    font-size: 0.85rem;
    color: #a89878;
    background: rgba(0,0,0,0.3);
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.legend h4 {
    color: #d4a574;
}

.legend p {
    color: #a89878;
}

.legend {
    font-size: 0.85rem;
}

.legend h4 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.legend p {
    margin: 0.3rem 0;
}

.legend-hero, .legend-enemy, .legend-sword, .legend-goal {
    font-size: 1.2rem;
}

/* Sprite stilleri */
.sprite {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.hero-sprite {
    font-size: 1.5rem;
    animation: hero-idle 2s ease-in-out infinite;
}

.hero-warrior { color: #6366f1; }
.hero-knight { color: #64748b; }
.hero-archer { color: #10b981; }

.enemy-sprite {
    font-size: 1.6rem;
    animation: enemy-pulse 1.5s ease-in-out infinite;
}

.sword-sprite {
    font-size: 1.5rem;
    animation: sword-glow 1.5s ease-in-out infinite;
}

.obstacle-sprite {
    font-size: 1.3rem;
    opacity: 0.9;
}

.goal-sprite {
    font-size: 1.5rem;
    animation: goal-sparkle 2s ease-in-out infinite;
}

@keyframes hero-idle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes enemy-pulse {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.08); filter: brightness(1.2); }
}

@keyframes sword-glow {
    0%, 100% { filter: drop-shadow(0 0 4px #fbbf24); }
    50% { filter: drop-shadow(0 0 8px #f59e0b); }
}

@keyframes goal-sparkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.9; transform: scale(1.1); }
}

/* Executing animasyonu */
.game-cell.executing {
    animation: cell-flash 0.3s ease;
}

@keyframes cell-flash {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.4); }
}
