/* =========================================================
   TOPIC PAGE BASE STYLES
   Shared layout and reusable styling for all topic pages.
   Keep topic-specific styles out of this file where possible.
   ========================================================= */


/* =========================================================
   MAIN PAGE WRAPPER
   Controls the overall page width and spacing.
   ========================================================= */

.topic-page {
    max-width: 1440px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}



/* =========================================================
   HERO SECTION
   Top introduction block used on every topic page.
   ========================================================= */

.topic-hero {
    background: linear-gradient(135deg, #f4f7ff 0%, #eefaf6 100%);
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

.topic-hero h1 {
    margin: 0 0 0.75rem;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.1;
}

.topic-hero p {
    margin: 0;
    max-width: 760px;
    font-size: 1.1rem;
    line-height: 1.7;
    color: #374151;
}


/* =========================================================
   TOPIC BADGES
   Small labels shown under the hero text.
   ========================================================= */

.topic-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.topic-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.9rem;
    border: 1px solid #dbe3f0;
    border-radius: 999px;
    background: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    color: #334155;
}


/* =========================================================
   PAGE LAYOUT
   Two-column layout: sidebar on the left, content on the right.
   ========================================================= */

.topic-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 1.75rem;
    align-items: start;
}

.topic-sidebar {
    position: sticky;
    top: 90px;
}

.topic-content {
    display: grid;
    gap: 1.5rem;
}


/* =========================================================
   SHARED CONTAINERS
   Common card styling for the sidebar and content sections.
   ========================================================= */

.topic-nav-card,
.topic-section {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}


/* =========================================================
   SIDEBAR NAVIGATION
   "On this page" card and anchor list.
   ========================================================= */

.topic-nav-card {
    padding: 1.25rem;
}

.topic-nav-card h2 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
}

.topic-nav-card ul {
    display: grid;
    gap: 0.6rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.topic-nav-card a {
    text-decoration: none;
    font-weight: 600;
    color: #1f2937;
}

.topic-nav-card a:hover {
    color: #2563eb;
}


/* =========================================================
   CONTENT SECTIONS
   Main reusable section styling for all topic blocks.
   ========================================================= */

.topic-section {
    padding: 1.5rem;
}

.topic-section h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.topic-section h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.15rem;
}

.topic-section h4 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.topic-section p,
.topic-section li {
    line-height: 1.75;
    color: #374151;
}

.topic-section ul,
.topic-section ol {
    margin-bottom: 0;
    padding-left: 1.2rem;
}


/* =========================================================
   SHARED GRID LAYOUTS
   Reusable grid structures for cards and grouped content.
   ========================================================= */

.types-grid,
.placeholder-grid,
.related-grid,
.checklist-grid,
.rules-grid,
.quick-recognition-grid,
.practice-intro-grid,
.examples-grid,
.faq-grid {
    display: grid;
    gap: 1rem;
}

.recognition-card {
    text-align: center;
}

.recognition-card img {
    display: block;
    width: 100%;
    max-width: 180px;   /* smaller than before */
    height: 140px;      /* fixed visual height */
    object-fit: contain;
    margin: 0 auto 0.85rem;
    border-radius: 12px;
}

.types-grid,
.quick-recognition-grid,
.practice-intro-grid,
.examples-grid,
.faq-grid,
.checklist-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.placeholder-grid,
.related-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.rules-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.examples-grid {
    margin-top: 1rem;
}

.examples-grid-single {
    grid-template-columns: 1fr;
}

.example-card img {
    width: 100%;
    height: 220px;
    object-fit: contain;
    background-color: #f8f9fc;
    padding: 8px;
}

.example-question {
    margin-top: 0.5rem;
    font-weight: 500;
    line-height: 1.5;
}

.example-board-badge {
    display: inline-block;
    margin-bottom: 0.75rem;
    background: #eef2ff;
    color: #1e3a8a;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
}

.example-card strong {
    color: #1e3a8a;
    font-weight: 600;
}

.example-card {
    transition: all 0.2s ease-in-out;
}

.example-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}
/* =========================================================
   SHARED CARDS
   Generic card styles used across many topic sections.
   ========================================================= */

.mini-card,
.example-card,
.faq-card {
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #f8fafc;
}

.mini-card h4,
.example-card h4,
.faq-card h4 {
    margin-top: 0;
}


.image-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.88);
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
}

.image-modal.open {
    display: flex;
}

.image-modal-content {
    max-width: 95%;
    max-height: 90vh;
    width: auto;
    height: auto;
    border-radius: 12px;
    display: block;
}

.image-modal-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    background: transparent;
    border: none;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
}

.example-image-wrapper {
    position: relative;
    display: block;
    border-radius: 12px;
    overflow: hidden;
}

.example-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    transition: transform 0.3s ease;
    cursor: zoom-in;
}

.image-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #ffffff;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-align: center;
    pointer-events: none;
}

.example-image-wrapper:hover .image-overlay {
    opacity: 1;
}

.example-image-wrapper:hover .example-image {
    transform: scale(1.03);
}

#examples {
    overflow-x: hidden;
}

#examples .examples-board-block {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: block;
    box-sizing: border-box;
}

#examples .examples-scroll-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 1.25rem;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.75rem;
    box-sizing: border-box;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

#examples .examples-scroll-row .example-card {
    flex: 0 0 65%;
    min-width: 65%;
    max-width: 65%;
}

/* Large screens */
@media (min-width: 1400px) {
    #examples .examples-scroll-row .example-card {
        flex: 0 0 55%;
        min-width: 55%;
        max-width: 55%;
    }
}

/* Tablets */
@media (max-width: 1024px) {
    #examples .examples-scroll-row .example-card {
        flex: 0 0 75%;
        min-width: 75%;
        max-width: 75%;
    }
}

/* Mobile devices */
@media (max-width: 640px) {
    #examples .examples-scroll-row .example-card {
        flex: 0 0 90%;
        min-width: 90%;
        max-width: 90%;
    }
}

.examples-scroll-row::-webkit-scrollbar {
    height: 10px;
}

.examples-scroll-row::-webkit-scrollbar-thumb {
    background: #cfd7e6;
    border-radius: 999px;
}

.examples-scroll-row::-webkit-scrollbar-track {
    background: #eef2f7;
    border-radius: 999px;
}

/* =========================================================
   VISUAL / PLACEHOLDER BOXES
   Used for diagrams, images, placeholders or visual examples.
   ========================================================= */

.visual-box {
    padding: 1.5rem;
    border: 2px dashed #cbd5e1;
    border-radius: 18px;
    background: #f8fafc;
    text-align: center;
    color: #64748b;
}

.placeholder-note {
    margin-top: 0.85rem;
    font-size: 0.95rem;
    color: #64748b;
}


/* =========================================================
   WARNING / MISTAKE LISTS
   Used for common mistakes and caution-style lists.
   ========================================================= */

.warning-list li {
    margin-bottom: 0.5rem;
}


/* =========================================================
   EXAMPLE QUESTION STYLES
   Shared styling for worked examples and expandable answers.
   ========================================================= */

.example-tag {
    display: inline-block;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: #e0ecff;
    font-size: 0.82rem;
    font-weight: 700;
    color: #1d4ed8;
}

.example-card details {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #dbe3f0;
}

.example-card summary {
    cursor: pointer;
    font-weight: 700;
    color: #1f2937;
}

.example-card details[open] summary {
    margin-bottom: 0.75rem;
}


/* =========================================================
   TOPIC NAVIGATION / RELATED TOPICS
   Shared bottom navigation block for previous, next
   and related topic links.
   ========================================================= */

.topic-navigation-inner {
    display: grid;
    gap: 1.5rem;
}

.topic-navigation h2 {
    margin-top: 0;
}

.related-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.related-grid a {
    display: block;
    text-decoration: none;
    font-weight: 700;
    color: #1f2937;
}

.related-grid a:hover {
    color: #2563eb;
}

.related .mini-card {
    display: block;
    text-decoration: none;
    transition: all 0.2s ease;
}

.related .mini-card:hover {
    transform: translateY(-3px);
    border-color: #93c5fd;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.08);
}

.related .mini-card h4 {
    margin: 0 0 0.65rem;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
    color: #1f2937;
}

.related .mini-card p {
    margin: 0;
    font-size: 0.96rem;
    font-weight: 400;
    line-height: 1.7;
    color: #64748b;
}

/* =========================================================
   PREVIOUS / NEXT TOPIC NAVIGATION
   Shared bottom navigation buttons used on all topic pages.
   ========================================================= */

.nav-row {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 1rem;
    margin: 2rem 0;
}

.nav-row a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.4rem;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.nav-row .prev {
    background: #ffffff;
    color: #374151;
}

.nav-row .prev:hover {
    background: #f9fafb;
    border-color: #cbd5e1;
    transform: translateY(-2px);
}

.nav-row .next {
    background: linear-gradient(135deg, #eff6ff 0%, #f8fbff 100%);
    border-color: #bfdbfe;
    font-weight: 700;
    color: #1d4ed8;
}

.nav-row .next:hover {
    background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
    border-color: #60a5fa;
    transform: translateY(-2px);
}


/* =========================================================
   RESPONSIVE LAYOUT
   Tablet and mobile adjustments for shared topic layouts.
   ========================================================= */

@media (max-width: 900px) {
    .topic-layout {
        grid-template-columns: 1fr;
    }

    .topic-sidebar {
        position: static;
    }

    .rules-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .nav-row {
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .types-grid,
    .quick-recognition-grid,
    .practice-intro-grid,
    .examples-grid,
    .faq-grid,
    .checklist-grid,
    .rules-grid {
        grid-template-columns: 1fr;
    }
}

.practice-local-box,
.active-game-panel {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid #dbe6f2;
    border-radius: 24px;
    padding: 1.25rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.practice-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.practice-level-tabs {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.level-btn {
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #1f2937;
    padding: 0.75rem 1rem;
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.level-btn:hover {
    background: #eef4ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.level-btn.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.22);
}

.practice-progress {
    font-weight: 700;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 0.55rem 0.9rem;
}

.practice-group-header {
    margin-bottom: 1rem;
}

.practice-group-header h3 {
    margin: 0.5rem 0 0.35rem;
    font-size: 1.25rem;
}

.practice-group-header p {
    margin: 0;
    color: #64748b;
}

.practice-group-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: #e0ecff;
    color: #1d4ed8;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.practice-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.practice-nav-btn {
    border: none;
    background: #2563eb;
    color: #ffffff;
    border-radius: 14px;
    padding: 0.85rem 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.practice-nav-btn.secondary {
    background: #e5e7eb;
    color: #111827;
}

@media (max-width: 640px) {
    .practice-level-tabs {
        width: 100%;
    }

    .level-btn {
        flex: 1 1 0;
        text-align: center;
    }

    .practice-nav {
        flex-direction: column;
    }

    .practice-nav-btn {
        width: 100%;
    }
}

.topic-game-card {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.topic-game-card:hover {
    transform: translateY(-2px);
    border-color: #93c5fd;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.08);
}

.topic-game-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.topic-game-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.8rem;
    font-weight: 700;
}

.topic-game-link {
    display: inline-block;
    margin-top: 1rem;
    font-weight: 700;
    color: #2563eb;
}

.topic-games-actions {
    margin-top: 1.25rem;
}

.topic-game-card {
    display: block;
    width: 100%;
    text-align: left;
    border: 1px solid #dbe6f2;
    background: #ffffff;
    cursor: pointer;
    font: inherit;
}

.topic-game-card:hover {
    transform: translateY(-2px);
    border-color: #93c5fd;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.08);
}

.topic-game-card.active {
    border-color: #2563eb;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.12);
}

.active-game-panel {
    margin-top: 1.5rem;
}

.exam-table {
    border-collapse: collapse;
    margin: 1rem 0;
    width: auto;
    min-width: 420px;
    background: #fff;
}

.exam-table th,
.exam-table td {
    border: 1px solid #333;
    padding: 0.6rem 1rem;
    text-align: center;
    min-width: 80px;
}

.exam-table th {
    background: #f3f4f6;
    font-weight: 700;
}

.exam-table td:empty::after {
    content: "";
    display: inline-block;
    width: 2rem;
    height: 1rem;
}

.bar-chart {
    margin: 1rem 0;
    max-width: 520px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 14px;
    padding: 1rem;
}

.bar-chart-y-label {
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #374151;
}

.bar-chart-plot {
    height: 180px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: end;
    gap: 1rem;
    border-left: 2px solid #111827;
    border-bottom: 2px solid #111827;
    padding: 0 0.75rem;
}

.bar {
    height: calc(var(--value) * 12px);
    background: #93c5fd;
    border: 1px solid #2563eb;
    border-bottom: none;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    font-weight: 700;
    padding-top: 0.25rem;
}

.bar-chart-x-labels {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding-left: 0.75rem;
    margin-top: 0.5rem;
    text-align: center;
    font-weight: 600;
}

svg {
    display: block;
    margin: 1rem auto;
}

.axis-note {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

.questionnaire-box {
    border: 1px solid #d1d5db;
    background: #f9fafb;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
}

.questionnaire-box p {
    margin: 0.4rem 0;
}

.practice-result-message {
    margin-top: 0.6rem;
    font-weight: 600;
}

.practice-result-message.correct {
    color: #16a34a;
}

.practice-result-message.incorrect {
    color: #dc2626;
}

.practice-answer-input.correct {
    border: 2px solid #16a34a;
}

.practice-answer-input.incorrect {
    border: 2px solid #dc2626;
}

/* ========================================
   PRACTICE GAME STYLE
======================================== */

.practice-local-box {
    background: #2344b8;
    border: 3px solid #2f8fb3;
    border-radius: 26px;
    padding: 2rem;
    color: #ffffff;
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.22);
}

.practice-topbar {
    border-bottom: 2px solid rgba(255, 255, 255, 0.55);
    padding-bottom: 1.4rem;
}

.level-btn {
    background: #ffffff;
    color: #15318f;
    border: 2px solid #ffffff;
}

.level-btn.active {
    background: #ffd84d;
    color: #15318f;
    border-color: #ffd84d;
}

.practice-progress {
    background: #ffd84d;
    color: #15318f;
    border: none;
}

.practice-group-header h3,
.practice-group-header p {
    color: #ffffff;
}

.practice-group-badge {
    background: #ffd84d;
    color: #15318f;
}

.practice-question-card {
    margin-top: 1.5rem;
}

.practice-question-card > p {
    background: #ffd84d;
    color: #15318f;
    padding: 1.2rem 1.5rem;
    border-radius: 12px;
    font-size: 1.25rem;
}

.practice-options {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

.practice-options button {
    width: 100%;
    text-align: left;
    background: #ffffff;
    color: #15318f;
    border: 2px solid #dbeafe;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
}

.practice-options button:hover,
.practice-options button.selected {
    background: #fff3ad;
    border-color: #ffd84d;
}

.practice-options button.correct {
    background: #bbf7d0;
    border-color: #16a34a;
}

.practice-options button.incorrect {
    background: #fecaca;
    border-color: #dc2626;
}

.practice-input-box {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.practice-answer-input {
    flex: 1;
    min-width: 220px;
    padding: 0.9rem 1rem;
    border-radius: 10px;
    border: 2px solid #ffffff;
    font-size: 1.05rem;
}

.practice-check-btn {
    background: #ffd84d;
    color: #15318f;
    border: none;
    border-radius: 10px;
    padding: 0.9rem 1.4rem;
    font-weight: 800;
    cursor: pointer;
}

.practice-result-message {
    margin-top: 0.8rem;
    font-weight: 800;
    color: #ffd84d;
}

.practice-feedback {
    margin-top: 1rem;
    background: #ffd84d;
    color: #15318f;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    font-weight: 700;
}

.practice-nav {
    border-top: 2px solid rgba(255, 255, 255, 0.55);
}

.practice-nav-btn {
    background: #ffd84d;
    color: #15318f;
}

.practice-nav-btn.secondary {
    background: #ffffff;
    color: #15318f;
}

/* HINT SYSTEM */

.practice-hint {
    margin-top: 1rem;
}

.practice-hint-toggle {
    background: #ffd84d;
    color: #15318f;
    border: none;
    border-radius: 10px;
    padding: 0.5rem 1rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.practice-hint-toggle:hover {
    background: #ffe57a;
}

.practice-hint-content {
    margin-top: 0.6rem;
    background: #fff3ad;
    color: #15318f;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    border-left: 4px solid #ffd84d;
}

.practice-question-html {
    margin: 1rem 0;
    display: flex;
    justify-content: center;
}

.practice-question-html svg {
    max-width: 100%;
    height: auto;
}

.practice-question-html svg text {
    fill: #f9fafb;
}

.common-mistakes-section {
    margin-top: 3rem;
}

.common-mistakes-section .section-intro {
    max-width: 780px;
    color: #4b5563;
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.mistakes-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.mistake-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.mistake-card h4 {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    color: #111827;
}

.mistake-wrong,
.mistake-correction {
    border-radius: 0.85rem;
    padding: 0.85rem 1rem;
    margin-top: 0.75rem;
}

.mistake-wrong {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.mistake-correction {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.mistake-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
    color: #374151;
}

.mistake-wrong p,
.mistake-correction p {
    margin: 0;
    color: #1f2937;
    line-height: 1.6;
}

@media (max-width: 760px) {
    .mistakes-grid {
        grid-template-columns: 1fr;
    }

    .mistake-card {
        padding: 1rem;
    }
}

/* =========================================================
   TUTORIAL / HOW TO SOLVE SECTION
   Step-by-step teaching layout.
   ========================================================= */

#tutorial .tutorial-step {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-left: 5px solid #2563eb;
    border-radius: 18px;
    padding: 1.25rem 1.35rem;
    margin: 1.35rem 0;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

#tutorial .tutorial-step h3 {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 1.25rem;
}

#tutorial .tutorial-step p {
    margin-bottom: 0.85rem;
}

#tutorial .tutorial-note {
    border-radius: 14px;
    padding: 0.85rem 1rem;
    margin: 0.75rem 0;
    line-height: 1.65;
}

#tutorial .tutorial-why {
    background: #eff6ff;
    border-left: 4px solid #2563eb;
}

#tutorial .tutorial-mistake {
    background: #fef2f2;
    border-left: 4px solid #dc2626;
}

#tutorial .tutorial-tip {
    background: #ecfdf5;
    border-left: 4px solid #16a34a;
}

#tutorial .tutorial-check {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
}

#tutorial .equation-box {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    padding: 0.9rem 1rem;
    margin: 0.85rem 0;
    text-align: center;
    font-size: 1.08rem;
}

#tutorial .mini-card {
    background: #f8fafc;
    border-radius: 16px;
}

#tutorial .tutorial-step.example-step {
    border-left-color: #7c3aed;
    background: linear-gradient(180deg, #ffffff 0%, #faf7ff 100%);
}

#tutorial .tutorial-step.non-example-step {
    border-left-color: #dc2626;
    background: linear-gradient(180deg, #ffffff 0%, #fff7f7 100%);
}

#tutorial .tutorial-step.final-check-step {
    border-left-color: #f59e0b;
    background: linear-gradient(180deg, #ffffff 0%, #fffbeb 100%);
}

@media (max-width: 640px) {
    #tutorial .tutorial-step {
        padding: 1rem;
        border-radius: 16px;
    }

    #tutorial .tutorial-step h3 {
        font-size: 1.12rem;
    }
}

.topic-hero a {
    color: #1d4ed8;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 2px solid rgba(29, 78, 216, 0.25);
    transition: all 0.2s ease;
}

.topic-hero a:hover {
    color: #1e40af;
    border-bottom-color: rgba(29, 78, 216, 0.6);
}

/* =========================================================
   INTERNAL LINKS (TOPIC CONTENT)
   Modern inline link styling
   ========================================================= */

.topic-section a,
.topic-hero a {
    color: #1d4ed8;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 2px solid rgba(29, 78, 216, 0.25);
    transition: all 0.2s ease;
}

.topic-section a:hover,
.topic-hero a:hover {
    color: #1e40af;
    border-bottom-color: rgba(29, 78, 216, 0.6);
}

.tutorial-image-box {
    padding: 1rem;
    text-align: center;
}

.tutorial-step-image {
    max-width: 100%;
    height: auto;
    border-radius: 16px;
    display: block;
    margin: 0 auto;
}

.video-wrapper {
    position: relative;
    width: 100%;
    max-width: 900px;   /* controls max size */
    margin: 0 auto;     /* center it */
    aspect-ratio: 16 / 9;
}

.video-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
}

.video-wrapper iframe {
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.video-wrapper:hover iframe {
    transform: scale(1.01);
    transition: 0.3s ease;
}

.video-section {
    margin-top: 30px;
    margin-bottom: 10px;
}