/* --- GENEL AYARLAR & UZAY TEMASI --- */
body {
    margin: 0; padding: 0;
    /* DERİN UZAY ARKA PLANI */
    background-color: #020005;
    background-image: 
        radial-gradient(white, rgba(255,255,255,.2) 1px, transparent 2px),
        radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 2px),
        radial-gradient(circle at 10% 20%, rgba(70, 0, 180, 0.25) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(180, 0, 100, 0.2) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(20, 20, 60, 0.6) 0%, transparent 70%);
    background-size: 550px 550px, 350px 350px, 100% 100%, 100% 100%, 100% 100%;
    background-attachment: fixed;
    color: #fff;
    font-family: 'Press Start 2P', cursive;
    display: flex; flex-direction: column;
    align-items: center; 
    justify-content: center;
    min-height: 100vh;
    user-select: none;
    overflow: hidden;
}

/* --- UI DÜZENLEME (KOMPAKT) --- */
.game-header { 
    margin-top: 10px; /* Üst boşluk azaltıldı */
    text-align: center; 
    margin-bottom: 5px; /* Alt boşluk azaltıldı */
    z-index: 5; 
}

h1 { 
    color: #00f3ff; 
    font-size: 1.5rem; /* Font biraz küçültüldü */
    margin-bottom: 5px; 
    text-shadow: 0 0 15px rgba(0, 243, 255, 0.6); 
    line-height: 1.2; 
}

.status { 
    font-family: 'Roboto', sans-serif; 
    font-size: 0.8rem; 
    color: #aaa; 
    min-height: 1.2em; 
    font-weight: bold; 
    letter-spacing: 1px;
}

/* --- OYUN ALANI --- */
.main-container {
    display: flex; 
    gap: 20px; /* Paneller arası boşluk azaltıldı */
    align-items: flex-start; 
    justify-content: center;
    flex-wrap: wrap; 
    margin-bottom: 5px; 
    z-index: 5;
    /* transform: scale(1); Küçültmeye gerek kalmadı */
}

.board-wrapper {
    display: flex; flex-direction: column; align-items: center; 
    transition: opacity 0.3s;
}
.board-wrapper.inactive { opacity: 0.4; pointer-events: none; filter: grayscale(0.8); }
.board-title { margin-bottom: 5px; color: #fff; font-size: 0.7rem; letter-spacing: 2px; text-shadow: 0 0 5px #fff; }

/* GRID (IZGARA) - 40px */
.grid {
    display: grid;
    grid-template-columns: repeat(10, 40px);
    grid-template-rows: repeat(10, 40px);
    gap: 1px; /* Bu 1px boşluk JS hesabında önemli */
    background: rgba(10, 20, 40, 0.6); 
    border: 1px solid #00f3ff;
    position: relative;
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.15);
    backdrop-filter: blur(4px);
}
.grid.locked { cursor: not-allowed; border-color: #555; }

.cell {
    width: 40px; height: 40px;
    background: rgba(0, 243, 255, 0.03); 
    border: 1px solid rgba(0, 243, 255, 0.1); 
    display: flex; align-items: center; justify-content: center;
    position: relative;
}

.cell.miss::after { 
    content: ''; width: 8px; height: 8px; 
    background: #555; border-radius: 50%; box-shadow: 0 0 5px #555; 
}
.cell.hit { 
    background: rgba(255, 0, 85, 0.2); 
    box-shadow: inset 0 0 15px rgba(255, 0, 85, 0.5); 
    border: 1px solid #ff0055;
}
.cell.hit::after { 
    content: '💥'; font-size: 1.5rem; 
    filter: drop-shadow(0 0 5px #ff0055);
}
.cell.sunk { 
    background: rgba(255, 0, 0, 0.4) !important; 
    border: 1px solid #ff0000; 
}
.cell.sunk::after { content: '☠️'; font-size: 1.5rem; }

.grid.clickable .cell:hover:not(.hit):not(.miss):not(.sunk) { 
    background: rgba(0, 243, 255, 0.3); 
    border-color: #00f3ff;
    cursor: crosshair; 
}

/* --- UZAY GEMİSİ TASARIMI --- */
.ship-dock {
    width: 420px; 
    min-height: 60px; /* Yükseklik azaltıldı */
    background: rgba(0, 0, 0, 0.6); 
    border-top: 1px solid #333;
    border-bottom: 1px solid #333;
    padding: 10px; /* Padding azaltıldı */
    display: flex; flex-wrap: wrap; gap: 10px;
    align-items: center; justify-content: center;
    margin-top: 10px; /* Margin azaltıldı */
    border-radius: 12px;
}

.ship-visual {
    background: linear-gradient(135deg, #2b323c 0%, #101216 100%);
    border: 1px solid #00f3ff;
    border-radius: 4px;
    position: absolute; 
    cursor: grab;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.3), inset 0 0 5px rgba(255,255,255,0.1);
    z-index: 10;
    overflow: hidden;
}

.ship-visual::after {
    content: '';
    position: absolute;
    background: rgba(0, 243, 255, 0.6);
    box-shadow: 0 0 5px rgba(0, 243, 255, 0.8);
}

.ship-visual:not(.vertical) {
    border-top-right-radius: 15px; 
    border-bottom-right-radius: 15px;
    border-left: 3px solid #ff0055; 
}
.ship-visual:not(.vertical)::after {
    right: 5px; top: 50%; transform: translateY(-50%);
    width: 6px; height: 20px; border-radius: 2px;
}

.ship-visual.vertical {
    background: linear-gradient(180deg, #101216 0%, #2b323c 100%);
    border-bottom-left-radius: 15px; 
    border-bottom-right-radius: 15px;
    border-top: 3px solid #ff0055; 
}
.ship-visual.vertical::after {
    bottom: 5px; left: 50%; transform: translateX(-50%);
    width: 20px; height: 6px; border-radius: 2px;
}

.ship-dock .ship-visual { position: relative; left: auto; top: auto; }

/* --- BUTONLAR --- */
.btn {
    background: rgba(0, 243, 255, 0.1); 
    color: #00f3ff; 
    border: 1px solid #00f3ff;
    padding: 10px 20px; 
    font-family: 'Press Start 2P'; font-size: 0.65rem;
    cursor: pointer; border-radius: 4px; 
    margin-top: 8px; 
    transition: 0.2s;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.1);
}
.btn:hover { 
    background: #00f3ff; color: #000; 
    box-shadow: 0 0 20px #00f3ff; 
    transform: translateY(-2px);
}
.btn:disabled { 
    opacity: 0.3; cursor: not-allowed; 
    box-shadow: none; border-color: #555; color: #555; transform: none;
}

.btn.secondary { color: #ff00de; border-color: #ff00de; background: rgba(255, 0, 222, 0.1); }
.btn.secondary:hover { background: #ff00de; color: #000; box-shadow: 0 0 20px #ff00de; }

#confirmBtn {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    font-size: 0.75rem;
    border-width: 2px;
    background: rgba(0, 0, 0, 0.8);
}

.info-tip { 
    font-family: 'Roboto', sans-serif; 
    color: #888; 
    font-size: 0.7rem; 
    margin-top: 5px; 
    text-align: center;
}

.back-link {
    position: absolute; top: 20px; left: 20px;
    color: #aaa; text-decoration: none; font-family: 'Roboto', sans-serif; 
    font-weight: bold; font-size: 0.8rem; z-index: 100;
    display: flex; align-items: center; gap: 8px; transition: color 0.3s;
}
.back-link:hover { color: #00f3ff; text-shadow: 0 0 5px #00f3ff; }

.top-controls {
    position: absolute; top: 20px; right: 20px;
    display: flex; gap: 10px; z-index: 100;
}

.icon-btn {
    background: rgba(20, 20, 40, 0.8); border: 1px solid #334; color: #aaa;
    width: 40px; height: 40px; border-radius: 8px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; font-size: 1rem; backdrop-filter: blur(2px);
}
.icon-btn:hover { 
    background: #223; border-color: #00f3ff; color: #00f3ff; 
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4); 
}

/* OVERLAYS */
.overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(2, 0, 5, 0.95);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; z-index: 50;
    backdrop-filter: blur(10px);
}
.hidden { display: none !important; }

.btn-group-vertical { display: flex; flex-direction: column; gap: 20px; }
.btn-play {
    background: transparent; border: 2px solid #00f3ff; color: #00f3ff;
    padding: 15px 40px; font-family: 'Press Start 2P'; font-size: 0.9rem;
    cursor: pointer; transition: 0.2s; text-transform: uppercase;
    min-width: 220px; text-align: center;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
}
.btn-play:hover { background: #00f3ff; color: #000; box-shadow: 0 0 30px #00f3ff; transform: scale(1.05); }
.btn-play.secondary { border-color: #ff00de; color: #ff00de; }
.btn-play.secondary:hover { background: #ff00de; color: #000; box-shadow: 0 0 30px #ff00de; }

.subtitle { color: #888; font-family: 'Roboto', sans-serif; font-size: 0.8rem; margin-bottom: 40px; letter-spacing: 3px; }

@media (max-width: 900px) {
    body { padding-top: 20px; justify-content: flex-start; overflow-y: auto; }
    .main-container { flex-direction: column; gap: 20px; transform: scale(1); margin-bottom: 20px;}
    .grid { grid-template-columns: repeat(10, 30px); grid-template-rows: repeat(10, 30px); }
    .cell { width: 30px; height: 30px; }
    .ship-dock { width: 320px; }
    .game-header { margin-top: 10px; }
    h1 { font-size: 1.2rem; }
    #confirmBtn { margin-bottom: 50px; }
}