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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: #f2f2f7;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 24px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
    max-width: 420px;
    width: 100%;
    overflow: hidden;
}

/* Header */
.header {
    background: white;
    color: #1c1c1e;
    padding: 48px 24px 32px;
    text-align: center;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.05);
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: -1px;
}

.header h1:first-child {
    font-size: 2.2em;
    margin-bottom: 12px;
    font-weight: 400;
}

.header p {
    font-size: 1.05em;
    color: #8e8e93;
    font-weight: 400;
    letter-spacing: -0.2px;
}

/* Content */
.content {
    padding: 24px;
}

.section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 1.15em;
    color: #1c1c1e;
    margin-bottom: 12px;
    font-weight: 600;
    letter-spacing: -0.4px;
}

/* Card Style */
.card {
    background: #f2f2f7;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
}

/* Player Input */
.player-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

input[type="text"] {
    flex: 1;
    padding: 14px 16px;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    transition: all 0.2s ease;
    background: #f2f2f7;
    color: #1c1c1e;
}

input[type="text"]:focus {
    outline: none;
    background: #e5e5ea;
}

input[type="text"]::placeholder {
    color: #aeaeb2;
}

/* Buttons */
.btn {
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: -0.3px;
}

.btn-add {
    background: #007aff;
    color: white;
}

.btn-add:active {
    transform: scale(0.96);
    background: #0051d5;
}

/* Players List */
.players-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f2f2f7;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.player-item:active {
    background: #e5e5ea;
}

.player-name {
    font-size: 1.05em;
    font-weight: 500;
    color: #1c1c1e;
    letter-spacing: -0.3px;
}

.btn-remove {
    background: transparent;
    color: #ff3b30;
    padding: 8px 16px;
    font-size: 0.9em;
    font-weight: 600;
}

.btn-remove:active {
    background: rgba(255, 59, 48, 0.1);
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #aeaeb2;
    font-size: 1em;
    letter-spacing: -0.2px;
}

.btn-start {
    width: 100%;
    padding: 18px;
    background: #007aff;
    color: white;
    font-size: 1.1em;
    margin-top: 8px;
    font-weight: 600;
    border-radius: 14px;
    letter-spacing: -0.3px;
}

.btn-start:active {
    transform: scale(0.98);
    background: #0051d5;
}

.btn-start:disabled {
    background: #e5e5ea;
    color: #aeaeb2;
    cursor: not-allowed;
    transform: none;
}

/* Game Screens */
.game-screen {
    display: none;
}

.game-screen.active {
    display: block;
}

.setup-screen.hidden {
    display: none;
}

/* Game Header */
.game-header {
    text-align: center;
    margin-bottom: 24px;
    position: relative;
}

.settings-btn {
    position: absolute;
    right: 0;
    top: 0;
    background: #f2f2f7;
    border: none;
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 1.2em;
}

.settings-btn:active {
    background: #e5e5ea;
    transform: scale(0.95);
}

.current-player {
    font-size: 1.75em;
    color: #1c1c1e;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.8px;
}

.turn-counter {
    font-size: 0.95em;
    color: #8e8e93;
    font-weight: 500;
    letter-spacing: -0.2px;
}

/* Result Display */
.result-display {
    color: white;
    padding: 48px 32px;
    border-radius: 20px;
    text-align: center;
    margin-bottom: 24px;
    min-height: 240px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.limb-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
}

.result-limb {
    font-size: 2em;
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: -0.8px;
}

.result-color-text {
    font-size: 1.2em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

/* Gradient Colors */
.color-red {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
}

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

.color-yellow {
    background: linear-gradient(135deg, #ffd93d 0%, #feca57 100%);
    color: #1c1c1e;
}

.color-yellow .result-limb,
.color-yellow .result-color-text {
    color: #1c1c1e;
}

.color-green {
    background: linear-gradient(135deg, #6dd5b9 0%, #48bb78 100%);
}

.color-waiting {
    background: #f2f2f7;
    color: #8e8e93;
    box-shadow: none;
}

/* Challenge Banner */
.challenge-banner {
    background: linear-gradient(135deg, #ff9500 0%, #ff6b00 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 16px;
    margin-bottom: 24px;
    text-align: center;
    box-shadow: 0 4px 16px rgba(255, 149, 0, 0.3);
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.challenge-label {
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
    opacity: 0.9;
}

.challenge-text {
    font-size: 1.3em;
    font-weight: 700;
    letter-spacing: -0.4px;
}

/* Game Controls */
.game-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-spin {
    width: 100%;
    padding: 18px;
    background: #007aff;
    color: white;
    font-size: 1.15em;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.15s ease;
    letter-spacing: -0.3px;
}

.btn-spin:active {
    transform: scale(0.98);
    background: #0051d5;
}

.btn-spin:disabled {
    background: #e5e5ea;
    color: #aeaeb2;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #f2f2f7;
    padding: 14px;
    font-size: 1em;
    color: #007aff;
    font-weight: 600;
}

.btn-secondary:active {
    background: #e5e5ea;
}

/* Turn Mode Settings */
.turn-mode-section {
    background: transparent;
    padding: 0;
}

.mode-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    background: #f2f2f7;
    border-radius: 12px;
    padding: 4px;
}

.mode-btn {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    border-radius: 10px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #1c1c1e;
}

.mode-btn.active {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.mode-btn:active:not(.active) {
    background: rgba(255, 255, 255, 0.5);
}

.timer-settings {
    display: none;
    padding: 16px;
    background: #f2f2f7;
    border-radius: 12px;
}

.timer-settings.active {
    display: block;
}

.timer-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.timer-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

.timer-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.timer-btn img {
    width: 24px;
    height: 24px;
}

.timer-display {
    font-size: 2.2em;
    font-weight: 700;
    color: #1c1c1e;
    min-width: 90px;
    text-align: center;
    letter-spacing: -1px;
}

/* In-Game Timer Adjustment */
.ingame-timer-adjust {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px;
    background: #f2f2f7;
    border-radius: 12px;
    margin-bottom: 16px;
}

.ingame-timer-adjust .timer-btn {
    width: 40px;
    height: 40px;
}

.ingame-timer-adjust .timer-btn img {
    width: 20px;
    height: 20px;
}

.ingame-timer-adjust .timer-display {
    font-size: 1.5em;
    min-width: 70px;
}

/* Timer Countdown */
.timer-countdown {
    text-align: center;
    margin-bottom: 24px;
    padding: 16px;
    background: #f2f2f7;
    border-radius: 14px;
}

.countdown-text {
    font-size: 0.9em;
    color: #8e8e93;
    margin-bottom: 6px;
    font-weight: 500;
    letter-spacing: -0.2px;
}

.countdown-timer {
    font-size: 2.8em;
    font-weight: 800;
    color: #007aff;
    letter-spacing: -1.5px;
}

/* Voice Section */
.voice-section {
    background: transparent;
    padding: 0;
}

.voice-toggle-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f2f2f7;
    border-radius: 12px;
    margin-bottom: 12px;
}

.voice-label {
    font-size: 1.05em;
    font-weight: 500;
    color: #1c1c1e;
    letter-spacing: -0.3px;
}

/* iOS Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 51px;
    height: 31px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e5e5ea;
    transition: 0.3s;
    border-radius: 31px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 27px;
    width: 27px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

input:checked + .slider {
    background-color: #34c759;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.voice-controls {
    display: none;
    flex-direction: column;
    gap: 12px;
}

.voice-controls.active {
    display: flex;
}

.voice-control-row {
    padding: 16px;
    background: #f2f2f7;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.control-label {
    font-size: 1em;
    color: #1c1c1e;
    font-weight: 500;
    letter-spacing: -0.3px;
    min-width: 80px;
}

.voice-slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.voice-slider {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: #d1d1d6;
    outline: none;
    -webkit-appearance: none;
}

.voice-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.voice-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.slider-value {
    font-size: 0.95em;
    color: #8e8e93;
    min-width: 45px;
    text-align: right;
    font-weight: 500;
}

.test-voice-btn {
    width: 100%;
    padding: 14px;
    background: #f2f2f7;
    color: #007aff;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.test-voice-btn:active {
    background: #e5e5ea;
    transform: scale(0.98);
}

/* Challenge Controls */
.challenge-controls {
    display: none;
    flex-direction: column;
    gap: 0;
}

.challenge-controls.active {
    display: flex;
}

/* Settings Panel Overlay */
.settings-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.settings-overlay.active {
    display: block;
}

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

.settings-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 24px 24px 0 0;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 1001;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.12);
}

.settings-panel.active {
    transform: translateY(0);
}

.settings-header {
    padding: 24px 24px 16px;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.settings-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-title {
    font-size: 1.4em;
    font-weight: 700;
    color: #1c1c1e;
    letter-spacing: -0.6px;
}

.close-settings-btn {
    background: #f2f2f7;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2em;
    color: #8e8e93;
    transition: all 0.15s ease;
}

.close-settings-btn:active {
    background: #e5e5ea;
    transform: scale(0.95);
}

.settings-content {
    padding: 20px 24px 40px;
}

/* Spotify Controls */
.spotify-connect-btn {
    width: 100%;
    padding: 14px 20px;
    background: #1DB954;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.spotify-connect-btn:active {
    background: #1aa34a;
    transform: scale(0.98);
}

.spotify-disconnect-btn {
    width: 100%;
    padding: 14px;
    background: #f2f2f7;
    color: #ff3b30;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-top: 16px;
}

.spotify-disconnect-btn:active {
    background: #e5e5ea;
    transform: scale(0.98);
}

.playlist-search-input {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    font-size: 0.95em;
    background: #f2f2f7;
    color: #1c1c1e;
    margin-bottom: 12px;
}

.playlist-search-input:focus {
    outline: none;
    background: #e5e5ea;
}

.playlist-results {
    max-height: 300px;
    overflow-y: auto;
    border-radius: 12px;
    background: #f2f2f7;
}

.playlist-item-simple {
    display: flex;
    align-items: center;
    padding: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.playlist-item-simple:hover {
    background: #e5e5ea;
}

.playlist-cover-small {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    margin-right: 12px;
}

.playlist-info-simple {
    flex: 1;
}

.playlist-name-simple {
    font-size: 0.95em;
    font-weight: 600;
    color: #1c1c1e;
    margin-bottom: 4px;
}

.playlist-meta {
    font-size: 0.85em;
    color: #8e8e93;
}

/* Mini Music Player */
.mini-music-player {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(28, 28, 30, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 16px;
    border-radius: 16px;
    display: none;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 999;
    max-width: 90%;
}

.mini-player-info {
    flex: 1;
    min-width: 0;
}

.now-playing-track {
    font-size: 0.9em;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.now-playing-artist {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-player-controls {
    display: flex;
    gap: 8px;
}

.mini-player-btn {
    background: transparent;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.mini-player-btn:active {
    transform: scale(0.9);
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 2.2em;
    }



    .header h1:first-child {
        font-size: 2em;
    }

    .content {
        padding: 20px;
    }

    .result-limb {
        font-size: 1.7em;
    }

    .result-color-text {
        font-size: 1.1em;
    }

    .limb-icon {
        width: 48px;
        height: 48px;
    }

    .mini-music-player {
        bottom: 10px;
        padding: 10px 12px;
        max-width: 95%;
    }
}

   /* Mini Music Player (inside game screen) */
.mini-music-player {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #f2f2f7;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 0.5px solid rgba(0,0,0,0.05);
}

.mini-player-info {
    flex: 1;
    overflow: hidden;
}

.now-playing-track {
    font-size: 0.98em;
    font-weight: 600;
    color: #1c1c1e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.2px;
}

.now-playing-artist {
    font-size: 0.85em;
    color: #8e8e93;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-player-controls {
    display: flex;
    gap: 8px;
}

.mini-player-btn {
    background: white;
    border: none;
    border-radius: 10px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 1em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.12s ease;
}

.mini-player-btn:active {
    transform: scale(0.96);
}

/* Challenge Dropdown & List */
.challenge-dropdown {
    margin-top: 16px;
}

.challenge-dropdown-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f2f2f7;
    border: none;
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    font-weight: 600;
    color: #1c1c1e;
    letter-spacing: -0.2px;
}

.challenge-list-container {
    margin-top: 10px;
    background: #f8f8fb;
    border: 0.5px solid rgba(0,0,0,0.05);
    border-radius: 12px;
    overflow: hidden;
}

.challenge-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 0.5px solid rgba(0,0,0,0.05);
    background: #fff;
}

.challenge-list-item:last-child {
    border-bottom: none;
}

.challenge-list-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.challenge-icon {
    font-size: 1.1em;
}

.challenge-text {
    font-size: 0.95em;
    color: #1c1c1e;
}
