/* Reset e Variáveis CSS */
:root {
    /* Cores Principais */
    --primary: #00d4ff;
    --secondary: #ff006e;
    --accent: #ffbe0b;
    --success: #00ff88;
    --warning: #ff6b35;
    --error: #ff4757;
    --danger: #ff4757;
    
    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    --gradient-secondary: linear-gradient(135deg, #ff006e 0%, #cc0056 100%);
    --gradient-accent: linear-gradient(135deg, #ffbe0b 0%, #ff9500 100%);
    --gradient-danger: linear-gradient(135deg, #ff4757 0%, #c44569 100%);
    --gradient-bg: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    --gradient-ocean: linear-gradient(135deg, #001122 0%, #003366 50%, #004488 100%);
    
    /* Sombras */
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.3);
    --shadow-glow-strong: 0 0 30px rgba(0, 212, 255, 0.6);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-explosion: 0 0 40px rgba(255, 71, 87, 0.8);
    
    /* Fontes */
    --font-primary: 'Orbitron', monospace;
    --font-secondary: 'Exo 2', sans-serif;
    
    /* Transições */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    max-width: 100vw;
}

* {
    max-width: 100%;
}

body {
    font-family: var(--font-secondary);
    background: var(--gradient-bg);
    color: #ffffff;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100vw;
}

/* Background Animation */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.wave {
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.1) 0%, transparent 70%);
    animation: wave-move 20s linear infinite;
}

.wave1 {
    top: -50%;
    left: -50%;
    animation-delay: 0s;
}

.wave2 {
    top: -50%;
    left: -50%;
    animation-delay: -7s;
    background: radial-gradient(circle, rgba(255, 0, 110, 0.1) 0%, transparent 70%);
}

.wave3 {
    top: -50%;
    left: -50%;
    animation-delay: -14s;
    background: radial-gradient(circle, rgba(255, 190, 11, 0.1) 0%, transparent 70%);
}

@keyframes wave-move {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.particles {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, rgba(0, 212, 255, 0.3), transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255, 0, 110, 0.3), transparent),
        radial-gradient(1px 1px at 90px 40px, rgba(255, 190, 11, 0.3), transparent);
    background-repeat: repeat;
    background-size: 100px 100px;
    animation: particles-move 30s linear infinite;
}

@keyframes particles-move {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-100px, -100px); }
}

/* Header */
.header {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 212, 255, 0.3);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    font-size: 3rem;
    animation: logo-float 3s ease-in-out infinite;
}

@keyframes logo-float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.logo h1 {
    font-family: var(--font-primary);
    font-size: 2rem;
    font-weight: 900;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: var(--shadow-glow);
}

.logo-subtitle {
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.header-controls {
    display: flex;
    align-items: center;
    justify-content: center;
}


.game-stats {
    display: flex;
    gap: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    border: 1px solid var(--primary);
    transition: var(--transition-normal);
}

.stat-item:hover {
    box-shadow: var(--shadow-glow);
}

.stat-item i {
    color: var(--primary);
}

/* Main Content */
.main-content {
    max-width: 100%;
    margin: 0 auto;
    padding: 1rem;
    width: 100%;
    box-sizing: border-box;
}

/* Game Phases */
.game-phase {
    display: none;
    grid-column: 1 / -1;
}

.game-phase.active {
    display: block;
}

/* Setup Phase */
.setup-container {
    background: rgba(0, 0, 0, 0.3);
    padding: 2rem;
    border-radius: 20px;
    border: 1px solid rgba(0, 212, 255, 0.2);
    backdrop-filter: blur(10px);
    text-align: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.setup-container h2 {
    font-family: var(--font-primary);
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 2rem;
}

.setup-controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 2rem;
}

.ship-selector {
    background: rgba(0, 0, 0, 0.5);
    padding: 1.5rem;
    border-radius: 15px;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.ship-selector h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-family: var(--font-primary);
}

.ship-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    max-width: 100%;
}

.ship-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    cursor: pointer;
    transition: var(--transition-normal);
    text-align: center;
    min-height: 80px;
    justify-content: center;
}

.ship-item:hover {
    background: rgba(0, 212, 255, 0.1);
    box-shadow: var(--shadow-glow);
}

.ship-item.selected {
    background: var(--gradient-primary);
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.ship-item.placed {
    opacity: 0.5;
    cursor: not-allowed;
}

.ship-icon {
    font-size: 1.5rem;
}

.ship-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    width: 100%;
}

.ship-name {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.8rem;
    text-align: center;
}

.ship-size {
    font-size: 0.7rem;
    color: #ccc;
    text-align: center;
}

.setup-actions {
    display: flex;
    flex-direction: row;
    gap: 0.8rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Battle Phase */
.battle-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.battlefield {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.player-board {
    background: rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid rgba(0, 212, 255, 0.2);
    backdrop-filter: blur(10px);
}

.player-board h3 {
    font-family: var(--font-primary);
    color: var(--primary);
    margin-bottom: 1rem;
    text-align: center;
}

.battle-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 2px;
    background: var(--gradient-ocean);
    padding: 0.5rem;
    border-radius: 15px;
    border: 2px solid var(--primary);
    box-shadow: var(--shadow-glow);
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.grid-cell {
    aspect-ratio: 1;
    min-width: 25px;
    min-height: 25px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 1rem;
    position: relative;
    overflow: hidden;
}

.grid-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: var(--transition-fast);
    z-index: -1;
}

.grid-cell:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-glow);
}

.grid-cell:hover::before {
    opacity: 0.2;
}

/* Ship States */
.grid-cell.ship {
    background: var(--gradient-primary);
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
    animation: ship-pulse 2s ease-in-out infinite;
}

@keyframes ship-pulse {
    0%, 100% { box-shadow: var(--shadow-glow); }
    50% { box-shadow: var(--shadow-glow-strong); }
}

.grid-cell.hit {
    background: var(--gradient-danger);
    border-color: var(--error);
    animation: hit-explosion 0.5s ease-out;
}

@keyframes hit-explosion {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); box-shadow: var(--shadow-explosion); }
    100% { transform: scale(1); }
}

.grid-cell.miss {
    background: rgba(255, 255, 255, 0.2);
    border-color: #ccc;
    animation: miss-splash 0.3s ease-out;
}

@keyframes miss-splash {
    0% { transform: scale(1); }
    50% { transform: scale(0.8); }
    100% { transform: scale(1); }
}

.grid-cell.sunk {
    background: var(--gradient-danger);
    border-color: var(--error);
    animation: ship-sink 1s ease-out;
}

@keyframes ship-sink {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Battle Info */
.battle-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.fleet-status {
    background: rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
    border-radius: 15px;
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.fleet-status h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-family: var(--font-primary);
}

.fleet-status-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fleet-status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.fleet-status-item.sunk {
    background: var(--gradient-danger);
    border-color: var(--error);
}

.battle-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Victory Phase */
.victory-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.victory-content {
    background: var(--gradient-bg);
    padding: 3rem;
    border-radius: 20px;
    border: 2px solid var(--primary);
    box-shadow: var(--shadow-glow-strong);
    text-align: center;
    position: relative;
    animation: victory-appear 0.5s ease-out;
}

@keyframes victory-appear {
    0% { transform: scale(0.5) rotate(10deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.victory-content h2 {
    font-family: var(--font-primary);
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
    text-shadow: var(--shadow-glow-strong);
    animation: victory-pulse 2s ease-in-out infinite;
}

@keyframes victory-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Vitória */
.victory-content.victory h2 {
    color: var(--success);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Derrota */
.victory-content.defeat h2 {
    color: var(--error);
    background: var(--gradient-danger);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.victory-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: #ccc;
}

.stat-value {
    font-family: var(--font-primary);
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: bold;
}

/* Action Buttons */
.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1rem;
    border: none;
    border-radius: 25px;
    font-family: var(--font-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
    min-width: 100px;
    justify-content: center;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: var(--transition-slow);
}

.action-btn:hover::before {
    left: 100%;
}

.action-btn.primary {
    background: var(--gradient-primary);
    color: white;
}

.action-btn.secondary {
    background: var(--gradient-secondary);
    color: white;
}

.action-btn.accent {
    background: var(--gradient-accent);
    color: white;
}

.action-btn.danger {
    background: var(--gradient-danger);
    color: white;
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow-strong);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}


/* Confetti Animation */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary);
    animation: confetti-fall 3s linear infinite;
}

.confetti:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
    background: var(--primary);
}

.confetti:nth-child(2) {
    left: 30%;
    animation-delay: 0.5s;
    background: var(--secondary);
}

.confetti:nth-child(3) {
    left: 50%;
    animation-delay: 1s;
    background: var(--accent);
}

.confetti:nth-child(4) {
    left: 70%;
    animation-delay: 1.5s;
    background: var(--success);
}

.confetti:nth-child(5) {
    left: 90%;
    animation-delay: 2s;
    background: var(--warning);
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Notifications */
.notifications {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notification {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow-glow);
    animation: notification-slide 0.3s ease-out;
    max-width: 300px;
}

@keyframes notification-slide {
    0% { transform: translateX(100%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 0 0.5rem;
    }
    
    .header-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .game-stats {
        justify-content: center;
    }
    
    .setup-actions {
        flex-direction: row;
        justify-content: center;
        gap: 0.5rem;
        padding: 0 0.5rem;
    }
    
    .action-btn {
        flex: 1;
        min-width: 120px;
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .btn-text {
        display: inline;
        font-size: 0.8rem;
    }
    
    .main-content {
        padding: 0.5rem;
        max-width: 100vw;
        box-sizing: border-box;
    }
    
    .setup-container {
        padding: 1rem;
        margin: 0 0.5rem;
    }
    
    .player-board {
        padding: 1rem;
    }
    
    .battle-grid {
        padding: 0.3rem;
        max-width: 90vw;
        width: 90vw;
    }
    
    .grid-cell {
        min-width: 20px;
        min-height: 20px;
        font-size: 0.8rem;
    }
    
    .ship-list {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.4rem;
    }
    
    .ship-item {
        min-height: 70px;
    }
}

@media (max-width: 600px) {
    .battle-grid {
        max-width: 95vw;
        width: 95vw;
        padding: 0.2rem;
    }
    
    .grid-cell {
        min-width: 18px;
        min-height: 18px;
        font-size: 0.7rem;
    }
    
    .ship-list {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.3rem;
    }
    
    .ship-item {
        min-height: 60px;
        padding: 0.4rem;
    }
    
    .ship-name {
        font-size: 0.7rem;
    }
    
    .ship-size {
        font-size: 0.6rem;
    }
    
    .main-content {
        padding: 0.3rem;
    }
    
    .setup-container {
        padding: 0.8rem;
        margin: 0 0.3rem;
    }
    
    .action-btn {
        min-width: 100px;
        padding: 0.5rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .btn-text {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .logo-subtitle {
        font-size: 0.8rem;
    }
    
    .victory-content {
        padding: 1.5rem;
        margin: 0.5rem;
    }
    
    .victory-content h2 {
        font-size: 2rem;
    }
    
    .battle-grid {
        max-width: 98vw;
        width: 91vw;
        padding: 0.1rem;
    }
    
    .grid-cell {
        min-width: 16px;
        min-height: 16px;
        font-size: 0.6rem;
    }
    
    .main-content {
        padding: 0.2rem;
    }
    
    .setup-container {
        padding: 0.6rem;
        margin: 0 0.2rem;
    }
    
    .action-btn {
        min-width: 90px;
        padding: 0.4rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .btn-text {
        font-size: 0.65rem;
    }
    
    .victory-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .grid-cell {
        min-width: 18px;
        min-height: 18px;
        font-size: 0.7rem;
    }
    
    .battle-grid {
        gap: 1px;
        padding: 0.2rem;
    }
    
    .ship-list {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.3rem;
    }
    
    .ship-item {
        padding: 0.5rem;
        min-height: 60px;
    }
    
    .ship-icon {
        font-size: 1.2rem;
    }
    
    .ship-name {
        font-size: 0.7rem;
    }
    
    .ship-size {
        font-size: 0.6rem;
    }
}