/* ===== Minimalist Black & White Design ===== */
:root {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-card: #111111;
    --bg-card-hover: #1a1a1a;

    --text-primary: #ffffff;
    --text-secondary: #888888;
    --text-muted: #555555;

    --success-color: #ffffff;
    --error-color: #ff3333;

    --border-color: #222222;
    --border-hover: #333333;

    --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ===== Game Container ===== */
#game-container {
    width: 100%;
    max-width: 900px;
    height: 100vh;
    height: 100dvh;
    max-height: 800px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ===== Screen States ===== */
.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    animation: fadeIn 0.4s ease;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ===== Start Screen ===== */
.logo-container {
    text-align: center;
    margin-bottom: 30px;
}

.main-title {
    font-size: clamp(2.2rem, 7vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 15px;
    letter-spacing: -0.02em;
}

.title-line {
    display: block;
}

.title-line.accent {
    color: var(--text-secondary);
}

.subtitle {
    font-size: clamp(1rem, 3vw, 1.4rem);
    font-weight: 300;
    color: var(--text-muted);
    letter-spacing: 0.3em;
    text-transform: uppercase;
}

.description {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 50px;
    text-align: center;
}

.stats-preview {
    display: flex;
    gap: 60px;
    margin-top: 60px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.gameover-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

/* ===== Primary Button ===== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 35px;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-main);
    letter-spacing: 0.05em;
    color: #000000;
    background: #ffffff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 35px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-main);
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-primary:hover {
    transform: scale(1.02);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--text-muted);
}

.btn-primary:active,
.btn-secondary:active {
    transform: scale(0.98);
}

.btn-primary svg {
    stroke: #000000;
}

.btn-secondary.success {
    border-color: #4cd137;
    color: #4cd137;
}

.btn-secondary.success svg {
    stroke: #4cd137;
}



/* ===== Game Screen ===== */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 0;
    margin-bottom: 20px;
}

.score-display,
.highscore-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 85px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.score-label,
.highscore-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 4px;
}

.score-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.highscore-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-secondary);
    line-height: 1;
}

/* ===== Timer ===== */
.timer-container {
    width: 100%;
    margin-bottom: 25px;
}

.timer-bar {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border: none;
    border-radius: 3px;
    background-color: var(--bg-card);
    overflow: hidden;
}

/* Chrome, Safari, Edge */
.timer-bar::-webkit-progress-bar {
    background-color: var(--bg-card);
    border-radius: 3px;
}

.timer-bar::-webkit-progress-value {
    background-color: #ffffff;
    border-radius: 3px;
    transition: background-color 0.3s ease;
}

/* Firefox */
.timer-bar::-moz-progress-bar {
    background-color: #ffffff;
    border-radius: 3px;
}

.timer-bar.warning::-webkit-progress-value {
    background-color: #ff4757;
}

.timer-bar.warning::-moz-progress-bar {
    background-color: #ff4757;
}

/* ===== Cards Container ===== */
.cards-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    width: 100%;
    flex: 1;
    position: relative;
}

.card {
    width: 100%;
    max-width: 350px;
    height: 350px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
    position: relative;
}

.card-content {
    text-align: center;
    padding: 25px;
    width: 100%;
}

.card-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 20px;
    display: block;
}

.card-name {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    font-weight: 800;
    margin-bottom: 25px;
    line-height: 1.2;
    word-break: break-word;
}

.card-count-display {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.count-number {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.count-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.question-ir {
    display: block;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.question-mark {
    font-size: 3.5rem;
    font-weight: 300;
    color: var(--text-secondary);
    line-height: 1;
}


/* ===== VS Badge ===== */
.vs-badge {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 55px;
    height: 55px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
    z-index: 10;
}

/* ===== Guess Buttons ===== */
.buttons-container {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 25px;
}

.btn-guess {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 28px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-main);
    letter-spacing: 0.05em;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-more {
    background: transparent;
    color: var(--text-primary);
}

.btn-more:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
    border-color: var(--text-primary);
}

.btn-more svg {
    stroke: currentColor;
}

.btn-less {
    background: transparent;
    color: var(--text-primary);
}

.btn-less:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
    border-color: var(--text-primary);
}

.btn-less svg {
    stroke: currentColor;
}

.btn-guess:active {
    transform: scale(0.95);
}

.btn-guess:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none !important;
}

/* ===== Feedback ===== */
.feedback-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.feedback-container.show {
    opacity: 1;
}

.feedback-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 25px 45px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
}

.feedback-icon {
    font-size: 2.5rem;
}

.feedback-text {
    font-size: 1.2rem;
    font-weight: 600;
}

.feedback-container.correct .feedback-icon,
.feedback-container.correct .feedback-text {
    color: var(--text-primary);
}

.feedback-container.wrong .feedback-icon,
.feedback-container.wrong .feedback-text {
    color: var(--error-color);
}

/* ===== Game Over Screen ===== */
.gameover-content {
    text-align: center;
    padding: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    max-width: 400px;
    width: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.gameover-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.gameover-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 30px;
}

.score-summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 35px;
    width: 100%;
}

.current-score-box {
    text-align: center;
}

.score-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 10px;
}

.final-score {
    font-size: 5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.best-score-badge {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 25px;
    background: #ffffff;
    border-radius: 50px;
    color: #000000;
}

.best-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.best-value {
    font-size: 1.4rem;
    font-weight: 800;
    border-left: 1px solid rgba(0, 0, 0, 0.2);
    padding-left: 15px;
}


/* ===== Comparison Section (Game Over) ===== */
.comparison-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 35px;
    gap: 15px;
}

.comparison-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.comparison-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.comparison-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-secondary);
    word-break: break-word;
    text-align: center;
}

.comparison-count {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-muted);
}

.comparison-vs {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    opacity: 0.5;
    padding-top: 15px;
}

.comparison-item.highlight .comparison-name {
    color: var(--text-primary);
    font-size: 1.3rem;
}

.comparison-item.highlight .comparison-count {
    color: var(--error-color);
    font-size: 1.8rem;
}


/* ===== Animations ===== */
.card.flip-out {
    animation: flipOut 0.35s ease forwards;
}

.card.flip-in {
    animation: flipIn 0.35s ease forwards;
}

@keyframes flipOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(0.95);
    }
}

@keyframes flipIn {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.card.shake {
    animation: shake 0.4s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

.card.celebrate {
    animation: celebrate 0.4s ease;
}

@keyframes celebrate {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}

.score-value.pop {
    animation: scorePop 0.3s ease;
}

@keyframes scorePop {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* ===== Responsive Design ===== */
@media (max-width: 800px) {
    .cards-container {
        flex-direction: column;
        gap: 15px;
    }

    .card {
        max-width: 100%;
        height: auto;
        min-height: 180px;
    }

    .card-content {
        padding: 20px;
    }

    .vs-badge {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        width: 45px;
        height: 45px;
        font-size: 0.85rem;
        margin: -10px 0;
    }

    .card-name {
        font-size: 1.6rem;
        margin-bottom: 15px;
    }

    .count-number {
        font-size: 1.8rem;
    }

    .question-mark {
        font-size: 2.5rem;
        margin-bottom: 20px;
    }

    .card-label {
        margin-bottom: 12px;
    }

    .buttons-container {
        gap: 10px;
    }

    .btn-guess {
        padding: 12px 24px;
        font-size: 0.75rem;
    }

    .game-header {
        margin-bottom: 15px;
    }

    .score-display,
    .highscore-display {
        width: 100px;
        height: 70px;
        padding: 0;
    }

    .score-value,
    .highscore-value {
        font-size: 1.6rem;
    }

    .final-score {
        font-size: 4rem;
    }
}

@media (max-width: 480px) {
    #game-container {
        padding: 15px;
    }

    .main-title {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 0.85rem;
        letter-spacing: 0.2em;
    }

    .description {
        font-size: 0.9rem;
        margin-bottom: 40px;
    }

    .btn-primary {
        padding: 15px 35px;
        font-size: 0.9rem;
    }

    .stats-preview {
        gap: 40px;
        margin-top: 40px;
    }

    .stat-number {
        font-size: 1.4rem;
    }

    .card {
        min-height: 155px;
    }

    .card-name {
        font-size: 1.4rem;
    }

    .count-number {
        font-size: 1.5rem;
    }

    .question-mark {
        font-size: 2rem;
        margin-bottom: 15px;
    }

    .btn-guess {
        padding: 10px 20px;
    }

    .gameover-content {
        padding: 30px 25px;
    }

    .gameover-title {
        font-size: 1.4rem;
    }

    .score-summary {
        gap: 15px;
        margin-bottom: 25px;
    }

    .final-score {
        font-size: 3.5rem;
    }

    .best-score-badge {
        padding: 8px 18px;
    }

    .best-value {
        font-size: 1.1rem;
    }

    .comparison-container {
        padding: 15px 10px;
        gap: 8px;
    }

    .comparison-name {
        font-size: 0.9rem;
    }

    .comparison-count {
        font-size: 1.1rem;
    }

    .comparison-item.highlight .comparison-name {
        font-size: 1.1rem;
    }

    .comparison-item.highlight .comparison-count {
        font-size: 1.4rem;
    }
}

/* ===== Safe Area for notch devices ===== */
@supports (padding: max(0px)) {
    #game-container {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }
}