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

/* Base */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    /* Disable text selection for native app feel */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.container {
    text-align: center;
    width: 90vw;
    max-width: 900px;
}

h1 {
    color: #fff;
    margin-bottom: 10px;
    font-size: 2.5rem;
}

/* Score display */
.score-display {
    color: #a0a0a0;
    margin-bottom: 25px;
    font-size: 1.3rem;
}

.score-display span {
    color: #4ade80;
    font-weight: bold;
}

/* Setup screen */
.setup-screen {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 50px;
    color: #fff;
    max-width: 600px;
    margin: 0 auto;
}

.setup-screen h2 {
    font-size: 2rem;
    margin-bottom: 35px;
}

.setting-group {
    margin-bottom: 30px;
    text-align: left;
}

.setting-group label {
    display: block;
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #c0c0c0;
}

.setting-group input[type="number"] {
    width: 100%;
    padding: 12px 15px;
    font-size: 1.2rem;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    outline: none;
}

.setting-group input[type="number"]:focus {
    background: rgba(255, 255, 255, 0.25);
}

/* Continent list */
.continent-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.continent-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.continent-item:hover {
    background: rgba(255, 255, 255, 0.2);
}

.continent-item input {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.continent-item span {
    font-size: 1rem;
}

/* Setting value display */
.setting-value {
    color: #4ade80;
    font-weight: bold;
}

.setting-hint {
    font-size: 0.85rem;
    color: #a0a0a0;
    font-weight: normal;
}

.user-country-hint {
    font-size: 0.8rem;
    color: #a0a0a0;
    font-weight: normal;
}

/* Start button - two lines */
.btn-start-label {
    font-size: 1.4rem;
    font-weight: 600;
}

.btn-start-count {
    font-size: 1rem;
    opacity: 0.9;
}

/* Version display */
.version-info {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.75rem;
    color: #555;
    text-align: center;
    cursor: pointer;
    transition: color 0.2s;
}

.version-info:hover {
    color: #888;
}

/* Single slider */
.slider-container {
    position: relative;
    padding: 10px 0;
}

.slider-touch-overlay {
    cursor: pointer;
}

.slider {
    -webkit-appearance: none;
    position: relative;
    z-index: 1;
    pointer-events: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    cursor: pointer;
    touch-action: pan-y;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4ade80, #22c55e);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(74, 222, 128, 0.5);
    border: 3px solid #fff;
    transition: transform 0.15s ease;
}

.slider::-webkit-slider-thumb:hover,
.slider::-webkit-slider-thumb:active {
    transform: scale(1.15);
}

.slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4ade80, #22c55e);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(74, 222, 128, 0.5);
    border: 3px solid #fff;
    transition: transform 0.15s ease;
}

.slider::-moz-range-thumb:hover,
.slider::-moz-range-thumb:active {
    transform: scale(1.15);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #a0a0a0;
    margin-top: 5px;
}

/* Dual range slider for difficulty */
.range-slider-container {
    position: relative;
    height: 50px;
    padding: 10px 0;
}

.range-slider-track {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
}

.range-slider-highlight {
    position: absolute;
    top: 0;
    height: 100%;
    background: linear-gradient(135deg, #4ade80, #22c55e);
    border-radius: 4px;
}

.range-slider {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    top: 10px;
    left: 0;
    width: 100%;
    height: 28px;
    background: transparent;
    pointer-events: none;
    outline: none;
    touch-action: pan-y;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4ade80, #22c55e);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(74, 222, 128, 0.5);
    border: 3px solid #fff;
    /* pointer-events handled by overlay */
    transition: transform 0.15s ease;
}

.range-slider::-webkit-slider-thumb:hover,
.range-slider::-webkit-slider-thumb:active {
    transform: scale(1.15);
}

.range-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4ade80, #22c55e);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(74, 222, 128, 0.5);
    border: 3px solid #fff;
    /* pointer-events handled by overlay */
    transition: transform 0.15s ease;
}

.range-slider::-moz-range-thumb:hover,
.range-slider::-moz-range-thumb:active {
    transform: scale(1.15);
}

.range-slider-labels {
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #a0a0a0;
}

/* Buttons */
.btn-start {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: #fff;
    border: none;
    padding: 18px 60px;
    border-radius: 35px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 8px 30px rgba(74, 222, 128, 0.4);
    margin-top: 20px;
}

.btn-start:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(74, 222, 128, 0.5);
}

.btn-start:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Pause overlay */
.pause-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.pause-dialog {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    color: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 90vw;
    width: 350px;
}

.pause-dialog h2 {
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.pause-dialog p {
    color: #a0a0a0;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.pause-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
}

.btn-resume {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: #fff;
    border: none;
    padding: 16px 40px;
    font-size: 1.2rem;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 8px 30px rgba(74, 222, 128, 0.4);
}

.btn-resume:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(74, 222, 128, 0.5);
}

.btn-new-game {
    background: transparent;
    color: #a0a0a0;
    border: 2px solid #a0a0a0;
    padding: 14px 40px;
    font-size: 1.1rem;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-new-game:hover {
    color: #fff;
    border-color: #fff;
}

/* Card flip */
.card-container {
    perspective: 2000px;
    margin: 25px auto;
    width: 100%;
    max-width: 800px;
    height: 50vh;
    min-height: 300px;
    max-height: 500px;
}

.card {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.card.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    cursor: pointer;
}

.card-front {
    background: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 25px;
}

.card-front:hover,
.card-back:hover {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.card-back {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 50px 40px;
    color: #fff;
}

/* Flag wrapper */
.flag-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
}

.flag-wrapper > div {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.flag-wrapper svg {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    border: 1px solid #000;
}

.flag-loading {
    color: #999;
    font-size: 1.2rem;
}

/* Country info */
.country-name {
    font-size: 2.8rem;
    font-weight: bold;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    line-height: 1.2;
}

.country-info {
    font-size: 1.5rem;
    opacity: 0.95;
    margin: 10px 0;
}

.country-info strong {
    color: #ffd700;
}

.flip-hint {
    margin-top: 25px;
    font-size: 0.95rem;
    opacity: 0.7;
}

/* Progress bar */
.progress-container {
    width: 100%;
    max-width: 800px;
    margin: 25px auto;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    overflow: hidden;
    height: 16px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4ade80, #22c55e);
    transition: width 0.1s linear;
    border-radius: 12px;
}

.progress-bar.warning {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.progress-bar.danger {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

/* Hint */
.hint {
    color: #888;
    font-size: 1.1rem;
    margin-top: 18px;
}

/* Answer buttons */
.buttons {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-top: 35px;
}

.btn {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 3rem;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn:hover {
    transform: scale(1.15);
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-correct {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    box-shadow: 0 8px 30px rgba(74, 222, 128, 0.5);
}

.btn-wrong {
    background: linear-gradient(135deg, #f87171, #ef4444);
    box-shadow: 0 8px 30px rgba(248, 113, 113, 0.5);
}

/* Results screen */
.results {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 60px 50px;
    color: #fff;
}

.results h2 {
    font-size: 2.5rem;
    margin-bottom: 30px;
}

.final-score {
    font-size: 6rem;
    font-weight: bold;
    color: #4ade80;
    margin: 30px 0;
}

.final-score span {
    color: #a0a0a0;
    font-size: 3rem;
}

.score-message {
    font-size: 1.5rem;
    color: #c0c0c0;
    margin-bottom: 40px;
}

.btn-new-game {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    padding: 20px 60px;
    font-size: 1.4rem;
    border-radius: 35px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.5);
}

.btn-new-game:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.6);
}

/* Loading & Error */
.loading {
    color: #fff;
    font-size: 1.8rem;
}

.error {
    color: #f87171;
    font-size: 1.1rem;
    padding: 20px;
    background: rgba(248, 113, 113, 0.1);
    border-radius: 10px;
    margin-top: 20px;
}

.error code {
    display: block;
    margin-top: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    font-family: monospace;
}

/* Game Type Selection */
.game-type-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.game-type-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.game-type-item:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.15);
}

.game-type-item.selected {
    background: rgba(74, 222, 128, 0.2);
    border-color: #4ade80;
}

.game-type-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.game-type-icon {
    font-size: 2rem;
    margin-right: 15px;
    min-width: 40px;
    text-align: center;
}

.game-type-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.game-type-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.game-type-desc {
    font-size: 0.9rem;
    color: #a0a0a0;
}

.coming-soon {
    font-size: 0.7rem;
    font-weight: normal;
    background: #667eea;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

/* Quiz Options */
.quiz-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.quiz-option {
    padding: 20px;
    font-size: 1.1rem;
    font-weight: 500;
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quiz-option:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.quiz-option:disabled {
    cursor: not-allowed;
}

.quiz-option.selected {
    background: rgba(102, 126, 234, 0.4);
    border-color: #667eea;
}

.quiz-option.correct {
    background: rgba(74, 222, 128, 0.4);
    border-color: #4ade80;
}

.quiz-option.wrong {
    background: rgba(248, 113, 113, 0.4);
    border-color: #f87171;
}

.quiz-option.dimmed {
    opacity: 0.5;
}

/* Score percentage */
.score-percentage {
    font-size: 2rem;
    color: #a0a0a0;
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 600px) {
    h1 {
        font-size: 1.8rem;
    }

    .score-display {
        font-size: 1rem;
    }

    .card-container {
        height: 40vh;
        min-height: 200px;
    }

    .country-name {
        font-size: 1.8rem;
    }

    .country-info {
        font-size: 1.1rem;
    }

    .btn {
        width: 70px;
        height: 70px;
        font-size: 2rem;
    }

    .buttons {
        gap: 40px;
    }

    .setup-screen {
        padding: 30px 20px;
    }

    .continent-list {
        grid-template-columns: 1fr;
    }

    .game-type-item {
        padding: 12px 15px;
    }

    .game-type-icon {
        font-size: 1.5rem;
    }

    .quiz-options {
        grid-template-columns: 1fr;
    }

    .quiz-option {
        padding: 15px;
        font-size: 1rem;
    }

    /* Larger touch targets on mobile */
    .slider::-webkit-slider-thumb {
        width: 36px;
        height: 36px;
    }

    .slider::-moz-range-thumb {
        width: 36px;
        height: 36px;
    }

    .range-slider::-webkit-slider-thumb {
        width: 36px;
        height: 36px;
    }

    .range-slider::-moz-range-thumb {
        width: 36px;
        height: 36px;
    }

    .slider-container {
        padding: 15px 0;
    }

    .range-slider-container {
        height: 60px;
        padding: 15px 0;
    }
}
