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

body {
    background: #15110C;
}

::selection {
    background: #C8963E;
    color: #15110C;
}

.page {
    min-height: 100vh;
    background: radial-gradient(1200px 600px at 50% -10%, #221B10 0%, #15110C 60%);
    color: #EAE0CC;
    font-family: 'Source Serif 4', Georgia, serif;
    padding: 32px 16px 48px;
    max-width: 900px;
    margin: 0 auto;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 36px;
}

.eyebrow {
    font-family: 'Cinzel', serif;
    font-size: 11px;
    letter-spacing: 0.35em;
    color: #C8963E;
    margin-bottom: 10px;
}

.h1 {
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: clamp(34px, 7vw, 56px);
    letter-spacing: 0.08em;
    margin: 0;
    background: linear-gradient(180deg, #EAE0CC 30%, #C8963E 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sub {
    margin-top: 10px;
    font-size: 15px;
    color: #B5A88F;
}

/* Sections */
.section {
    border: 1px solid #2E2618;
    background: #1B1610AA;
    border-radius: 4px;
    padding: 20px 18px;
    margin-bottom: 24px;
}

.section-title {
    font-family: 'Cinzel', serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: #C8963E;
    margin-bottom: 14px;
    text-align: center;
}

/* Deck Grid */
.shuffle-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

.shuffle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.shuffle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #C8963E;
    cursor: pointer;
}

.shuffle-text {
    font-family: 'Cinzel', serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #B5A88F;
}

.deck-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.deck-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 28px 16px;
    background: #15110C;
    border: 1px solid #2E2618;
    border-radius: 4px;
    text-decoration: none;
    color: #EAE0CC;
    transition: all 0.2s ease;
    cursor: pointer;
}

.deck-card:hover {
    border-color: #C8963E;
    background: #C8963E0D;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(200, 150, 62, 0.1);
}

.deck-glyph {
    font-size: 36px;
    margin-bottom: 12px;
}

.deck-name {
    font-family: 'Cinzel', serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #EAE0CC;
    margin-bottom: 6px;
    text-align: center;
}

.deck-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #8C7F6A;
}

/* Back Link */
.back-link {
    text-align: center;
    margin-bottom: 16px;
}

.back-link a {
    font-family: 'Cinzel', serif;
    font-size: 11px;
    letter-spacing: 0.15em;
    color: #C8963E;
    text-decoration: none;
    border: 1px solid #C8963E55;
    padding: 6px 14px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.back-link a:hover {
    background: #C8963E1A;
    border-color: #C8963E;
}

/* Card Area */
.card-section {
    border-color: #C8963E44;
}

.card-area {
    perspective: 1000px;
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
}

.flashcard {
    width: 100%;
    max-width: 620px;
    height: 400px;
    cursor: pointer;
    border-radius: 4px;
}

.flashcard-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.6s ease;
    transform-style: preserve-3d;
    border-radius: 4px;
}

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

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #2E2618;
    background: #15110C;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.flashcard-back {
    transform: rotateY(180deg);
}

.card-side-label {
    font-family: 'Cinzel', serif;
    font-size: 10px;
    letter-spacing: 0.2em;
    color: #8C7F6A;
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
}

.flashcard-front img,
.flashcard-back img {
    max-width: 92%;
    max-height: 85%;
    object-fit: contain;
    border-radius: 3px;
}

.no-back-msg {
    color: #8C7F6A;
    font-size: 14px;
    font-style: italic;
    font-family: 'Source Serif 4', serif;
}

/* Card Info */
.card-info {
    text-align: center;
    margin-bottom: 18px;
}

.card-info span {
    font-family: 'Cinzel', serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #B5A88F;
    text-transform: capitalize;
}

/* Controls */
.controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.ctrl-btn {
    font-family: 'Cinzel', serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    padding: 12px 24px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid;
}

.flip-btn {
    background: transparent;
    color: #C8963E;
    border-color: #C8963E88;
}

.flip-btn:hover {
    background: #C8963E1A;
    border-color: #C8963E;
}

.next-btn {
    background: #C8963E1A;
    color: #EAE0CC;
    border-color: #C8963E;
}

.next-btn:hover {
    background: #C8963E33;
}

.ctrl-btn:active {
    transform: scale(0.97);
}

/* Progress */
.progress {
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #6B6154;
    padding: 8px 0;
}

/* Footer */
.footer {
    text-align: center;
    font-size: 11px;
    color: #6B6154;
    margin-top: 8px;
    font-style: italic;
}

/* Responsive */
@media (max-width: 600px) {
    .flashcard {
        height: 300px;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .ctrl-btn {
        width: 100%;
    }

    .deck-selector select {
        min-width: 100%;
    }
}
