* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #eee;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #00d4ff;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.tagline {
    font-size: 1.1rem;
    color: #aaa;
}

.settings-bar {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.settings-bar label {
    color: #ccc;
    font-weight: 600;
}

.settings-bar select {
    padding: 8px 15px;
    background: #2a2a3e;
    border: 2px solid #444;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.settings-bar select:hover {
    border-color: #00d4ff;
}

.win-points-buttons {
    display: flex;
    gap: 10px;
}

.btn-win-points {
    padding: 10px 20px;
    background: #2a2a3e;
    color: #fff;
    border: 2px solid #444;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-win-points:hover {
    border-color: #00d4ff;
    background: #353550;
}

.btn-win-points.active {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    border-color: #00d4ff;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
}

.setup-section {
    margin-bottom: 20px;
}

.btn-start {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    margin-top: 20px;
}

.player-management {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
}

.player-management h2 {
    color: #00d4ff;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.add-player-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.add-player-form input {
    flex: 1;
    padding: 12px 15px;
    background: #2a2a3e;
    border: 2px solid #444;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s;
}

.add-player-form input:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.player-name-input {
    flex: 1;
    min-width: 0; /* Allow input to shrink below its default minimum size */
    padding: 10px 15px; /* Slightly less padding to fit in list item */
    background: #2a2a3e;
    border: 2px solid #444;
    border-radius: 8px;
    color: #fff;
    font-size: 1.1rem; /* Slightly larger than normal input to match player name span */
    font-weight: 600; /* Match player name span */
    transition: all 0.3s;
    margin-right: 15px; /* To give space to score */
}

.player-name-input:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.player-list {
    list-style: none;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #2a2a3e;
    border: 2px solid transparent;
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: move;
    transition: all 0.3s;
}

.player-item:hover {
    background: #353550;
    border-color: #00d4ff;
}

.player-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.drag-handle {
    font-size: 1.2rem;
    color: #666;
    cursor: grab;
}

.drag-handle:active {
    cursor: grabbing;
}

.player-name {
    flex: 1;
    font-weight: 600;
    font-size: 1.1rem;
}

.player-score {
    color: #00d4ff;
    font-weight: bold;
    font-size: 1.1rem;
    min-width: 50px;
    text-align: right;
}

#setupSection .player-score {
    display: none;
}

.btn-remove {
    background: #ff4444;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
}

.btn-remove:hover {
    background: #ff6666;
    transform: scale(1.1);
}

.btn-primary {
    padding: 12px 25px;
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 212, 255, 0.4);
}

.btn-danger {
    padding: 8px 15px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-left: auto;
}

.btn-warning {
    padding: 8px 15px;
    background: #ffae44;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-left: auto;
}

.btn-danger:hover {
    background: #ff6666;
}

.game-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
}

.game-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.game-controls .btn-large {
    flex: 1;
    margin-bottom: 0;
}

.game-controls .btn-danger {
    flex: 0 0 auto;
}

.btn-large {
    width: 100%;
    padding: 20px;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.btn-large:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(106, 17, 203, 0.5);
}

.question-card {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.3);
}

.question-card p {
    font-size: 1.8rem;
    font-weight: bold;
    line-height: 1.4;
}

.scoring-section h3 {
    color: #00d4ff;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.scoring-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.scoring-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: #2a2a3e;
    border: 2px solid transparent;
    border-radius: 10px;
    transition: all 0.3s;
}

.scoring-item.matchpoint {
    border-color: #ffd700;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 193, 7, 0.1) 100%);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
    }
}

.scoring-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.scoring-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.scoring-points {
    font-size: 1.3rem;
    font-weight: bold;
    color: #00d4ff;
    min-width: 40px;
    text-align: center;
}

.btn-score {
    width: 45px;
    height: 45px;
    border: none;
    border-radius: 10px;
    font-size: 1.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    color: white;
}

.btn-plus {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.btn-plus:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(56, 239, 125, 0.4);
}

.btn-minus {
    background: linear-gradient(135deg, #ee0979 0%, #ff6a00 100%);
}

.btn-minus:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(238, 9, 121, 0.4);
}

.hidden {
    display: none !important;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 90%;
    animation: scaleIn 0.3s;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
    }
    to {
        transform: scale(1);
    }
}

.modal-content h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.modal-content p {
    font-size: 1.5rem;
    margin-bottom: 30px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .tagline {
        font-size: 0.9rem;
    }
    
    .question-card p {
        font-size: 1.4rem;
    }
    
    .btn-large {
        font-size: 1.2rem;
        padding: 15px;
    }
    
    .scoring-item {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .scoring-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .btn-score {
        width: 50px;
        height: 50px;
    }
    
    .modal-content {
        padding: 30px 20px;
    }
    
    .modal-content h2 {
        font-size: 2rem;
    }
    
    .modal-content p {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 0;
    }
    
    .player-management,
    .game-section {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .add-player-form {
        flex-direction: column;
    }

    .add-player-form input {
        width: 100%;
        text-align: center;
    }
    
    .add-player-form button {
        width: 100%;
    }

    .player-item {
        position: relative;
        flex-wrap: wrap;
        gap: 10px;
        padding-right: 45px;
    }
    
    .player-name {
        flex-basis: 100%; /* Take full width on its own line */
    }

    .player-score {
        flex-grow: 1; /* Take available space */
        text-align: left; /* Align to the left now */
    }

    .btn-remove {
        position: absolute;
        right: 5px;
        top: 50%;
        transform: translateY(-50%);
    }
}
.btn-back {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-secondary {
    padding: 10px 20px;
    background: #4a4a5e;
    color: #fff;
    border: 2px solid #666;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-left: auto;
}

.btn-secondary:hover {
    border-color: #00d4ff;
    background: #555570;
}

.modal-content {
    position: relative;
}

#rulesModal .modal-content {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    text-align: left;
    max-width: 500px;
}

#rulesModal .modal-content h2 {
    text-align: center;
}

#rulesModal .modal-content p {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 15px;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    font-weight: bold;
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s;
}

.modal-close:hover {
    transform: scale(1.2);
}

@media (max-width: 768px) {
    .btn-back {
        top: 10px;
        left: 10px;
    }
    header {
        position: relative;
        padding-top: 50px;
    }
}

@media (max-width: 480px) {
    .settings-bar {
        justify-content: center;
    }
    .btn-secondary {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
    }
}