:root {
    --color-waiting: #34495E;
    --color-ready: #E74C3C;
    --color-go: #2ECC71;
    --color-result: #3498DB;
    --color-early: #F39C12;
    --color-finished: #9B59B6;
    --color-text: #FFFFFF;
    --color-text-muted: rgba(255, 255, 255, 0.8);
    --transition-speed: 0.3s;
}

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--color-text);
    background-color: var(--color-waiting);
    transition: background-color var(--transition-speed) ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body.state-waiting { background-color: var(--color-waiting); }
body.state-ready { background-color: var(--color-ready); transition: none; }
body.state-go { background-color: var(--color-go); transition: none; }
body.state-result { background-color: var(--color-result); }
body.state-early { background-color: var(--color-early); }
body.state-finished { background-color: var(--color-finished); }

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    min-width: 320px;
    padding: 20px;
    text-align: center;
}

.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
    max-width: 400px;
}

.screen.active {
    display: flex;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

h2 {
    font-size: 1.75rem;
    font-weight: 600;
}

.instructions {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    margin-bottom: 10px;
}

.best-time {
    font-size: 1rem;
    color: var(--color-text-muted);
    margin-bottom: 20px;
}

.big-text {
    font-size: 2.5rem;
    font-weight: 700;
}

.hint {
    font-size: 1.1rem;
    color: var(--color-text-muted);
}

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

.result-time {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.attempt-info {
    font-size: 1rem;
    color: var(--color-text-muted);
}

.times-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 10px 0;
}

.times-list li {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.95rem;
}

.new-record {
    font-size: 1.1rem;
    font-weight: 600;
    color: #FFD700;
    margin: 10px 0;
}

.btn-primary,
.btn-secondary {
    min-width: 160px;
    min-height: 48px;
    padding: 14px 28px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
    touch-action: manipulation;
}

.btn-primary {
    background-color: var(--color-text);
    color: #333;
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--color-text);
    border: 2px solid var(--color-text);
}

.btn-primary:active,
.btn-secondary:active {
    transform: scale(0.95);
    opacity: 0.9;
}

.btn-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Pantalla completa táctil para ready y go */
#screen-ready,
#screen-go {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: none;
    padding: 20px;
    cursor: pointer;
}

/* Media queries para pantallas más grandes */
@media (min-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    .big-text {
        font-size: 3.5rem;
    }

    .result-time {
        font-size: 4.5rem;
    }
}
