:root {
    --primary: #6200ee;
    --secondary: #03dac6;
    --background: #121212;
    --surface: #1e1e1e;
    --error: #cf6679;
    --on-primary: #ffffff;
    --on-background: #e1e1e1;
    --accent: #ff4081;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background);
    color: var(--on-background);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

#app {
    width: 100%;
    max-width: 900px;
    padding: 20px;
}

.screen {
    background-color: var(--surface);
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

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

h1 { color: var(--secondary); margin-bottom: 10px; }
h2 { color: var(--on-background); }

.input-group {
    margin: 20px 0;
    display: flex;
    justify-content: center;
    gap: 10px;
}

input {
    padding: 12px 20px;
    border-radius: 8px;
    border: 1px solid #444;
    background: #2c2c2c;
    color: white;
    font-size: 1rem;
    outline: none;
}

input:focus { border-color: var(--secondary); }

button {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    background-color: var(--primary);
    color: white;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
}

button:hover {
    background-color: #7c4dff;
    transform: scale(1.05);
}

button:active { transform: scale(0.95); }

/* Loader */
.loader {
    border: 5px solid #333;
    border-top: 5px solid var(--secondary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Game Layout */
.game-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #444;
}

.game-main {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .game-main { grid-template-columns: 1fr; }
}

#canvas-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

canvas {
    width: 100%;
    display: block;
    transform: scaleX(-1); /* Espejo */
}

#prediction-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
}

#prediction-fill {
    height: 100%;
    background: var(--secondary);
    width: 0%;
    transition: width 0.1s;
}

#prediction-label {
    position: absolute;
    width: 100%;
    text-align: center;
    font-size: 0.8rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
}

#target-pose-container {
    background: #2c2c2c;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 2px solid var(--accent);
}

#target-pose-display {
    font-size: 4rem;
    font-weight: bold;
    color: var(--accent);
}

.scores {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.score-card {
    flex: 1;
    background: #2c2c2c;
    padding: 15px;
    border-radius: 12px;
}

.score-card .name { display: block; font-size: 0.9rem; color: #aaa; }
.score-card .points { font-size: 2rem; font-weight: bold; color: var(--secondary); }

#game-messages {
    background: #1a1a1a;
    height: 100px;
    overflow-y: auto;
    border-radius: 8px;
    padding: 10px;
    font-size: 0.9rem;
    text-align: left;
}

.msg { margin-bottom: 5px; }
.msg.system { color: var(--secondary); font-weight: bold; }

/* Results */
#finalScoreDisplay {
    font-size: 1.5rem;
    margin: 20px 0;
}

#history {
    margin-top: 30px;
    max-height: 200px;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px;
    border-bottom: 1px solid #444;
}
