:root {
    --bg-main: #1a1b2e;
    --bg-secondary: #242540;
    --bg-elevated: #2a2b48;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #64748b;

    --accent-primary: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-glow: rgba(129, 140, 248, 0.25);

    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;

    --tag-red-bg: rgba(248, 113, 113, 0.15);
    --tag-red-text: #f87171;
    --tag-green-bg: rgba(52, 211, 153, 0.15);
    --tag-green-text: #34d399;

    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 32px;
    --radius-full: 999px;

    --shadow-light: rgba(255, 255, 255, 0.04);
    --shadow-dark: rgba(0, 0, 0, 0.5);

    --clay-base:
        8px 8px 20px var(--shadow-dark),
        -8px -8px 20px var(--shadow-light),
        inset -2px -2px 6px rgba(0, 0, 0, 0.3),
        inset 2px 2px 6px rgba(255, 255, 255, 0.03);

    --clay-sm:
        4px 4px 10px var(--shadow-dark),
        -4px -4px 10px var(--shadow-light),
        inset -1px -1px 3px rgba(0, 0, 0, 0.2),
        inset 1px 1px 3px rgba(255, 255, 255, 0.03);

    --clay-hover:
        10px 10px 24px var(--shadow-dark),
        -10px -10px 24px var(--shadow-light),
        inset -2px -2px 6px rgba(0, 0, 0, 0.15),
        inset 2px 2px 6px rgba(255, 255, 255, 0.05);

    --clay-inset:
        inset 4px 4px 10px var(--shadow-dark),
        inset -4px -4px 10px var(--shadow-light);

    --clay-primary:
        4px 4px 12px rgba(129, 140, 248, 0.3),
        -4px -4px 12px var(--shadow-light),
        inset -2px -2px 4px rgba(0, 0, 0, 0.3),
        inset 2px 2px 4px rgba(255, 255, 255, 0.08);

    --clay-primary-inset:
        inset 4px 4px 10px rgba(0, 0, 0, 0.4),
        inset -4px -4px 10px rgba(255, 255, 255, 0.03);
}

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

body {
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    background: linear-gradient(135deg, #020617 0%, #0f172a 100%);
    line-height: 1.5;
    overflow: hidden;
    min-height: 100vh;
}

/* ========== Base Layout ========== */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    padding: 20px;
    gap: 24px;
}

/* ========== Sidebar ========== */
.sidebar {
    width: 280px;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--clay-base);
    display: flex;
    flex-direction: column;
    padding: 28px 22px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.2);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 10px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 28px;
}

.logo-icon {
    font-size: 26px;
    color: var(--accent-primary);
    filter: drop-shadow(0 0 8px rgba(129, 140, 248, 0.4));
}

.logo-area h1 {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 24px 18px;
    margin-bottom: 28px;
    border-radius: var(--radius-md);
    background-color: var(--bg-main);
    box-shadow: var(--clay-inset);
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.avatar {
    width: 42px;
    height: 42px;
    background-color: var(--bg-secondary);
    box-shadow: var(--clay-sm);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    font-weight: 700;
    font-size: 17px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-level {
    font-size: 12px;
    color: var(--accent-primary);
    font-weight: 500;
}

/* ========== Navigation ========== */
.main-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 18px;
    background-color: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    position: relative;
    outline: none;
}

.nav-item i {
    width: 22px;
    text-align: center;
    font-size: 16px;
}

.nav-item:not(:disabled) {
    box-shadow: var(--clay-sm);
}

.nav-item:hover:not(:disabled):not(.active) {
    box-shadow: var(--clay-hover);
    transform: translateY(-2px);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
    box-shadow: var(--clay-inset);
    color: var(--accent-primary);
    background-color: var(--bg-main);
    border-color: rgba(129, 140, 248, 0.1);
}

.nav-item:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
    background-color: transparent;
    border-color: transparent;
}

.badge {
    position: absolute;
    right: 14px;
    background: linear-gradient(135deg, #f87171, #ef4444);
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    box-shadow: 0 2px 8px rgba(248, 113, 113, 0.4);
}

.badge.hidden {
    display: none;
}

/* ========== Quest Tracker ========== */
.quest-tracker {
    margin-top: auto;
    padding: 20px;
    background-color: var(--bg-main);
    border-radius: var(--radius-md);
    box-shadow: var(--clay-inset);
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.quest-tracker h3 {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

.progress-bar-container {
    width: 100%;
    height: 10px;
    background-color: var(--bg-main);
    box-shadow: var(--clay-inset);
    border-radius: var(--radius-full);
    margin-bottom: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-hover));
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(129, 140, 248, 0.3);
}

.progress-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.quest-status {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ========== Main Content Area ========== */
.content-area {
    flex-grow: 1;
    position: relative;
    overflow-y: auto;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--clay-base);
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-width: 0;
}

.content-area::-webkit-scrollbar,
.chat-container::-webkit-scrollbar {
    width: 6px;
}

.content-area::-webkit-scrollbar-track,
.chat-container::-webkit-scrollbar-track {
    background: transparent;
}

.content-area::-webkit-scrollbar-thumb,
.chat-container::-webkit-scrollbar-thumb {
    background: rgba(129, 140, 248, 0.2);
    border-radius: var(--radius-full);
}

.content-area::-webkit-scrollbar-thumb:hover,
.chat-container::-webkit-scrollbar-thumb:hover {
    background: rgba(129, 140, 248, 0.4);
}

.view-section {
    display: none;
    padding: 44px;
    max-width: 1100px;
    margin: 0 auto;
    min-height: 100%;
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.view-header {
    margin-bottom: 36px;
}

.view-header h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -0.8px;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* ========== Cards ========== */
.widget-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
}

.card {
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--clay-base);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.card:hover {
    box-shadow: var(--clay-hover);
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.07);
}

.highlight-card {
    position: relative;
}

.highlight-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: var(--radius-lg);
    background: radial-gradient(circle at top right, rgba(248, 113, 113, 0.08), transparent 60%);
    pointer-events: none;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

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

.highlight-card .card-header h3 i {
    color: var(--danger);
}

.card-body p {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 28px;
    line-height: 1.7;
}

.tag {
    font-size: 11px;
    font-weight: 700;
    padding: 5px 11px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag-red {
    background-color: var(--tag-red-bg);
    color: var(--tag-red-text);
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 22px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    outline: none;
    font-family: inherit;
}

.btn-sm {
    padding: 9px 14px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), #6366f1);
    color: white;
    box-shadow: var(--clay-primary);
}

.btn-primary:hover {
    box-shadow: 6px 6px 16px rgba(129, 140, 248, 0.35), -4px -4px 12px var(--shadow-light);
    transform: translateY(-1px);
}

.btn-primary:active {
    box-shadow: var(--clay-primary-inset);
    transform: scale(0.98);
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: var(--clay-sm);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-secondary:active,
.btn-secondary:hover:active {
    box-shadow: var(--clay-inset);
    transform: scale(0.98);
}

.btn-secondary:hover {
    box-shadow: var(--clay-hover);
    transform: translateY(-2px);
}

/* ========== Stats List ========== */
.stats-card h3 {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.stats-card h3 i {
    color: var(--accent-primary);
}

.stat-grid {
    display: flex;
    justify-content: space-between;
    margin: 12px 0;
}

.stat-item {
    text-align: center;
    flex: 1;
}

.stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--accent-primary);
    text-shadow: 0 0 15px rgba(129, 140, 248, 0.3);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mastery-list {
    list-style: none;
}

.mastery-list li {
    display: flex;
    justify-content: space-between;
    padding: 14px 16px;
    margin-bottom: 10px;
    background-color: var(--bg-main);
    border-radius: var(--radius-sm);
    box-shadow: var(--clay-inset);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.mastery-list li:last-child {
    margin-bottom: 0;
}

.mastery-score {
    font-weight: 700;
}

.mastery-score.high {
    color: var(--success);
}

.mastery-score.medium {
    color: var(--warning);
}

.mastery-score.low {
    color: var(--danger);
}

/* ========== Skill Tree ========== */
.skill-tree-container {
    position: relative;
    height: 520px;
    background-color: var(--bg-main);
    border-radius: var(--radius-lg);
    box-shadow: var(--clay-inset);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.skill-tree-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(129, 140, 248, 0.04) 1px, transparent 0);
    background-size: 32px 32px;
    pointer-events: none;
}

.tree-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.tree-svg line {
    stroke-linecap: round;
    transition: stroke 0.3s ease, stroke-opacity 0.3s ease;
}

.tree-node {
    position: absolute;
    padding: 12px 24px;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    font-size: 13px;
    font-weight: 700;
    transform: translate(-50%, -50%);
    box-shadow: var(--clay-sm);
    z-index: 2;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    white-space: nowrap;
    user-select: none;
}

.tree-node:hover:not(.locked) {
    box-shadow: var(--clay-hover);
    transform: translate(-50%, -54%);
}

.tree-node.mastered {
    color: var(--success);
    border-color: rgba(52, 211, 153, 0.25);
    box-shadow: var(--clay-sm), 0 0 14px rgba(52, 211, 153, 0.12);
}

.tree-node.partial {
    color: var(--warning);
    border-color: rgba(251, 191, 36, 0.25);
    box-shadow: var(--clay-sm), 0 0 14px rgba(251, 191, 36, 0.12);
}

.tree-node.critical {
    color: var(--danger);
    border-color: rgba(248, 113, 113, 0.3);
    box-shadow: var(--clay-sm), 0 0 14px rgba(248, 113, 113, 0.12);
}

.tree-node.locked {
    box-shadow: var(--clay-inset);
    color: var(--text-tertiary);
    cursor: not-allowed;
    border-color: transparent;
    background-color: var(--bg-main);
    opacity: 0.7;
}

.tree-node.locked:hover {
    transform: translate(-50%, -50%);
    box-shadow: var(--clay-inset);
}

.tree-node.selected {
    box-shadow: var(--clay-hover), 0 0 0 2px var(--accent-primary);
}

.pulse {
    animation: pulseObj 2s infinite;
}

@keyframes pulseObj {
    0% {
        box-shadow: var(--clay-sm), 0 0 0 0 rgba(248, 113, 113, 0.35);
    }

    70% {
        box-shadow: var(--clay-sm), 0 0 0 14px rgba(248, 113, 113, 0);
    }

    100% {
        box-shadow: var(--clay-sm), 0 0 0 0 rgba(248, 113, 113, 0);
    }
}

/* ========== Node Detail Panel ========== */
.node-detail-panel {
    margin-top: 24px;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--clay-base);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 28px;
    animation: slideUp 0.3s ease-out;
}

.node-detail-panel.hidden {
    display: none;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.node-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.node-detail-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.node-detail-title h3 {
    font-size: 20px;
    font-weight: 700;
}

.success-badge {
    animation: bounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}


.node-detail-icon {
    font-size: 24px;
}

.node-detail-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
}

.node-detail-status.status-mastered {
    background: var(--tag-green-bg);
    color: var(--tag-green-text);
}

.node-detail-status.status-partial {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
}

.node-detail-status.status-critical {
    background: var(--tag-red-bg);
    color: var(--tag-red-text);
}

.node-detail-status.status-locked {
    background: rgba(71, 85, 105, 0.2);
    color: var(--text-tertiary);
}

.node-detail-body {
    color: var(--text-secondary);
    line-height: 1.75;
    font-size: 15px;
    margin-bottom: 24px;
}

.node-detail-body h4 {
    color: var(--text-primary);
    font-size: 15px;
    margin: 16px 0 8px;
}

.node-detail-body h4:first-child {
    margin-top: 0;
}

.node-detail-body .math-block {
    background-color: var(--bg-main);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin: 10px 0;
    text-align: center;
    box-shadow: var(--clay-inset);
    color: var(--text-primary);
    font-size: 16px;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.node-detail-body ul {
    list-style: none;
    padding: 0;
    margin: 8px 0;
}

.node-detail-body ul li {
    padding: 6px 0 6px 20px;
    position: relative;
}

.node-detail-body ul li::before {
    content: '›';
    position: absolute;
    left: 4px;
    color: var(--accent-primary);
    font-weight: 700;
}

.node-detail-actions {
    display: flex;
    gap: 12px;
}

.node-detail-actions .btn {
    flex: 1;
}

/* ========== Battle Arena ========== */
.battle-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 88px);
    border-radius: var(--radius-lg);
    background-color: var(--bg-main);
    box-shadow: var(--clay-base);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.04);
    position: relative;
    /* Contain absolute children */
}

.battle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 28px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    z-index: 10;
    flex-shrink: 0;
}

.battle-info h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.battle-info .topic {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 3px;
}

.battle-meta {
    display: flex;
    align-items: center;
    gap: 16px;
}

.battle-progress {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-primary);
    padding: 6px 14px;
    background-color: var(--bg-main);
    border-radius: var(--radius-full);
    box-shadow: var(--clay-inset);
}

.chat-container {
    flex: 1;
    min-height: 0;
    padding: 28px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background-color: var(--bg-main);
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: 16px;
    max-width: 85%;
    animation: msgSlide 0.3s ease-out;
}

@keyframes msgSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai-avatar,
.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.ai-avatar {
    background-color: var(--bg-secondary);
    box-shadow: var(--clay-sm);
    color: var(--accent-primary);
    border: 1px solid rgba(129, 140, 248, 0.1);
}

.user-avatar {
    background: linear-gradient(135deg, var(--accent-primary), #6366f1);
    color: white;
    box-shadow: var(--clay-primary);
}

.message-content {
    background-color: var(--bg-secondary);
    padding: 18px 22px;
    border-radius: var(--radius-md);
    font-size: 15px;
    line-height: 1.65;
    color: var(--text-primary);
    box-shadow: var(--clay-sm);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.message-content p:last-child {
    margin-bottom: 0;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 2px 0;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--accent-primary);
    border-radius: 50%;
    animation: typingBounce 1s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    50% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

/* Solved State Flash */
.ai-message.solved-state .message-content {
    border-color: var(--success);
    background: linear-gradient(135deg, var(--bg-secondary), rgba(52, 211, 153, 0.05));
    box-shadow: 0 0 15px rgba(52, 211, 153, 0.15), var(--clay-sm);
}

/* Next Button Animation */
.advance-btn-container {
    animation: slideInUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.user-message .message-content {
    background: linear-gradient(135deg, var(--accent-primary), #6366f1);
    color: white;
    box-shadow: var(--clay-primary);
    border-color: transparent;
}

.math-block {
    background-color: var(--bg-main);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin: 12px 0;
    text-align: center;
    box-shadow: var(--clay-inset);
    color: var(--text-primary);
    font-size: 17px;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.solved-state .message-content {
    background: linear-gradient(135deg, #10b981, #059669);
    border: 2px solid #34d399;
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.4), var(--clay-primary);
    color: white;
}

.solved-state .math-pill {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-message .math-block {
    background-color: rgba(255, 255, 255, 0.12);
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.15), inset -2px -2px 4px rgba(255, 255, 255, 0.08);
    color: white;
    border-color: transparent;
}

.math-pill {
    background-color: rgba(15, 23, 42, 0.4);
    padding: 2px 10px;
    border-radius: var(--radius-sm);
    display: inline-block;
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.2);
    margin: 0 4px;
    font-family: inherit;
    color: var(--accent-primary);
    font-weight: 500;
}

.math-block .math-pill {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.ai-message:not(.task-message) .math-pill {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 4px !important;
    text-shadow: 0 0 10px rgba(129, 140, 248, 0.3), 0 0 2px rgba(0, 0, 0, 0.4);
}

.ai-message:not(.task-message) .math-block {
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 12px 0;
    text-shadow: 0 0 15px rgba(129, 140, 248, 0.25);
}


.hint-message .message-content {
    border-left: 3px solid var(--warning);
    background-color: rgba(251, 191, 36, 0.06);
}

.reveal-message .message-content {
    border-left: 3px solid var(--accent-primary);
    background-color: var(--accent-glow);
}

.chat-input-area {
    padding: 20px 28px;
    display: flex;
    gap: 14px;
    background-color: var(--bg-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    z-index: 10;
    flex-shrink: 0;
}

.chat-input-area input {
    flex-grow: 1;
    padding: 14px 22px;
    background-color: var(--bg-main);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 15px;
    color: var(--text-primary);
    box-shadow: var(--clay-inset);
    outline: none;
    transition: all 0.3s ease;
}

.chat-input-area input::placeholder {
    color: var(--text-tertiary);
}

.chat-input-area input:focus {
    box-shadow: var(--clay-inset), 0 0 0 2px rgba(129, 140, 248, 0.2);
    border-color: rgba(129, 140, 248, 0.15);
}

.chat-input-area button {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* ========== MathLive Field Overrides ========== */
math-field {
    --text-color: var(--text-primary);
    --selection-background-color: rgba(129, 140, 248, 0.4);
    --keyboard-zindex: 10000;
    --keyboard-background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 14px 22px;
}

math-field::part(virtual-keyboard-toggle) {
    display: none;
}

math-field::part(menu-toggle) {
    display: none;
}

/* ========== Typing Indicator ========== */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 6px 10px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-primary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
    box-shadow: 0 0 6px rgba(129, 140, 248, 0.3);
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========== Completion States ========== */
.quest-complete {
    animation: questPop 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

@keyframes questPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.card.completed-card {
    border-color: rgba(52, 211, 153, 0.15);
}

.card.completed-card::before {
    background: radial-gradient(circle at top right, rgba(52, 211, 153, 0.08), transparent 60%);
}

.card.completed-card .card-header h3 i {
    color: var(--success);
}

/* ========== XP Toast ========== */
.xp-toast {
    position: fixed;
    top: 32px;
    right: 32px;
    background: linear-gradient(135deg, var(--accent-primary), #6366f1);
    color: white;
    padding: 16px 28px;
    border-radius: var(--radius-md);
    box-shadow: var(--clay-primary), 0 8px 32px rgba(0, 0, 0, 0.4);
    font-weight: 700;
    font-size: 16px;
    z-index: 9999;
    animation: toastIn 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55), toastOut 0.3s ease 2.5s forwards;
    display: flex;
    align-items: center;
    gap: 10px;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* ========== Responsive ========== */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
        padding: 12px;
        gap: 12px;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 12px 18px;
        border-radius: var(--radius-md);
    }

    .logo-area {
        padding: 0;
    }

    .logo-area h1,
    .quest-tracker,
    .user-info {
        display: none;
    }

    .user-profile {
        margin: 0;
        padding: 6px;
        box-shadow: none;
        background: transparent;
        border: none;
    }

    .main-nav {
        flex-direction: row;
        gap: 6px;
    }

    .nav-item {
        padding: 10px;
        font-size: 0;
    }

    .nav-item i {
        font-size: 18px;
    }

    .badge {
        display: none;
    }

    .content-area {
        height: auto;
        flex: 1;
        min-height: 0;
    }

    .view-section {
        padding: 28px 20px;
    }

    .view-header h2 {
        font-size: 24px;
    }

    .widget-grid {
        grid-template-columns: 1fr;
    }

    .battle-container {
        height: calc(100vh - 140px);
    }

    .skill-tree-container {
        height: 420px;
    }

    .node-detail-panel {
        padding: 20px;
    }

    .node-detail-actions {
        flex-direction: column;
    }
}

/* ========== Modals ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 1;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background-color: var(--bg-main);
    border-radius: var(--radius-lg);
    box-shadow: var(--clay-hover), 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 32px;
    width: 90%;
    max-width: 500px;
    transform: scale(1);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.hidden .modal-content {
    transform: scale(0.9) translateY(40px);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.modal-body p {
    color: var(--text-secondary);
    font-size: 15px;
}

.input-group {
    margin: 20px 0 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input {
    background-color: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 14px;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    outline: none;
    box-shadow: var(--clay-inset);
}

.input-group input:focus {
    border-color: var(--accent-primary);
    box-shadow: var(--clay-inset), 0 0 0 2px rgba(129, 140, 248, 0.2);
}

/* ========== Cleverness Switch ========== */
.cleverness-switch {
    display: flex;
    background: var(--bg-main);
    padding: 3px;
    border-radius: var(--radius-md);
    box-shadow: var(--clay-inset);
    margin-right: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.switch-opt {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    padding: 6px 12px;
    border-radius: calc(var(--radius-md) - 2px);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.switch-opt i {
    font-size: 10px;
}

.switch-opt.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: var(--clay-flat);
}

.switch-opt[data-mode="groq"].active {
    color: #f59e0b;
    /* Amber for Llama/Fast */
}

.switch-opt[data-mode="gemini"].active {
    color: #818cf8;
    /* Indigo for Gemini/Smart */
}

.switch-opt:hover:not(.active) {
    color: var(--text-secondary);
}

/* ==========================================================================
   ONBOARDING REFINEMENTS
   ========================================================================== */

.hidden-view {
    display: none !important;
}

.onboarding-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #05070a;
    /* Deepest black base */
}

.onboarding-container.hidden {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

#grid-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    opacity: 0.25;
    /* Visible and elegant */
}

.mesh-gradient {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, #0f172a 0%, #020617 100%);
    background-image:
        radial-gradient(at 10% 20%, #1e293b 0, transparent 40%),
        radial-gradient(at 80% 10%, #0f172a 0, transparent 50%),
        radial-gradient(at 50% 50%, #020617 0, transparent 50%),
        radial-gradient(at 10% 80%, #0f172a 0, transparent 50%);
    filter: blur(80px);
    animation: meshRotate 20s ease-in-out infinite alternate;
    z-index: -3;
    opacity: 1;
}

@keyframes meshRotate {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(1.1) rotate(5deg);
    }
}

.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}


.particle {
    position: absolute;
    color: rgba(255, 255, 255, 0.6) !important;
    /* Whiter/Less transparent */
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    font-weight: 300;
    z-index: -1;
    pointer-events: none !important;
    will-change: transform;
}

.onboarding-card {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 40px;
    padding: 60px;
    width: 640px;
    max-width: 95%;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 20px 40px -10px rgba(0, 0, 0, 0.5),
        inset 0 1px 1px rgba(255, 255, 255, 0.05);
    text-align: center;
    position: relative;
    z-index: 10;
}

.onboarding-step {
    display: none;
}

.onboarding-step.active {
    display: block;
    animation: stepFadeIn 0.5s ease forwards;
}

@keyframes stepFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-icon {
    font-size: 48px;
    margin-bottom: 24px;
    display: inline-block;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.onboarding-card h2 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 12px;
    color: white;
    letter-spacing: -0.01em;
}

.onboarding-card p {
    color: #94a3b8;
    font-size: 18px;
    margin-bottom: 40px;
    line-height: 1.6;
    font-weight: 300;
}

#ob-name {
    width: 100%;
    padding: 18px 24px;
    background: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid rgba(148, 163, 184, 0.2) !important;
    border-radius: 16px;
    color: white !important;
    font-size: 18px;
    font-family: 'Outfit', sans-serif;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

#ob-name:focus {
    outline: none;
    border-color: #818cf8 !important;
    background: rgba(30, 41, 59, 0.8) !important;
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.1), inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

#ob-name:focus::placeholder {
    color: transparent;
}

.form-group label {
    display: block;
    margin-bottom: 12px;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.form-group {
    text-align: center;
    margin-bottom: 32px;
}

.form-group input {
    text-align: center;
}

.grade-selector {
    display: flex;
    gap: 16px;
    margin-bottom: 40px;
}

.grade-option {
    flex: 1;
    padding: 24px 16px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0.4;
    filter: grayscale(0.5);
    font-weight: 700;
    /* Bold as requested */
}

.grade-option:hover:not(.disabled) {
    transform: scale(1.08);
    /* Pop effect */
    opacity: 0.8;
}

.grade-option.active {
    border-color: #818cf8;
    background: rgba(129, 140, 248, 0.2);
    opacity: 1;
    filter: grayscale(0);
    box-shadow: 0 0 30px rgba(129, 140, 248, 0.2);
    transform: scale(1.05);
}

.curriculum-note-inline {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
    margin: 0;
    opacity: 0.8;
}

.curriculum-note-inline .highlight {
    color: #818cf8;
    font-weight: 700;
}

.grade-option.disabled {
    cursor: not-allowed;
    opacity: 0.15;
}

/* Material-Precision Slider - Hybrid Polish */
#ob-confidence {
    -webkit-appearance: none;
    width: 100%;
    height: 12px;
    background: rgba(129, 140, 248, 0.15);
    /* Light Indigo Wire */
    border-radius: 10px !important;
    outline: none;
    margin: 20px 0;
    border: none;
    cursor: pointer;
}

#ob-confidence::-webkit-slider-runnable-track {
    height: 12px;
    background: transparent;
    border-radius: 10px;
}

#ob-confidence::-webkit-slider-thumb {
    -webkit-appearance: none !important;
    height: 28px !important;
    width: 4px !important;
    /* Vertical Separator Hook */
    border-radius: 2px !important;
    background: white !important;
    border: 1px solid #818cf8 !important;
    cursor: pointer;
    margin-top: -8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
    position: relative;
    z-index: 5;
}

#ob-confidence::-moz-range-thumb {
    height: 28px;
    width: 4px;
    border-radius: 2px;
    background: white;
    border: 1px solid #818cf8;
}

#ob-confidence:active::-webkit-slider-thumb {
    transform: scaleY(1.1);
    /* Subtle Vertical Swell */
}

.confidence-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #a5b4fc;
    font-weight: 500;
}

.confidence-value-display {
    transition: all 0.2s ease;
    font-weight: 700;
    color: #818cf8;
    margin-top: 8px;
}

/* Accordion Smooth Transitions */
.accordion-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s ease-in-out;
    padding: 0 20px;
    border-top: none;
    opacity: 0;
}

.accordion-item.custom-dropdown-active .accordion-body {
    grid-template-rows: 1fr;
    padding: 20px;
    border-top: 1px solid rgba(129, 140, 248, 0.2);
    opacity: 1;
}

.accordion-body-inner {
    overflow: hidden;
}

/* Sub-Knowledge Pills */
.sub-knowledge-pill {
    padding: 6px 12px;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 12px;
    color: #cbd5e1;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.sub-knowledge-pill:hover {
    background: rgba(129, 140, 248, 0.15);
    border-color: rgba(129, 140, 248, 0.5);
}

.sub-knowledge-pill.selected-sub-pill {
    background: rgba(16, 185, 129, 0.15);
    /* Emerald tint for mastered */
    border-color: #10b981;
    color: #34d399;
}

#diag-answer {
    width: 100%;
    max-width: 400px;
    margin-top: 24px;
    padding: 16px 24px;
    background: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid rgba(148, 163, 184, 0.2) !important;
    border-radius: 12px;
    color: white !important;
    font-size: 18px;
    text-align: center;
    font-family: 'Outfit', sans-serif;
    transition: all 0.3s ease;
}

#diag-answer:focus {
    outline: none;
    border-color: #818cf8 !important;
    box-shadow: 0 0 20px rgba(129, 140, 248, 0.1);
}

.nav-btns {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.confidence-slider-container {
    margin: 30px 0;
    padding: 0 20px;
}

.diagnostic-question {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
}

.onboarding-container.hidden {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* ====================================================
   NOTIFICATIONS / TOAST SYSTEM
   ==================================================== */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 99999;
    pointer-events: none;
}

.toast {
    position: relative;
    padding: 16px 24px;
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    min-width: 320px;
    max-width: 450px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    pointer-events: all;
    overflow: hidden;
}

.toast.show {
    transform: translateX(0);
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--accent-primary);
}

.toast-icon {
    font-size: 20px;
    margin-top: 2px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.toast-message {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* Types */
.toast-success::before {
    background: #10b981;
}

.toast-success .toast-icon {
    color: #10b981;
}

.toast-error::before {
    background: #ef4444;
}

.toast-error .toast-icon {
    color: #ef4444;
}

.toast-warning::before {
    background: #f59e0b;
}

.toast-warning .toast-icon {
    color: #f59e0b;
}

.toast-info::before {
    background: #3b82f6;
}

.toast-info .toast-icon {
    color: #3b82f6;
}

@keyframes toast-progress {
    from {
        width: 100%;
    }

    to {
        width: 0%;
    }
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    animation: toast-progress linear forwards;
}

/* ====================================================
   FLOATING SKIP ACTION
   ==================================================== */
.floating-actions {
    position: absolute;
    top: 100px;
    /* Neatly below the header with extra breathing room */
    right: 12px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.floating-actions:not(.hidden) {
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
}

.floating-actions .skip-btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    background: rgba(30, 41, 59, 0.8) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: var(--text-secondary) !important;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.floating-actions .skip-btn:hover {
    transform: scale(1.05);
    background: rgba(239, 68, 68, 0.15) !important;
    /* Subtle red for skip */
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: white !important;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

/* ====================================================
   MATH EMPHASIS & PILLS
   ==================================================== */
.math-pill {
    display: inline-block;
    background: rgba(129, 140, 248, 0.1);
    border: 1px solid rgba(129, 140, 248, 0.2);
    padding: 2px 8px;
    border-radius: 6px;
    color: var(--accent-primary);
    font-weight: 500;
}

.math-block {
    margin: 16px 0;
    padding: 18px;
    background: rgba(15, 23, 42, 0.4);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: var(--clay-inset);
    text-align: center;
    font-size: 1.1rem;
    overflow-x: auto;
}

.solved-state .math-block {
    background: rgba(52, 211, 153, 0.05);
    border-color: rgba(52, 211, 153, 0.2);
}