:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #f72585;
    --background-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-color: #2b2d42;
    --grid-gap: 10px;
    --cell-size: 80px;
    /* Responsive değişkenler - media query'lerde güncellenecek */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

#app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Utilities */
.hidden { display: none !important; }

/* Landing Page */
#landing-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: linear-gradient(135deg, #4cc9f0 0%, #4361ee 100%);
    color: white;
}

.main-header h1 {
    font-size: clamp(2rem, 8vw, 4rem);
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    text-align: center;
}

.main-header p {
    font-size: clamp(1rem, 4vw, 1.5rem);
    opacity: 0.9;
    margin-bottom: 3rem;
    text-align: center;
}

.game-menu {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 1200px;
    padding: 0 1rem;
}

.game-btn {
    background: white;
    border: none;
    padding: clamp(1rem, 3vw, 2rem);
    border-radius: 20px;
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    font-weight: bold;
    color: var(--primary-color);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 300px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.game-btn:hover:not(:disabled) {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
}

.game-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #e9ecef;
    color: #adb5bd;
}

.game-btn .icon {
    font-size: clamp(2rem, 6vw, 2.5rem);
}

/* Game Section */
.game-section {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.game-header {
    padding: 1rem clamp(1rem, 3vw, 2rem);
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.game-header h2 {
    font-size: clamp(1.2rem, 4vw, 1.8rem);
}

.score-board {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
}

.back-btn {
    background: none;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

.game-container {
    flex: 1;
    display: flex;
    flex-direction: row;
    padding: clamp(1rem, 3vw, 2rem);
    gap: clamp(1rem, 3vw, 2rem);
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    overflow-y: auto;
}

/* Sidebar */
.game-sidebar {
    width: 100%;
    max-width: 350px;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 3vw, 2rem);
    flex-shrink: 0;
}

.question-box {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    text-align: center;
    border-left: 5px solid var(--accent-color);
}

.question-display {
    font-size: clamp(1.2rem, 4vw, 2rem);
    font-weight: 800;
    color: var(--primary-color);
    margin: 10px 0;
    word-break: break-word;
}

.controls {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.command-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 1rem;
}

.command-buttons button {
    padding: clamp(8px, 2vw, 10px);
    border: 1px solid #dee2e6;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    transition: background 0.2s;
}

.command-buttons button:hover {
    background: #e9ecef;
}

.command-queue-display {
    flex: 1;
    background: #f1f3f5;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 1rem;
    overflow-y: auto;
    max-height: 200px;
}

.command-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.cmd-item {
    background: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.9rem;
    border: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    gap: 5px;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.run-btn {
    flex: 2;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

.clear-btn {
    flex: 1;
    background: #ff4757;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

/* Board */
.game-board-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    position: relative;
    padding: 20px;
    gap: 20px;
}

/* Collected Words Display */
.collected-words-display {
    width: 100%;
    max-width: 400px;
    background: #f8f9fa;
    border-radius: 15px;
    padding: 1rem;
    text-align: center;
    border: 2px solid var(--primary-color);
}

.collected-words-display h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.words-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
    min-height: 40px;
}

.collected-word {
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.collected-word:hover {
    transform: scale(1.05);
}

.grid-board {
    display: grid;
    grid-template-columns: repeat(4, var(--cell-size));
    grid-template-rows: repeat(4, var(--cell-size));
    gap: var(--grid-gap);
    background: #e9ecef;
    padding: var(--grid-gap);
    border-radius: 10px;
    width: fit-content;
    height: fit-content;
}

.cell {
    background: white;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: clamp(0.7rem, 2vw, 0.9rem);
    position: relative;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
    text-align: center;
    padding: 5px;
    word-break: break-word;
    overflow: hidden;
}

.cell.obstacle {
    background: repeating-linear-gradient(
        45deg,
        #ffe3e3,
        #ffe3e3 10px,
        #ffc9c9 10px,
        #ffc9c9 20px
    );
    color: #c92a2a;
}

.robot {
    position: absolute;
    width: var(--cell-size);
    height: var(--cell-size);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    transition: all 0.5s ease-in-out;
    z-index: 10;
    /* Adjust for grid gap/padding if needed, but absolute positioning based on cell index is easier in JS */
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: clamp(1.5rem, 4vw, 2rem);
    border-radius: 20px;
    text-align: center;
    min-width: min(90vw, 300px);
    max-width: 500px;
    margin: 1rem;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content button {
    display: block;
    width: 100%;
    padding: 1rem;
    margin: 10px 0;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
}

.modal-content button:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
}

/* Feedback Overlay */
.feedback-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 20px;
    z-index: 20;
}

.feedback-content {
    text-align: center;
}

#feedback-icon {
    font-size: clamp(2.5rem, 8vw, 4rem);
    display: block;
    margin-bottom: 1rem;
}

#feedback-message {
    font-size: clamp(1rem, 3vw, 1.5rem);
    font-weight: bold;
    margin-bottom: 1rem;
    padding: 0 1rem;
    word-break: break-word;
}

.feedback-content button {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    padding: clamp(0.75rem, 2vw, 1rem) clamp(1.5rem, 4vw, 2rem);
}

/* ============================================
   RESPONSIVE MEDIA QUERIES
   ============================================ */

/* Mobil Cihazlar (max-width: 600px) */
@media (max-width: 600px) {
    :root {
        --cell-size: 60px;
        --grid-gap: 8px;
    }

    body {
        overflow-y: auto;
    }

    #landing-page {
        padding: 1rem;
        min-height: 100vh;
    }

    .game-menu {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 0 0.5rem;
    }

    .game-btn {
        max-width: 100%;
        padding: 1.5rem;
    }

    .game-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .game-header h2 {
        width: 100%;
    }

    .game-container {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }

    .game-sidebar {
        max-width: 100%;
        min-width: 100%;
        order: 2;
    }

    .game-board-container {
        order: 1;
        min-height: auto;
        padding: 1rem;
    }

    .grid-board {
        margin: 0 auto;
    }

    .collected-words-display {
        max-width: 100%;
    }

    .question-box {
        padding: 1rem;
    }

    .controls {
        padding: 1rem;
    }

    .command-queue-display {
        max-height: 150px;
    }

    .modal-content {
        min-width: calc(100vw - 2rem);
        padding: 1.5rem;
    }

    .modal-content button {
        padding: 0.875rem;
        font-size: 0.95rem;
    }
}

/* Tablet Cihazlar (601px - 1024px) */
@media (min-width: 601px) and (max-width: 1024px) {
    :root {
        --cell-size: 70px;
        --grid-gap: 9px;
    }

    .game-menu {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        max-width: 800px;
    }

    .game-btn {
        max-width: 280px;
    }

    .game-container {
        flex-direction: row;
        padding: 1.5rem;
    }

    .game-sidebar {
        max-width: 300px;
        min-width: 280px;
    }

    .game-board-container {
        flex: 1;
    }

    .collected-words-display {
        max-width: 350px;
    }
}

/* Masaüstü ve Akıllı Tahta (min-width: 1025px) */
@media (min-width: 1025px) {
    :root {
        --cell-size: 90px;
        --grid-gap: 12px;
    }

    .game-menu {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
        max-width: 1400px;
    }

    .game-btn {
        max-width: 300px;
        padding: 2rem;
    }

    .game-container {
        padding: 2rem;
        gap: 2.5rem;
    }

    .game-sidebar {
        max-width: 380px;
        min-width: 320px;
    }

    .cell {
        font-size: 1rem;
    }

    .robot {
        font-size: 3rem;
    }

    .question-display {
        font-size: 2.2rem;
    }

    .collected-words-display {
        max-width: 450px;
        padding: 1.25rem;
    }

    .collected-word {
        font-size: 1rem;
        padding: 10px 20px;
    }
}

/* Çok Geniş Ekranlar / Akıllı Tahta (min-width: 1440px) */
@media (min-width: 1440px) {
    :root {
        --cell-size: 110px;
        --grid-gap: 15px;
    }

    .game-menu {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }

    .game-btn {
        max-width: 350px;
        padding: 2.5rem;
        font-size: 1.4rem;
    }

    .game-btn .icon {
        font-size: 3rem;
    }

    .game-container {
        max-width: 1600px;
        padding: 2.5rem;
    }

    .game-sidebar {
        max-width: 420px;
    }

    .cell {
        font-size: 1.1rem;
    }

    .robot {
        font-size: 3.5rem;
    }

    .question-display {
        font-size: 2.5rem;
    }

    .command-buttons button {
        font-size: 1.4rem;
        padding: 12px;
    }

    .modal-content {
        min-width: 400px;
        padding: 2.5rem;
    }

    .modal-content button {
        padding: 1.25rem;
        font-size: 1.2rem;
    }
}
