/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    padding: 1rem;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

/* Login Screen */
#loginScreen h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.login-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-form input {
    padding: 1rem;
    font-size: 1.1rem;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    text-align: center;
}

.login-form input::placeholder {
    color: #999;
}

.btn {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.btn-primary {
    background: #ffffff;
    color: #667eea;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Sync Screen */
#syncScreen h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

.sync-progress {
    width: 100%;
    text-align: center;
}

.sync-spinner {
    width: 80px;
    height: 80px;
    margin: 0 auto 2rem;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#syncStatus {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: #ffffff;
    width: 0%;
    transition: width 0.3s ease;
}

.sync-info {
    font-size: 1rem;
    opacity: 0.8;
}

/* Game Screen */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.player-name {
    font-size: 1.2rem;
    font-weight: bold;
}

.quality-indicator {
    font-size: 1.5rem;
}

.quality-indicator.excellent { color: #4ade80; }
.quality-indicator.good { color: #22c55e; }
.quality-indicator.fair { color: #facc15; }
.quality-indicator.poor { color: #ef4444; }

.score-display {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.score {
    font-size: 2rem;
    font-weight: bold;
    line-height: 1;
}

.score-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Answer Button */
.button-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
}

.answer-button {
    width: 280px;
    height: 280px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    color: white;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.answer-button:active {
    transform: scale(0.95);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
}

.answer-button:disabled {
    background: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
    opacity: 0.6;
}

.answer-button.ready {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 10px 60px rgba(16, 185, 129, 0.6);
    }
}

.answer-button.pressed {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    animation: none;
}

.button-text {
    position: relative;
    z-index: 1;
}

.button-status {
    margin-top: 1.5rem;
    font-size: 1.1rem;
    text-align: center;
    opacity: 0.9;
}

/* Press Info */
.press-info {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 0 1rem 1rem;
    backdrop-filter: blur(10px);
}

.press-info.hidden {
    display: none;
}

.press-rank {
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.rank-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.rank-value {
    display: block;
    font-size: 3rem;
    font-weight: bold;
}

.rank-value.first {
    color: #fbbf24;
}

.rank-value.second {
    color: #d1d5db;
}

.rank-value.third {
    color: #cd7f32;
}

.press-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    opacity: 0.8;
    margin-bottom: 0.25rem;
}

.stat-value {
    display: block;
    font-size: 1.3rem;
    font-weight: bold;
}

/* Connection Info */
.connection-info {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    margin: 0 1rem 1rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.info-row {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.info-label {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-bottom: 0.25rem;
}

.info-value {
    font-size: 1.1rem;
    font-weight: bold;
}

/* Status Messages */
.status-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    font-size: 1.2rem;
    text-align: center;
    z-index: 1000;
    max-width: 80%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.status-message.hidden {
    display: none;
}

.status-message.error {
    background: rgba(239, 68, 68, 0.95);
}

.status-message.success {
    background: rgba(16, 185, 129, 0.95);
}

/* Responsive Design */
@media (max-width: 400px) {
    .answer-button {
        width: 240px;
        height: 240px;
        font-size: 1.8rem;
    }
}

@media (min-width: 600px) {
    .answer-button {
        width: 320px;
        height: 320px;
        font-size: 2.2rem;
    }
}

/* Landscape Mode */
@media (orientation: landscape) and (max-height: 600px) {
    .button-container {
        padding: 1rem;
    }

    .answer-button {
        width: 200px;
        height: 200px;
        font-size: 1.6rem;
    }

    .header {
        margin-bottom: 1rem;
    }
}
