/* Base & Reset  */
:root {
    --bg-color: #f8fafc;
    --fg-color: #0f172a;
    --muted: #f1f5f9;
    --muted-fg: #64748b;
    --border: #e2e8f0;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-gradient: linear-gradient(135deg, #6a0dad, #c71585);
    --green: #22c55e;
    --green-hover: #16a34a;
    --red: #ef4444;
    --red-hover: #dc2626;
    --yellow: #eab308;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md:
        0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg:
        0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 1rem;
}

/* Layout and Containers */
.main-wrapper {
    font-family:
        "SN Pro",
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        sans-serif;
    background-color: var(--bg-color);
    color: var(--fg-color);
    -webkit-font-smoothing: antialiased;

    /* Layout */
    min-height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
}
.content-container {
    width: 100%;
    max-width: 42rem;
    margin: 0 auto;
    padding: 3rem 1rem;
}

/* Header / Navigation */
.fc-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.fc-title-group {
    text-align: center;
}
.fc-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--fg-color);
    margin-bottom: 0.25rem;
}
.fc-counter {
    font-size: 0.75rem;
    color: var(--muted-fg);
}

/* Progress Bar */
.progress-track {
    width: 100%;
    background-color: var(--muted);
    border-radius: 9999px;
    height: 0.5rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 9999px;
    transition: width 0.5s ease-in-out;
    width: 0%;
}

/* Metrics & Modes */
.metrics-row {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.mode-selectors {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: var(--radius-md);
    gap: 0.375rem;
}

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

.btn-icon-text {
    height: 2rem;
    padding: 0 0.75rem;
    font-size: 0.75rem;
    color: var(--muted-fg);
}
.btn-icon-text:hover {
    background-color: var(--muted);
    color: var(--fg-color);
}

.btn-mode {
    height: 2rem;
    padding: 0 1rem;
    font-size: 0.75rem;
    background-color: var(--muted);
    color: var(--muted-fg);
    border-radius: 9999px;
}
.btn-mode.active {
    background: var(--primary-gradient);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}
.btn-mode:hover:not(.active) {
    background-color: var(--border);
}

.btn-action {
    flex: 1;
    height: 3rem;
    padding: 0 1rem;
    font-size: 0.875rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.btn-danger-outline {
    border: 1px solid #fecaca;
    color: var(--red);
    background-color: transparent;
}
.btn-danger-outline:hover {
    background-color: #fef2f2;
}
.btn-success-solid {
    background-color: var(--green);
    color: var(--white);
}
.btn-success-solid:hover {
    background-color: var(--green-hover);
}

.btn-nav {
    height: 2.5rem;
    padding: 0 1rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    background: transparent;
    box-shadow: var(--shadow-sm);
    color: var(--fg-color);
}
.btn-nav:hover {
    background-color: var(--muted);
}

.btn-link {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

svg.icon {
    width: 1.25rem;
    height: 1.25rem;
}
svg.icon-sm {
    width: 1rem;
    height: 1rem;
}

/* Flashcard 3D Scene */
.card-scene {
    perspective: 1200px;
    cursor: pointer;
    user-select: none;
    margin-bottom: 2rem;
}

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

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

.card-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    background-color: var(--white);
    border: 2px solid var(--border);
}

/* Front Face */
.card-front {
    padding: 2rem;
    align-items: center;
    justify-content: center;
}

.card-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-fg);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}
.card-question {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--fg-color);
    text-align: center;
    margin-bottom: 1.5rem;
}
.card-hint {
    font-size: 0.875rem;
    color: var(--muted-fg);
    background: var(--muted);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    text-align: center;
    margin-bottom: 1.5rem;
    border: 1px dashed var(--border);
}
.card-tap-hint {
    font-size: 0.6875rem;
    color: var(--muted-fg);
    position: absolute;
    bottom: 1.5rem;
}
#btn-hint {
    text-decoration: none;
}

#btn-hint span {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Back Face */
.card-back {
    transform: rotateY(180deg);
    border: none;
    overflow: hidden;
}

.card-back-header {
    background: var(--primary-gradient);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: rgba(255, 255, 255, 0.9);
}

.card-back-header span {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.card-back-body {
    flex: 1;
    background-color: var(--white);
    border-left: 2px solid rgba(79, 70, 229, 0.2);
    border-right: 2px solid rgba(79, 70, 229, 0.2);
    border-bottom: 2px solid rgba(79, 70, 229, 0.2);
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.answer-content {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.answer-text {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--fg-color);
    line-height: 1.4;
}

.card-tap-back {
    font-size: 0.6875rem;
    color: var(--muted-fg);
    text-align: center;
    margin-top: 1.5rem;
}

/* Layout Helpers */
.action-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

/* Status Colors */
.text-green {
    color: var(--green);
}
.text-red {
    color: var(--red);
}
.text-yellow {
    color: var(--yellow);
}

/* Back of Card Answer Layout */
.answer-container {
    width: 100%;
    text-align: left;
}

.answer-top-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.answer-icon-box {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 800;
    font-size: 1.25rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
}

.answer-title-text {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--fg-color);
    line-height: 1.375;
    padding-top: 0.25rem;
}

.answer-why-box {
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-xl);
    padding: 1rem;
}

.answer-why-label {
    font-size: 11px;
    font-weight: 700;
    color: #d97706;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.375rem;
}

.answer-why-text {
    font-size: 0.875rem;
    color: #78350f;
    line-height: 1.625;
}
/* Responsiveness & Adaptive Scaling  */

/* Ultra Small Screens */
@media (max-width: 380px) {
    html {
        font-size: 13px;
    }
    .content-container {
        padding: 5rem 0.5rem 2rem 0.5rem;
    }
    .metrics-row {
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    .mode-selectors {
        flex-wrap: wrap;
    }
    .action-row {
        flex-direction: column;
    }
    .card-front,
    .card-back-body {
        padding: 1.25rem;
    }
    .card-inner {
        min-height: 280px;
    }
}

/* Standard Mobile & Tablets   */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    .mode-selectors {
        flex-wrap: wrap;
    }
    .card-front,
    .card-back-body {
        padding: 1.5rem;
    }
}

/*  Standard Desktops */
@media (min-width: 1024px) {
    html {
        font-size: 16px;
    }

    .card-inner:hover:not(.is-flipped) {
        transform: translateY(-4px);
        box-shadow:
            0 20px 25px -5px rgba(0, 0, 0, 0.1),
            0 10px 10px -5px rgba(0, 0, 0, 0.04);
    }
}

/* Large Screens */
@media (min-width: 1920px) {
    html {
        font-size: 22px;
    }
    .content-container {
        max-width: 48rem;
    }
}

/*  Ultrawide */
@media (min-width: 3000px) {
    html {
        font-size: 32px;
    }
    .content-container {
        max-width: 60rem;
    }
}
