:root {
    --bg-dark: #000000;
    --text-primary: #FFFFFF;
    --text-secondary: #888888;
    --accent: #00F0FF;
    --accent-glow: rgba(0, 240, 255, 0.6);
    --player-color: #39FF14;
    --ghost-color: #B200FF;
    --danger: #FF003C;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden; /* Modo TV: sem scroll */
}

.tv-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(20, 20, 20, 0.9);
    border-bottom: 2px solid #222;
    height: 60px;
}

.logo {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.2rem;
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent-glow);
}

.controls {
    display: flex;
    gap: 10px;
}

.btn {
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    text-transform: uppercase;
    padding: 10px 20px;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    background: #111;
    color: #fff;
    transition: 0.2s;
}
.btn:disabled { opacity: 0.3; cursor: not-allowed; }
.btn.primary { border-color: var(--accent); color: var(--accent); }
.btn.primary:not(:disabled):hover { background: var(--accent); color: #000; }
.btn.success { border-color: var(--player-color); color: var(--player-color); }
.btn.success:not(:disabled):hover { background: var(--player-color); color: #000; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:not(:disabled):hover { background: var(--danger); color: #000; }
.btn.ghost-btn { border-color: var(--ghost-color); color: var(--ghost-color); }
.btn.ghost-btn:hover { background: var(--ghost-color); color: #fff; }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #111;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #555; }
.connected .status-dot { background: var(--player-color); box-shadow: 0 0 8px var(--player-color); }

/* Race Track (Agua) */
.race-track {
    flex-grow: 1;
    position: relative;
    background: radial-gradient(circle at center, #021a2c 0%, #000000 100%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Efeito de água no fundo da pista usando ondas SVG */
.race-track::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="120" height="40" viewBox="0 0 120 40"><path d="M0 20 Q 15 5, 30 20 T 60 20 T 90 20 T 120 20" fill="none" stroke="rgba(0, 240, 255, 0.15)" stroke-width="2"/></svg>');
    background-size: 120px 40px;
    animation: moveWater 3s linear infinite;
    opacity: 0.8;
    z-index: 0;
}

@keyframes moveWater {
    0% { background-position: 0 0; }
    100% { background-position: -120px 0; }
}

.lane {
    flex: 1;
    position: relative;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    z-index: 1;
}
.lane-label {
    position: absolute;
    left: 20px;
    font-size: 0.8rem;
    font-weight: 900;
    color: rgba(255,255,255,0.2);
    text-transform: uppercase;
}
.boat-container {
    position: absolute;
    left: 5%;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-50%);
    transition: left 0.5s ease-out;
}
.boat { font-size: 3rem; filter: drop-shadow(0 0 10px rgba(0,0,0,0.5)); }
.player-lane .boat { filter: drop-shadow(0 0 20px var(--player-color)); }
.ghost-lane .boat { filter: grayscale(100%) opacity(0.5); }
.player-rank {
    background: var(--player-color);
    color: #000;
    font-weight: 900;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: -15px;
    z-index: 2;
    box-shadow: 0 0 15px var(--player-color);
}
.stats-badge {
    background: rgba(0,0,0,0.9);
    border: 2px solid #333;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 800;
    margin-top: -5px;
    color: var(--text-secondary);
    white-space: nowrap;
    z-index: 2;
}
.player-lane .stats-badge { color: var(--player-color); border-color: rgba(57, 255, 20, 0.5); font-size: 1.1rem; }

.finish-line {
    position: absolute;
    right: 5%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: repeating-linear-gradient(0deg, #fff, #fff 15px, transparent 15px, transparent 30px);
    opacity: 0.3;
    z-index: 0;
}

/* Dashboard Inferior */
.dashboard-panel {
    height: 38vh;
    background: #050505;
    border-top: 2px solid #222;
    display: flex;
    padding: 1rem;
    gap: 1rem;
    box-sizing: border-box;
}

.metrics-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 10px;
}

.metric-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.metric-card.highlight {
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.1) inset;
}
.metric-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 800;
}
.metric-val {
    font-size: 3rem;
    font-weight: 900;
    color: #fff;
    margin-top: 5px;
    line-height: 1.1;
}
.metric-val.split-text {
    font-size: 2rem;
}
.metric-val small { font-size: 1.3rem; color: #666; font-weight: 600; }

.chart-wrapper {
    flex: 1;
    background: #111;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 10px;
    position: relative;
}

/* Modals */
.emoji-opt:hover { transform: scale(1.2); }

.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 100;
    justify-content: center;
    align-items: center;
}
.modal.open { display: flex; }
.modal-content {
    background: #111;
    border: 1px solid #333;
    border-radius: 12px;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    padding: 2rem;
    position: relative;
    overflow-y: auto;
}
.close-btn {
    position: absolute;
    top: 15px; right: 15px;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}
.history-item {
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.history-item button { margin-left: 10px; }
.split-table {
    width: 100%;
    margin-top: 10px;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.split-table th, .split-table td {
    padding: 5px;
    border-bottom: 1px solid #333;
    text-align: left;
}
