/* ============================================
   DEDO MAS RAPIDO - STYLES
   Mobile-first, dark theme, game-show style
   ============================================ */

/* CSS Variables */
:root {
    --color-primary: #6C5CE7;
    --color-primary-hover: #5B4BD5;
    --color-secondary: #00CEC9;
    --color-success: #00B894;
    --color-error: #FF7675;
    --color-warning: #FDCB6E;
    --color-bg: #1A1A2E;
    --color-surface: #16213E;
    --color-surface-light: #1F2B47;
    --color-text: #FFFFFF;
    --color-text-muted: #A0A0A0;
    --color-gold: #FFD700;
    --color-silver: #C0C0C0;
    --color-bronze: #CD7F32;
    --color-number: #FFEB3B;
    --transition-speed: 0.2s;
    --border-radius: 12px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================
   SCREENS
   ============================================ */
.screen {
    display: none;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1rem;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.container.centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1.5rem;
}

.game-container {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 2rem);
    min-height: calc(100dvh - 2rem);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
.title {
    font-size: 1.75rem;
    font-weight: 800;
    text-align: center;
    color: var(--color-gold);
    text-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
    letter-spacing: 2px;
    margin-bottom: 0.25rem;
}

.title-small {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    color: var(--color-text);
    margin-bottom: 1rem;
}

.subtitle {
    font-size: 0.875rem;
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.trophy {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
}

/* ============================================
   FORMS & INPUTS
   ============================================ */
.input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--color-surface-light);
    border-radius: var(--border-radius);
    background: var(--color-surface);
    color: var(--color-text);
    outline: none;
    transition: border-color var(--transition-speed);
}

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

.input::placeholder {
    color: var(--color-text-muted);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: block;
    width: 100%;
    padding: 1rem;
    font-size: 1.125rem;
    font-weight: 700;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-speed);
    touch-action: manipulation;
    min-height: 56px;
}

.btn:active {
    transform: scale(0.98);
}

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

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

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

.btn-secondary {
    background: var(--color-surface-light);
    color: var(--color-text);
}

.btn-text {
    background: transparent;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    min-height: auto;
    padding: 0.5rem;
}

.btn-icon {
    width: 56px;
    min-width: 56px;
    padding: 0;
    font-size: 1.5rem;
    background: var(--color-primary);
    color: var(--color-text);
    flex-shrink: 0;
}

.btn-large {
    padding: 1.25rem 2rem;
    font-size: 1.5rem;
    min-height: 64px;
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn-link {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0.5rem;
    margin-top: 1rem;
}

/* ============================================
   SETUP SCREEN - PLAYERS
   ============================================ */
.players-section {
    margin-bottom: 1.5rem;
}

.section-label {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.players-list {
    list-style: none;
    background: var(--color-surface);
    border-radius: var(--border-radius);
    min-height: 60px;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 0.75rem;
}

.setup-list {
    padding: 0.25rem;
}

.setup-list:empty::after {
    content: "Agrega jugadores para empezar";
    display: block;
    padding: 1rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    border-radius: 8px;
}

.player-item:not(:last-child) {
    border-bottom: 1px solid var(--color-surface-light);
}

.player-name {
    flex: 1;
    font-weight: 500;
}

.player-remove {
    background: none;
    border: none;
    color: var(--color-error);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    opacity: 0.7;
}

.player-remove:hover {
    opacity: 1;
}

.add-player-form {
    display: flex;
    gap: 0.5rem;
}

.add-player-form .input {
    flex: 1;
}

/* ============================================
   ROUNDS SELECTOR
   ============================================ */
.rounds-section {
    margin-bottom: 1.5rem;
}

.rounds-selector {
    display: flex;
    gap: 0.5rem;
}

.round-btn {
    flex: 1;
    padding: 0.75rem;
    font-size: 1.125rem;
    font-weight: 700;
    background: var(--color-surface);
    border: 2px solid var(--color-surface-light);
    border-radius: var(--border-radius);
    color: var(--color-text);
    cursor: pointer;
    transition: all var(--transition-speed);
}

.round-btn.selected {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.round-btn:active {
    transform: scale(0.98);
}

/* ============================================
   HANDOFF SCREEN
   ============================================ */
.handoff-content {
    text-align: center;
}

.handoff-label {
    font-size: 1.25rem;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.handoff-name {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--color-gold);
    text-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
    margin-bottom: 0.5rem;
}

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

.handoff-hint {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-top: 1rem;
}

/* ============================================
   TIMER
   ============================================ */
.timer-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--color-surface);
    border-radius: var(--border-radius);
}

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

.timer-display {
    font-size: 2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--color-secondary);
    min-width: 80px;
}

.timer-display.warning {
    color: var(--color-warning);
}

.timer-display.danger {
    color: var(--color-error);
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ============================================
   QUESTION
   ============================================ */
.question-section {
    margin-bottom: 1rem;
}

.question-text {
    font-size: 1.125rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.4;
    padding: 0.5rem;
}

/* ============================================
   ORDER INDICATOR
   ============================================ */
.order-indicator {
    text-align: center;
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--color-text-muted);
}

.order-numbers {
    font-family: monospace;
    font-size: 1.25rem;
    letter-spacing: 0.25rem;
    color: var(--color-number);
}

/* ============================================
   OPTIONS
   ============================================ */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex: 1;
}

.option-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    min-height: 56px;
    background: var(--color-surface);
    border: 2px solid var(--color-surface-light);
    border-radius: var(--border-radius);
    color: var(--color-text);
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-speed);
    touch-action: manipulation;
}

.option-btn:active:not(.selected) {
    transform: scale(0.98);
}

.option-btn.selected {
    border-color: var(--color-primary);
    background: var(--color-surface-light);
}

.option-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-light);
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
    transition: all var(--transition-speed);
}

.option-btn.selected .option-number {
    background: var(--color-primary);
    color: var(--color-text);
}

.option-text {
    flex: 1;
}

/* ============================================
   CONFIRM BUTTON
   ============================================ */
.btn-confirm {
    margin-top: auto;
}

/* ============================================
   RESULT SCREEN
   ============================================ */
.result-icon {
    font-size: 5rem;
    line-height: 1;
}

.result-title {
    font-size: 2rem;
    font-weight: 800;
}

.result-title.correct {
    color: var(--color-success);
}

.result-title.incorrect {
    color: var(--color-error);
}

.result-time {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-secondary);
}

.correct-order-section {
    background: var(--color-surface);
    border-radius: var(--border-radius);
    padding: 1rem;
    width: 100%;
    max-width: 300px;
}

.correct-order-label {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
    text-align: left;
}

.correct-order-list {
    padding-left: 1.5rem;
    text-align: left;
}

.correct-order-list li {
    padding: 0.25rem 0;
}

/* ============================================
   FINISHED SCREEN - RANKING
   ============================================ */
.final-ranking {
    margin-bottom: 1.5rem;
}

.ranking-list {
    list-style: none;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--color-surface);
    border-radius: var(--border-radius);
    margin-bottom: 0.75rem;
}

.ranking-item.first {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), var(--color-surface));
    border: 2px solid var(--color-gold);
}

.ranking-item.second {
    border: 2px solid var(--color-silver);
}

.ranking-item.third {
    border: 2px solid var(--color-bronze);
}

.ranking-medal {
    font-size: 2rem;
    width: 50px;
    text-align: center;
    flex-shrink: 0;
}

.ranking-position {
    width: 50px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.ranking-info {
    flex: 1;
    min-width: 0;
}

.ranking-name {
    font-size: 1.125rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-stats {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.ranking-score {
    text-align: right;
}

.ranking-correct {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--color-success);
}

.ranking-time {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 100;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--color-surface);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    max-width: 360px;
    width: 100%;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
}

.modal-content h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    text-align: center;
}

.help-content {
    margin-bottom: 1.5rem;
}

.help-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.help-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.help-item p {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}

/* ============================================
   TOAST
   ============================================ */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-surface-light);
    color: var(--color-text);
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    box-shadow: var(--shadow);
    z-index: 200;
    animation: slideUp 0.3s ease;
}

.toast.hidden {
    display: none;
}

.toast.error {
    background: var(--color-error);
}

.toast.success {
    background: var(--color-success);
    color: var(--color-bg);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ============================================
   UTILITIES
   ============================================ */
.hidden {
    display: none !important;
}

/* ============================================
   TABLET+ STYLES
   ============================================ */
@media (min-width: 768px) {
    .screen {
        padding: 2rem;
    }

    .title {
        font-size: 2.25rem;
    }

    .handoff-name {
        font-size: 3rem;
    }

    .option-btn {
        padding: 1.25rem;
    }

    .modal-content {
        max-width: 420px;
        padding: 2rem;
    }
}
