/* ==========================================================================
   Bijective Base-6 Explorer - Modern Glassmorphic Design System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    /* Color Tokens - Dark Mode (Default) */
    --bg-color: #090d16;
    --bg-gradient: radial-gradient(circle at 50% 0%, #171b2f 0%, #0b0f19 50%, #05070c 100%);
    --card-bg: rgba(18, 24, 38, 0.75);
    --card-bg-solid: #121826;
    --card-hover-bg: rgba(28, 36, 56, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(99, 102, 241, 0.35);
    
    --text-color: #f1f5f9;
    --text-color-muted: #94a3b8;
    --text-dim: #64748b;
    --header-color: #ffffff;
    
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-tertiary: #ec4899;
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    --accent-glow: rgba(99, 102, 241, 0.35);
    --cyan-glow: rgba(6, 182, 212, 0.25);
    --final-answer-color: #38bdf8;
    
    --input-bg-color: rgba(15, 21, 34, 0.85);
    --input-border: rgba(255, 255, 255, 0.12);
    --input-focus-border: #6366f1;
    --input-focus-glow: rgba(99, 102, 241, 0.25);
    
    --rain-color: #818cf8;
    --table-header-bg: rgba(30, 41, 59, 0.85);
    --table-cell-hover: rgba(99, 102, 241, 0.18);
    --table-active-header: #818cf8;
    
    --glass-blur: blur(16px);
    --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.2);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

[data-theme="light"] {
    /* Color Tokens - Light Mode */
    --bg-color: #f3f6fc;
    --bg-gradient: radial-gradient(circle at 50% 0%, #e8eeff 0%, #f1f5fb 50%, #e2e8f0 100%);
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-bg-solid: #ffffff;
    --card-hover-bg: rgba(255, 255, 255, 0.98);
    --border-color: rgba(15, 23, 42, 0.08);
    --border-highlight: rgba(79, 70, 229, 0.35);
    
    --text-color: #0f172a;
    --text-color-muted: #475569;
    --text-dim: #94a3b8;
    --header-color: #0f172a;
    
    --accent-primary: #4f46e5;
    --accent-secondary: #7c3aed;
    --accent-tertiary: #c026d3;
    --accent-cyan: #0284c7;
    --accent-emerald: #059669;
    --accent-amber: #d97706;
    
    --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #c026d3 100%);
    --accent-glow: rgba(79, 70, 229, 0.2);
    --cyan-glow: rgba(2, 132, 199, 0.15);
    --final-answer-color: #0284c7;
    
    --input-bg-color: rgba(255, 255, 255, 0.95);
    --input-border: rgba(15, 23, 42, 0.15);
    --input-focus-border: #4f46e5;
    --input-focus-glow: rgba(79, 70, 229, 0.2);
    
    --rain-color: #4f46e5;
    --table-header-bg: rgba(226, 232, 240, 0.9);
    --table-cell-hover: rgba(79, 70, 229, 0.12);
    --table-active-header: #4f46e5;
    
    --shadow-soft: 0 10px 30px -10px rgba(15, 23, 42, 0.08);
    --shadow-glow: 0 0 25px rgba(79, 70, 229, 0.15);
}

/* ==========================================================================
   Base & Resets
   ========================================================================== */
* {
    box-sizing: border-box;
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.2s ease;
}

html, body {
    max-width: 100vw;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-text-size-adjust: 100%;
    -webkit-overflow-scrolling: touch;
}

body {
    background-color: var(--bg-color);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-color);
    font-family: var(--font-sans);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding-top: max(env(safe-area-inset-top, 0px), 0px);
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 24px);
    padding-left: max(env(safe-area-inset-left, 0px), 12px);
    padding-right: max(env(safe-area-inset-right, 0px), 12px);
    overflow-x: hidden;
    line-height: 1.6;
}

#background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.35;
    pointer-events: none;
}

.container {
    position: relative;
    z-index: 1;
    max-width: 1180px;
}

/* ==========================================================================
   Header & Brand Title
   ========================================================================== */
.brand-header {
    margin-bottom: 2.5rem;
    padding-top: 1rem;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    border-radius: 9999px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-primary);
    backdrop-filter: var(--glass-blur);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-soft);
}

.brand-badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald);
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.brand-title {
    font-weight: 800;
    font-size: clamp(2rem, 5vw, 3.25rem);
    letter-spacing: -0.03em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.brand-subtitle {
    color: var(--text-color-muted);
    font-size: 1.1rem;
    max-width: 650px;
    margin: 0 auto;
}

/* ==========================================================================
   Settings Floating Button & Modal
   ========================================================================== */
.settings-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 48px;
    height: 48px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: var(--text-color);
    backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-soft);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

.settings-btn:hover {
    transform: rotate(45deg) scale(1.08);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    color: var(--accent-primary);
}

.modal-content {
    background: var(--card-bg-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft), var(--shadow-glow);
    color: var(--text-color);
    backdrop-filter: var(--glass-blur);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

[data-theme="light"] .btn-close {
    filter: none;
}

.modal-title {
    font-weight: 700;
    letter-spacing: -0.01em;
}

.modal-body {
    padding: 1.5rem;
}

.modal-backdrop.show {
    backdrop-filter: blur(6px);
    background-color: rgba(0, 0, 0, 0.6);
}

.language-option {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm) !important;
    color: var(--text-color);
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.language-option:hover {
    background: var(--card-hover-bg);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateX(4px);
}

.language-option.active {
    background: var(--accent-gradient) !important;
    border-color: transparent !important;
    color: #ffffff !important;
    box-shadow: var(--shadow-glow);
}

/* ==========================================================================
   Navigation Tabs
   ========================================================================== */
.nav-tabs-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 0.5rem 0.5rem 0;
    backdrop-filter: var(--glass-blur);
}

.nav-tabs {
    border-bottom: none;
    gap: 0.35rem;
}

.nav-tabs .nav-link {
    color: var(--text-color-muted);
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    padding: 0.85rem 1.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    background: transparent;
    transition: all 0.2s ease;
}

.nav-tabs .nav-link:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.04);
}

.nav-tabs .nav-link.active {
    color: var(--text-color);
    background: var(--card-bg-solid);
    border: 1px solid var(--border-color);
    border-bottom-color: var(--card-bg-solid);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
}

.nav-tabs .nav-link.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

/* Tab Content Box */
.tab-content {
    background: var(--card-bg-solid);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow-soft);
    backdrop-filter: var(--glass-blur);
    overflow: hidden;
}

.tab-pane {
    animation: tabFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ==========================================================================
   Section & Card Styling
   ========================================================================== */
.card-panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: var(--shadow-soft);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.card-panel:hover {
    border-color: var(--border-highlight);
    box-shadow: var(--shadow-soft), var(--shadow-glow);
}

.card-panel h2 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--header-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.card-panel p {
    color: var(--text-color-muted);
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
}

/* ==========================================================================
   Form Controls, Inputs, & Buttons
   ========================================================================== */
.form-label {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.form-control {
    background: var(--input-bg-color);
    color: var(--text-color);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    background: var(--input-bg-color);
    color: var(--text-color);
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px var(--input-focus-glow);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-dim);
    font-family: var(--font-sans);
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--accent-gradient);
    border: none;
    color: #ffffff;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
    color: #ffffff;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary-action {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-weight: 600;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary-action:hover {
    background: var(--card-hover-bg);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* ==========================================================================
   Quick Virtual Keypad for Base-6
   ========================================================================== */
.keypad-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.75rem;
    margin-bottom: 1rem;
}

.keypad-btn {
    flex: 1 1 calc(16.66% - 0.4rem);
    min-width: 40px;
    height: 42px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-color);
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}

.keypad-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.keypad-btn:active {
    transform: translateY(1px);
}

.keypad-btn.action-btn {
    font-size: 0.85rem;
    font-family: var(--font-sans);
    background: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   Quick Preset Badges
   ========================================================================== */
.preset-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.6rem;
    margin-bottom: 1rem;
}

.preset-chip-label {
    font-size: 0.78rem;
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-inline-end: 0.25rem;
}

.chip-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 0.2rem 0.65rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-color-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.chip-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #ffffff;
    transform: scale(1.05);
}

/* ==========================================================================
   Live Conversion Result Cards
   ========================================================================== */
.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.85rem;
    margin-top: 1rem;
}

.conversion-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.conversion-card:hover {
    border-color: var(--border-highlight);
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.conversion-card.featured {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(139, 92, 246, 0.06) 100%);
    border: 1.5px solid var(--accent-primary);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

.conversion-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.conversion-card-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-dim);
}

.conversion-card.featured .conversion-card-label {
    color: var(--accent-primary);
}

.conversion-value {
    font-family: var(--font-mono);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-color);
    word-break: break-all;
}

.conversion-card.featured .conversion-value {
    color: var(--final-answer-color);
    font-size: 1.5rem;
}

.copy-mini-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.copy-mini-btn:hover {
    color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   Calculator Results Area
   ========================================================================== */
#result-area {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    animation: fadeIn 0.4s ease;
}

.op-result-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.25s ease;
}

.op-result-item:hover {
    border-color: var(--border-highlight);
    transform: translateY(-3px);
    box-shadow: var(--shadow-soft), var(--shadow-glow);
}

.op-result-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0.8;
}

.op-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.op-problem {
    font-family: var(--font-mono);
    color: var(--text-color-muted);
    font-size: 1rem;
    margin-bottom: 0.4rem;
}

.op-answer {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 800;
    color: var(--final-answer-color);
    line-height: 1.2;
    margin-bottom: 0.35rem;
    text-shadow: 0 0 15px rgba(56, 189, 248, 0.25);
}

.op-step {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    color: var(--text-dim);
}

#error-display {
    color: #ef4444;
    font-weight: 600;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-sm);
    display: none;
}

#error-display.visible {
    display: block;
}

/* ==========================================================================
   Tables View
   ========================================================================== */
.table-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
}

.table-size-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-inspector-badge {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--final-answer-color);
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.85rem;
}

.table-responsive {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--card-bg);
    max-height: 520px;
    overflow: auto;
    position: relative;
    box-shadow: var(--shadow-soft);
}

.bijective-matrix-table {
    margin-bottom: 0;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.bijective-matrix-table th,
.bijective-matrix-table td {
    padding: 0.55rem 0.65rem;
    text-align: center;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.bijective-matrix-table thead th {
    position: sticky;
    top: 0;
    background: var(--table-header-bg);
    backdrop-filter: var(--glass-blur);
    z-index: 2;
    color: var(--accent-primary);
    font-weight: 700;
}

.bijective-matrix-table tbody th {
    position: sticky;
    left: 0;
    background: var(--table-header-bg);
    backdrop-filter: var(--glass-blur);
    z-index: 1;
    color: var(--accent-primary);
    font-weight: 700;
}

.bijective-matrix-table thead th:first-child {
    z-index: 3;
    left: 0;
    background: var(--table-header-bg);
}

.bijective-matrix-table td {
    color: var(--text-color);
    cursor: pointer;
    transition: background-color 0.1s ease, color 0.1s ease;
}

.bijective-matrix-table td:hover,
.bijective-matrix-table td.cell-highlight {
    background: var(--table-cell-hover);
    color: var(--final-answer-color);
    font-weight: 700;
}

.bijective-matrix-table th.header-highlight {
    background: var(--accent-primary) !important;
    color: #ffffff !important;
}

/* ==========================================================================
   Practice / Quiz Mode
   ========================================================================== */
.quiz-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    max-width: 620px;
    margin: 0 auto;
    box-shadow: var(--shadow-soft);
}

.quiz-score-banner {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.quiz-stat {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 0.35rem 0.95rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color-muted);
}

.quiz-stat .val {
    font-family: var(--font-mono);
    color: var(--accent-primary);
    font-weight: 700;
}

.quiz-question-box {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1.5rem;
}

.quiz-question-box code {
    background: rgba(99, 102, 241, 0.15);
    color: var(--final-answer-color);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 1.6rem;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* ==========================================================================
   Study Tab
   ========================================================================== */
.study-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    margin-bottom: 2rem;
}

.example-box {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-primary);
    border-radius: var(--radius-sm);
    padding: 1.25rem 1.5rem;
    margin-top: 1rem;
    font-size: 0.95rem;
}

[data-theme="light"] .example-box {
    background: rgba(241, 245, 249, 0.8);
}

.comparison-table-wrapper {
    margin-top: 1.5rem;
    overflow-x: auto;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table th,
.comparison-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.comparison-table th {
    color: var(--accent-primary);
    font-weight: 700;
}

.pros-cons-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    height: 100%;
}

.pros-cons-card.pros {
    border-top: 4px solid var(--accent-emerald);
}

.pros-cons-card.cons {
    border-top: 4px solid var(--accent-tertiary);
}

.pros-cons-card ul {
    list-style: none;
    padding-left: 0;
    margin-top: 1rem;
}

.pros-cons-card li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.85rem;
    color: var(--text-color-muted);
}

.pros-cons-card.pros li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--accent-emerald);
    font-weight: bold;
}

.pros-cons-card.cons li::before {
    content: '✕';
    position: absolute;
    left: 0;
    color: var(--accent-tertiary);
    font-weight: bold;
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
    color: var(--text-dim) !important;
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    margin-top: 3.5rem;
    padding: 2rem 0;
}

footer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s ease;
}

footer a:hover {
    color: var(--final-answer-color);
    text-decoration: underline;
}

/* ==========================================================================
   RTL (Right-to-Left) Support for Arabic & Hebrew
   ========================================================================== */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .settings-btn {
    left: auto;
    right: 20px;
}

[dir="rtl"] .example-box {
    border-left: 1px solid var(--border-color);
    border-right: 4px solid var(--accent-primary);
}

[dir="rtl"] .modal-header .btn-close {
    margin-left: 0;
    margin-right: auto;
}

[dir="rtl"] .language-option:hover {
    transform: translateX(-4px);
}

[dir="rtl"] .pros-cons-card li {
    padding-left: 0;
    padding-right: 1.5rem;
}

[dir="rtl"] .pros-cons-card.pros li::before,
[dir="rtl"] .pros-cons-card.cons li::before {
    left: auto;
    right: 0;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 768px) {
    .brand-title {
        font-size: 1.85rem;
    }
    
    .settings-btn {
        top: 12px;
        left: 12px;
        width: 42px;
        height: 42px;
    }
    
    [dir="rtl"] .settings-btn {
        right: 12px;
        left: auto;
    }
    
    .nav-tabs .nav-link {
        padding: 0.65rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .card-panel {
        padding: 1.25rem;
    }
    
    .op-answer {
        font-size: 1.5rem;
    }
}

@media (max-width: 420px) {
    .brand-title {
        font-size: 1.5rem;
    }
    .brand-subtitle {
        font-size: 0.85rem;
    }
    .nav-tabs .nav-link {
        padding: 0.5rem 0.55rem;
        font-size: 0.78rem;
    }
    .card-panel {
        padding: 1rem 0.75rem;
        border-radius: var(--radius-md);
    }
    .calc-btn {
        font-size: 0.85rem;
        padding: 0.5rem 0.8rem;
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    .card-panel {
        padding: 2.25rem;
    }
}
