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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.container {
    width: 100%;
    max-width: 600px;
    background: white;
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    min-height: 500px;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

h1, h2 {
    text-align: center;
    margin-bottom: 24px;
    color: #333;
}

/* Кнопки */
.btn {
    padding: 14px 24px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    width: 100%;
}

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

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-secondary {
    background: #48bb78;
    color: white;
    margin-top: 12px;
}

.btn-start {
    background: #f6ad55;
    color: #2d3748;
}

.btn-back {
    background: #e53e3e;
    color: white;
    margin-top: 12px;
}

.btn-exit {
    background: #e53e3e;
    color: white;
    margin-top: 20px;
}

.role-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Админ панель */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.room-info {
    font-size: 18px;
    font-weight: bold;
    background: #edf2f7;
    padding: 10px 16px;
    border-radius: 12px;
}

.teams-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.admin-team-button {
    position: relative;
    aspect-ratio: 1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.admin-team-button.pressed {
    box-shadow: 0 0 0 4px #fff, 0 0 0 8px #ffd700, 0 4px 12px rgba(0,0,0,0.2);
    animation: pulse 0.5s ease;
}

.admin-team-button.has-order {
    opacity: 0.7;
}

.team-name {
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    word-break: break-word;
    font-size: 14px;
}

.order-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.8);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

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

.no-teams {
    text-align: center;
    padding: 40px;
    color: #a0aec0;
    font-size: 16px;
}

/* Игровая страница */
.join-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-field {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    outline: none;
    transition: border-color 0.2s;
}

.input-field:focus {
    border-color: #667eea;
}

.error-msg {
    color: #e53e3e;
    margin-top: 12px;
    text-align: center;
    font-size: 14px;
}

.game-area {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.game-info {
    position: fixed;
    top: 16px;
    left: 16px;
    right: 16px;
    background: white;
    padding: 12px 16px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    z-index: 10;
}

.game-button {
    width: 80vw;
    height: 80vw;
    max-width: 400px;
    max-height: 400px;
    border-radius: 50%;
    border: none;
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.game-button:active {
    transform: scale(0.97);
}

.game-button.active {
    animation: glow 1s infinite;
    cursor: pointer;
}

.game-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    }
    50% {
        box-shadow: 0 0 20px 10px rgba(255,215,0,0.5);
    }
}

.order-info {
    margin-top: 24px;
    font-size: 18px;
    font-weight: bold;
    background: white;
    padding: 12px 24px;
    border-radius: 40px;
    color: #4a5568;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .teams-container {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
    }
    
    .admin-team-button {
        padding: 12px;
    }
    
    .team-name {
        font-size: 12px;
    }
    
    .order-badge {
        width: 24px;
        height: 24px;
        font-size: 12px;
        top: 4px;
        right: 4px;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .teams-container {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }
    
    .team-name {
        font-size: 10px;
    }
}