@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&family=Press+Start+2P&display=swap');

:root {
    --primary-color: #4a90e2; /* Daha yumuşak mavi */
    --secondary-color: #50e3c2; /* Turkuaz */
    --background-color: #f0f4f8; /* Açık gri-mavi */
    --card-background: #ffffff;
    --text-color: #333;
    --border-color: #dce4ec;
    --error-color: #e74c3c; /* Red */
    --success-color: #2ecc71; /* Green */
    --warning-color: #f39c12; /* Orange */
    --dark-blue: #2c3e50;
    --grid-gap: 12px; /* Biraz daha az boşluk */
    --border-radius: 8px;
    --button-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --pixel-font: 'Press Start 2P', cursive;
    --font-main: 'Poppins', sans-serif;

    /* Game Specific */
    --checker-light: #f0d9b5; /* Light wood */
    --checker-dark: #b58863; /* Dark wood */
    --checker-white: #ffffff;
    --checker-black: #444444;
    --checker-king: gold;
    --checker-selected: rgba(80, 227, 194, 0.6); /* Secondary color transparent */
    --checker-valid-move: rgba(46, 204, 113, 0.4); /* Success color transparent */

    --rush-hour-cell-size: 50px; /* Default, JS can override */
    --rush-hour-exit-color: #f1c40f; /* Yellow for exit visual */
    --error-color: #e74c3c;
	
    /* 2048 Specific */
     --game2048-gap: 10px; /* Default gap */

    /* Word Search Specific */
    --wordsearch-grid-size: 12; /* Default */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    touch-action: manipulation; /* Attempt to prevent double-tap zoom globally */
}

body {
    font-family: var(--font-main);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* İçeriği yukarıdan başlat */
    min-height: 100vh;
    padding: 20px;
    overscroll-behavior-y: contain; /* Prevent pull-to-refresh */
}

.container {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    padding: 25px;
    width: 100%;
    max-width: 1000px; /* Oyun alanına göre ayarlanabilir */
    display: flex;
    flex-direction: column;
    transition: padding 0.4s ease;
}

/* --- Oyun Seçim Alanı (GRID - Desktop) --- */
.game-selection {
    display: grid;
    gap: var(--grid-gap);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* Geçiş efekti */
    width: 100%; /* Tam genişlik */
}

.game-selection-center {
    align-items: center; /* Dikey hizalama */
    justify-content: center; /* Yatay hizalama */
    min-height: 60vh;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); /* Ortadayken */
    padding: 40px 0; /* Dikey boşluk */
}

.game-selection-top {
    min-height: auto;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 25px;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); /* Üstteyken daha küçük */
    align-items: center; /* Dikey hizalama */
}

.game-button {
    background: linear-gradient(145deg, var(--primary-color), #3a7ac8); /* Gradient */
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 15px 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--button-shadow);
    overflow: hidden; /* İkon taşmasını engelle */
    position: relative; /* Efekt için */
    min-height: 100px; /* Ortadayken minimum yükseklik */
    user-select: none; /* Prevent text selection on button */
}

.game-button i {
    margin-bottom: 8px;
    transition: transform 0.3s ease;
    font-size: 2em; /* Ortadayken ikon boyutu */
    pointer-events: none; /* Allow click on button not icon */
}

.game-button span {
    display: block;
    font-weight: 500;
    font-size: 0.9em; /* Ortadayken yazı boyutu */
    line-height: 1.2;
    pointer-events: none; /* Allow click on button not span */
}

.game-selection-top .game-button {
    padding: 8px 5px; /* Üstteyken daha az padding */
    min-height: 70px; /* Sabit yükseklik */
}

.game-selection-top .game-button i {
    font-size: 1.6em; /* Üstteyken ikon boyutu */
    margin-bottom: 4px;
}

.game-selection-top .game-button span {
    font-size: 0.75em; /* Üstteyken yazı boyutu */
}

.game-button:hover {
    background: linear-gradient(145deg, #5a9eee, var(--primary-color));
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}
.game-button:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* --- Oyun Seçim Alanı (DROPDOWN - Mobile) --- */
.game-selection-dropdown-container {
    display: none; /* Başlangıçta gizli */
    margin-bottom: 20px; /* Oyun alanından önce boşluk */
    transition: display 0.3s ease;
}
.game-selection-dropdown-container.active {
    display: block;
}
#game-select-dropdown {
    width: 100%;
    padding: 12px 15px;
    font-size: 1.1em;
    border-radius: var(--border-radius);
    border: 2px solid var(--primary-color);
    background-color: var(--card-background);
    color: var(--text-color);
    appearance: none; /* Default style removal */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23333' d='M6 8L0 2l1.4-1.4L6 5.2 10.6.6 12 2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    cursor: pointer;
}
#game-select-dropdown:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.3); /* Focus indicator */
}

/* --- Oyun Alanı Genel --- */
#game-area {
    margin-top: 10px; /* Üst menü/dropdown ile oyun alanı arası boşluk */
    width: 100%;
}

.game-content {
    display: none; /* Başlangıçta gizle */
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: #fdfefe;
    animation: fadeIn 0.6s ease-out;
    margin-top: 15px; /* Butonlardan/dropdowndan sonra biraz boşluk */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.game-content h2 {
    color: var(--dark-blue);
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

/* Genel Oyun Kontrolleri Stili */
.game-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-around; /* Butonları yay */
    gap: 10px;
    margin-bottom: 20px;
    padding: 10px;
    background-color: var(--background-color);
    border-radius: calc(var(--border-radius) / 2);
}

.game-controls label {
    font-weight: 500;
    margin-right: 5px;
}

.game-controls select,
.game-controls button {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 0.9em;
    cursor: pointer;
    background-color: var(--card-background);
    transition: background-color 0.2s, box-shadow 0.2s;
    font-family: var(--font-main);
    user-select: none; /* Prevent text selection on controls */
}

.game-controls select {
     appearance: none; /* Tarayıcı varsayılan okunu kaldır */
     background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='5' viewBox='0 0 10 5'%3E%3Cpath fill='%23333' d='M0 0l5 5 5-5z'/%3E%3C/svg%3E");
     background-repeat: no-repeat;
     background-position: right 10px center;
     padding-right: 30px; /* Ok için yer aç */
}

.game-controls button {
    background-color: var(--secondary-color);
    color: var(--dark-blue);
    font-weight: 500;
}
.game-controls button:hover:not(:disabled) {
    background-color: #48d1b5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.game-controls button:active:not(:disabled) {
    background-color: #3fbf9f;
}
.game-controls button:disabled {
    background-color: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
}

/* Reset/Yeni Oyun Butonları biraz farklı olabilir */
.game-controls button[id^="reset-"],
.game-controls button[id^="start-"] {
    background-color: var(--primary-color);
    color: white;
}
.game-controls button[id^="reset-"]:hover:not(:disabled),
.game-controls button[id^="start-"]:hover:not(:disabled) {
    background-color: #5a9eee;
}
.game-controls button[id^="pause-"] {
    background-color: var(--warning-color);
    color: white;
}
.game-controls button[id^="pause-"]:hover:not(:disabled) {
    background-color: #f5b041;
}


.score-display, .game-controls span {
    font-weight: 500;
    background-color: #e9eef2;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.95em;
    min-width: 80px; /* Minimum genişlik */
    text-align: center;
}

.game-status {
    text-align: center;
    margin-top: 15px;
    font-weight: 600;
    min-height: 20px;
    color: var(--primary-color);
    transition: color 0.3s;
}
.game-status.error { color: var(--error-color); }
.game-status.success { color: var(--success-color); }
.game-status.warning { color: var(--warning-color); }


/* Ortak Canvas Stili */
canvas {
    display: block;
    margin: 15px auto;
    border: 3px solid var(--dark-blue);
    background-color: #f8f9fa; /* Varsayılan canvas arka planı */
    box-shadow: 0 0 10px rgba(0,0,0,0.05) inset;
    max-width: 100%; /* Ensures canvas scales down */
    height: auto; /* Maintain aspect ratio */
    user-select: none; /* Prevent selection on canvas */
    touch-action: none; /* Prevent scrolling/zooming on canvas for touch games */
    -webkit-user-drag: none; /* Prevent dragging image */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
}


/* --- 1. Yılan Oyunu --- */
#snake-canvas {
    background-color: #e8f6fd;
    border-color: var(--primary-color);
}

/* --- 2. XOX Oyunu --- */
.tictactoe-board {
    display: grid;
    grid-template-columns: repeat(3, 90px); /* Biraz daha küçük */
    grid-template-rows: repeat(3, 90px);
    gap: 6px;
    justify-content: center;
    margin: 20px auto;
    width: fit-content;
}
.tictactoe-cell {
    width: 90px;
    height: 90px;
    background-color: #e9f5fe;
    border: 2px solid var(--primary-color);
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;
    user-select: none;
    font-family: var(--pixel-font); /* İsteğe bağlı piksel font */
    color: var(--dark-blue);
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
}
.tictactoe-cell:hover { background-color: #d4ecfc; }
.tictactoe-cell.X { color: var(--error-color); }
.tictactoe-cell.O { color: var(--success-color); }

/* --- 3. Görsel Eşleştirme --- */
.image-match-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4x4 grid */
    gap: 8px; /* Biraz daha aralık */
    max-width: 400px; /* Gridin max genişliği */
    margin: 20px auto;
    perspective: 1000px;
}
.image-match-card {
    background-color: var(--primary-color);
    aspect-ratio: 1 / 1; /* Kare kartlar */
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.image-match-card.flipped,
.image-match-card.matched {
    transform: rotateY(180deg);
    cursor: default;
}
.image-match-card.matched {
    opacity: 0.6;
    box-shadow: 0 0 0 2px var(--success-color);
}
.image-match-card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2em; /* İkon boyutu */
    border-radius: 4px;
    pointer-events: none; /* Let click go through to card */
}
.image-match-card-front {
    background-color: var(--primary-color);
    color: white;
    /* Desen veya soru işareti */
     background-image:
        linear-gradient(45deg, rgba(255,255,255,0.1) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.1) 75%, rgba(255,255,255,0.1)),
        linear-gradient(45deg, rgba(255,255,255,0.1) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.1) 75%, rgba(255,255,255,0.1));
    background-size: 10px 10px;
    background-position: 0 0, 5px 5px;
}
/* .image-match-card-front::before { content: '?'; font-weight: bold; font-size: 1.2em; } */
.image-match-card-back {
    background-color: var(--card-background);
    color: var(--text-color);
    transform: rotateY(180deg);
    border: 1px solid var(--border-color);
}
#image-match-timer { font-family: monospace; }

/* --- 4. 2048 Oyunu --- */
#game2048-grid-container {
    background-color: #bbada0; /* Klasik 2048 arkaplanı */
    padding: var(--game2048-gap); /* Use CSS variable */
    border-radius: 6px;
    width: fit-content; /* Size based on grid */
    margin: 20px auto;
    position: relative; /* Karoların pozisyonlanması için */
    touch-action: none; /* Prevent default browser touch actions like scrolling */
    user-select: none; /* Prevent text selection during swipe */
    /* JS bu container'ın height'ını ayarlayacak */
}
.game2048-grid {
    display: grid;
    /* JS grid-template-columns/rows ve gap ayarlar */
    position: relative; /* Tile container'ın üzerine bineceği yer */
    z-index: 1;
}
.game2048-cell { /* Arka plan hücreleri */
    background-color: #cdc1b4;
    border-radius: 3px;
    /* width/height JS tarafından grid-template ile ayarlanır */
}
#game2048-tile-container {
    position: absolute;
    top: 0; /* Matches padding */
    left: 0; /* Matches padding */
    /* Width/height set by JS to match container minus padding */
    z-index: 2;
    pointer-events: none; /* Allows underlying grid interaction if needed */
}

.game2048-tile { /* Hareket eden karolar */
    position: absolute;
    /* width/height JS ile ayarlanacak */
    border-radius: 3px;
    font-family: var(--font-main); /* Using Poppins */
    font-weight: bold;
    /* font-size JS ile ayarlanacak */
    display: flex;
    justify-content: center;
    align-items: center;
    transition: top 0.1s ease-out, left 0.1s ease-out; /* Basic movement transition */
    z-index: 10;
    user-select: none;
    /* Karo renkleri JS ile atanacak */
    background-color: #eee4da; /* Default for 2 */
    color: #776e65;
}
/* 2048 Animasyonları */
.game2048-tile.new-tile {
    animation: appear 0.2s ease;
}
.game2048-tile.merged-tile {
     animation: pop 0.2s ease;
     z-index: 20; /* Birleşen üstte görünsün */
}
@keyframes appear {
    from { transform: scale(0); opacity: 0;}
    to { transform: scale(1); opacity: 1;}
}
@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

#game2048-status.game-over-overlay.game-over { /* Apply only when game-over class is present */
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(238, 228, 218, 0.73); /* Semi-transparent overlay */
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-radius: 6px; /* Match container */
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}
#game2048-status.game-over-overlay { /* Default hidden state */
    opacity: 0;
    visibility: hidden;
    position: absolute; /* Keep it positioned even when hidden */
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1; /* Hide behind */
}
#game2048-status.game-over h3 {
    color: #776e65;
    font-size: 2em;
    margin-bottom: 10px;
}
#game2048-status.game-over p {
    color: #776e65;
    font-size: 1.2em;
    margin-bottom: 15px;
}
#game2048-status.game-over small {
    color: #a79d92;
}

/* --- 5. Mayın Tarlası --- */
#minesweeper-grid-container {
    margin: 20px auto;
    width: fit-content; /* Adjust to content */
    max-width: 100%; /* Prevent overflow on small screens */
    overflow: auto; /* Add scrollbars IF needed */
    border: 3px solid #7b7b7b; /* Outer bevel */
    border-top-color: #fff;
    border-left-color: #fff;
}
.minesweeper-grid {
    display: grid;
    /* grid-template-columns/rows JS ile ayarlanacak */
    gap: 0px; /* No gap for classic look */
    background-color: #bdbdbd; /* Background shown if cells fail */
    padding: 5px; /* Inner padding */
    user-select: none; /* Prevent text selection */
    line-height: 1; /* Prevent extra space in cells */
}
.minesweeper-cell {
    width: 25px; /* Hücre boyutu ayarlanabilir */
    height: 25px;
    background-color: #bdbdbd; /* Kapalı hücre rengi */
    border: 2px solid;
    border-color: #fff #7b7b7b #7b7b7b #fff; /* Kabartma efekti */
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--pixel-font);
    font-size: 14px; /* Pixel font size */
    font-weight: bold;
    cursor: pointer;
    color: transparent; /* Hide text initially */
    -webkit-tap-highlight-color: transparent;
}
.minesweeper-cell.revealed {
    background-color: #d6d6d6; /* Açık gri */
    border: 1px solid #9e9e9e; /* Düz kenarlık */
    color: black; /* Make text visible */
    cursor: default;
}
.minesweeper-cell.flagged {
    color: black; /* Make flag visible */
    font-size: 16px; /* Adjust icon size */
}
.minesweeper-cell.flagged i {
    color: var(--error-color);
    pointer-events: none; /* Let click go through to cell */
}
.minesweeper-cell.mine {
    background-color: #f8d7da; /* Light red background for revealed mines */
    border-color: #dc3545;
    color: black; /* Make bomb visible */
    font-size: 16px; /* Adjust icon size */
}
.minesweeper-cell.mine i, .minesweeper-cell.mine-wrong i {
    pointer-events: none; /* Let click go through to cell */
}
.minesweeper-cell.mine-hit {
    background-color: var(--error-color); /* Bright red for the hit mine */
    border-color: darkred;
}
.minesweeper-cell.mine-wrong i { /* Incorrectly placed flag */
    color: black;
    opacity: 0.7;
    text-decoration: line-through; /* Add line through */
}
/* Sayı Renkleri - !important might be needed if icon styles override */
.minesweeper-cell.revealed.count-1 { color: blue !important; }
.minesweeper-cell.revealed.count-2 { color: green !important; }
.minesweeper-cell.revealed.count-3 { color: red !important; }
.minesweeper-cell.revealed.count-4 { color: navy !important; }
.minesweeper-cell.revealed.count-5 { color: maroon !important; }
.minesweeper-cell.revealed.count-6 { color: teal !important; }
.minesweeper-cell.revealed.count-7 { color: black !important; }
.minesweeper-cell.revealed.count-8 { color: gray !important; }

#minesweeper-timer, #minesweeper-flags { font-family: var(--pixel-font); font-size: 1em; }

/* --- 6. Sudoku --- */
#sudoku-grid-container {
    display: flex;
    flex-direction: column; /* Grid ve sayıları alt alta */
    align-items: center;
    margin: 15px auto;
    width: fit-content;
    max-width: 100%; /* Prevent overflow */
}
.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, minmax(30px, 45px)); /* Responsive cell size */
    grid-template-rows: repeat(9, minmax(30px, 45px));
    border: 3px solid var(--dark-blue);
    width: fit-content;
    background-color: #f0f4f8;
    aspect-ratio: 1 / 1; /* Make grid square */
    max-width: 400px; /* Limit max size */
    user-select: none;
}
.sudoku-cell {
    /* width/height are set by grid */
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(1em, 4vw, 1.5em); /* Responsive font size */
    position: relative; /* Notlar için */
    transition: background-color 0.2s ease;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.sudoku-cell input {
    width: 100%;
    height: 100%;
    border: none;
    text-align: center;
    font-size: 1em; /* Parent'a göre */
    font-family: var(--font-main);
    background-color: transparent;
    padding: 0;
    outline: none;
    color: var(--primary-color); /* Girilen sayı rengi */
    caret-color: transparent; /* Hide cursor */
    cursor: pointer;
    pointer-events: none; /* Let click go through to cell */
}
.sudoku-cell input:disabled {
    font-weight: bold;
    color: var(--text-color);
    background-color: #e9ecef;
    cursor: default;
    pointer-events: none;
}
.sudoku-cell:has(input:disabled) {
    cursor: default; /* Cell cursor for disabled inputs */
}
.sudoku-cell.selected {
    background-color: var(--secondary-color) !important; /* Override others */
    outline: 2px solid #3fbf9f;
    z-index: 1;
}
.sudoku-cell.highlight { /* Seçili hücre ile ilişkili */
    background-color: #e0f7fa;
}
.sudoku-cell.highlight-same-number input:not(:disabled){
    font-weight: bold;
    color: #1d7b8a; /* Highlight same user numbers */
}
.sudoku-cell.error {
    background-color: #f8d7da !important; /* Override others */
}
.sudoku-cell.error input {
    color: var(--error-color) !important;
    font-weight: bold;
    animation: shake 0.3s ease-in-out;
}

/* Sudoku 3x3 Blok Çizgileri */
.sudoku-cell:nth-child(3n):not(:nth-child(9n)) { border-right: 2px solid var(--dark-blue); }
/* .sudoku-cell:nth-child(9n) { border-right: 1px solid var(--border-color); } */ /* Handled by grid border */
/* 3. ve 6. satırların altı */
.sudoku-grid > .sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-grid > .sudoku-cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 2px solid var(--dark-blue);
}

#sudoku-numbers {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    gap: 5px;
    justify-content: center;
}
#sudoku-numbers button {
    width: 38px;
    height: 38px;
    font-size: 1.3em;
    padding: 0;
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 4px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
#sudoku-numbers button:hover { background-color: #e9f5fe; }
#sudoku-numbers button.selected { background-color: var(--primary-color); color: white; border-color: var(--primary-color); }
#sudoku-erase { color: var(--error-color); }
#sudoku-erase:hover { background-color: #f8d7da; }

/* --- 7. Tetris --- */
.tetris-layout {
    display: flex;
    justify-content: center;
    gap: 20px;
    align-items: flex-start; /* Hizalama */
    flex-wrap: wrap;
}
#tetris-canvas {
    background-color: #222; /* Darker background for Tetris */
    border-color: #555;
}

#tetris-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    min-width: 180px; /* Bilgi alanı genişliği */
}
#tetris-info .game-controls {
    flex-direction: column; /* Kontrolleri alt alta */
    align-items: stretch; /* Butonlar tam genişlik */
    background-color: transparent;
    padding: 0;
    border: none;
    margin-bottom: 5px;
}
#tetris-info .score-display {
    width: 100%;
    text-align: left;
    background-color: #e9ecef;
    padding: 6px 8px;
}
#tetris-info h3 {
    font-size: 1em;
    margin-bottom: 0;
    text-align: center;
    font-weight: 600;
}
#tetris-next-canvas {
    border: 2px solid #555;
    background-color: #333; /* Dark background for next piece */
    margin: 5px auto; /* Ortala */
}
/* Tetris için fontlar */
#tetris-game .score-display, #tetris-game .game-status { font-family: var(--pixel-font); font-size: 0.8em;}
#tetris-game h2, #tetris-info h3 { font-family: var(--pixel-font); }

/* --- 8. Adam Asmaca Stilleri --- */
.hangman-container { display: flex; gap: 30px; align-items: flex-start; flex-wrap: wrap; justify-content: center;}
.hangman-drawing { flex-shrink: 0; }
.hangman-svg { border: 1px solid #ccc; display: block; margin: 0 auto; max-width: 100%; height: auto; }
.hangman-part { display: none; /* Başlangıçta gizli */ stroke-linecap: round; }
.hangman-info { flex-grow: 1; min-width: 250px; }
.hangman-word-display { font-size: clamp(1.5em, 5vw, 2em); letter-spacing: 0.3em; margin: 20px 0; text-align: center; font-family: monospace; word-break: break-all; }
.hangman-letters-container { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; justify-content: center;}
.hangman-letter-button {
    font-size: 1.1em;
    padding: 8px 12px;
    min-width: 40px;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f0f0f0;
    transition: background-color 0.2s;
    font-family: var(--font-main);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.hangman-letter-button:hover:not(:disabled) { background-color: #ddd; }
.hangman-letter-button:disabled, .hangman-letter-button.disabled {
    background-color: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    opacity: 0.7;
}
#hangman-hint { font-style: italic;}
#hangman-guessed { font-style: italic; color: #555; word-break: break-all; }

/* --- 9. Kelime Eşleştirme Stilleri --- */
.wordmatch-container { display: flex; justify-content: space-around; gap: 20px; margin-top: 20px; min-height: 200px; flex-wrap: wrap; }
.wordmatch-column { border: 1px dashed #ccc; padding: 15px; width: 45%; background-color: #f9f9f9; border-radius: 5px; min-height: 180px; flex-basis: 200px; /* Allow wrapping */}
.wordmatch-word {
    background-color: #e9ecef;
    padding: 10px 15px;
    margin-bottom: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    text-align: center;
    transition: all 0.3s ease;
    word-break: break-word; /* Prevent long words overflowing */
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.wordmatch-word[draggable="true"] { cursor: grab; }
.wordmatch-word.dragging { opacity: 0.5; background-color: #d1d8e0; transform: scale(0.95); }
.wordmatch-word.droptarget { border-style: dashed; background-color: #f0f8ff; }
.wordmatch-word.droptarget.drag-over { background-color: #cfe2ff; border-color: #9ec5fe; transform: scale(1.02);}
.wordmatch-word.correct { background-color: #d1e7dd !important; border-color: #198754 !important; color: #0f5132 !important; font-weight: bold;}
.wordmatch-word.error { background-color: #f8d7da; border-color: #dc3545; animation: shake 0.5s ease; }
.wordmatch-word.matched { opacity: 0.6; cursor: default; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-5px); }
    30% { transform: translateX(5px); }
    50% { transform: translateX(-5px); }
    70% { transform: translateX(5px); }
    90% { transform: translateX(-5px); }
}


/* --- 10. Kelime Bulmaca Stilleri --- */
.wordsearch-container { display: flex; gap: 30px; flex-wrap: wrap; justify-content: center;}
#wordsearch-grid-container { border: 2px solid #333; display: inline-block; /* İçeriğe göre boyutlanması için */ max-width: 100%; overflow: hidden; }
#wordsearch-grid {
    display: grid;
    grid-template-columns: repeat(var(--wordsearch-grid-size), 1fr); /* Use variable */
    gap: 1px;
    background-color: #ccc; /* Boşluk rengi */
    user-select: none; /* Metin seçmeyi engelle */
    cursor: pointer;
    aspect-ratio: 1 / 1; /* Keep grid square */
    width: clamp(250px, 90vw, 450px); /* Responsive width */
    -webkit-tap-highlight-color: transparent;
}
.wordsearch-cell {
    /* width/height set by grid */
    background-color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(0.8em, 2.5vw, 1.2em); /* Responsive font */
    font-weight: bold;
    text-transform: uppercase;
    border: 1px solid #eee;
    transition: background-color 0.1s ease-in-out;
    line-height: 1;
    pointer-events: none; /* Let events go to grid */
}
.wordsearch-cell.selected { background-color: #a0d9ef; } /* Geçici seçim */
.wordsearch-cell.found-permanent { background-color: #a0e0a0; color: #006400; } /* Kalıcı bulunan */
.wordsearch-cell.error-temp { background-color: #f8d7da; } /* Yanlış seçim */

#wordsearch-list-container { flex-basis: 180px; flex-grow: 1; border-left: 1px solid #ccc; padding-left: 20px; max-width: 90%; }
#wordsearch-list { list-style: none; padding: 0; margin: 0; }
#wordsearch-list li { margin-bottom: 5px; font-size: 1.1em; transition: all 0.3s ease; word-break: break-all; }
#wordsearch-list li.found { text-decoration: line-through; color: #888; font-style: italic; }

/* --- 11. Maze Game --- */
#maze-canvas {
    background-color: #f0f4f8;
    border-color: var(--dark-blue);
    max-width: 400px; /* Max maze size */
    width: 100%;
}

/* --- 12. Checkers Game --- */
#checkers-board-container {
    margin: 15px auto;
    width: fit-content;
    max-width: 100%;
}
.checkers-board {
    display: grid;
    grid-template-columns: repeat(8, clamp(35px, 10vw, 55px)); /* Responsive cell size */
    grid-template-rows: repeat(8, clamp(35px, 10vw, 55px));
    border: 3px solid #6f4e37; /* Dark wood border */
    width: fit-content;
    aspect-ratio: 1 / 1; /* Keep square */
    max-width: 450px; /* Max board size */
    user-select: none;
}
.checkers-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}
.checkers-cell.light { background-color: var(--checker-light); }
.checkers-cell.dark { background-color: var(--checker-dark); }

.checkers-piece {
    width: 75%;
    height: 75%;
    border-radius: 50%;
    box-shadow: inset 0 -3px 5px rgba(0,0,0,0.3), 0 2px 3px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.2s ease;
    pointer-events: none; /* Let click go through to cell */
}
.checkers-piece.white { background-color: var(--checker-white); }
.checkers-piece.black { background-color: var(--checker-black); }
.checkers-piece.king::after { /* Crown */
    content: '\f451'; /* Font Awesome Queen icon */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 60%; /* Relative to piece size */
    color: var(--checker-king);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}
/* Apply selection style to the PIECE not the cell */
.checkers-piece.selected {
    transform: scale(1.1);
    box-shadow: inset 0 -3px 5px rgba(0,0,0,0.3), 0 4px 8px rgba(0,0,0,0.3), 0 0 0 3px var(--checker-selected);
}
.checkers-cell.valid-move::before {
    content: '';
    position: absolute;
    top: 30%; left: 30%;
    width: 40%; height: 40%;
    background-color: var(--checker-valid-move);
    border-radius: 50%;
    pointer-events: none; /* Allow clicking the cell beneath */
}
/* Turn Indicator Styling */
#checkers-turn.player-white { color: #333; background-color: var(--checker-white); border: 1px solid #ccc; }
#checkers-turn.player-black { color: white; background-color: var(--checker-black); }

/* --- 13. 8 Queens Puzzle --- */
#eight-queens-board-container {
    margin: 15px auto;
    width: fit-content;
    max-width: 100%;
}
.eight-queens-board {
    display: grid;
    grid-template-columns: repeat(8, clamp(35px, 10vw, 55px)); /* Responsive cell size */
    grid-template-rows: repeat(8, clamp(35px, 10vw, 55px));
    border: 3px solid var(--dark-blue);
    width: fit-content;
    aspect-ratio: 1 / 1; /* Keep square */
    max-width: 450px; /* Max board size */
    user-select: none;
}
.eight-queens-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative; /* For attack highlight */
    transition: background-color 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.eight-queens-cell.light { background-color: #f0f4f8; }
.eight-queens-cell.dark { background-color: #dce4ec; }
.eight-queens-cell:hover { background-color: #c8d4e0; }

.queen-piece {
    font-size: clamp(1.5em, 7vw, 2.5em); /* Responsive icon size */
    color: var(--dark-blue);
    pointer-events: none; /* Prevent icon stealing click */
}
.eight-queens-cell.attack .queen-piece {
    color: var(--error-color);
    animation: pulse 1s infinite;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* --- 14. Tetravex --- */
.tetravex-container {
    display: flex;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
    margin-top: 15px;
    min-height: 200px; /* Ensure space */
}
.tetravex-grid {
    display: grid;
    /* grid-template-columns/rows set by JS */
    gap: 4px;
    padding: 4px;
    background-color: #ccc;
    border: 2px solid #999;
    width: fit-content; /* Adjust to content */
    aspect-ratio: 1 / 1; /* Keep square */
    max-width: 350px;
    user-select: none;
}
.tetravex-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    border: 1px dashed #aaa;
    background-color: #f0f4f8;
    border-radius: 5px;
    align-content: flex-start; /* Align items to top */
    width: 250px; /* Adjust as needed */
    min-height: 150px;
    user-select: none;
}
.tetravex-slot {
    background-color: #e0e0e0;
    border-radius: 3px;
    min-width: 50px; /* Minimum size */
    min-height: 50px;
    aspect-ratio: 1 / 1; /* Keep square */
    display: flex; /* Allow centering if needed */
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s;
}
.tetravex-slot.drag-over {
    background-color: #cfe2ff;
    border: 1px dashed #9ec5fe;
}
.tetravex-pool.drag-over {
    background-color: #e9f5fe;
    border-color: #9ec5fe;
}

.tetravex-tile {
    width: 60px; /* Tile size */
    height: 60px;
    background-color: #f8f9fa;
    border: 1px solid #adb5bd;
    border-radius: 3px;
    position: relative;
    font-family: var(--font-main);
    font-weight: bold;
    cursor: grab;
    transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-drag: element; /* Allow dragging */
}
.tetravex-tile.dragging {
    opacity: 0.6;
    transform: scale(0.95);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    cursor: grabbing;
}
.tetravex-tile .num {
    position: absolute;
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.9em;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 2px;
    pointer-events: none;
}
.tetravex-tile .top { top: 2px; left: 50%; transform: translateX(-50%); }
.tetravex-tile .bottom { bottom: 2px; left: 50%; transform: translateX(-50%); }
.tetravex-tile .left { left: 2px; top: 50%; transform: translateY(-50%); }
.tetravex-tile .right { right: 2px; top: 50%; transform: translateY(-50%); }
.tetravex-tile .center-bg { /* Optional center visual */
    position: absolute;
    top: 25%; left: 25%;
    width: 50%; height: 50%;
    background-color: #ced4da;
    z-index: -1;
    border-radius: 2px;
    pointer-events: none;
}
.tetravex-slot.invalid .tetravex-tile {
    border-color: var(--error-color);
    box-shadow: 0 0 0 2px var(--error-color);
}
/* Ensure tiles inside slots don't prevent slot drop events */
.tetravex-slot .tetravex-tile {
    pointer-events: auto; /* Tiles inside slots are draggable */
}

/* --- 15. Rush Hour --- */
#rush-hour-board-container {
    margin: 15px auto;
    width: fit-content; /* Shrink to board size */
    position: relative; /* For absolute positioning of board */
}
.rush-hour-board {
    display: block; /* Changed from grid */
    position: relative; /* For absolute positioning of vehicles */
    background-color: #e9e9e9;
    border: 3px solid #777;
    border-radius: 4px;
    /* Width and height set by JS based on cell size */
    /* overflow: hidden; */ /* Can hide parts moving out */
    /* Background Grid Pattern (Optional) */
    background-image:
        linear-gradient(to right, #d8d8d8 1px, transparent 1px),
        linear-gradient(to bottom, #d8d8d8 1px, transparent 1px);
    background-size: var(--rush-hour-cell-size) var(--rush-hour-cell-size);
    user-select: none;
    touch-action: none; /* Prevent scrolling while dragging */
}
.rush-hour-board::after { /* Exit visual cue */
    content: '';
    position: absolute;
    top: calc(var(--rush-hour-cell-size) * 2); /* Exit row (0-indexed) */
    right: -10px; /* Position slightly outside the right border */
    width: 10px;
    height: var(--rush-hour-cell-size);
    background-color: var(--rush-hour-exit-color);
    border-radius: 0 3px 3px 0;
    box-shadow: inset -2px 0 3px rgba(0,0,0,0.2);
    z-index: 5; /* Below vehicles */
}

.rush-hour-vehicle {
    position: absolute;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.2);
    box-shadow: inset 0 2px 2px rgba(255,255,255,0.3), inset 0 -2px 2px rgba(0,0,0,0.1);
    cursor: grab;
    transition: box-shadow 0.2s ease, left 0.1s ease-out, top 0.1s ease-out; /* Transition for dragging and snapping back */
    z-index: 10;
    /* width, height, top, left, background-color set by JS */
    user-select: none;
    -webkit-user-drag: none;
    -webkit-tap-highlight-color: transparent;
}
.rush-hour-vehicle.target-car {
    background-color: var(--error-color) !important; /* Ensure red overrides others */
    z-index: 11; /* Target car slightly above others */
}
.rush-hour-vehicle.dragging {
    cursor: grabbing;
    opacity: 0.85; /* Slightly less transparent */
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    z-index: 12; /* Highest while dragging */
    transition: box-shadow 0.2s ease; /* Remove position transition while dragging */
}

/* --- 16. Go Game --- */
#go-board-container {
    margin: 15px auto;
    width: fit-content;
}
#go-board-canvas {
    background-color: #e3c16f; /* Wooden color from JS */
    border: 3px solid #6f4e37; /* Darker wood border */
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    /* width/height set dynamically in JS */
}
/* Turn indicator styling */
#go-turn {
    display: inline-block; /* Allow styling */
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    transition: background-color 0.3s, color 0.3s;
}
/* Go turn indicator style via JS is preferred */
.turn-black {
    background-color: #333;
    color: white;
}
.turn-white {
    background-color: #fff;
    color: #333;
    border: 1px solid #ccc;
}

/* --- 17. Nim Game --- */
.nim-heaps-container {
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Align heaps at the bottom */
    gap: 30px;
    margin-top: 25px;
    min-height: 100px; /* Ensure space */
    flex-wrap: wrap;
    user-select: none;
}
.nim-heap {
    display: flex;
    flex-direction: column-reverse; /* Stack items upwards */
    gap: 4px;
    align-items: center;
    padding: 5px;
    /* border: 1px dashed #ccc; */
}
.nim-item {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #add8e6, #4682b4); /* Light blue stone */
    box-shadow: inset 0 -2px 3px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.1);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #2a5275;
    transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.nim-item i { display: none; } /* Hide icon if using background */
.nim-item:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 -2px 3px rgba(0,0,0,0.2), 0 3px 5px rgba(0,0,0,0.2);
}
.nim-item.selected {
    opacity: 0.5;
    transform: scale(0.9);
    box-shadow: none;
}

/* --- 18. Connect Four --- */
#connect-four-board-container {
    margin: 15px auto;
    width: fit-content;
    background-color: #007bff; /* Blue frame */
    padding: 10px 10px 5px 10px; /* Padding around grid */
    border-radius: 10px;
    box-shadow: 0 5px 10px rgba(0,0,0,0.2);
    position: relative; /* Needed for absolute drop animation */
    overflow: hidden; /* Clip the dropping piece if needed */
    user-select: none;
}
.connect-four-board {
    display: grid;
    grid-template-columns: repeat(7, clamp(40px, 10vw, 60px)); /* Responsive columns */
    grid-template-rows: auto repeat(6, clamp(40px, 10vw, 60px)); /* Header row + 6 cell rows */
    gap: 5px;
    width: fit-content;
    /* position: relative; For dropping animation - Moved to container */
}
.connect-four-header {
    grid-column: span 1;
    grid-row: 1; /* Headers are in the first row */
    height: clamp(40px, 10vw, 60px); /* Match cell height */
    cursor: pointer;
    position: relative;
    border-radius: 5px 5px 0 0; /* Rounded top */
    /* background-color: rgba(0, 0, 0, 0.1); Subtle hover */
    display: flex;
    justify-content: center;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
}
.connect-four-header:hover {
    background-color: rgba(255, 255, 255, 0.1);
}
.drop-indicator { /* Piece shown on hover */
    width: 70%;
    height: 70%;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}
.drop-indicator.piece-red { background-color: var(--error-color); box-shadow: inset 0 -2px 3px rgba(0,0,0,0.3); }
.drop-indicator.piece-yellow { background-color: var(--warning-color); box-shadow: inset 0 -2px 3px rgba(0,0,0,0.3); }

.connect-four-cell {
    grid-column: span 1;
    /* grid-row is implicit */
    background-color: #f0f4f8; /* Empty slot background */
    border-radius: 50%; /* Make circular holes */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Hide piece overflow */
    aspect-ratio: 1 / 1; /* Ensure circle */
    box-shadow: inset 0 3px 5px rgba(0,0,0,0.15);
    pointer-events: none; /* Let header handle clicks */
}
.connect-four-piece {
    width: 80%; /* Piece smaller than cell */
    height: 80%;
    border-radius: 50%;
    background-color: transparent; /* Start transparent */
    /* opacity: 0; Start hidden for animation - removed, color change handles */
    transition: background-color 0.3s ease;
    box-shadow: inset 0 -3px 4px rgba(0,0,0,0.3), 0 1px 1px rgba(255,255,255,0.2);
}
.connect-four-piece.red { background-color: var(--error-color); }
.connect-four-piece.yellow { background-color: var(--warning-color); }

/* Dropping Animation Piece */
.connect-four-piece.dropping {
    position: absolute; /* Positioned relative to board container */
    z-index: 100;
    /* width/height match placed piece */
    transition: top 0.3s cubic-bezier(0.45, 0, 0.95, 0.6), left 0.3s linear; /* Adjusted bounce */
}
.connect-four-piece.placed {
    animation: piecePop 0.2s ease-out;
}
@keyframes piecePop {
    0% { transform: scale(0.8); }
    70% { transform: scale(1.05); }
    100% { transform: scale(1); }
}
/* Turn indicator styling */
#connect-four-turn.player-red { color: white; background-color: var(--error-color); }
#connect-four-turn.player-yellow { color: #333; background-color: var(--warning-color); }

/* --- 19. Mastermind --- */
.mastermind-container {
    display: flex;
    flex-direction: column-reverse; /* Show current guess at bottom, history above */
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}
#mastermind-color-palette {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    user-select: none;
}
#mastermind-color-palette h4 { width: 100%; text-align: center; margin-bottom: 5px; font-size: 0.9em; }
.mastermind-palette-color {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    -webkit-tap-highlight-color: transparent;
}
.mastermind-palette-color:hover {
    transform: scale(1.1);
}
.mastermind-palette-color.selected {
    border-color: var(--dark-blue);
    box-shadow: 0 0 0 3px var(--secondary-color);
}

#mastermind-current-guess {
    text-align: center;
    margin-bottom: 10px;
}
#mastermind-current-guess h4 { margin-bottom: 8px; font-weight: 600; }
#mastermind-guesses-area {
    display: flex;
    flex-direction: column; /* Rows stack vertically */
    gap: 8px;
    width: 100%;
    max-width: 350px; /* Limit width */
    margin-bottom: 15px; /* Space below history */
}
.mastermind-guess-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8f9fa;
    padding: 8px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
}
.mastermind-pegs {
    display: flex;
    gap: 8px;
    user-select: none;
}
.mastermind-peg-slot {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background-color: #e9ecef; /* Empty slot color */
    border: 1px solid #ced4da;
    cursor: pointer;
    display: inline-block; /* Needed? Flex handles it */
    transition: background-color 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.mastermind-peg-slot.filled {
    cursor: default;
}
.mastermind-peg-slot.past { /* For previous guesses */
     cursor: default;
}
.mastermind-feedback {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2x2 grid for feedback */
    gap: 3px;
    width: 35px; /* Match peg size roughly */
    height: 35px;
    padding: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #e9e9e9;
    user-select: none;
}
.feedback-peg {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid #777;
}
.feedback-peg.black { background-color: black; }
.feedback-peg.white { background-color: white; }
.feedback-peg.empty { background-color: transparent; border: none; }

.secret-reveal {
    background-color: transparent; /* Remove background */
    display: inline-flex; /* Make it inline with text */
    vertical-align: middle; /* Align with text */
    margin-left: 5px; /* Space from text */
    gap: 5px; /* Space between revealed pegs */
}
.secret-reveal .mastermind-peg-slot.past {
    width: 20px; /* Smaller reveal pegs */
    height: 20px;
}


/* --- Responsive Adjustments --- */

/* Hide grid, show dropdown on mobile */
@media (max-width: 768px) {
    #game-selection-grid {
        display: none;
    }
    .game-selection-dropdown-container {
        display: block; /* Show dropdown */
    }
     /* Style the dropdown container when active */
     #game-selection-dropdown-container.selection-top {
        border-bottom: 2px solid var(--border-color);
        padding-bottom: 15px;
        margin-bottom: 25px;
     }
}

/* Larger screen adjustments */
@media (min-width: 769px) {
    /* Ensure dropdown is hidden on larger screens if it was shown */
    .game-selection-dropdown-container {
        display: none;
    }
    /* Ensure grid is shown */
    #game-selection-grid {
        display: grid;
    }
}

/* General tablet size adjustments */
@media (max-width: 900px) {
     .game-selection-top {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }
    .game-selection-top .game-button i { font-size: 1.4em; }
    .game-selection-top .game-button span { font-size: 0.7em; }

    /* Adjust game layouts */
    .tictactoe-board { grid-template-columns: repeat(3, 70px); grid-template-rows: repeat(3, 70px); }
    .tictactoe-cell { width: 70px; height: 70px; font-size: 2.5em; }

    #game2048-grid-container { padding: 8px;}
    /* Game 2048 cell size will be adapted by JS */

    .sudoku-grid { max-width: 360px; }

    .wordsearch-container { flex-direction: column; align-items: center;}
    #wordsearch-list-container { width: 90%; max-width: 300px; border-left: none; border-top: 1px solid #ccc; padding-left: 0; padding-top: 15px; }
    #wordsearch-grid { width: clamp(250px, 90vw, 380px); }

    .tetravex-container { flex-direction: column; align-items: center; }
    .tetravex-pool { width: 90%; max-width: 300px; justify-content: center; }

    #rush-hour-board { /* Rely on JS for sizing */ }

}

/* General mobile size adjustments */
@media (max-width: 600px) {
    body { padding: 10px; }
    .container { padding: 15px; }
     .game-selection-center { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
     /* No .game-selection-top styles needed for grid as it's hidden */

    .game-controls { justify-content: center; } /* Küçük ekranda ortala */
    .game-controls > * { flex-grow: 1; text-align: center;} /* Stretch controls */
    .game-controls label { margin-right: 0; margin-bottom: 5px; display: block;}
    .game-controls select { width: 100%;}

    #image-match-grid { grid-template-columns: repeat(4, 1fr); max-width: 95%; gap: 5px;}
    .image-match-card-face { font-size: 1.5em; }

    /* Further grid size adjustments */
    #snake-canvas { max-width: 280px; height: auto; } /* Make responsive */

    .minesweeper-cell { width: 22px; height: 22px; font-size: 12px; }
    .minesweeper-cell.flagged, .minesweeper-cell.mine { font-size: 13px;}

    .sudoku-grid { max-width: 300px; }
    #sudoku-numbers button { width: 30px; height: 30px; font-size: 1.1em;}

    .tetris-layout { flex-direction: column; align-items: center; }
    #tetris-info { width: 90%; max-width: 250px;}

    .hangman-container { flex-direction: column; align-items: center; gap: 15px; }
    .hangman-info { width: 100%; }
    .hangman-word-display { letter-spacing: 0.2em;}
    .hangman-letter-button { min-width: 35px; padding: 6px 8px; font-size: 1em;}

    .wordmatch-column { width: 90%; flex-basis: auto; }

    .checkers-board, .eight-queens-board { max-width: 320px; }

    .tetravex-grid { max-width: 300px; }
    .tetravex-tile { width: 50px; height: 50px; }

    .connect-four-board { gap: 4px; }

    #mastermind-color-palette { gap: 8px; }
    .mastermind-palette-color { width: 35px; height: 35px; }
    .mastermind-peg-slot { width: 30px; height: 30px; }
    .mastermind-feedback { width: 30px; height: 30px; }
    .feedback-peg { width: 8px; height: 8px; }
    .secret-reveal .mastermind-peg-slot.past { width: 18px; height: 18px; }

}

/* Smaller mobile adjustments */
@media (max-width: 400px) {
    /* Game Selection Dropdown is already active */

     .game-controls { flex-direction: column; align-items: stretch; gap: 8px;}
     .game-controls select, .game-controls button { width: 100%; margin-bottom: 5px; padding: 10px 12px;} /* Larger buttons */
     .score-display, .game-controls span { width: 100%; text-align: center; margin-bottom: 5px; }

    .tictactoe-board { grid-template-columns: repeat(3, 60px); grid-template-rows: repeat(3, 60px); gap: 4px;}
    .tictactoe-cell { width: 60px; height: 60px; font-size: 2em; }

    .image-match-grid { gap: 4px; }
    .image-match-card-face { font-size: 1.2em; }

    .checkers-board, .eight-queens-board { max-width: 280px; }
    .sudoku-grid { max-width: 270px; }

    #wordsearch-grid { width: clamp(200px, 90vw, 280px); }
    .wordsearch-cell { font-size: clamp(0.7em, 2vw, 1em); }

    .nim-item { width: 25px; height: 25px; }

    .connect-four-board { gap: 3px; }
    .mastermind-peg-slot { width: 25px; height: 25px; }
    .mastermind-feedback { width: 25px; height: 25px; }
    .feedback-peg { width: 6px; height: 6px; }
    .secret-reveal .mastermind-peg-slot.past { width: 16px; height: 16px; }

}