/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
    --color-bg-dark: #060b13;
    --color-bg-deep: #020508;
    --color-primary: #00f2fe;
    --color-primary-rgb: 0, 242, 254;
    --color-secondary: #4facfe;
    --color-secondary-rgb: 79, 172, 254;
    --color-accent: #ff416c;
    --color-accent-rgb: 255, 65, 108;
    --color-success: #00ff87;
    --color-text-main: #e2e8f0;
    --color-text-muted: #718096;
    --color-border: rgba(0, 242, 254, 0.2);
    --color-panel-bg: rgba(10, 20, 38, 0.7);
    --glow-primary: 0 0 10px rgba(0, 242, 254, 0.5);
    --glow-accent: 0 0 10px rgba(255, 65, 108, 0.6);
    --font-heading: 'Orbitron', sans-serif;
    --font-body: 'Inter', sans-serif;
    --cell-size: 36px;
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-drag: none;
}

body {
    background-color: var(--color-bg-dark);
    color: var(--color-text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Эффект сетки и звезд на заднем плане */
.stars-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background: 
        radial-gradient(ellipse at 50% 50%, rgba(10, 25, 47, 0.6) 0%, var(--color-bg-deep) 100%),
        radial-gradient(white, rgba(255,255,255,.2) 2px, transparent 40px),
        radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 30px),
        radial-gradient(white, rgba(255,255,255,.1) 2px, transparent 40px);
    background-size: 100% 100%, 550px 550px, 350px 350px, 250px 250px;
    background-repeat: no-repeat, repeat, repeat, repeat;
    background-position: center, 0 0, 40px 60px, 130px 270px;
    opacity: 0.8;
    pointer-events: none;
}

/* CRT Эффект полос сканирования */
.scanline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.25) 50%
    );
    background-size: 100% 4px;
    z-index: 100;
    pointer-events: none;
    opacity: 0.4;
}

/* ==========================================================================
   TYPOGRAPHY & BUTTONS
   ========================================================================== */
h1, h2, h3, .coordinates-label-top, .coordinates-label-side, .turn-title, .stat-badge, .stat-value {
    font-family: var(--font-heading);
    letter-spacing: 1.5px;
}

kbd {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: monospace;
    color: var(--color-primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 1px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-primary) 100%);
    color: #000;
    box-shadow: var(--glow-primary);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.8);
    filter: brightness(1.1);
}

.btn-primary:disabled {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.05);
    color: var(--color-text-muted);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-secondary {
    background: rgba(10, 25, 47, 0.5);
    border-color: var(--color-border);
    color: var(--color-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(0, 242, 254, 0.1);
    box-shadow: var(--glow-primary);
    border-color: var(--color-primary);
}

.btn-danger {
    background: rgba(255, 65, 108, 0.1);
    border-color: rgba(255, 65, 108, 0.3);
    color: var(--color-accent);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(255, 65, 108, 0.2);
    border-color: var(--color-accent);
    box-shadow: var(--glow-accent);
    transform: translateY(-2px);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(0, 242, 254, 0.1);
    box-shadow: var(--glow-primary);
    color: #fff;
}

.hidden {
    display: none !important;
}

.input-field {
    background: rgba(10, 25, 47, 0.5);
    border: 1px solid var(--color-border);
    color: var(--color-primary);
    padding: 10px 15px;
    border-radius: 4px;
    font-family: var(--font-heading);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
}

.input-field:focus {
    border-color: var(--color-primary);
    box-shadow: var(--glow-primary);
}

/* ==========================================================================
   GLASSMORPHISM PANEL SYSTEM
   ========================================================================== */
.glass-panel {
    background: var(--color-panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
    border-color: rgba(0, 242, 254, 0.35);
    box-shadow: 0 8px 32px 0 rgba(0, 242, 254, 0.05);
}

.panel-header {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 12px;
}

.panel-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.3);
}

.subtitle {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* ==========================================================================
   HEADER & FOOTER
   ========================================================================== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    border-bottom: 1px solid var(--color-border);
    background: rgba(2, 5, 8, 0.8);
    backdrop-filter: blur(10px);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: 2px;
}

.logo h1 span {
    color: var(--color-primary);
    text-shadow: var(--glow-primary);
    font-weight: 300;
    margin-left: 5px;
}

.pulse-dot {
    width: 12px;
    height: 12px;
    background-color: var(--color-primary);
    border-radius: 50%;
    box-shadow: var(--glow-primary);
    animation: pulse 2s infinite;
}

.app-footer {
    text-align: center;
    padding: 20px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    border-top: 1px solid rgba(0, 242, 254, 0.1);
    background: rgba(2, 5, 8, 0.9);
    margin-top: auto;
}

/* ==========================================================================
   MAIN GAME LAYOUT
   ========================================================================== */
.game-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.screen {
    display: none;
    width: 100%;
    animation: fadeIn 0.5s ease forwards;
}

.screen.active {
    display: block;
}

/* ==========================================================================
   SCREEN 1: SETUP SCREEN
   ========================================================================== */
.main-panel {
    max-width: 950px;
    margin: 0 auto;
}

.setup-layout {
    display: flex;
    gap: 30px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

.setup-sidebar {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.instructions-panel {
    background: rgba(0, 242, 254, 0.03);
    border: 1px dashed var(--color-border);
    padding: 15px;
    border-radius: 6px;
}

.instructions-panel h3 {
    font-size: 0.95rem;
    color: var(--color-primary);
    margin-bottom: 10px;
}

.instructions-panel ul {
    list-style-type: none;
}

.instructions-panel li {
    font-size: 0.8rem;
    color: var(--color-text-main);
    margin-bottom: 8px;
    position: relative;
    padding-left: 14px;
    line-height: 1.4;
}

.instructions-panel li::before {
    content: "•";
    color: var(--color-primary);
    position: absolute;
    left: 0;
    top: 0;
}

.dock-panel {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(2, 5, 8, 0.5);
    border-radius: 6px;
    padding: 15px;
}

.dock-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.dock-header h3 {
    font-size: 0.95rem;
}

.ship-direction-indicator {
    font-size: 0.8rem;
    margin-bottom: 15px;
    color: var(--color-text-muted);
}

.glow-cyan {
    color: var(--color-primary);
    font-weight: 700;
    text-shadow: 0 0 5px rgba(0, 242, 254, 0.5);
}

.glow-orange {
    color: #ff9f43;
    font-weight: 700;
    text-shadow: 0 0 5px rgba(255, 159, 67, 0.5);
}

.ships-dock {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.setup-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    border-top: 1px solid var(--color-border);
    padding-top: 20px;
    flex-wrap: wrap;
}

/* ==========================================================================
   BOARD COORDINATES & LAYOUT
   ========================================================================== */
.board-container {
    display: inline-block;
    padding: 10px;
}

.coordinates-label-top {
    display: grid;
    grid-template-columns: 24px repeat(10, var(--cell-size));
    text-align: center;
    font-size: 0.8rem;
    color: var(--color-primary);
    margin-bottom: 4px;
    font-weight: bold;
}

.board-with-row-labels {
    display: flex;
}

.coordinates-label-side {
    display: grid;
    grid-template-rows: repeat(10, var(--cell-size));
    width: 24px;
    text-align: right;
    align-items: center;
    font-size: 0.8rem;
    color: var(--color-primary);
    padding-right: 8px;
    font-weight: bold;
}

/* ==========================================================================
   GAME BOARD & CELLS
   ========================================================================== */
.game-board {
    display: grid;
    grid-template-columns: repeat(10, var(--cell-size));
    grid-template-rows: repeat(10, var(--cell-size));
    background-color: var(--color-border);
    gap: 1px;
    border: 2px solid var(--color-primary);
    box-shadow: var(--glow-primary);
    position: relative;
    overflow: hidden;
}

.cell {
    background-color: var(--color-bg-deep);
    transition: background-color 0.2s, box-shadow 0.2s;
    cursor: crosshair;
    position: relative;
}

/* Эффект сетки на ячейках */
.cell::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    border: 1px solid rgba(0, 242, 254, 0.03);
    pointer-events: none;
}

/* Свечение ячеек при наведении */
.game-board:not(.placement-mode) .cell:hover {
    background-color: rgba(0, 242, 254, 0.15);
    box-shadow: inset 0 0 8px rgba(0, 242, 254, 0.4);
}

/* ==========================================================================
   SHIP STYLING & DRAGGING
   ========================================================================== */
/* Корабль в Доке */
.dock-ship {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    cursor: grab;
    transition: all 0.2s;
}

.dock-ship:hover:not(.placed) {
    background: rgba(0, 242, 254, 0.05);
    border-color: rgba(0, 242, 254, 0.3);
}

.dock-ship.selected {
    background: rgba(0, 242, 254, 0.1);
    border-color: var(--color-primary);
    box-shadow: inset 0 0 5px rgba(0, 242, 254, 0.2);
}

.dock-ship.placed {
    opacity: 0.3;
    cursor: default;
    background: rgba(0, 0, 0, 0.2);
    border-color: transparent;
}

.ship-info-name {
    font-size: 0.8rem;
    width: 90px;
    color: var(--color-text-main);
}

.ship-blocks-preview {
    display: flex;
    gap: 3px;
}

.preview-block {
    width: 16px;
    height: 16px;
    background: var(--color-secondary);
    border: 1px solid var(--color-primary);
    border-radius: 2px;
}

.dock-ship.selected .preview-block {
    background: var(--color-primary);
    box-shadow: 0 0 5px var(--color-primary);
}

/* Корабли на поле расстановки */
.cell.ship-present {
    background: rgba(0, 242, 254, 0.25);
    box-shadow: inset 0 0 10px rgba(0, 242, 254, 0.5);
    border: 1px solid var(--color-primary);
}

.placement-mode .cell.ship-present {
    cursor: grab;
}

/* Классы предварительного просмотра кораблей во время расстановки */
.cell.preview-valid {
    background: rgba(0, 255, 135, 0.4) !important;
    box-shadow: inset 0 0 10px rgba(0, 255, 135, 0.6) !important;
}

.cell.preview-invalid {
    background: rgba(255, 65, 108, 0.4) !important;
    box-shadow: inset 0 0 10px rgba(255, 65, 108, 0.6) !important;
}

/* ==========================================================================
   SCREEN 2: BATTLE SCREEN
   ========================================================================== */
.battle-layout {
    display: grid;
    grid-template-columns: minmax(350px, 1fr) 280px minmax(350px, 1fr);
    gap: 20px;
    align-items: start;
    max-width: 1300px;
    margin: 0 auto;
}

@media (max-width: 1100px) {
    .battle-layout {
        grid-template-columns: 1fr;
    }
    .middle-panel {
        order: -1; /* Статистика и логи наверху на маленьких экранах */
    }
}

.player-panel, .enemy-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.middle-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

.stat-badge {
    background: rgba(0, 242, 254, 0.08);
    border: 1px solid var(--color-border);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--color-primary);
    margin-top: 8px;
    display: inline-block;
}

/* Очередь хода */
.info-board {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
}

.turn-indicator {
    display: flex;
    flex-direction: column;
}

.turn-title {
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

#turn-badge {
    font-size: 1.1rem;
    font-weight: 900;
    margin-top: 3px;
    text-shadow: 0 0 10px currentColor;
    transition: all 0.3s;
}

.badge-player {
    color: var(--color-primary);
}

.badge-enemy {
    color: var(--color-accent);
}

.game-timer {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--color-text-main);
    border-left: 2px solid var(--color-border);
    padding-left: 15px;
}

/* Бортовой журнал (логи) */
.log-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 250px;
    max-height: 350px;
}

.log-panel .panel-header {
    margin-bottom: 10px;
    padding-bottom: 8px;
}

.log-panel h3 {
    font-size: 0.9rem;
}

.log-messages {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 5px;
    font-size: 0.78rem;
    line-height: 1.4;
}

/* Стилизация скроллбара для логов */
.log-messages::-webkit-scrollbar {
    width: 4px;
}
.log-messages::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}
.log-messages::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 2px;
}

.log-msg {
    padding: 4px 8px;
    border-radius: 4px;
    border-left: 2px solid transparent;
}

.log-msg.system {
    background: rgba(79, 172, 254, 0.05);
    border-color: var(--color-secondary);
    color: var(--color-secondary);
}

.log-msg.player {
    background: rgba(0, 242, 254, 0.05);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.log-msg.enemy {
    background: rgba(255, 65, 108, 0.05);
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.log-msg.success {
    background: rgba(0, 255, 135, 0.05);
    border-color: var(--color-success);
    color: var(--color-success);
    font-weight: 500;
}

/* Сводка кораблей на боковой панели */
.ships-tracker {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
    width: 100%;
    border-top: 1px solid var(--color-border);
    padding-top: 15px;
    flex-wrap: wrap;
}

.tracker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.tracker-ship-visual {
    display: flex;
    gap: 2px;
}

.tracker-dot {
    width: 8px;
    height: 8px;
    background: rgba(0, 242, 254, 0.2);
    border: 1px solid var(--color-primary);
    border-radius: 50%;
}

.tracker-item.sunk .tracker-dot {
    background: rgba(255, 65, 108, 0.2);
    border-color: var(--color-accent);
}

.tracker-item.alive .tracker-dot {
    background: var(--color-primary);
    box-shadow: 0 0 5px var(--color-primary);
}

.tracker-count {
    font-size: 0.7rem;
    font-family: var(--font-heading);
    color: var(--color-text-muted);
}

/* ==========================================================================
   HIT, MISS AND SUNK ANIMATIONS & STATES
   ========================================================================== */
/* Промах (капли воды) */
.cell.miss {
    cursor: not-allowed;
}

.cell.miss::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background-color: var(--color-secondary);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--color-secondary);
    animation: ripple 0.6s ease-out;
}

/* Попадание (огонь / взрыв) */
.cell.hit {
    background-color: rgba(255, 65, 108, 0.2);
    cursor: not-allowed;
}

.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

#particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--color-accent);
    border-radius: 50%;
    box-shadow: var(--glow-accent);
}

.cell.hit::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: radial-gradient(circle, var(--color-accent) 0%, rgba(255, 65, 108, 0) 70%);
    border-radius: 50%;
    box-shadow: var(--glow-accent);
    animation: explode 0.5s ease-out forwards;
}

.cell.hit::after {
    content: '×';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--color-accent);
    font-size: 20px;
    font-family: var(--font-heading);
    font-weight: bold;
    text-shadow: var(--glow-accent);
}

/* Уничтоженный корабль целиком */
.cell.sunk {
    background-color: rgba(255, 65, 108, 0.4) !important;
    border: 1px solid var(--color-accent) !important;
    box-shadow: inset 0 0 10px rgba(255, 65, 108, 0.6) !important;
    animation: blink-red 1s infinite alternate;
}

.cell.sunk::after {
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
}

/* Автоматически помеченные промахи вокруг уничтоженного корабля */
.cell.auto-miss {
    opacity: 0.6;
}

.cell.auto-miss::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    background-color: var(--color-text-muted);
    border-radius: 50%;
}

/* Сетка радара (Анимация сканирования на поле компьютера) */
.radar-sweep::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        0deg,
        rgba(0, 242, 254, 0) 45%,
        rgba(0, 242, 254, 0.08) 49%,
        rgba(0, 242, 254, 0.15) 50%,
        rgba(0, 242, 254, 0.08) 51%,
        rgba(0, 242, 254, 0) 55%
    );
    transform: rotate(0deg);
    transform-origin: center center;
    animation: sweep 4s linear infinite;
    pointer-events: none;
    z-index: 5;
}

/* ==========================================================================
   OVERLAY: GAME OVER OVERLAY
   ========================================================================== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(2, 5, 8, 0.85);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.4s ease forwards;
}

.overlay.active {
    display: flex;
}

.gameover-panel {
    max-width: 550px;
    width: 100%;
    text-align: center;
    animation: scaleUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

#gameover-title {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 5px;
    text-shadow: var(--glow-primary);
}

.gameover-panel.victory #gameover-title {
    color: var(--color-success);
    text-shadow: 0 0 15px rgba(0, 255, 135, 0.6);
}

.gameover-panel.defeat #gameover-title {
    color: var(--color-accent);
    text-shadow: var(--glow-accent);
}

.gameover-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 25px 0;
}

.stat-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}

.gameover-panel.victory .stat-value {
    color: var(--color-primary);
}

/* ==========================================================================
   TABS & ROCKET (MOBILE & EFFECTS)
   ========================================================================== */
.tabs-container {
    display: none;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    width: 100%;
}

.tab-btn {
    flex: 1;
    background: rgba(10, 20, 30, 0.7);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    padding: 10px;
    border-radius: 8px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.tab-btn.active {
    background: rgba(0, 242, 254, 0.2);
    border-color: var(--color-primary);
    color: var(--color-text-main);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.3);
}

.rocket {
    position: absolute;
    width: 12px;
    height: 30px;
    background: linear-gradient(to top, #ff416c, #ff4b2b, yellow, white);
    border-radius: 50% 50% 10% 10%;
    box-shadow: 0 0 15px #ff416c, 0 0 30px #ff4b2b;
    pointer-events: none;
    z-index: 10000;
    transform-origin: center center;
    /* След от ракеты */
    filter: drop-shadow(0 10px 5px rgba(255, 65, 108, 0.5));
}

/* ==========================================================================
   ANIMATIONS & KEYFRAMES
   ========================================================================== */
@keyframes pulse {
    0% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(0, 242, 254, 0.7);
    }
    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(0, 242, 254, 0);
    }
    100% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(0, 242, 254, 0);
    }
}

@keyframes sweep {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes ripple {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 28px;
        height: 28px;
        opacity: 0;
        border: 1px solid var(--color-secondary);
    }
}

@keyframes explode {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    50% {
        width: 25px;
        height: 25px;
        opacity: 0.8;
    }
    100% {
        width: 32px;
        height: 32px;
        opacity: 0;
    }
}

@keyframes blink-red {
    from {
        box-shadow: inset 0 0 5px rgba(255, 65, 108, 0.4);
    }
    to {
        box-shadow: inset 0 0 15px rgba(255, 65, 108, 0.8);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* ==========================================================================
/* ==========================================================================
   MOBILE & RESPONSIVE
   ========================================================================== */
@media (max-width: 1100px) {
    .battle-layout {
        grid-template-columns: 1fr;
    }
    .middle-panel {
        order: -1;
    }
}

@media (max-width: 600px) {
    :root {
        /* Делаем ячейки такими, чтобы всё поле точно влезло в экран (минус отступы) */
        --cell-size: calc((100vw - 70px) / 10); 
    }
    
    .app-header {
        padding: 10px 15px;
        flex-direction: column;
        gap: 10px;
    }
    
    .logo h1 {
        font-size: 1.1rem;
    }
    
    .game-container {
        padding: 10px 5px;
    }
    
    .setup-layout {
        flex-direction: column;
        gap: 15px;
    }
    
    .setup-sidebar {
        min-width: 100%;
    }
    
    .glass-panel {
        padding: 12px;
    }

    .main-panel {
        padding: 15px !important;
    }

    .tabs-container {
        display: flex;
    }
    
    .mobile-hidden {
        display: none !important;
    }

    .panel-header h2 {
        font-size: 1.1rem;
    }
    
    .btn {
        font-size: 0.75rem;
        padding: 8px 12px;
        width: 100%;
        margin-bottom: 5px;
    }

    .setup-actions {
        flex-direction: column;
        gap: 5px;
    }

    .btn-lg {
        font-size: 0.9rem;
        padding: 10px 15px;
    }

    .board-container {
        padding: 5px;
        overflow-x: auto;
    }

    .log-panel {
        min-height: 150px;
        max-height: 200px;
    }

    .ships-tracker {
        gap: 8px;
    }
    
    .tracker-count {
        font-size: 0.6rem;
    }

    #main-menu-screen h1 {
        font-size: 1.8rem !important;
    }
}

/* ==========================================================================
   HELPER UTILITY CLASSES
   ========================================================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.btn-lg {
    padding: 12px 30px;
    font-size: 1.05rem;
}

.icon {
    vertical-align: middle;
}
