:root {
    /* -- LIGHT MODE (Varsayılan) -- */
    --bg-color: #f3f4f6;
    --board-bg: #ffffff;
    --text-color: #1f2937;
    --highlight: #e5e7eb;
    --primary: #6366f1; 
    --shadow: rgba(0,0,0,0.1);
    --btn-shadow: rgba(99, 102, 241, 0.3);

    /* Pastel Renkler */
    --color-blue: #93c5fd;   
    --color-green: #86efac;  
    --color-yellow: #fde047; 
    --color-orange: #fdba74; 
    
    --modal-bg: rgba(0, 0, 0, 0.8);
}

/* -- DARK MODE -- */
body.dark-mode {
    --bg-color: #111827;
    --board-bg: #1f2937;
    --text-color: #f3f4f6;
    --highlight: #374151;
    --primary: #818cf8;
    --shadow: rgba(0,0,0,0.5);
    --btn-shadow: rgba(129, 140, 248, 0.2);
}

* { box-sizing: border-box; }

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    user-select: none;
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
}

/* ÜST BAR */
.top-bar {
    position: absolute; top: 20px; right: 20px;
    display: flex; gap: 10px; z-index: 50;
}

.icon-btn {
    background: var(--board-bg); border: none;
    width: 45px; height: 45px; border-radius: 50%;
    cursor: pointer; font-size: 22px; color: var(--text-color);
    box-shadow: 0 4px 10px var(--shadow); transition: 0.3s;
    display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { transform: scale(1.1); background-color: var(--highlight); }

.container {
    text-align: center; padding: 20px;
    position: relative; z-index: 10;
}

.header {
    display: flex; justify-content: center; align-items: center;
    gap: 10px; margin-bottom: 20px;
}
.logo-icon { font-size: 36px; color: var(--primary); }
h1 { margin: 0; text-transform: uppercase; font-size: 32px; letter-spacing: 1px; font-weight: 800; }

/* SKOR ALANI */
.game-info { display: flex; justify-content: center; gap: 20px; margin-bottom: 25px; }

.score-box {
    background: var(--board-bg); padding: 10px 25px;
    border-radius: 16px; box-shadow: 0 4px 15px var(--shadow);
    display: flex; flex-direction: column; min-width: 140px;
    transition: background-color 0.3s;
}
.score-box span:first-child { font-size: 13px; opacity: 0.7; font-weight: 600; letter-spacing: 0.5px; }
.score-box span:last-child { font-size: 26px; font-weight: 700; color: var(--primary); }

/* --- OYUN ALANI --- */
#game-board {
    width: 560px; height: 560px;
    background-color: var(--board-bg);
    margin: 0 auto;
    border-radius: 16px;
    display: grid;
    grid-template-rows: repeat(8, 1fr);
    grid-template-columns: repeat(8, 1fr);
    gap: 5px; padding: 5px;
    box-shadow: 0 20px 50px var(--shadow);
    position: relative;
    transition: background-color 0.3s;
}

.tile {
    width: 100%; height: 100%;
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    z-index: 10;
    transition: transform 0.1s, filter 0.1s; /* Sadece hover ve tıklama için */
}

.tile:hover { filter: brightness(0.92); transform: scale(0.95); }
.tile:active { transform: scale(0.85); }

/* Renkler */
.tile.blue { background-color: var(--color-blue); border-bottom: 4px solid #60a5fa; }
.tile.green { background-color: var(--color-green); border-bottom: 4px solid #4ade80; }
.tile.yellow { background-color: var(--color-yellow); border-bottom: 4px solid #facc15; }
.tile.orange { background-color: var(--color-orange); border-bottom: 4px solid #fb923c; }

/* Patlama Efekti */
.tile.explode { animation: popOut 0.2s forwards; }
@keyframes popOut {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0); opacity: 0; }
}

/* Parçacıklar */
.particle {
    position: absolute; width: 12px; height: 12px; border-radius: 3px;
    pointer-events: none; z-index: 20;
    animation: particleFly 0.6s ease-out forwards;
}
@keyframes particleFly {
    0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(0); opacity: 0; }
}

/* Ceza (Titreme) */
.shake { animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(4px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
    40%, 60% { transform: translate3d(6px, 0, 0); }
}

/* Kayan Ceza Yazısı */
.floating-text {
    position: absolute; font-weight: 800; font-size: 28px; 
    pointer-events: none; z-index: 100;
    animation: floatUp 1s forwards; text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
@keyframes floatUp {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-60px) scale(1.2); opacity: 0; }
}

/* BUTONLAR */
.controls-info { margin-top: 25px; color: var(--text-color); opacity: 0.8; font-size: 16px; }
.controls button {
    margin-top: 15px; width: 100%; padding: 18px 0;
    border-radius: 16px; background: var(--primary); color: white;
    border: none; font-size: 20px; font-weight: 700; cursor: pointer;
    box-shadow: 0 10px 25px var(--btn-shadow); transition: 0.2s;
}
.controls button:hover { transform: translateY(-3px); filter: brightness(1.1); box-shadow: 0 15px 30px var(--btn-shadow); }
.controls button:disabled { background: #6b7280; box-shadow: none; transform: none; cursor: not-allowed; }

/* MODAL GENEL */
.modal {
    display: none; position: fixed; z-index: 100;
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: var(--modal-bg);
    align-items: center; justify-content: center;
    backdrop-filter: blur(8px);
}
.modal-content {
    background-color: var(--board-bg); padding: 40px; border-radius: 24px;
    text-align: center; width: 90%; max-width: 480px;
    color: var(--text-color);
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
    border: 2px solid var(--highlight);
    animation: zoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes zoomIn { from {transform: scale(0.8); opacity: 0;} to {transform: scale(1); opacity: 1;} }

.modal-icon { font-size: 64px; color: var(--primary); margin-bottom: 15px; display: block; }
.final-score { font-size: 56px; font-weight: 800; color: var(--primary); margin: 20px 0; }
.modal-content button {
    padding: 15px 15px; font-size: 18px; background: var(--primary);
    color: white; border: none; border-radius: 50px; cursor: pointer; font-weight: 600;
}

/* YARDIM MODAL */
.help-content { text-align: left; padding: 30px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.modal-header h2 { margin: 0; color: var(--primary); font-size: 24px; }
.close-btn { background: none; border: none; font-size: 28px; color: var(--text-color); cursor: pointer; transition: 0.2s; }
.close-btn:hover { color: var(--primary); transform: rotate(90deg); }

.rule-item { display: flex; align-items: center; gap: 15px; margin-bottom: 15px; font-size: 18px; }
.rule-item i { font-size: 28px; color: var(--primary); background: var(--highlight); padding: 8px; border-radius: 10px; }
hr { border: 0; height: 1px; background: var(--highlight); margin: 25px 0; }
h3 { margin-bottom: 15px; font-size: 18px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-color); }

.score-table, .penalty-table { list-style: none; padding: 0; margin: 0; }
.score-table li, .penalty-table li {
    display: flex; justify-content: space-between; margin-bottom: 10px; font-weight: 500; font-size: 16px;
    padding: 8px; border-radius: 8px; background-color: var(--highlight);
}
.danger { color: #ef4444; font-weight: 800; }