/* Charadas - Mobile-first styles */

:root {
    --color-primary: #6C5CE7;
    --color-primary-dark: #5B4CD4;
    --color-secondary: #A29BFE;
    --color-success: #00B894;
    --color-success-dark: #00A382;
    --color-warning: #FDCB6E;
    --color-danger: #E17055;
    --color-danger-dark: #D35845;
    --color-bg: #1A1A2E;
    --color-bg-light: #16213E;
    --color-card: #0F3460;
    --color-text: #FFFFFF;
    --color-text-muted: #A0A0A0;

    --transition-speed: 0.2s;
    --border-radius: 12px;
    --border-radius-large: 20px;
}

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

html, body {
    height: 100%;
    height: 100dvh;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Screens */
.screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20px;
    overflow-y: auto;
}

.screen.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.screen-content {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

.screen-content.centered {
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 100%;
}

/* Typography */
.title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}

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

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 20px;
    color: var(--color-secondary);
}

/* Setup Screen */
.setup-section {
    margin-bottom: 20px;
}

.label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--color-text-muted);
}

.input, .select {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    border: 2px solid var(--color-card);
    border-radius: var(--border-radius);
    background: var(--color-bg-light);
    color: var(--color-text);
    transition: border-color var(--transition-speed);
}

.input:focus, .select:focus {
    outline: none;
    border-color: var(--color-primary);
}

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

.select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23A0A0A0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 44px;
}

/* Checkbox */
.checkbox-section {
    margin-top: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 1rem;
}

.checkbox-label input {
    display: none;
}

.checkbox-custom {
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-card);
    border-radius: 6px;
    background: var(--color-bg-light);
    position: relative;
    transition: all var(--transition-speed);
}

.checkbox-label input:checked + .checkbox-custom {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.checkbox-custom::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 7px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity var(--transition-speed);
}

.checkbox-label input:checked + .checkbox-custom::after {
    opacity: 1;
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-speed);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
}

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

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

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

.btn-secondary {
    background: transparent;
    color: var(--color-text-muted);
    border: 2px solid var(--color-card);
}

.btn-secondary:active {
    background: var(--color-card);
}

.btn-success {
    background: var(--color-success);
    color: white;
}

.btn-success:active {
    background: var(--color-success-dark);
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-danger:active {
    background: var(--color-danger-dark);
}

.btn-large {
    padding: 18px 32px;
    font-size: 1.125rem;
    border-radius: var(--border-radius-large);
    margin-top: 24px;
}

.btn-icon {
    font-size: 1.25rem;
}

/* Header Info */
.header-info {
    text-align: center;
    padding: 16px;
    background: var(--color-bg-light);
    border-radius: var(--border-radius);
    margin-bottom: 24px;
}

.turn-indicator {
    font-size: 1rem;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.turn-indicator span {
    color: var(--color-primary);
    font-weight: 600;
}

.score-display {
    font-size: 1.75rem;
    font-weight: 700;
}

.score {
    color: var(--color-text);
}

.score-separator {
    color: var(--color-text-muted);
    margin: 0 12px;
}

/* Category Grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.btn-category {
    flex-direction: column;
    padding: 20px 16px;
    background: var(--color-card);
    border-radius: var(--border-radius);
}

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

.category-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.category-name {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Ready Screen */
.ready-icon {
    font-size: 5rem;
    margin-bottom: 16px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.ready-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.ready-subtitle {
    font-size: 1rem;
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

.ready-category {
    font-size: 1rem;
    color: var(--color-secondary);
    margin-bottom: 8px;
}

#btn-back-category {
    margin-top: 12px;
}

/* Playing Screen */
#screen-playing .screen-content {
    justify-content: space-between;
    min-height: 100%;
    padding-top: 20px;
    padding-bottom: 20px;
}

.timer-display {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    padding: 16px;
    background: var(--color-bg-light);
    border-radius: var(--border-radius);
    transition: all 0.3s;
}

.timer-display.hidden {
    opacity: 0.3;
}

.timer-display.warning {
    background: var(--color-warning);
    color: var(--color-bg);
    animation: timerPulse 1s infinite;
}

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

@keyframes timerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.timer-icon {
    margin-right: 8px;
}

.timer-unit {
    font-size: 1.5rem;
    color: var(--color-text-muted);
}

.timer-display.warning .timer-unit,
.timer-display.danger .timer-unit {
    color: inherit;
}

/* Word Container */
.word-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
}

.word-category {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    color: var(--color-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.word-card {
    width: 100%;
    padding: 32px 20px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-card) 100%);
    border-radius: var(--border-radius-large);
    text-align: center;
    box-shadow: 0 8px 32px rgba(108, 92, 231, 0.3);
}

#current-word {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.3;
    word-break: break-word;
}

/* Action Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.action-buttons .btn {
    flex-direction: column;
    padding: 20px 16px;
    font-size: 0.875rem;
}

.action-buttons .btn-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

/* Results Screen */
.results-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 32px;
}

.results-scores {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
}

.result-team {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-team-name {
    font-size: 1rem;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.result-score {
    font-size: 3rem;
    font-weight: 700;
}

.result-vs {
    font-size: 1.25rem;
    color: var(--color-text-muted);
    font-weight: 600;
}

.winner-announcement {
    font-size: 1.25rem;
    color: var(--color-success);
    font-weight: 600;
    margin-bottom: 16px;
    min-height: 30px;
}

#btn-new-game {
    margin-top: 12px;
}

/* Responsive */
@media (min-width: 768px) {
    .title {
        font-size: 3rem;
    }

    .word-card {
        padding: 48px 32px;
    }

    #current-word {
        font-size: 2.5rem;
    }

    .category-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Prevent text selection during game */
#screen-playing {
    user-select: none;
    -webkit-user-select: none;
}

/* Smooth scrolling */
.screen {
    scroll-behavior: smooth;
}

/* Focus styles for accessibility */
.btn:focus-visible,
.input:focus-visible,
.select:focus-visible {
    outline: 2px solid var(--color-secondary);
    outline-offset: 2px;
}
