/* ===========================
   CAPTAIN JON - GRILLE ET BOUSSOLE
   =========================== */

.grid-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    justify-content: center;
    height: 100%;
}

/* ===========================
   GRILLE DE JEU
   =========================== */

.grid-section {
    display: flex;
    justify-content: center;
    align-items: center;
}

.grid {
    display: grid;
    grid-template-columns: 25px repeat(12, 28px);
    grid-template-rows: 25px repeat(12, 28px);
    gap: 1px;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px;
    border: 2px solid #1e3a5f;
    border-radius: 5px;
}

.cell {
    background: #2a4a6a;
    border: 1px solid #1e3a5f;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    font-size: 14px;
}

.cell:hover:not(.label):not(.corner) {
    background: #3a5a7a;
    transform: scale(1.1);
    z-index: 10;
}

/* Labels de la grille */
.cell.label {
    background: rgba(0, 0, 0, 0.6);
    color: #7a9cb5;
    font-size: 9px;
    font-weight: bold;
    cursor: default;
    border: none;
}

.cell.corner {
    background: transparent;
    border: none;
}

/* Types de cases */
.cell.water {
    background: #1a3a5a;
}

.cell.hidden {
    background: #0a0a0a;
    border-color: #050505;
    cursor: not-allowed;
}

.cell.port {
    background: #2d5016;
    border-color: #4a8020;
}

.cell.target {
    background: #6a2a2a;
    border-color: #8a4a4a;
}

.cell.obstacle {
    background: #1a1a1a;
    border-color: #0a0a0a;
}

.cell.detection {
    background: #6a2a2a;
    border-color: #4a1a1a;
    opacity: 0.6;
}

.cell.submarine {
    background: #1e3a5f;
    border-color: #3a5a8f;
    box-shadow: 0 0 15px rgba(58, 90, 143, 0.9);
}

.cell.path {
    background: #4a7a9a;
    border-color: #5a8aaa;
}

.cell.deep-water {
    background: #0a2a4a;
    border-color: #0a3a5a;
}

/* ===========================
   BOUSSOLE
   =========================== */

.compass-section {
    background: rgba(15, 25, 40, 0.8);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #1e3a5f;
    text-align: center;
    display: none; /* Cachée par défaut */
    max-width: 300px;
}

.compass-section.active {
    display: block;
}

.compass-title {
    color: #c5d8e8;
    font-size: 1em;
    margin-bottom: 10px;
    font-weight: bold;
}

.compass {
    width: 150px;
    height: 150px;
    position: relative;
    background: radial-gradient(circle, #1e3a5f 0%, #0a1a2f 100%);
    border-radius: 50%;
    border: 3px solid #3a5a8f;
    box-shadow: 0 0 15px rgba(58, 90, 143, 0.5);
    margin: 0 auto 10px;
}


.compass-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 15px;
    height: 15px;
    background: #c5d8e8;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(197, 216, 232, 0.8);
    z-index: 10;
}

.compass-direction {
    position: absolute;
    font-weight: bold;
    font-size: 1.1em;
    color: #c5d8e8;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.compass-direction.north {
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    color: #ff6b6b;
    font-size: 1.4em;
}

.compass-direction.east {
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.compass-direction.south {
    top: 50%;
    left: 10px;
    transform: translateY(-50%);
}

.compass-direction.west {
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.compass-needle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3px;
    height: 60px;
    background: linear-gradient(to bottom, #ff6b6b 0%, #ff6b6b 50%, #c5d8e8 50%, #c5d8e8 100%);
    transform-origin: center bottom;
    transform: translate(-50%, -100%) rotate(90deg);
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.8);
}

.compass-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.compass-line {
    position: absolute;
    background: rgba(197, 216, 232, 0.3);
    transform-origin: center;
}

.compass-line.horizontal {
    width: 100%;
    height: 2px;
    top: 50%;
    left: 0;
}

.compass-line.vertical {
    width: 2px;
    height: 100%;
    left: 50%;
    top: 0;
}

.compass-title {
    cursor: pointer;
    user-select: none;
    transition: color 0.3s;
}

.compass-title:hover {
    color: #6bff6b;
}

/* ===========================
   RESPONSIVE
   =========================== */

@media (max-width: 1200px) {
    .grid {
        grid-template-columns: 20px repeat(12, 22px);
        grid-template-rows: 20px repeat(12, 22px);
    }
    
    .cell {
        font-size: 11px;
    }
    
    .cell.label {
        font-size: 8px;
    }
}

@media (max-width: 768px) {
    .grid {
        grid-template-columns: 18px repeat(12, 18px);
        grid-template-rows: 18px repeat(12, 18px);
    }
    
    .cell {
        font-size: 10px;
    }
    
    .compass {
        width: 120px;
        height: 120px;
    }
}