:root {
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --accent: #3b82f6;
    --accent-light: #93c5fd;
    --accent-dark: #1d4ed8;
    --card-back-bg: var(--accent-light);
    --card-front-bg: #ffffff;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --success-color: #10b981;
    --graph-line-moves: #3b82f6;
    --graph-line-time: #10b981;
}

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

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 10px;
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 40px;
    background: var(--bg-secondary);
    padding: 15px 30px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
}

.stat {
    text-align: center;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--accent);
}

.game-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 10px;
    max-width: 700px;
    margin: 0 auto 20px;
}

.card {
    aspect-ratio: 3/4;
    perspective: 1000px;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.5s;
    transform-style: preserve-3d;
}

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

.card.matched {
    animation: fadeOut 0.5s ease forwards;
    pointer-events: none;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--card-shadow);
}

.card-back {
    background: var(--card-back-bg);
    border: 3px solid var(--accent);
}

.card-back::after {
    content: "?";
    font-size: 2rem;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.card-front {
    background: var(--card-front-bg);
    transform: rotateY(180deg);
    border: 3px solid var(--accent);
}

.card-front span {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-primary);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition:
        transform 0.2s,
        box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--accent);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 16px;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    text-align: center;
}

.modal h2 {
    color: var(--success-color);
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.current-result {
    background: var(--accent);
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.current-result h3 {
    margin-bottom: 10px;
}

.current-result p {
    font-size: 1.2rem;
}

.graph-container {
    background: var(--bg-primary);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.graph-toggle {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.graph-toggle button {
    padding: 8px 16px;
    border: 2px solid var(--accent);
    background: transparent;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
}

.graph-toggle button.active {
    background: var(--accent);
    color: white;
}

.chart-wrapper {
    position: relative;
    height: 250px;
}

.celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.no-data {
    color: var(--text-secondary);
    padding: 40px;
}
