/* ==========================================================================
   PREMIUM DESIGN SYSTEM — v2.0
   Self-contained, works offline with system font fallbacks.
   ========================================================================== */

/* --- CSS Variables --- */
:root {
    --bg-main: #080415;
    --bg-deep: #0d0821;
    --bg-card: rgba(18, 12, 42, 0.65);
    --bg-card-hover: rgba(28, 18, 60, 0.75);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --border-glow: rgba(139, 92, 246, 0.25);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(139, 92, 246, 0.45);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-violet: #8b5cf6;
    --accent-purple: #a855f7;
    --accent-fuchsia: #d946ef;
    --accent-pink: #ec4899;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --gradient-hero: linear-gradient(135deg, #8b5cf6 0%, #d946ef 50%, #ec4899 100%);
    --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #ef4444 50%, #ec4899 100%);
    --gradient-cool: linear-gradient(135deg, #06b6d4 0%, #3b82f6 50%, #8b5cf6 100%);
    --gradient-card-border: linear-gradient(135deg, rgba(139, 92, 246, 0.4), rgba(217, 70, 239, 0.2), rgba(59, 130, 246, 0.4));
    --font-sans: 'Montserrat', 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    --sidebar-w: 290px;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --radius-xl: 28px;
    --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.12);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-float: 0 20px 50px rgba(0, 0, 0, 0.55);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition-fast: 0.18s var(--ease-out);
    --transition-normal: 0.35s var(--ease-out);
    --transition-slow: 0.6s var(--ease-out);
}

/* --- Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    color: var(--text-primary);
    line-height: 1.65;
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--bg-main);
    /* Animated mesh gradient background */
    background-image:
        radial-gradient(ellipse 80% 60% at 10% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 85% 70%, rgba(217, 70, 239, 0.06) 0%, transparent 55%),
        radial-gradient(ellipse 70% 55% at 50% 50%, rgba(59, 130, 246, 0.04) 0%, transparent 50%);
    background-attachment: fixed;
}

/* Animated floating orbs background */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: 0;
    pointer-events: none;
    animation: floatOrb 20s ease-in-out infinite;
}
body::before {
    width: 600px;
    height: 600px;
    background: rgba(139, 92, 246, 0.06);
    top: -200px;
    left: -100px;
}
body::after {
    width: 500px;
    height: 500px;
    background: rgba(217, 70, 239, 0.05);
    bottom: -150px;
    right: -100px;
    animation-delay: -10s;
    animation-direction: reverse;
}

@keyframes floatOrb {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(60px, -40px) scale(1.05); }
    66% { transform: translate(-40px, 30px) scale(0.95); }
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.25);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent-violet); }

/* ==========================================================================
   Layout
   ========================================================================== */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-w);
    background: rgba(8, 4, 21, 0.92);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-right: 1px solid var(--border-subtle);
    padding: 2rem 1.25rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    overflow-y: auto;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 2.5rem;
    padding: 0 0.25rem;
}
.logo-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 12px rgba(139, 92, 246, 0.5));
    animation: logoPulse 3s ease-in-out infinite;
}
@keyframes logoPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 12px rgba(139, 92, 246, 0.5)); }
    50% { transform: scale(1.08); filter: drop-shadow(0 0 18px rgba(139, 92, 246, 0.7)); }
}
.logo-text h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.logo-text p {
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nav-item {
    background: transparent;
    border: 1px solid transparent;
    outline: none;
    color: var(--text-secondary);
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}
.nav-item .icon { font-size: 1.1rem; flex-shrink: 0; }

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 60%;
    background: var(--gradient-hero);
    border-radius: 0 4px 4px 0;
    transition: transform var(--transition-fast);
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.025);
    border-color: rgba(255, 255, 255, 0.03);
}
.nav-item.active {
    color: var(--text-primary);
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--border-glow);
    box-shadow: inset 0 0 20px rgba(139, 92, 246, 0.05), var(--shadow-glow);
}
.nav-item.active::before {
    transform: translateY(-50%) scaleY(1);
}

.nav-item.creative-btn {
    margin-top: 0.75rem;
    border: 1px dashed rgba(217, 70, 239, 0.3);
}
.nav-item.creative-btn:hover {
    background: rgba(217, 70, 239, 0.06);
    border-color: rgba(217, 70, 239, 0.5);
    color: #f0abfc;
}
.nav-item.creative-btn.active {
    background: rgba(217, 70, 239, 0.12);
    border-color: var(--accent-fuchsia);
    box-shadow: inset 0 0 20px rgba(217, 70, 239, 0.05), 0 0 25px rgba(217, 70, 239, 0.15);
}
.nav-item.creative-btn.active::before {
    background: linear-gradient(to bottom, var(--accent-fuchsia), var(--accent-pink));
}

.sidebar-footer {
    margin-top: auto;
    font-size: 0.72rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
    padding-top: 1.25rem;
    line-height: 1.5;
}
.sidebar-footer .year {
    color: var(--accent-violet);
    font-weight: 600;
    margin-top: 0.15rem;
}

/* --- Content Area --- */
.content-area {
    margin-left: var(--sidebar-w);
    flex-grow: 1;
    padding: 2.5rem 3.5rem 4rem;
    max-width: 1150px;
    width: calc(100% - var(--sidebar-w));
}

/* --- Tab Switching --- */
.tab-content { display: none; }
.tab-content.active { display: block; animation: contentReveal 0.4s var(--ease-out); }

@keyframes contentReveal {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Global Components
   ========================================================================== */
/* --- Page Titles --- */
.page-title { margin-bottom: 2.5rem; }
.page-title h2 {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.25;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}
.page-title p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* --- Badge --- */
.badge {
    background: rgba(139, 92, 246, 0.12);
    color: #c084fc;
    border: 1px solid rgba(139, 92, 246, 0.25);
    padding: 0.35rem 0.9rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.creative-badge {
    background: rgba(217, 70, 239, 0.1);
    color: #f0abfc;
    border-color: rgba(217, 70, 239, 0.25);
}

/* --- Action Buttons --- */
.action-btn {
    background: var(--gradient-hero);
    background-size: 200% 200%;
    border: none;
    outline: none;
    color: #fff;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.88rem;
    padding: 0.75rem 1.7rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 18px rgba(139, 92, 246, 0.25);
    position: relative;
    overflow: hidden;
}
.action-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
    opacity: 0;
    transition: opacity var(--transition-fast);
}
.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
    background-position: 100% 100%;
}
.action-btn:hover::before { opacity: 1; }
.action-btn:active { transform: translateY(0); }

.secondary-btn {
    background: transparent;
    border: 1px solid var(--border-glow);
    color: #c084fc;
    box-shadow: none;
}
.secondary-btn::before { display: none; }
.secondary-btn:hover {
    background: rgba(139, 92, 246, 0.08);
    border-color: var(--accent-violet);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.1);
    transform: translateY(-1px);
}

/* --- Type Badges --- */
.type-badge {
    padding: 0.25rem 0.7rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.type-badge.bsp { background: rgba(59, 130, 246, 0.12); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.25); }
.type-badge.ssp { background: rgba(16, 185, 129, 0.12); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.25); }
.type-badge.spp { background: rgba(139, 92, 246, 0.12); color: #c084fc; border: 1px solid rgba(139, 92, 246, 0.25); }
.type-badge.sprvs { background: rgba(217, 70, 239, 0.12); color: #f0abfc; border: 1px solid rgba(217, 70, 239, 0.25); }
.type-badge.simple { background: rgba(100, 116, 139, 0.12); color: #94a3b8; border: 1px solid rgba(100, 116, 139, 0.25); }
.type-badge.small { padding: 0.18rem 0.55rem; font-size: 0.65rem; }

.block-desc {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* ==========================================================================
   Welcome / Intro Page
   ========================================================================== */
.welcome-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 3rem 3.5rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}
/* Decorative gradient stripe on top */
.welcome-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-hero);
}

.welcome-header { margin-bottom: 2rem; }
.welcome-header h2 {
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1.2;
    background: linear-gradient(135deg, #fff 0%, #c084fc 40%, #f0abfc 70%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-top: 0.75rem;
}
.welcome-body p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 1.25rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-top: 2.5rem;
}

.feature-item {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}
.feature-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-hero);
    opacity: 0;
    transition: opacity var(--transition-normal);
}
.feature-item:hover {
    transform: translateY(-6px);
    background: var(--bg-card-hover);
    border-color: var(--border-glow);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3);
}
.feature-item:hover::after { opacity: 1; }
.f-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: inline-block;
}
.feature-item h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}
.feature-item p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 0;
}

/* ==========================================================================
   Task 1: Accordion
   ========================================================================== */
.topics-accordion {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.accordion-item {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-normal);
}
.accordion-item:hover { border-color: rgba(139, 92, 246, 0.2); }

.accordion-header {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    padding: 1.25rem 1.75rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background var(--transition-fast);
}
.accordion-header:hover { background: rgba(255, 255, 255, 0.015); }
.accordion-header .arrow {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform var(--transition-normal), color var(--transition-fast);
}

.accordion-item.active {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}
.accordion-item.active .accordion-header .arrow {
    transform: rotate(180deg);
    color: var(--accent-violet);
}

.accordion-content {
    display: none;
    padding: 0 1.75rem 1.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    background: rgba(0, 0, 0, 0.12);
}
.accordion-item.active .accordion-content {
    display: block;
    animation: accordionSlide 0.35s var(--ease-out);
}
@keyframes accordionSlide {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
.accordion-content > p {
    margin-top: 1.25rem;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.sub-schema { margin-top: 1.75rem; }
.sub-schema h4 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-violet);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Card Grids */
.card-grid    { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.25rem; }
.card-grid-3  { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.25rem; }
.card-grid-4  { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; }

.schema-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 1.35rem;
    transition: all var(--transition-fast);
}
.schema-card:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(139, 92, 246, 0.15);
    transform: translateY(-2px);
}
.schema-card.highlight-card {
    background: rgba(139, 92, 246, 0.03);
    border-color: rgba(139, 92, 246, 0.12);
}
.schema-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
}
.schema-card h5 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}
.schema-card .desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
}
.schema-card .example {
    font-size: 0.82rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.65rem 0.9rem;
    border-radius: 6px;
    border-left: 3px solid var(--accent-violet);
    line-height: 1.5;
}
.schema-card .example strong { color: #c084fc; }
.schema-card ul { list-style: none; margin-top: 0.4rem; }
.schema-card li {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
    padding-left: 1.1rem;
    position: relative;
}
.schema-card li::before {
    content: "›";
    color: var(--accent-violet);
    font-weight: 700;
    position: absolute;
    left: 0;
    font-size: 1.1rem;
    line-height: 1;
}
.schema-card li ul { margin-top: 0.4rem; padding-left: 0.3rem; }
.schema-card li ul li { font-size: 0.82rem; margin-bottom: 0.35rem; }
.schema-card li ul li::before { color: var(--accent-fuchsia); }

/* ==========================================================================
   Data Tables (Tasks 1, 2)
   ========================================================================== */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-card);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.92rem;
}
.data-table th {
    background: rgba(139, 92, 246, 0.08);
    color: var(--text-primary);
    padding: 1rem 1.3rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
.data-table td {
    padding: 1rem 1.3rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }

/* ==========================================================================
   Task 2: Interactive Table
   ========================================================================== */
.interactive-row {
    cursor: pointer;
    transition: background var(--transition-fast);
}
.interactive-row:hover { background: rgba(255, 255, 255, 0.015); }
.interactive-row.active { background: rgba(139, 92, 246, 0.04); }

.sentence-text { color: var(--text-primary) !important; font-size: 0.92rem; }
.sentence-text.highlighted .subj {
    border-bottom: 1px solid var(--accent-blue);
    padding-bottom: 1px;
    color: #60a5fa;
}
.sentence-text.highlighted .pred {
    border-bottom: 3px double var(--accent-fuchsia);
    padding-bottom: 1px;
    color: #f0abfc;
}

.bases-select, .type-select {
    background: rgba(8, 4, 21, 0.85);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    outline: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
}
.bases-select:focus, .type-select:focus {
    border-color: var(--accent-violet);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.15);
}
.bases-select option, .type-select option {
    background: #0c081e;
    color: var(--text-primary);
}
.bases-select.correct, .type-select.correct {
    border-color: var(--accent-emerald) !important;
    color: var(--accent-emerald) !important;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.2);
}
.bases-select.incorrect, .type-select.incorrect {
    border-color: var(--accent-red) !important;
    color: var(--accent-red) !important;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.2);
}
.interactive-row.correct-row {
    background: rgba(16, 185, 129, 0.03) !important;
}
.interactive-row.incorrect-row {
    background: rgba(239, 68, 68, 0.03) !important;
}

.text-center { text-align: center; }
.font-bold { font-weight: 700; color: var(--text-primary); }

/* Details drawer */
.details-row { display: none; background: rgba(0, 0, 0, 0.15); }
.details-row.show { display: table-row; }
.details-content {
    padding: 1.35rem;
    border-left: 3px solid var(--accent-violet);
    animation: accordionSlide 0.3s var(--ease-out);
}
.details-content strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
.details-content ol { margin-left: 1.3rem; margin-bottom: 0.8rem; }
.details-content li { font-size: 0.88rem; margin-bottom: 0.25rem; }
.details-content code {
    background: rgba(255, 255, 255, 0.04);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    color: #f0abfc;
    font-size: 0.82rem;
}
.details-content .comment {
    font-size: 0.82rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
    padding-top: 0.7rem;
    margin-top: 0.7rem;
}

.tip-box {
    margin-top: 1.25rem;
    background: rgba(139, 92, 246, 0.04);
    border: 1px dashed rgba(139, 92, 246, 0.2);
    padding: 0.9rem;
    border-radius: var(--radius-md);
    text-align: center;
}
.tip-box p { font-size: 0.82rem; color: var(--text-muted); }

/* ==========================================================================
   Task 3: Matching Board
   ========================================================================== */
.matching-container {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.75rem;
}
.matching-row {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.9rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all var(--transition-fast);
}
.matching-row:hover {
    border-color: rgba(139, 92, 246, 0.15);
    background: var(--bg-card-hover);
}

.sentence-col {
    flex-grow: 1;
    font-size: 0.92rem;
    color: var(--text-primary);
}
.sentence-col .bracket {
    font-family: var(--font-mono);
    color: var(--accent-violet);
    font-weight: 700;
    margin: 0 0.15rem;
}

.select-col { width: 210px; flex-shrink: 0; }
.punc-select {
    width: 100%;
    background: rgba(8, 4, 21, 0.85);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 0.55rem 0.9rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: border var(--transition-fast), box-shadow var(--transition-fast);
}
.punc-select:focus {
    border-color: var(--accent-violet);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.15);
}

.feedback-col {
    width: 110px;
    font-size: 0.82rem;
    font-weight: 600;
    text-align: right;
    flex-shrink: 0;
}
.feedback-col.correct { color: var(--accent-emerald); }
.feedback-col.incorrect { color: var(--accent-red); }

.matching-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}
.score-display {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent-fuchsia);
}

/* ==========================================================================
   Task 4: Interactive Exercise
   ========================================================================== */
.task4-exercise {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.t4-row {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-fast);
}
.t4-row:hover {
    border-color: rgba(139, 92, 246, 0.15);
    background: var(--bg-card-hover);
}
.t4-row.t4-highlight {
    border-color: rgba(217, 70, 239, 0.25);
    background: rgba(217, 70, 239, 0.02);
}
.t4-row.t4-correct-row { border-color: rgba(16, 185, 129, 0.3); }
.t4-row.t4-incorrect-row { border-color: rgba(239, 68, 68, 0.3); }

.t4-row > .num {
    background: rgba(255, 255, 255, 0.03);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

/* Row header with sentence + selects */
.t4-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.3rem;
    flex-wrap: wrap;
}

.t4-sentence-area {
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.t4-text {
    flex-grow: 1;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.punc-inline {
    background: rgba(8, 4, 21, 0.9);
    border: 2px solid var(--accent-violet);
    color: var(--accent-fuchsia);
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    outline: none;
    transition: all var(--transition-fast);
    margin: 0 0.1rem;
    min-width: 42px;
    text-align: center;
}
.punc-inline:focus {
    border-color: var(--accent-fuchsia);
    box-shadow: 0 0 12px rgba(217, 70, 239, 0.3);
}
.punc-inline option { background: #0c081e; color: var(--text-primary); }

.punc-inline.t4-select-correct {
    border-color: var(--accent-emerald) !important;
    color: var(--accent-emerald) !important;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.2);
}
.punc-inline.t4-select-incorrect {
    border-color: var(--accent-red) !important;
    color: var(--accent-red) !important;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.2);
}

.t4-type-select {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.t4-type-select label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.type-inline {
    background: rgba(8, 4, 21, 0.85);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 0.35rem 0.7rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    outline: none;
    cursor: pointer;
    transition: border var(--transition-fast), box-shadow var(--transition-fast);
}
.type-inline:focus {
    border-color: var(--accent-violet);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.15);
}
.type-inline option { background: #0c081e; }
.type-inline.t4-select-correct {
    border-color: var(--accent-emerald) !important;
    color: var(--accent-emerald) !important;
}
.type-inline.t4-select-incorrect {
    border-color: var(--accent-red) !important;
    color: var(--accent-red) !important;
}

.t4-feedback {
    font-size: 0.82rem;
    font-weight: 600;
    flex-shrink: 0;
    min-width: 80px;
    text-align: right;
}
.t4-feedback.correct { color: var(--accent-emerald); }
.t4-feedback.incorrect { color: var(--accent-red); }

/* T4 Details Drawer */
.t4-details {
    display: none;
    width: 100%;
    padding: 1rem 1.3rem 1.3rem;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    background: rgba(0, 0, 0, 0.12);
    margin-top: 0.5rem;
    cursor: default;
}
.t4-details.show {
    display: block;
    animation: accordionSlide 0.3s var(--ease-out);
}
.t4-details-inner {
    border-left: 3px solid var(--accent-violet);
    padding-left: 1rem;
}
.t4-details-inner p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    line-height: 1.6;
}
.t4-details-inner .t4-full-sentence {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
    font-weight: 500;
}
.t4-details-inner .t4-full-sentence .subj {
    border-bottom: 2px solid var(--accent-blue);
    color: #60a5fa;
}
.t4-details-inner .t4-full-sentence .pred {
    border-bottom: 3px double var(--accent-fuchsia);
    color: #f0abfc;
}
.t4-details-inner .t4-char {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

.t4-row.t4-expandable { cursor: pointer; }


/* Syntax Analysis Card */
.syntax-analysis-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    box-shadow: var(--shadow-glow);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
}
.syntax-analysis-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to right, var(--accent-violet), var(--accent-fuchsia), var(--accent-pink));
}
.syntax-analysis-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #f0abfc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1.5rem;
}
.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 1.75rem;
}
.analysis-block h4 {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--accent-violet);
    margin-bottom: 0.8rem;
}
.analysis-block p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
}
.analysis-block ul { margin-left: 1rem; }
.analysis-block li {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}
.member-list p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    line-height: 1.6;
}
.member-list strong { color: var(--text-primary); }

.mark {
    padding: 0.08rem 0.4rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    display: inline-block;
}
.subj-mark { background: rgba(59, 130, 246, 0.12); color: #60a5fa; }
.pred-mark { background: rgba(217, 70, 239, 0.12); color: #f0abfc; }
.obs-mark  { background: rgba(16, 185, 129, 0.12); color: #34d399; }
.def-mark  { background: rgba(245, 158, 11, 0.12); color: #fbbf24; }

.scheme-visual {
    margin-top: 1.75rem;
    border-top: 1px solid var(--border-subtle);
    padding-top: 1.25rem;
}
.scheme-visual h4 {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
}
.scheme-box {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-subtle);
    padding: 1rem;
    border-radius: var(--radius-sm);
    text-align: center;
}
.scheme-box code {
    font-family: var(--font-mono);
    color: var(--accent-fuchsia);
    font-size: 1.2rem;
    letter-spacing: 2px;
}

/* ==========================================================================
   Task 5: Official Document
   ========================================================================== */
.document-container {
    display: flex;
    justify-content: center;
    margin-top: 1.75rem;
}
.document-paper {
    background: #ffffff;
    color: #1e293b;
    width: 100%;
    max-width: 700px;
    padding: 3.5rem 4.5rem;
    border-radius: 4px;
    box-shadow: var(--shadow-float);
    font-family: "Times New Roman", Times, Georgia, serif;
    font-size: 14pt;
    line-height: 1.5;
}
.doc-header {
    margin-left: 45%;
    margin-bottom: 2.5rem;
    text-align: left;
}
.doc-header p { margin-bottom: 0.15rem; color: #1e293b; }
.doc-title { text-align: center; margin-bottom: 1.75rem; }
.doc-title h3 {
    font-weight: bold;
    font-size: 16pt;
    letter-spacing: 3px;
    color: #1e293b;
}
.doc-body {
    text-indent: 1.25cm;
    margin-bottom: 3.5rem;
    text-align: justify;
}
.doc-body p { margin-bottom: 0.8rem; color: #1e293b; }
.doc-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}
.doc-footer p { color: #1e293b; }
.date-col { width: 50%; }
.signature-col {
    width: 40%;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.signature-col .line {
    width: 100%;
    border-bottom: 1px solid #334155;
    height: 25px;
    margin-bottom: 4px;
}

/* ==========================================================================
   Creative Task 2: Quiz
   ========================================================================== */
.creative-header-card {
    background: linear-gradient(135deg, rgba(18, 12, 42, 0.85) 0%, rgba(55, 17, 72, 0.7) 100%);
    border: 1px solid rgba(217, 70, 239, 0.2);
    border-radius: var(--radius-xl);
    padding: 2.25rem 2.5rem;
    margin-bottom: 1.75rem;
    backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
}
.creative-header-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to right, var(--accent-fuchsia), var(--accent-pink), var(--accent-violet));
}
.creative-header-card h2 {
    font-size: 1.85rem;
    font-weight: 700;
    margin-top: 0.5rem;
    margin-bottom: 0.6rem;
    background: linear-gradient(135deg, #fff 0%, #f0abfc 50%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.creative-header-card p {
    color: var(--text-secondary);
    font-size: 0.92rem;
    max-width: 850px;
}

.quiz-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    backdrop-filter: blur(12px);
    min-height: 380px;
}

.quiz-screen { display: none; }
.quiz-screen.active { display: block; }

/* Start Screen */
.quiz-stats-info { margin-bottom: 1.75rem; }
.quiz-stats-info h3 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.8rem;
}
.quiz-topics-list { list-style: none; }
.quiz-topics-list li {
    font-size: 0.92rem;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
}
.quiz-topics-list li span { font-size: 1.1rem; }

.big-btn {
    font-size: 1.05rem;
    padding: 0.9rem 2.25rem;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-fuchsia) 0%, var(--accent-violet) 100%);
    box-shadow: 0 6px 22px rgba(217, 70, 239, 0.25);
}
.big-btn:hover { box-shadow: 0 8px 30px rgba(217, 70, 239, 0.4); }

/* Question Screen */
.quiz-header { margin-bottom: 2rem; }
.progress-bar-container {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.8rem;
}
.progress-bar-fill {
    width: 5%;
    height: 100%;
    background: var(--gradient-hero);
    transition: width var(--transition-normal);
    border-radius: 3px;
}
.quiz-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}
#quiz-score-display { color: var(--accent-fuchsia); font-weight: 600; }

.question-card h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.75rem;
    line-height: 1.5;
}
.options-container {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.option-btn {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    text-align: left;
    padding: 1.05rem 1.3rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
}
.option-btn:hover:not(:disabled) {
    background: rgba(139, 92, 246, 0.04);
    border-color: rgba(139, 92, 246, 0.25);
    transform: translateX(5px);
}
.option-btn.correct-choice {
    background: rgba(16, 185, 129, 0.12) !important;
    border-color: var(--accent-emerald) !important;
    color: #34d399 !important;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.1);
}
.option-btn.incorrect-choice {
    background: rgba(239, 68, 68, 0.12) !important;
    border-color: var(--accent-red) !important;
    color: #f87171 !important;
}

/* Feedback card */
.feedback-card {
    margin-top: 1.75rem;
    background: rgba(139, 92, 246, 0.04);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    animation: contentReveal 0.3s var(--ease-out);
}
.feedback-card.hidden { display: none; }
.feedback-title-area {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}
#feedback-icon { font-size: 1.2rem; }
.feedback-title-area h4 { font-size: 1.05rem; font-weight: 700; }
.feedback-card.correct-feedback h4 { color: var(--accent-emerald); }
.feedback-card.incorrect-feedback h4 { color: var(--accent-red); }
#feedback-explanation {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    line-height: 1.65;
}

/* Results Screen */
.results-card { text-align: center; padding: 1.5rem; }
.medal-icon {
    font-size: 3.5rem;
    margin-bottom: 0.8rem;
    filter: drop-shadow(0 0 18px rgba(234, 179, 8, 0.35));
    animation: medalBounce 0.6s var(--ease-spring);
}
@keyframes medalBounce {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.results-card h2 { font-size: 1.8rem; font-weight: 700; margin-bottom: 0.8rem; }
.final-score {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1.75rem;
}
.result-bar-container {
    width: 100%;
    max-width: 380px;
    height: 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 5px;
    overflow: hidden;
    margin: 0 auto 1.75rem;
}
.result-bar-fill {
    width: 0%;
    height: 100%;
    background: var(--gradient-hero);
    border-radius: 5px;
    transition: width 1s var(--ease-out);
}
#result-comment {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--accent-fuchsia);
    margin-bottom: 2rem;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1024px) {
    .content-area { padding: 2rem 2rem 3rem; }
    .analysis-grid { grid-template-columns: 1fr; }
    .welcome-card { padding: 2rem 2rem; }
    .welcome-header h2 { font-size: 1.8rem; }
}

@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
        padding: 0.6rem 0.8rem;
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        z-index: 200;
    }
    .logo-area { margin-bottom: 0; flex-shrink: 0; }
    .logo-text { display: none; }
    .logo-icon { font-size: 1.5rem; }
    .nav-menu {
        flex-direction: row;
        overflow-x: auto;
        width: 100%;
        gap: 0.2rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nav-menu::-webkit-scrollbar { display: none; }
    .nav-item {
        padding: 0.5rem 0.7rem;
        font-size: 0.75rem;
        white-space: nowrap;
        border-radius: var(--radius-sm);
    }
    .nav-item .icon { font-size: 0.9rem; }
    .nav-item::before { display: none; }
    .sidebar-footer { display: none; }
    .content-area {
        margin-left: 0;
        width: 100%;
        padding: 1.25rem;
        padding-top: 4.5rem;
    }
    .welcome-card { padding: 1.5rem; border-radius: var(--radius-lg); }
    .welcome-header h2 { font-size: 1.5rem; }
    .quiz-container { padding: 1.5rem; }
    .document-paper { padding: 2rem 2rem; font-size: 11pt; }
    .matching-row { flex-direction: column; align-items: stretch; gap: 0.6rem; }
    .select-col { width: 100%; }
    .feedback-col { text-align: left; width: auto; }
    .card-grid, .card-grid-3, .card-grid-4 { grid-template-columns: 1fr; }
    .syntax-analysis-card { padding: 1.5rem; }
}

/* ==========================================================================
   Print Styles — Only print the official document (Task 5)
   ========================================================================== */
@media print {
    body {
        background: #fff !important;
        color: #000 !important;
        font-size: 12pt;
        line-height: 1.5;
    }
    body::before, body::after { display: none !important; }
    .sidebar, .page-title, .control-panel, .action-btn,
    .nav-menu, .logo-area, .tip-box, .matching-actions {
        display: none !important;
    }
    .app-container { display: block !important; }
    .content-area {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 0 !important;
        max-width: 100% !important;
    }
    .tab-content { display: none !important; }
    #task5.tab-content { display: block !important; }
    .document-container { margin-top: 0 !important; }
    .document-paper {
        box-shadow: none !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        color: #000 !important;
        background: #fff !important;
    }
    .doc-header { margin-left: 50% !important; }
    .doc-header p,
    .doc-title h3,
    .doc-body p,
    .doc-footer p { color: #000 !important; }
}
