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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f1a;
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
    text-align: center;
    padding: 1.5rem 1rem 0.5rem;
}

header h1 {
    font-size: 1.6rem;
    color: #7eb8ff;
}

.subtitle {
    color: #888;
    font-size: 0.9rem;
}

.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0.8rem 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-group label {
    color: #aaa;
    font-size: 0.85rem;
}

.filter-group select {
    background: #1a1a2e;
    color: #e0e0e0;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.filter-group select:focus {
    outline: none;
    border-color: #7eb8ff;
}

button {
    background: #1a1a2e;
    color: #e0e0e0;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

button:hover {
    background: #252545;
    border-color: #7eb8ff;
}

.progress {
    color: #7eb8ff;
    font-size: 0.9rem;
    font-weight: 600;
}

.card-container {
    perspective: 1200px;
    width: 100%;
    max-width: 720px;
    padding: 0.5rem 1rem;
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.card {
    width: 100%;
    min-height: 380px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

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

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

.card-front, .card-back {
    position: absolute;
    width: 100%;
    min-height: 380px;
    backface-visibility: hidden;
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.card-front {
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    border: 1px solid #333;
}

.card-back {
    background: linear-gradient(145deg, #162032, #1a2a1a);
    border: 1px solid #2a5a2a;
    transform: rotateY(180deg);
}

.card-category {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #7eb8ff;
    margin-bottom: 0.8rem;
    font-weight: 600;
}

.card-content {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.6;
    overflow-y: auto;
    white-space: pre-wrap;
}

.card-content code {
    background: rgba(126, 184, 255, 0.1);
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.88em;
}

.card-content pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.8rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.5rem 0;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.82rem;
    line-height: 1.4;
    white-space: pre;
}

.card-content strong {
    color: #7eb8ff;
}

.card-content em {
    color: #a8d8a8;
}

.card-hint {
    text-align: center;
    color: #555;
    font-size: 0.75rem;
    margin-top: 0.8rem;
}

.nav-buttons {
    display: flex;
    gap: 0.8rem;
    padding: 1rem;
    justify-content: center;
}

.nav-buttons button {
    padding: 0.6rem 1.4rem;
    font-size: 0.95rem;
}

#markBtn {
    background: #1a2a1a;
    border-color: #2a5a2a;
}

#markBtn:hover {
    background: #2a4a2a;
}

#markBtn.marked {
    background: #2a5a2a;
    color: #a8d8a8;
    border-color: #4a8a4a;
}

.keyboard-hints {
    display: flex;
    gap: 1.5rem;
    padding: 0.5rem 1rem 1.5rem;
    color: #444;
    font-size: 0.7rem;
}

.keyboard-hints span {
    display: flex;
    gap: 0.3rem;
}

/* Scrollbar */
.card-content::-webkit-scrollbar {
    width: 4px;
}

.card-content::-webkit-scrollbar-track {
    background: transparent;
}

.card-content::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 2px;
}

@media (max-width: 600px) {
    header h1 {
        font-size: 1.3rem;
    }

    .card {
        min-height: 300px;
    }

    .card-inner, .card-front, .card-back {
        min-height: 300px;
    }

    .card-content {
        font-size: 0.88rem;
    }

    .keyboard-hints {
        display: none;
    }
}
