:root {
    /* Color Palette - Premium Dark Theme */
    --bg-color: #0f111a;
    --nav-bg: #151828;
    --sidebar-bg: #111322;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-primary: #6366f1; /* Indigo */
    --accent-secondary: #8b5cf6; /* Violet */
    --accent-hover: #4f46e5;
    
    /* UI States */
    --success: #10b981;
    --error: #ef4444;
    --border-color: rgba(255, 255, 255, 0.08);
    
    /* Alpha colors for backgrounds and borders */
    --alpha-03: rgba(255, 255, 255, 0.03);
    --alpha-05: rgba(255, 255, 255, 0.05);
    --alpha-08: rgba(255, 255, 255, 0.08);
    --alpha-10: rgba(255, 255, 255, 0.1);
    --alpha-20: rgba(255, 255, 255, 0.2);
    --rich-text: #cbd5e1;
}

/* Light Theme Overrides */
:root[data-theme="light"] {
    --bg-color: #f8fafc;
    --nav-bg: #ffffff;
    --sidebar-bg: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border-color: rgba(0, 0, 0, 0.08);
    
    /* Alpha overrides for light mode */
    --alpha-03: rgba(0, 0, 0, 0.03);
    --alpha-05: rgba(0, 0, 0, 0.05);
    --alpha-08: rgba(0, 0, 0, 0.08);
    --alpha-10: rgba(0, 0, 0, 0.1);
    --alpha-20: rgba(0, 0, 0, 0.2);
    --rich-text: #334155;
}

:root[data-theme="light"] .theme-dropdown {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

:root[data-theme="light"] .quiz-option {
    background: rgba(0, 0, 0, 0.03);
}

:root[data-theme="light"] .quiz-option:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.15);
}

:root[data-theme="light"] .mistake-card {
    background: rgba(239, 68, 68, 0.03);
    border-color: rgba(239, 68, 68, 0.15);
}

:root[data-theme="light"] .theme-option.active-theme {
    border-color: #0f172a;
}
    
    /* Layout */
    --topbar-height: 64px;
    --sidebar-width: 300px;
    --content-max-width: 840px;
    --border-radius-lg: 16px;
    --border-radius-md: 12px;
    --border-radius-sm: 8px;
    
    /* Typography */
    --font-family: 'Inter', 'Noto Sans SC', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden; /* Prevent body scroll, layout handles its own scrolling */
    display: flex;
    flex-direction: column;
}

/* =========================================
   TOP NAVBAR
========================================= */
.top-navbar {
    height: var(--topbar-height);
    background-color: var(--nav-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    flex-shrink: 0;
    z-index: 100;
}

.nav-left, .nav-right {
    flex: 1;
    display: flex;
    align-items: center;
}

.nav-right {
    justify-content: flex-end;
}

/* Theme Picker */
.theme-picker {
    position: relative;
    margin-right: 1.5rem;
}

.theme-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-btn:hover {
    color: var(--text-primary);
}

.theme-dropdown {
    position: absolute;
    top: 150%;
    right: 0;
    background: var(--nav-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem;
    display: none;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    flex-direction: row;
}

.theme-dropdown.show {
    display: flex;
}

.theme-option {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    background: linear-gradient(135deg, var(--t-primary), var(--t-secondary));
    border: 2px solid transparent;
    transition: transform 0.2s;
}

.theme-option:hover {
    transform: scale(1.1);
}

.theme-option.active-theme {
    border-color: white;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
}

.logo-text {
    font-weight: 700;
    font-size: 1.25rem;
    background: linear-gradient(to right, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-family);
    position: relative;
}

.nav-btn:hover {
    color: var(--text-primary);
    background: var(--alpha-05);
}

.nav-btn.active {
    color: white;
    background: rgba(99, 102, 241, 0.15);
}

.nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: -12px; /* Align with bottom border of navbar */
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 3px;
    background: var(--accent-primary);
    border-radius: 3px 3px 0 0;
}

.badge {
    background: var(--error);
    color: white;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    font-weight: 700;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.user-profile .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--alpha-10);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================
   MAIN APP CONTAINER
========================================= */
.app-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

.view-section {
    width: 100%;
    height: 100%;
    display: none;
    animation: fadeIn 0.3s ease forwards;
}

.view-section.active-view {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* =========================================
   GRAMMAR VIEW (TWO-PANE)
========================================= */
.two-pane-layout {
    flex-direction: row;
}

/* Sidebar */
.grammar-sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    padding: 1.5rem 1rem;
}

.sidebar-header {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding-left: 0.5rem;
}

.sidebar-header i {
    color: var(--accent-primary);
}

.sidebar-nav {
    flex: 1;
}

/* Tree Menu */
.tree-node {
    margin-bottom: 0.15rem;
}

.tree-node-header {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.5rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    font-size: 0.95rem;
    gap: 0.5rem;
    line-height: 1.4;
}

.tree-node-header:hover {
    background: var(--alpha-03);
    color: var(--text-primary);
}

.tree-node-header.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-secondary);
    font-weight: 600;
}

.node-icon {
    width: 16px;
    display: flex;
    justify-content: center;
    font-size: 0.9rem;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.node-icon.expanded {
    transform: rotate(90deg);
}

.node-title {
    flex: 1;
    /* Removed text truncation to allow wrapping if text is too long */
    word-break: break-word;
}

.tree-children {
    padding-left: 1.2rem;
    border-left: 1px solid var(--alpha-05);
    margin-left: 0.75rem;
    margin-top: 0.15rem;
    display: none;
}

.tree-children.open {
    display: block;
}

/* Main Content */
.grammar-main-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
    scroll-behavior: smooth;
    background: var(--bg-color);
}

.content-wrapper {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 3rem 2rem 5rem 2rem;
}

.centered-view {
    height: 100%;
    overflow-y: auto;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--alpha-10);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--alpha-20);
}

/* =========================================
   RICH CONTENT TYPOGRAPHY
========================================= */
.page-header {
    margin-bottom: 2.5rem;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.3;
}

.rich-content {
    color: var(--rich-text);
    line-height: 1.8;
    font-size: 1.1rem;
    margin-bottom: 3rem;
}

.rich-content p {
    margin-bottom: 1.2rem;
}

.rich-content ul, .rich-content ol {
    margin-bottom: 1.2rem;
    padding-left: 1.5rem;
}

.rich-content li {
    margin-bottom: 0.5rem;
}

.rich-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.intro-box {
    background: rgba(99, 102, 241, 0.08);
    border-radius: var(--border-radius-md);
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
}

.intro-box h3 {
    color: var(--accent-secondary);
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.intro-box p:last-child {
    margin-bottom: 0;
}

/* Pagination */
.doc-pagination {
    display: flex;
    justify-content: space-between;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--alpha-10);
}

.btn-doc-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: transparent;
    border: 1px solid var(--alpha-10);
    border-radius: var(--border-radius-md);
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    max-width: 48%;
    font-family: var(--font-family);
    text-align: left;
}

.btn-doc-nav:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.05);
}

.nav-text {
    display: flex;
    flex-direction: column;
}

.nav-text.text-right {
    align-items: flex-end;
}

.nav-text span {
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
}

.nav-text strong {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--accent-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

/* =========================================
   PRACTICE & MISTAKES VIEW
========================================= */
.view-header {
    margin-bottom: 3rem;
    text-align: center;
}

.view-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.view-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Quiz (Practice) */
.quiz-card {
    background: var(--nav-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    margin-bottom: 2rem;
}

.quiz-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.quiz-question {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quiz-option {
    background: var(--alpha-03);
    border: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-family: var(--font-family);
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.quiz-option:hover:not(:disabled) {
    background: var(--alpha-08);
    border-color: var(--alpha-20);
}

.quiz-option.correct {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--success);
    color: #34d399;
}

.quiz-option.incorrect {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--error);
    color: #f87171;
}

.quiz-option:disabled {
    cursor: not-allowed;
}

.quiz-feedback {
    margin-top: 2rem;
    padding: 1.5rem;
    border-radius: var(--border-radius-sm);
    display: none;
    background: rgba(0,0,0,0.2);
    border-left: 4px solid var(--accent-primary);
}

.quiz-feedback h4 {
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.feedback-success h4 { color: var(--success); }
.feedback-error h4 { color: var(--error); }

.action-row {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-family);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
}

/* Mistakes */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.mistake-card {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--border-radius-md);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.mistake-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.mistake-tag {
    background: var(--alpha-10);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.btn-remove {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
    font-size: 1.25rem;
}
.btn-remove:hover {
    color: var(--error);
}

/* =========================================
   INTERACTIVE COMPONENTS
========================================= */

/* 1. Reveal Blank (Click-to-reveal) */
.reveal-blank {
    display: inline-block;
    background: linear-gradient(90deg, rgba(99,102,241,0.1), rgba(139,92,246,0.1));
    border-bottom: 2px dashed var(--accent-primary);
    color: transparent;
    padding: 0 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 60px;
    text-align: center;
    user-select: none;
}

.reveal-blank::after {
    content: attr(data-hint);
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
    opacity: 0.8;
}

.reveal-blank:hover {
    background: rgba(99,102,241,0.2);
}

.reveal-blank.revealed {
    color: var(--accent-primary);
    background: transparent;
    border-bottom: 2px solid var(--accent-primary);
    font-weight: 600;
    cursor: default;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.reveal-blank.revealed::after {
    display: none;
}

@keyframes popIn {
    0% { transform: scale(0.9); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* 2. Flip Cards */
.flip-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.flip-card {
    background-color: transparent;
    height: 120px;
    perspective: 1000px;
    cursor: pointer;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-radius: var(--border-radius-md);
}

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

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    border-radius: var(--border-radius-md);
}

.flip-card-front {
    background: var(--alpha-03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 600;
}

.flip-card-front:hover {
    background: var(--alpha-05);
    border-color: var(--accent-primary);
}

.flip-card-back {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    transform: rotateY(180deg);
}

.flip-card-back .fc-note {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

/* 3. Inline Micro-Quiz */
.inline-quiz {
    background: var(--alpha-03);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
}

.inline-quiz::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: var(--accent-primary);
}

.inline-quiz-question {
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.inline-quiz-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.inline-quiz-btn {
    background: transparent;
    border: 1px solid var(--alpha-20);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.inline-quiz-btn:hover:not(:disabled) {
    background: var(--alpha-08);
    border-color: var(--accent-primary);
}

.inline-quiz-btn.correct {
    background: rgba(16,185,129,0.15);
    border-color: var(--success);
    color: var(--success);
}

.inline-quiz-btn.incorrect {
    background: rgba(239,68,68,0.15);
    border-color: var(--error);
    color: var(--error);
    animation: shake 0.4s;
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-4px); }
    100% { transform: translateX(0); }
}

.inline-quiz-feedback {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--alpha-05);
    font-size: 0.95rem;
    display: none;
    animation: fadeIn 0.3s;
}

/* 4. Progressive Disclosure (Accordion) */
details.grammar-accordion {
    background: var(--alpha-03);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    margin: 2rem 0;
    overflow: hidden;
}

details.grammar-accordion > summary {
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--accent-secondary);
    list-style: none; /* Hide default arrow */
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s;
}

details.grammar-accordion > summary::-webkit-details-marker {
    display: none;
}

details.grammar-accordion > summary:hover {
    background: var(--alpha-05);
}

details.grammar-accordion > summary::after {
    content: '+';
    font-size: 1.5rem;
    font-weight: 300;
    transition: transform 0.3s;
}

details[open].grammar-accordion > summary::after {
    transform: rotate(45deg);
}

details[open].grammar-accordion > summary {
    border-bottom: 1px solid var(--border-color);
    background: var(--alpha-05);
}

details.grammar-accordion > .accordion-content {
    padding: 1.5rem;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}


/* =========================================
   ADVANCED TYPOGRAPHY & LAYOUT
========================================= */

/* Formula Box */
.formula-box {
    background: var(--alpha-05);
    border-left: 4px solid var(--accent-primary);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
    font-family: 'Fira Code', 'Consolas', monospace;
}
.formula-box .formula {
    font-size: 1.1rem;
    color: var(--accent-secondary);
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.formula-box .example {
    color: var(--text-primary);
    font-style: italic;
    padding-left: 1.5rem;
    border-left: 2px dashed var(--alpha-20);
}

/* Comparison Table */
.comparison-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 2rem 0;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.comparison-table th {
    background: var(--alpha-08);
    color: var(--text-primary);
    font-weight: 600;
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.comparison-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--alpha-05);
    border-right: 1px solid var(--alpha-05);
    color: var(--text-secondary);
}
.comparison-table tr:last-child td {
    border-bottom: none;
}
.comparison-table td:last-child {
    border-right: none;
}
.comparison-table tr:hover td {
    background: var(--alpha-03);
}

/* Error Demo (Strike-through) */
.error-demo {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: rgba(239,68,68,0.03);
    border: 1px dashed rgba(239,68,68,0.3);
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    margin: 1rem 0;
}
.error-demo .wrong {
    color: var(--error);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.error-demo .wrong span {
    text-decoration: line-through;
    opacity: 0.8;
}
.error-demo .correct {
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Visual Mind Map Grid (for classification) */
.mind-map-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}
.mind-map-node {
    background: var(--alpha-03);
    border: 1px solid var(--alpha-10);
    padding: 1.2rem;
    border-radius: var(--border-radius-md);
    text-align: center;
    transition: transform 0.2s, background 0.2s;
}
.mind-map-node:hover {
    transform: translateY(-3px);
    background: var(--alpha-08);
    border-color: var(--accent-primary);
}
.mind-map-node .title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.mind-map-node .examples {
    font-size: 0.9rem;
    color: var(--accent-secondary);
}

/* Warning Box */
.warning-box {
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid var(--accent-secondary); /* or orange */
    padding: 1rem 1.5rem;
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
    margin: 1.5rem 0;
}
.warning-box h4 {
    color: #f59e0b; /* amber */
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

/* =========================================
   VISUAL RULE CARDS (极简规则卡片)
========================================= */
.rule-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
    margin: 1.5rem 0;
}

.rule-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.rule-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--accent-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.rule-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    border-color: var(--alpha-20);
}

.rule-card:hover::before {
    transform: scaleX(1);
}

.rule-card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    filter: grayscale(0.2);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rule-card:hover .rule-card-icon {
    transform: scale(1.15) rotate(5deg);
    filter: grayscale(0);
}

.rule-card-formula {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.8rem;
    width: 100%;
}

.rule-card-formula span.highlight {
    color: var(--accent-primary);
    background: var(--alpha-10);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

.rule-card-example {
    font-family: 'Fira Code', monospace;
    font-size: 0.95rem;
    color: var(--text-secondary);
    background: var(--alpha-03);
    width: 100%;
    padding: 0.6rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.rule-card:hover .rule-card-example {
    background: var(--alpha-08);
    color: var(--text-primary);
}

.rule-card-example span {
    transition: color 0.3s;
}

.rule-card:hover .rule-card-example span {
    color: var(--accent-primary);
    font-weight: bold;
}

.rule-card-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* =========================================
   CUSTOM CSS TOOLTIP (记忆口诀)
========================================= */
.mnemonic-tip {
    position: relative;
    cursor: help;
    border-bottom: 1px dashed var(--accent-secondary);
    display: inline-block;
    color: var(--text-muted);
}

.mnemonic-tip .tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 100%; /* Position above */
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--surface);
    color: var(--text-primary);
    text-align: left;
    padding: 0.8rem;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    width: 250px;
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-size: 0.85rem;
    border: 1px solid var(--accent-primary);
    pointer-events: none;
    line-height: 1.5;
}

/* Small triangle arrow */
.mnemonic-tip .tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: var(--accent-primary) transparent transparent transparent;
}

.mnemonic-tip:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}

/* =========================================
   COMIC EXPANDABLE PANEL (第六张口诀卡片)
========================================= */
.comic-card {
    background: linear-gradient(135deg, var(--alpha-05) 0%, var(--surface) 100%);
    border: 1px dashed var(--accent-secondary);
    cursor: pointer;
}

.comic-card:hover {
    border-style: solid;
    background: var(--alpha-05);
}

.comic-expand-content {
    grid-column: 1 / -1; /* Span all columns */
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.5s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.5s ease;
    opacity: 0;
    margin-top: -1rem;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
}

.comic-expand-content.expanded {
    max-height: 800px;
    opacity: 1;
    margin-top: 0.5rem;
    padding: 1.5rem;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
}

.comic-strip {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.comic-panel {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    border: 2px dashed var(--alpha-10);
}

.comic-panel-img {
    width: 120px;
    height: 120px;
    background: var(--alpha-05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--text-muted);
}

.comic-panel-text {
    flex: 1;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.comic-panel-text span.highlight {
    color: var(--accent-primary);
    font-weight: bold;
    font-size: 1.2rem;
}


/* =========================================
   PLURAL SPELLING MINIGAME
========================================= */
.plural-game-container {
    background: var(--surface);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    margin-top: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.plural-game-header {
    margin-bottom: 2rem;
}

.plural-game-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.emoji-display {
    display: flex;
    align-items: center;
    gap: 2rem;
    font-size: 4rem;
    font-family: 'Segoe UI Emoji', 'Apple Color Emoji', sans-serif;
}

.emoji-arrow {
    font-size: 2rem;
    color: var(--accent-primary);
    animation: pulse 2s infinite;
}

.game-input-wrapper {
    position: relative;
    width: 300px;
}

.game-input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    outline: none;
}

.game-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px var(--alpha-10);
}

.game-input.error {
    border-color: var(--error);
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

.game-input.success {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.game-feedback {
    min-height: 24px;
    color: var(--error);
    font-weight: 500;
    margin-top: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.game-feedback.show {
    opacity: 1;
}

.flying-word {
    position: fixed;
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    background: var(--success);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    pointer-events: none;
    z-index: 1000;
    transition: all 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

@keyframes cardReceive {
  0% { transform: scale(1); box-shadow: 0 0 0 transparent; }
  50% { transform: scale(1.05); box-shadow: 0 0 20px var(--success); border-color: var(--success); }
  100% { transform: scale(1); box-shadow: 0 0 0 transparent; }
}

.card-receiving {
    animation: cardReceive 0.8s ease;
}

.game-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted);
    border-top: 1px dashed var(--border-color);
    padding-top: 1rem;
}


/* Game Storage Cards */
.game-storage-cards {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.game-storage-card {
    background: var(--bg-primary);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    width: 100px;
    text-align: center;
    transition: all 0.3s;
}

.game-storage-card.card-receiving {
    transform: scale(1.1);
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

.storage-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.storage-progress {
    font-weight: bold;
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 2px 8px;
    display: inline-block;
}

.game-storage-card.card-completed {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}
.game-storage-card.card-completed .storage-progress {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}


/* Gaokao Quiz Section */
.gaokao-quiz-container {
    margin-top: 2rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.gaokao-toggle-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}

.gaokao-toggle-btn:hover {
    background: rgba(0,0,0,0.05);
}

.gaokao-toggle-btn.active {
    border-bottom: 1px solid var(--border-color);
}

.gaokao-toggle-btn .toggle-icon {
    transition: transform 0.3s;
}

.gaokao-toggle-btn.active .toggle-icon {
    transform: rotate(180deg);
}

.gaokao-quiz-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
    padding: 0 1.5rem;
}

.gaokao-quiz-content.expanded {
    max-height: 1000px;
    padding: 1.5rem;
}

.gaokao-quiz-card {
    background: var(--bg-primary);
    border-left: 4px solid var(--accent-primary);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.gaokao-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--accent-secondary);
    color: white;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.gaokao-question-text {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.gaokao-input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 1rem;
}

.gaokao-input {
    flex: 1;
    max-width: 250px;
    padding: 0.6rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background: var(--surface);
    color: var(--text-primary);
    transition: all 0.2s;
}

.gaokao-input:focus {
    border-color: var(--accent-primary);
    outline: none;
}

.gaokao-input.success {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.gaokao-input.error {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.05);
}

.gaokao-feedback {
    display: none;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border-radius: 6px;
    font-size: 0.95rem;
}

.gaokao-feedback.success-fb {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}


/* Irregular Dex Game */
.irregular-game-container {
    background: var(--surface);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
}

.dex-books-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 2rem;
}

.dex-book {
    background: var(--bg-primary);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.dex-book.receiving {
    border-color: var(--accent-primary);
    transform: scale(1.05);
    background: rgba(59, 130, 246, 0.1);
}

.dex-book.completed {
    border-style: solid;
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.dex-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.dex-title {
    font-weight: bold;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.dex-progress {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 2px 10px;
    border-radius: 12px;
}
.dex-book.completed .dex-progress {
    color: var(--success);
    background: rgba(16, 185, 129, 0.15);
}


/* Checkpoint Game */
.checkpoint-game-container {
    background: #111827;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    border: 2px solid #374151;
    color: #e5e7eb;
    position: relative;
    overflow: hidden;
}

.checkpoint-screen {
    background: #1f2937;
    border: 2px solid #4b5563;
    border-radius: 8px;
    padding: 2rem;
    margin: 1.5rem 0;
    position: relative;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.3s;
}

.checkpoint-screen.granted {
    border-color: #10b981;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

.checkpoint-screen.denied {
    border-color: #ef4444;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
    animation: flash-red 0.5s ease-in-out;
}

@keyframes flash-red {
    0%, 100% { background: #1f2937; }
    50% { background: #451a1a; }
}

.checkpoint-text {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    line-height: 1.6;
    text-align: center;
    z-index: 2;
}

.checkpoint-blank {
    display: inline-block;
    border-bottom: 2px solid #9ca3af;
    padding: 0 10px;
    min-width: 60px;
    margin: 0 5px;
    color: #9ca3af;
}

.checkpoint-screen.granted .checkpoint-blank {
    color: #10b981;
    border-color: #10b981;
    font-weight: bold;
}

.checkpoint-screen.denied .checkpoint-blank {
    color: #ef4444;
    border-color: #ef4444;
}

.access-stamp {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(2);
    font-size: 2.5rem;
    font-weight: 900;
    border: 6px solid;
    padding: 10px 20px;
    border-radius: 12px;
    opacity: 0;
    z-index: 1;
    pointer-events: none;
    font-family: Impact, sans-serif;
    letter-spacing: 2px;
}

.access-stamp.show-granted {
    color: rgba(16, 185, 129, 0.5);
    border-color: rgba(16, 185, 129, 0.5);
    animation: stamp-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.access-stamp.show-denied {
    color: rgba(239, 68, 68, 0.5);
    border-color: rgba(239, 68, 68, 0.5);
    animation: stamp-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes stamp-in {
    0% { transform: translate(-50%, -50%) scale(3); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1) rotate(-15deg); opacity: 1; }
}

.checkpoint-input-wrapper {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    z-index: 2;
}

.checkpoint-input {
    background: #374151;
    border: 2px solid #6b7280;
    color: #fff;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    width: 250px;
}

.checkpoint-input:focus {
    outline: none;
    border-color: #3b82f6;
}

.checkpoint-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 1.1rem;
}

.checkpoint-btn:hover {
    background: #2563eb;
}

.checkpoint-feedback {
    display: none;
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.15);
    border-left: 4px solid #ef4444;
    color: #fca5a5;
    border-radius: 4px;
    font-size: 0.95rem;
    z-index: 2;
}

/* Checkpoint Redesign Styles */
.cp-action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.cp-btn-pass {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 2px solid #10b981;
    padding: 0.8rem 2rem;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    flex: 1;
    max-width: 200px;
}
.cp-btn-pass:hover {
    background: #10b981;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.cp-btn-deny {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 2px solid #ef4444;
    padding: 0.8rem 2rem;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    flex: 1;
    max-width: 200px;
}
.cp-btn-deny:hover {
    background: #ef4444;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.checkpoint-screen.alarm-orange {
    border-color: #f59e0b;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3), inset 0 0 15px rgba(245, 158, 11, 0.2);
    animation: alarm-pulse-orange 1s infinite;
}

@keyframes alarm-pulse-orange {
    0% { box-shadow: 0 0 20px rgba(245, 158, 11, 0.3), inset 0 0 15px rgba(245, 158, 11, 0.2); }
    50% { box-shadow: 0 0 40px rgba(245, 158, 11, 0.6), inset 0 0 30px rgba(245, 158, 11, 0.4); }
    100% { box-shadow: 0 0 20px rgba(245, 158, 11, 0.3), inset 0 0 15px rgba(245, 158, 11, 0.2); }
}

.access-stamp.show-detected {
    color: #f59e0b;
    border-color: #f59e0b;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
    transform: translate(-50%, -50%) scale(1) rotate(-10deg);
    opacity: 0.9;
}
.access-stamp.show-cleared {
    color: #3b82f6;
    border-color: #3b82f6;
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
    transform: translate(-50%, -50%) scale(1) rotate(15deg);
    opacity: 0.9;
}

.cp-modify-area {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.2);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    animation: fadeIn 0.3s ease-out;
}
.cp-modify-area.active {
    display: flex;
}

/* Fix Gaokao Quiz visibility when placed inside the dark Checkpoint game container */
.checkpoint-game-container .gaokao-quiz-container {
    background: #1f2937;
    border-color: #374151;
}
.checkpoint-game-container .gaokao-toggle-btn {
    color: #e5e7eb;
}
.checkpoint-game-container .gaokao-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}
.checkpoint-game-container .gaokao-toggle-btn.active {
    border-bottom-color: #374151;
}
.checkpoint-game-container .gaokao-quiz-card {
    background: #111827;
    border-left-color: #f59e0b; /* Gaokao orange/gold */
}
.checkpoint-game-container .gaokao-question-text {
    color: #e5e7eb;
}
.checkpoint-game-container .gaokao-input-wrapper {
    background: #1f2937;
    border-color: #374151;
}
.checkpoint-game-container .gaokao-input {
    color: #f8fafc;
}
.checkpoint-game-container .gaokao-input::placeholder {
    color: #9ca3af;
}
.checkpoint-game-container .gaokao-input:focus {
    border-color: #f59e0b;
}

/* Faction Sorting Game Styles */
.faction-game-container {
    background: #0f172a;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    border: 2px solid #334155;
    color: #e2e8f0;
    position: relative;
    overflow: hidden;
}

.faction-scanner {
    background: #1e293b;
    border: 2px solid #475569;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.faction-target-word {
    font-size: 2.5rem;
    font-weight: 800;
    color: #38bdf8;
    text-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
    font-family: 'Courier New', Courier, monospace;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.faction-target-word.fly-down {
    transform: translateY(100px) scale(0.5);
    opacity: 0;
}
.faction-target-word.shake-err {
    animation: shake-error 0.5s;
    color: #ef4444;
    text-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
}

.faction-buckets {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.faction-bucket {
    background: #1e293b;
    border: 2px solid #475569;
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    min-width: 120px;
    max-width: 180px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.faction-bucket:hover {
    transform: translateY(-5px);
    border-color: #38bdf8;
    box-shadow: 0 8px 20px rgba(56, 189, 248, 0.2);
    background: #233147;
}

.faction-bucket.success-glow {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.2);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.faction-bucket-icon {
    font-size: 2rem;
}

.faction-bucket-name {
    font-weight: bold;
    font-size: 0.9rem;
    color: #cbd5e1;
}

.faction-feedback {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    display: none;
    text-align: center;
}
