:root {
    --bg-color: #050a14;
    --grid-bg: #0a1525;
    --grid-line: #1a3c5a;
    --primary: #00f0ff; /* Neon Cyan */
    --secondary: #00ff9d; /* Neon Green */
    --danger: #ff0055; /* Neon Red */
    --text-main: #ffffff;
    --text-dim: #8ba4b4;
    --water: #0b1e33;
    --ship: #4a5c6e;
    --ship-placed: #00f0ff;
    --hit: #ff0055;
    --miss: #ffffff;
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow: hidden; /* Prevent scroll */
    height: 100vh;
    display: flex;
    flex-direction: column;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    padding: 20px;
    background: var(--bg-color);
    z-index: 10;
}

.screen.active {
    display: flex;
}

/* Headers & Text */
h1, h2 {
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.status-box {
    text-align: center;
    margin-top: 20px;
}

.hidden { display: none !important; }

/* Grid System */
.grid-container {
    margin: 20px 0;
    display: flex;
    justify-content: center;
}

.grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    width: 90vmin;
    height: 90vmin;
    max-width: 400px;
    max-height: 400px;
    background-color: var(--grid-bg);
    border: 2px solid var(--primary);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

.cell {
    border: 1px solid var(--grid-line);
    cursor: pointer;
    position: relative;
}

.cell.ship {
    background-color: var(--ship-placed);
    box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
}

.cell.hit {
    background-color: var(--hit) !important;
    animation: flash 0.5s;
}

.cell.miss {
    background-color: rgba(255, 255, 255, 0.2);
}

.cell.miss::after {
    content: '•';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
}

@keyframes flash {
    0% { background-color: white; }
    100% { background-color: var(--hit); }
}

/* Controls */
.controls {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 400px;
    justify-content: space-between;
}

.btn {
    padding: 15px;
    flex: 1;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn.primary { background: var(--primary); color: #000; }
.btn.secondary { background: var(--grid-line); color: var(--primary); border: 1px solid var(--primary); }
.btn.danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }

/* Battle Screen specific */
.battle-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #000;
}

.turn-badge {
    background: var(--grid-line);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    border: 1px solid var(--text-dim);
}

.turn-badge.your-turn {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

.tabs {
    display: flex;
    width: 100%;
    max-width: 400px;
    margin-bottom: 10px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: #000;
    color: var(--text-dim);
    border: none;
    border-bottom: 2px solid #333;
    cursor: pointer;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.battle-views {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
}

.view {
    display: none;
    flex-direction: column;
    align-items: center;
}

.view.active {
    display: flex;
}

.view-label {
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.log-console {
    height: 40px;
    border-top: 1px solid #333;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: monospace;
    font-size: 12px;
    color: var(--secondary);
    background: #000;
    position: fixed;
    bottom: 0;
}

/* Animations */
.loader {
    width: 40px;
    height: 40px;
    border: 4px solid var(--grid-line);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
