/* Base & Reset  */
:root {
    --bg-color: #f4f7fa;
    --fg-color: #052965;
    --muted: #e7eef3;
    --muted-fg: #4a6280;
    --border: #c9d6e2;
    --primary: #052965;
    --primary-hover: #031a42;
    --primary-gradient: #052965;
    --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: "Source Sans 3", "Segoe UI", sans-serif;
    font-size: 1.05rem;
    line-height: 1.55;
    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-family: "Libre Baskerville", Palatino, "Palatino Linotype", serif;
    font-size: 1.55rem;
    font-weight: 400;
    line-height: 1.35;
    font-weight: 400;
    color: var(--fg-color);
    margin-bottom: 0.25rem;
}
.fc-counter {
    font-size: 0.95rem;
    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: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.mode-selectors .btn {
    width: 100%;
}

/* 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: 2.2rem;
    padding: 0 1rem;
    font-size: 0.95rem;
    background-color: transparent;
    color: var(--fg-color);
    border: 1px solid var(--border);
    border-radius: 0;
}
.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 1 12rem;
    min-height: 3.25rem;
    height: auto;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    line-height: 1.2;
    border-radius: 0;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
}
.btn-danger-outline {
    border: 1px solid #052965;
    color: #052965;
    background-color: #ffffff;
}
.btn-danger-outline:hover {
    background-color: #e7eef3;
}
.btn-success-solid {
    background-color: #052965;
    color: #ffffff;
    border: 1px solid #031a42;
}
.btn-success-solid:hover {
    background-color: #031a42;
    color: #ffffff;
}

.btn-nav {
    min-height: 2.75rem;
    height: auto;
    padding: 0.55rem 0.9rem;
    font-size: 1rem;
    line-height: 1.2;
    border: 1px solid #052965;
    background: #ffffff;
    box-shadow: none;
    color: #052965;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-nav:hover {
    background-color: var(--muted);
}

.btn-link {
    font-size: 1rem;
    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: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    border: 1px solid #052965;
}

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

.card-label {
    font-size: 0.92rem;
    font-weight: 600;
    color: #02ab96;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}
.badge-new { color: #02ab96; }
.badge-learning { color: #052965; }
.badge-mastered { color: #02ab96; }
.card-question {
    font-family: "Libre Baskerville", Palatino, serif;
    font-size: 1.55rem;
    font-weight: 400;
    color: var(--fg-color);
    text-align: left;
    margin-bottom: 1.5rem;
    line-height: 1.35;
}
.card-hint {
    font-size: 1.05rem;
    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.92rem;
    color: var(--muted-fg);
    position: absolute;
    bottom: 1.5rem;
}
#btn-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    background: #ffffff;
    color: #052965;
    border: 1px solid #052965;
    padding: 0.55rem 0.85rem;
    text-decoration: none;
    min-height: 2.75rem;
}
#btn-hint span {
    color: #052965;
    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: #052965;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #ffffff;
}

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

.card-back-body {
    flex: 1;
    background-color: #ffffff;
    border-left: 1px solid #052965;
    border-right: 1px solid #052965;
    border-bottom: 1px solid #052965;
    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.05rem;
    font-weight: 600;
    color: var(--fg-color);
    line-height: 1.4;
}

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

/* Layout Helpers */
.action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.card-question,
.answer-why-text,
.card-face {
    overflow-wrap: anywhere;
}
.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: #f4f7fa;
    border-left: 3px solid #02ab96;
    border-radius: 0;
    padding: 1rem;
}

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

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

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

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

/* Standard Desktops */
@media (min-width: 1024px) {

    .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) {
    .content-container {
        max-width: 52rem;
    }
}
.related-flashcards-container {
    margin-top: 50px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.related-flashcards-container h3 {
    font-family: "Libre Baskerville", Palatino, "Palatino Linotype", serif;
    font-weight: 400;
    font-size: 1.35rem;
    margin-bottom: 15px;
    color: #052965;
}

.related-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.related-list li a {
    text-decoration: none;
    color: #3b82f6;
    font-weight: 500;
    line-height: 1.4;
    display: block;
    padding: 10px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease-in-out;
}

.related-list li a:hover {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}
