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

html {
    height: 100%;
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 200% 200%;
    animation: gradientShift 15s ease infinite;
    color: #fff;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    height: 100%;
    overflow: auto;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.screen {
    display: none;
}

#setupScreen {
    min-height: 100vh;
    padding-bottom: 40px;
}

#gameScreen {
    height: 100vh;
    overflow: hidden;
}

.screen.active {
    display: block;
}

/* Setup Screen */
.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 30px 20px;
}

h1 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 3em;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, #e0e7ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 4px 20px rgba(255, 255, 255, 0.3);
    letter-spacing: -1px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 0.95em;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.form-group input, .form-group select {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.form-group input:focus, .form-group select:focus {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.form-group select {
    cursor: pointer;
}

.form-group select option {
    background: #764ba2;
    color: white;
}

.player-config {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 24px;
    border-radius: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.player-config:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.player-config h3 {
    margin-bottom: 18px;
    color: #fff;
    font-size: 1.2em;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.player-config .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.player-config .form-row.full {
    grid-template-columns: 1fr;
}

/* Buttons */
.btn {
    padding: 18px 36px;
    font-size: 18px;
    font-weight: 700;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
    color: #764ba2;
    font-weight: 800;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-secondary {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    margin-top: 12px;
}

.btn-secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(238, 90, 111, 0.4);
}

.btn-small {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 700;
    width: auto;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: #764ba2;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

/* Game Screen */
.game-header {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.players-area {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.player-button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border: none;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    font-size: 1.2em;
    padding: 30px;
    overflow: hidden;
}

.player-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.15), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.player-button:hover::before {
    opacity: 1;
}

.player-button:active {
    transform: scale(0.98);
}

.player-button.inactive {
    opacity: 0.45;
    filter: saturate(0.6);
}

.player-button.active {
    animation: modernPulse 2s ease-in-out infinite;
    box-shadow: inset 0 0 60px rgba(255, 255, 255, 0.2);
}

.player-button.finished {
    opacity: 0.25;
    cursor: not-allowed;
    filter: grayscale(0.8);
}

@keyframes modernPulse {
    0%, 100% {
        box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.15);
    }
    50% {
        box-shadow: inset 0 0 80px rgba(255, 255, 255, 0.35);
    }
}

.player-name {
    font-size: 1.8em;
    font-weight: 800;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    opacity: 0.95;
}

.player-time {
    font-size: 5em;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    margin-bottom: 15px;
    text-shadow: 0 6px 30px rgba(0, 0, 0, 0.5);
    letter-spacing: -2px;
}

.player-increment {
    font-size: 1em;
    opacity: 0.75;
    font-weight: 600;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.time-warning {
    animation: modernBlink 1.5s ease-in-out infinite;
}

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 40px;
    border-radius: 24px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    margin-bottom: 30px;
    color: #fff;
    font-size: 2em;
    font-weight: 800;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 15px rgba(0, 0, 0, 0.2);
}

/* Responsive Design */
@media (max-width: 600px) {
    .player-time {
        font-size: 3.5em;
    }
    
    .player-name {
        font-size: 1.3em;
    }
    
    h1 {
        font-size: 2.2em;
    }
}

@media (min-width: 768px) and (orientation: landscape) {
    .players-area {
        flex-direction: row;
    }
    
    .player-button:nth-child(odd) {
        transform: rotate(180deg);
    }
}

/* Color themes for players - Modern vibrant gradients */
.player-red { 
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 50%, #c44569 100%);
    color: white;
}

.player-blue { 
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 50%, #667eea 100%);
    color: white;
}

.player-green { 
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 50%, #0ba360 100%);
    color: white;
}

.player-orange { 
    background: linear-gradient(135deg, #fa709a 0%, #fee140 50%, #ff8008 100%);
    color: white;
}

.player-purple { 
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 50%, #c471ed 100%);
    color: white;
}

.player-yellow { 
    background: linear-gradient(135deg, #f6d365 0%, #fda085 50%, #fbc531 100%);
    color: #2d3436;
}
