/* Flattened professional styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: #f8fafc;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    color: #1e293b;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background-color: #f8fafc;
    background-image: 
        radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: center center;
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#top-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-sizing: border-box;
    z-index: 1000;
    border-bottom: 1px solid #334155;
}

#brand-logo {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #ffffff;
}

#top-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #334155;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #475569;
}

.stat-icon {
    width: 20px;
    height: 20px;
}

.stat-val {
    font-size: 18px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #ffffff;
}

.text-white { color: #f8fafc; }
.text-green { color: #4ade80; }
.text-red { color: #f87171; }

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

/* Main Menu */
#main-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    transition: opacity 0.2s ease;
    background: transparent;
}

.dashboard-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 40px;
    border: 1px solid #cbd5e1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90vw;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

#main-menu h1 {
    font-size: 42px;
    margin-bottom: 30px;
    font-weight: 700;
    color: #0f172a;
}

.player-input-container {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #ffffff;
    padding: 15px 20px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    margin-bottom: 40px;
}

.player-input-container label {
    font-size: 18px;
    font-weight: 600;
    color: #334155;
}

#input-player-name {
    font-size: 18px;
    padding: 8px 12px;
    width: 250px;
    background: #f8fafc;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    outline: none;
    font-weight: 600;
}

#input-player-name:focus {
    border-color: #2563eb;
}

.menu-buttons {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
}

.setup-controls {
    display: flex;
    gap: 40px;
    margin-top: 20px;
    margin-bottom: 30px;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-size: 16px;
    font-weight: 600;
    color: #334155;
}

.counter-widget {
    display: flex;
    align-items: center;
    background: #ffffff;
    border-radius: 6px;
    padding: 4px;
    border: 1px solid #cbd5e1;
}

.counter-btn {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    width: 36px;
    height: 36px;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.counter-btn:hover {
    background: #e2e8f0;
}
.counter-btn:active {
    background: #cbd5e1;
}

.counter-widget input {
    width: 60px;
    background: transparent;
    border: none;
    color: #0f172a;
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    pointer-events: none;
}

.preview-container {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 20px;
}

#preview-canvas {
    background: #000;
    border-radius: 4px;
    display: block;
}

.menu-btn {
    background: #2563eb;
    color: white;
    border: none;
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    width: 200px;
    text-align: center;
    transition: background 0.2s;
}

.menu-btn:disabled {
    background: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
}

.menu-btn:not(:disabled):hover {
    background: #1d4ed8;
}

.menu-btn-wide {
    width: 420px;
    background: #475569;
}

.menu-btn-wide:not(:disabled):hover {
    background: #334155;
}

.menu-inputs {
    display: flex;
    gap: 30px;
    align-items: center;
    background: #ffffff;
    padding: 15px 30px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
}

.menu-inputs label {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #334155;
}

.menu-inputs input {
    font-size: 18px;
    padding: 8px 12px;
    width: 80px;
    background: #f8fafc;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    text-align: center;
    outline: none;
    font-weight: 600;
}

.menu-inputs input:focus {
    border-color: #2563eb;
}

/* Selector Visual de Circuitos y Dianas */
#circuit-selector, #target-selector {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 80px 20px 40px;
    overflow-y: auto;
    pointer-events: auto;
    background: #f8fafc;
    z-index: 200;
}

/* Pantalla de Setup */
#game-setup {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    background: #f8fafc;
    z-index: 200;
    padding-top: 60px;
}

#circuit-selector h2, #target-selector h2, #game-setup h2 {
    font-size: 32px;
    margin-bottom: 24px;
    font-weight: 700;
    color: #0f172a;
}

.btn-huge {
    font-size: 20px;
    padding: 14px 36px;
    border-radius: 6px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    color: white;
}

#btn-play {
    background: #059669;
}

#btn-play:hover {
    background: #047857;
}

#btn-back-setup {
    background: #64748b;
}

#btn-back-setup:hover {
    background: #475569;
}

.circuit-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-bottom: 20px;
    max-width: 900px;
}

.circuit-card {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.circuit-card:hover {
    border-color: #2563eb;
    background: #f8fafc;
}

.circuit-card span {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

.circuit-card canvas {
    width: 120px;
    height: 80px;
    border-radius: 4px;
    background: #0f172a;
    display: block;
    border: 1px solid #334155;
}

/* UI del juego (HUD) */
.metric-val {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.text-white { color: #f8fafc; }
.text-green { color: #22c55e; }
.text-red { color: #ef4444; }

.game-btn {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    padding: 10px 20px;
    cursor: pointer;
    pointer-events: auto;
}

.game-btn:hover {
    background: #dc2626;
}

.bottom-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    width: 90%;
    gap: 15px;
    z-index: 100;
    pointer-events: auto;
}

.game-btn.secondary {
    background: #64748b;
}

.game-btn.secondary:hover {
    background: #475569;
}

.btn-full-width {
    width: 100%;
    display: block;
    margin: 0 auto 30px;
}

#recenter-overlay {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 100px;
    pointer-events: none;
}

.recenter-msg {
    font-size: 24px;
    font-weight: 600;
    color: white;
    padding: 30px 40px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid #334155;
}

/* Pantalla de Resumen */
#summary-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    pointer-events: auto;
}

.summary-content {
    background: #ffffff;
    border-radius: 8px;
    padding: 40px;
    border: 1px solid #cbd5e1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 900px;
    width: 90%;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.summary-content h2 {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 24px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    width: 100%;
    margin-bottom: 30px;
}

.summary-stat {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.summary-stat .stat-label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
}

.summary-stat .stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

.summary-canvas-wrapper {
    background: #0f172a;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #334155;
    display: flex;
    justify-content: center;
}

#summary-canvas {
    display: block;
    max-width: 100%;
    height: auto;
}
