/* ===== CSS RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-primary: #0F0F1A;
    --bg-card: #1B1B2F;
    --bg-elevated: #252542;
    --accent: #6C5CE7;
    --accent-glow: rgba(108, 92, 231, 0.4);
    --accent-secondary: #A29BFE;
    --text-primary: #FEFEFE;
    --text-secondary: #A0A0B0;
    --danger: #E74C3C;
    --success: #00B894;
    --warning: #FDCB6E;
    --civilian: #3498DB;
    --undercover: #E74C3C;
    --mister-white: #FDCB6E;
}

html {
    font-size: 16px;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100%;
    overflow: hidden;
    position: fixed;
    width: 100%;
    touch-action: manipulation;
}

#app {
    height: 100%;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* ===== SCREEN MANAGEMENT ===== */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 20px;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

/* ===== TYPOGRAPHY ===== */
.game-title {
    font-size: 3rem;
    font-weight: 900;
    text-align: center;
    line-height: 0.9;
    letter-spacing: -2px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 40px var(--accent-glow);
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-top: 8px;
    font-size: 1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
}

.reveal-title {
    animation: slideDown 0.6s ease;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3), 
                0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.join-card {
    margin-top: 40px;
    width: 100%;
    max-width: 400px;
    align-self: center;
}

/* ===== INPUTS ===== */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.input-group input {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--bg-elevated);
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-radius: 12px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    outline: none;
}

.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

/* ===== BUTTONS ===== */
.btn-primary, .btn-secondary {
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 60px;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #5B4BC4 100%);
    color: white;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 2px 10px var(--accent-glow);
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--bg-elevated);
    margin-top: 12px;
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.btn-icon {
    background: var(--bg-elevated);
    border: none;
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: transform 0.2s;
}

.btn-icon:active {
    transform: scale(0.9);
}

/* ===== JOIN SCREEN ===== */
.logo-container {
    margin-top: 60px;
    position: relative;
}

.logo-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    background: var(--accent);
    filter: blur(80px);
    opacity: 0.3;
    border-radius: 50%;
    animation: pulse 3s ease-in-out infinite;
}

.microphone-permission {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    padding: 30px;
    border-radius: 30px 30px 0 0;
    text-align: center;
    animation: slideUp 0.4s ease;
    z-index: 100;
}

.mic-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    animation: pulse 2s infinite;
}

/* ===== WAITING ROOM ===== */
.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-top: 20px;
}

.room-badge {
    background: var(--bg-card);
    padding: 12px 20px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
}

.room-badge .label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    letter-spacing: 2px;
}

.room-badge .code {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 4px;
    color: var(--accent);
}

.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
    overflow-y: auto;
    flex: 1;
}

.player-item {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px 8px;
    text-align: center;
    position: relative;
    animation: popIn 0.4s ease;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.player-item.ready {
    border-color: var(--success);
}

.player-item.host::after {
    content: '👑';
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 1.2rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.player-avatar {
    width: 60px;
    height: 60px;
    background: var(--bg-elevated);
    border-radius: 50%;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    position: relative;
}

.player-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ready-indicator {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 12px;
    height: 12px;
    background: var(--success);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.waiting-actions {
    padding-bottom: 20px;
}

.waiting-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== ROLE REVEAL ===== */
.role-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

.card-flip-container {
    perspective: 1000px;
    width: 280px;
    height: 380px;
    margin-bottom: 24px;
}

.card-flip {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

.card-flip.flipped {
    transform: rotateY(180deg);
}

.card-flip.revealed {
    cursor: default;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.card-front {
    background: linear-gradient(135deg, var(--accent) 0%, #5B4BC4 100%);
    border: 3px solid rgba(255, 255, 255, 0.1);
}

.card-pattern {
    width: 100%;
    height: 100%;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.05) 10px,
        rgba(255, 255, 255, 0.05) 20px
    );
    position: absolute;
    border-radius: 24px;
}

.tap-hint {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    z-index: 1;
    animation: pulse 2s infinite;
    margin-top: 20px;
}

.card-back {
    background: var(--bg-card);
    transform: rotateY(180deg);
    padding: 30px;
    text-align: center;
    border: 3px solid var(--accent);
}

.role-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

.role-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.role-title.civilian { color: var(--civilian); }
.role-title.undercover { color: var(--undercover); }
.role-title.mister-white { color: var(--mister-white); }

.role-word-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.role-word {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    margin: 8px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.role-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-top: 16px;
    padding: 0 10px;
}

.challenge-card {
    background: linear-gradient(135deg, rgba(253, 203, 110, 0.1) 0%, rgba(253, 203, 110, 0.05) 100%);
    border: 2px solid var(--warning);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    animation: slideUp 0.5s ease;
    max-width: 320px;
    width: 100%;
}

.challenge-header {
    color: var(--warning);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.challenge-text {
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.4;
}

.ready-btn {
    margin-top: auto;
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s ease 0.3s forwards;
}

/* ===== VOICE ROUND ===== */
.round-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 20px;
    margin-bottom: 20px;
}

.round-number {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.current-speaker {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.speaker-avatar {
    width: 120px;
    height: 120px;
    background: var(--bg-card);
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 4px solid var(--accent);
    box-shadow: 0 0 40px var(--accent-glow);
    animation: speakerPulse 2s ease-in-out infinite;
}

.speaker-avatar.muted {
    border-color: var(--bg-elevated);
    box-shadow: none;
    animation: none;
    opacity: 0.6;
}

.speaking-waves {
    position: absolute;
    display: flex;
    gap: 4px;
    align-items: center;
    height: 40px;
}

.speaking-waves span {
    width: 4px;
    background: var(--accent);
    border-radius: 2px;
    animation: wave 1s ease-in-out infinite;
}

.speaking-waves span:nth-child(1) { height: 20%; animation-delay: 0s; }
.speaking-waves span:nth-child(2) { height: 60%; animation-delay: 0.1s; }
.speaking-waves span:nth-child(3) { height: 40%; animation-delay: 0.2s; }

.avatar-text {
    font-size: 3rem;
    z-index: 1;
}

.speaker-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.speaker-status {
    color: var(--text-secondary);
    font-size: 1rem;
}

.speaker-status.speaking {
    color: var(--accent);
    font-weight: 600;
}

.audio-visualizer {
    height: 60px;
    margin-bottom: 20px;
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
}

#audio-canvas {
    width: 100%;
    height: 100%;
}

.reaction-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 30px;
    padding: 0 20px;
}

.reaction-btn {
    background: var(--bg-card);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.reaction-btn:active {
    transform: scale(0.9);
}

.reaction-btn:hover {
    background: var(--bg-elevated);
    transform: translateY(-2px);
}

.speaking-order {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 0 20px;
}

.order-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-elevated);
    transition: all 0.3s;
}

.order-dot.current {
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
    transform: scale(1.3);
}

.order-dot.completed {
    background: var(--success);
}

.order-dot.self {
    border: 2px solid var(--warning);
}

.floating-reactions {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1000;
}

.floating-emoji {
    position: absolute;
    font-size: 2rem;
    animation: floatUp 3s ease-out forwards;
    pointer-events: none;
}

/* ===== VOTING ===== */
.voting-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.voting-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

.vote-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

.vote-card:active {
    transform: scale(0.95);
}

.vote-card.selected {
    border-color: var(--accent);
    background: var(--bg-elevated);
    box-shadow: 0 0 20px var(--accent-glow);
}

.vote-card.eliminated {
    opacity: 0.4;
    pointer-events: none;
}

.vote-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, var(--accent-glow) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.vote-card:hover::before {
    opacity: 1;
}

.vote-avatar {
    width: 80px;
    height: 80px;
    background: var(--bg-elevated);
    border-radius: 50%;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.vote-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.vote-timer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--bg-card);
}

.vote-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    width: 100%;
    transition: width 0.1s linear;
}

/* ===== VOTE REVEAL ===== */
.vote-reveal-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

.vote-reveal-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    animation: slideInRight 0.5s ease;
    opacity: 0;
    transform: translateX(-50px);
    animation-fill-mode: forwards;
}

.vote-reveal-card:nth-child(1) { animation-delay: 0.2s; }
.vote-reveal-card:nth-child(2) { animation-delay: 0.4s; }
.vote-reveal-card:nth-child(3) { animation-delay: 0.6s; }
.vote-reveal-card:nth-child(4) { animation-delay: 0.8s; }
.vote-reveal-card:nth-child(5) { animation-delay: 1s; }
.vote-reveal-card:nth-child(6) { animation-delay: 1.2s; }
.vote-reveal-card:nth-child(7) { animation-delay: 1.4s; }
.vote-reveal-card:nth-child(8) { animation-delay: 1.6s; }

.voter-avatar {
    width: 50px;
    height: 50px;
    background: var(--bg-elevated);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.voter-info {
    flex: 1;
}

.voter-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.voted-for {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.vote-arrow {
    color: var(--accent);
    font-size: 1.5rem;
}

.vs-divider {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
    margin: 20px 0;
    animation: pulse 1s infinite;
}

.finalists {
    display: flex;
    justify-content: center;
    gap: 30px;
}

/* ===== ELIMINATION ===== */
.elimination-animation {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.spotlight {
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(108, 92, 231, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.eliminated-card {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    position: relative;
    z-index: 1;
    border: 3px solid var(--accent);
    box-shadow: 0 0 60px var(--accent-glow);
    animation: cardAppear 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    animation: rotate 4s linear infinite;
    z-index: -1;
}

.eliminated-name {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.eliminated-role {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 20px;
}

.role-reveal-icon {
    font-size: 5rem;
    animation: bounce 1s infinite;
}

.elimination-result {
    text-align: center;
    padding: 20px;
}

.result-text {
    font-size: 1.3rem;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* ===== SCOREBOARD ===== */
.podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 16px;
    margin: 30px 0;
    height: 200px;
}

.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: popIn 0.5s ease;
}

.podium-block {
    width: 80px;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--bg-primary);
    position: relative;
}

.podium-1 .podium-block {
    height: 140px;
    background: linear-gradient(180deg, #FFD700 0%, #FFA500 100%);
    width: 100px;
}

.podium-2 .podium-block {
    height: 100px;
    background: linear-gradient(180deg, #C0C0C0 0%, #808080 100%);
}

.podium-3 .podium-block {
    height: 80px;
    background: linear-gradient(180deg, #CD7F32 0%, #8B4513 100%);
}

.podium-avatar {
    width: 60px;
    height: 60px;
    background: var(--bg-card);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 8px;
    border: 3px solid;
}

.podium-1 .podium-avatar { border-color: #FFD700; }
.podium-2 .podium-avatar { border-color: #C0C0C0; }
.podium-3 .podium-avatar { border-color: #CD7F32; }

.podium-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 8px;
    text-align: center;
}

.podium-points {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--accent);
}

.scores-list {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    flex: 1;
    overflow-y: auto;
}

.score-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--bg-elevated);
    animation: slideInLeft 0.4s ease;
}

.score-item:last-child {
    border-bottom: none;
}

.score-rank {
    width: 30px;
    font-weight: 800;
    color: var(--text-secondary);
}

.score-avatar {
    width: 40px;
    height: 40px;
    background: var(--bg-elevated);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 12px;
    font-size: 1.2rem;
}

.score-name {
    flex: 1;
    font-weight: 600;
}

.score-value {
    font-weight: 800;
    color: var(--accent);
    font-size: 1.1rem;
}

.game-end-actions {
    padding-bottom: 20px;
}

/* ===== SPECTATOR MODE ===== */
.spectator-overlay {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid var(--text-secondary);
    border-radius: 50px;
    padding: 12px 24px;
    z-index: 1000;
    text-align: center;
}

.spectator-badge {
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

/* ===== ANIMATIONS ===== */
@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideInRight {
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    80% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes floatUp {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-100vh) scale(1.5); opacity: 0; }
}

@keyframes wave {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1); }
}

@keyframes speakerPulse {
    0%, 100% { box-shadow: 0 0 40px var(--accent-glow); }
    50% { box-shadow: 0 0 60px var(--accent-glow), 0 0 80px var(--accent-glow); }
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes cardAppear {
    0% { transform: scale(0) rotateY(180deg); opacity: 0; }
    100% { transform: scale(1) rotateY(0); opacity: 1; }
}

/* ===== BUTTON FINISH SPEAK ===== */
.btn-finish-speak {
    margin-top: 30px;
    padding: 18px 40px;
    background: linear-gradient(135deg, var(--success) 0%, #00A085 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 184, 148, 0.3);
    min-height: 60px;
    width: 100%;
    max-width: 300px;
}

.btn-finish-speak:active {
    transform: scale(0.98);
    box-shadow: 0 2px 10px rgba(0, 184, 148, 0.3);
}

/* ===== VOTING DISCUSSION MODE ===== */
.voting-discussion-mode {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(108, 92, 231, 0.1);
    border-radius: 12px;
    border: 2px solid var(--accent);
}

.discussion-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.95rem;
}

.mic-icon-small {
    font-size: 1.2rem;
    animation: pulse 2s infinite;
}

.vote-status-info {
    text-align: center;
    padding: 15px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 20px;
}

/* ===== RESPONSIVE MOBILE IMPROVEMENTS ===== */
@media (max-width: 480px) {
    .screen {
        padding: 15px;
    }
    
    .game-title {
        font-size: 2.2rem;
        line-height: 1;
    }
    
    .subtitle {
        font-size: 0.85rem;
        margin-top: 5px;
    }
    
    .card {
        padding: 20px;
        border-radius: 16px;
    }
    
    .join-card {
        margin-top: 30px;
    }
    
    .input-group input {
        padding: 14px;
        font-size: 1rem;
    }
    
    .btn-primary, .btn-secondary {
        padding: 16px;
        font-size: 0.95rem;
        min-height: 56px;
    }
    
    .room-header {
        margin-bottom: 20px;
        padding-top: 10px;
    }
    
    .room-badge {
        padding: 10px 16px;
    }
    
    .room-badge .code {
        font-size: 1.3rem;
        letter-spacing: 3px;
    }
    
    .players-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 10px;
    }
    
    .player-item {
        padding: 12px 6px;
    }
    
    .player-avatar {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .player-name {
        font-size: 0.8rem;
    }
    
    .card-flip-container {
        width: 260px;
        height: 360px;
    }
    
    .role-icon {
        font-size: 3.5rem;
    }
    
    .role-title {
        font-size: 1.3rem;
    }
    
    .role-word {
        font-size: 1.8rem;
    }
    
    .round-header {
        margin-bottom: 20px;
        padding-top: 10px;
    }
    
    .round-number {
        font-size: 1rem;
    }
    
    .current-speaker {
        margin-bottom: 20px;
    }
    
    .speaker-avatar {
        width: 100px;
        height: 100px;
        font-size: 2.5rem;
        margin-bottom: 15px;
    }
    
    .speaker-name {
        font-size: 1.3rem;
        margin-bottom: 6px;
    }
    
    .speaker-status {
        font-size: 0.9rem;
    }
    
    .btn-finish-speak {
        margin-top: 25px;
        padding: 16px 30px;
        font-size: 1rem;
        max-width: 100%;
    }
    
    .reaction-bar {
        gap: 8px;
        margin-bottom: 20px;
        padding: 0 10px;
    }
    
    .reaction-btn {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
    
    .voting-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .vote-card {
        padding: 16px;
        border-radius: 16px;
    }
    
    .vote-avatar {
        width: 70px;
        height: 70px;
        font-size: 2rem;
        margin-bottom: 10px;
    }
    
    .vote-name {
        font-size: 1rem;
    }
    
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 6px;
    }
    
    .voting-subtitle {
        font-size: 0.85rem;
        margin-bottom: 15px;
    }
    
    .voting-discussion-mode {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .discussion-indicator {
        font-size: 0.85rem;
        gap: 8px;
    }
    
    .vote-reveal-card {
        padding: 14px 16px;
    }
    
    .voter-avatar {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
    
    .eliminated-card {
        padding: 30px 20px;
    }
    
    .eliminated-name {
        font-size: 1.5rem;
    }
    
    .role-reveal-icon {
        font-size: 4rem;
    }
    
    .podium {
        height: 160px;
        gap: 12px;
        margin: 20px 0;
    }
    
    .podium-block {
        width: 70px;
    }
    
    .podium-1 .podium-block {
        height: 120px;
        width: 85px;
    }
    
    .podium-2 .podium-block {
        height: 85px;
    }
    
    .podium-3 .podium-block {
        height: 70px;
    }
    
    .podium-avatar {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .scores-list {
        padding: 15px;
    }
    
    .score-item {
        padding: 10px;
    }
    
    .score-avatar {
        width: 35px;
        height: 35px;
        font-size: 1rem;
        margin: 0 10px;
    }
    
    .score-name {
        font-size: 0.9rem;
    }
    
    .score-value {
        font-size: 1rem;
    }
}

@media (min-width: 768px) {
    .game-title {
        font-size: 4rem;
    }
    
    .players-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .voting-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===== UTILITY ===== */
.hidden {
    display: none !important;
}

.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ===== INTERROGATION SYSTEM ===== */
.interrogation-section {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 20px;
    margin: 20px 0;
    border: 2px solid var(--accent);
    box-shadow: 0 0 30px var(--accent-glow);
}

.interrogation-header {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.targets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.target-card {
    background: var(--bg-elevated);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid var(--bg-card);
    position: relative;
    overflow: hidden;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.target-card:not(.disabled):hover {
    background: var(--bg-card);
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 8px 20px var(--accent-glow);
}

.target-card:not(.disabled):active {
    transform: scale(0.95);
}

.target-card.selected {
    border-color: var(--success);
    background: var(--bg-card);
    box-shadow: 0 0 20px rgba(0, 184, 148, 0.4);
}

.target-card.disabled {
    opacity: 0.4;
    pointer-events: none;
    border-color: var(--danger);
}

.target-avatar {
    width: 60px;
    height: 60px;
    background: var(--bg-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 8px;
    border: 2px solid var(--bg-card);
}

.target-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Go to Vote Button */
.btn-vote {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
    color: var(--bg-primary);
    border: none;
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 20px var(--accent-glow);
    align-self: center;
    margin-top: 16px;
}

.btn-vote:active {
    transform: scale(0.95);
}

.btn-vote:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive adjustments for interrogation */
@media (min-width: 768px) {
    .targets-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .interrogation-section {
        max-height: 400px;
    }
}