:root {
    --radar-green: #00ff41;
    --radar-bg: #051a05;
    --navy-blue: #0a192f;
    --hit-red: #ff3e3e;
    --miss-white: rgba(255, 255, 255, 0.4);
    --ship-gray: #4a5568;
}

.bn-container {
    max-width: 1000px;
    width: 95%;
    font-family: 'Share Tech Mono', monospace;
}

.header-img {
    max-width: 200px;
    height: auto;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 10px rgba(0, 255, 65, 0.5));
    border-radius: 15px;
}

.back-link {
    display: inline-block;
    margin-bottom: 15px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.9rem;
}

.bn-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    gap: 2px;
    background: rgba(0, 255, 65, 0.1);
    border: 3px solid var(--radar-green);
    aspect-ratio: 1/1;
    width: 100%;
    max-width: 500px; /* Force a larger minimum size on desktop */
}

.grid-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bn-cell {
    background: var(--radar-bg);
    border: 0.5px solid rgba(0, 255, 65, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    font-size: 0.8rem;
    min-height: 30px; /* Ensure cells have a minimum size */
}

.bn-cell:hover {
    background: rgba(0, 255, 65, 0.2);
}

.grid-label {
    font-size: 1rem;
    color: var(--radar-green);
    margin-bottom: 10px;
    letter-spacing: 2px;
    text-align: center;
    width: 100%;
}

.battlefield {
    display: flex;
    gap: 40px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
}

.grid-wrapper {
    flex: 1;
    min-width: 350px;
    max-width: 500px;
}

.grid-wrapper.mini {
    flex: 0 0 250px;
    min-width: 250px;
}

/* Placement Layout */
.placement-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    justify-content: center;
    margin-top: 30px;
    width: 100%;
}

#ship-inventory {
    flex: 0 0 250px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
}

.ship-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 15px;
    cursor: grab;
    transition: background 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ship-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--radar-green);
}

.ship-item.placed {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

.ship-preview {
    background: var(--ship-gray);
    height: 12px;
    border-radius: 6px;
    border: 1px solid #718096;
}

.ship-preview.size-5 { width: 100px; }
.ship-preview.size-4 { width: 80px; }
.ship-preview.size-3 { width: 60px; }
.ship-preview.size-2 { width: 40px; }

.ship-item span {
    font-size: 0.7rem;
    color: var(--text-dim);
}

.bn-cell[draggable="true"] {
    cursor: grab !important;
}

.bn-cell[draggable="true"]:active {
    cursor: grabbing !important;
}

.bn-cell.drag-over {
    background: rgba(0, 255, 65, 0.3) !important;
}

.bn-cell.drag-invalid {
    background: rgba(255, 62, 62, 0.3) !important;
}

/* Ship states */
.ship { background-color: var(--ship-gray); border: 1px solid #718096; }
.ship.hit { background-color: var(--hit-red); animation: flicker 0.2s infinite; }
.miss::after { content: '×'; color: white; font-size: 1.5rem; }
.hit::after { content: '●'; color: var(--hit-red); font-size: 1.2rem; text-shadow: 0 0 10px var(--hit-red); }

.sunk {
    background: repeating-linear-gradient(
        45deg,
        rgba(255, 62, 62, 0.4),
        rgba(255, 62, 62, 0.4) 5px,
        rgba(0, 0, 0, 0.4) 5px,
        rgba(0, 0, 0, 0.4) 10px
    ) !important;
    border: 1px solid var(--hit-red);
}

@keyframes flicker {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Radar scanning effect */
.radar {
    position: relative;
    overflow: hidden;
}

.radar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 255, 65, 0.1) 50%, transparent 100%);
    animation: scan 4s linear infinite;
    pointer-events: none;
    z-index: 10;
}

@keyframes scan {
    from { transform: translateY(-100%); }
    to { transform: translateY(100%); }
}

/* Battle Log */
#battle-log {
    margin-top: 20px;
    height: 100px;
    overflow-y: auto;
    text-align: left;
    font-size: 0.9rem;
    padding: 15px;
    color: var(--radar-green);
    border-color: rgba(0, 255, 65, 0.3);
}

.log-entry { margin-bottom: 5px; }
.log-entry.enemy { color: var(--accent-o); }

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    padding: 10px 20px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    margin: 10px;
}

.info-panel {
    margin-bottom: 20px;
}

@media (max-width: 600px) {
    .battlefield { flex-direction: column; align-items: center; }
    .grid-wrapper { width: 100%; }
}

/* Hit Notification Animation */
.hit-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 62, 62, 0.9);
    color: white;
    padding: 20px 40px;
    font-size: 3rem;
    font-weight: bold;
    border-radius: 20px;
    z-index: 1000;
    pointer-events: none;
    animation: hitPop 1.5s ease-out forwards;
    text-shadow: 0 0 20px black;
    border: 5px solid white;
    white-space: nowrap;
}

.hit-notification.enemy-hit {
    background: rgba(255, 126, 0, 0.9);
}

@keyframes hitPop {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    20% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    80% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
}
