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

/* ── Dark theme: deep indigo + coral/teal accents ── */
:root,
[data-theme="dark"] {
    --bg: #0b0f1a;
    --bg-gradient: linear-gradient(135deg, #0b0f1a 0%, #121829 50%, #0f1525 100%);
    --surface: #161c2e;
    --surface-raised: #1c2438;
    --editor-bg: #131825;
    --border: #2a3350;
    --border-light: #353f5c;
    --text: #e8ecf4;
    --text-muted: #8b95ad;
    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --accent-soft: rgba(139, 92, 246, 0.15);
    --left-accent: #f472b6;
    --left-accent-soft: rgba(244, 114, 182, 0.12);
    --right-accent: #34d399;
    --right-accent-soft: rgba(52, 211, 153, 0.12);
    --removed: #fb7185;
    --removed-bg: rgba(251, 113, 133, 0.15);
    --added: #4ade80;
    --added-bg: rgba(74, 222, 128, 0.15);
    --changed: #fbbf24;
    --changed-bg: rgba(251, 191, 36, 0.15);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --radius: 12px;
    --radius-sm: 8px;
    --kbd-bg: #252d45;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
}

/* ── Light theme: clean slate + violet accents ── */
[data-theme="light"] {
    --bg: #eef1f8;
    --bg-gradient: linear-gradient(135deg, #eef1f8 0%, #e4e9f4 100%);
    --surface: #ffffff;
    --surface-raised: #f8f9fc;
    --editor-bg: #fafbfe;
    --border: #d4dae8;
    --border-light: #e2e7f0;
    --text: #1a2236;
    --text-muted: #5c667a;
    --accent: #6d28d9;
    --accent-hover: #5b21b6;
    --accent-soft: rgba(109, 40, 217, 0.1);
    --left-accent: #db2777;
    --left-accent-soft: rgba(219, 39, 119, 0.08);
    --right-accent: #059669;
    --right-accent-soft: rgba(5, 150, 105, 0.08);
    --removed: #dc2626;
    --removed-bg: rgba(220, 38, 38, 0.08);
    --added: #16a34a;
    --added-bg: rgba(22, 163, 74, 0.08);
    --changed: #d97706;
    --changed-bg: rgba(217, 119, 6, 0.08);
    --shadow: 0 8px 32px rgba(26, 34, 54, 0.08);
    --shadow-sm: 0 2px 8px rgba(26, 34, 54, 0.06);
    --kbd-bg: #e8ecf4;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    background-image: var(--bg-gradient);
    color: var(--text);
    line-height: 1.5;
    overflow-x: hidden;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* ── Top bar ── */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    border: 1px solid var(--border);
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.logo {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.brand-link {
    text-decoration: none;
    color: inherit;
}

.brand-link:hover .logo {
    color: var(--accent);
}

.tagline {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.global-status {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.global-status.success { color: var(--added); }
.global-status.error { color: var(--removed); }

.theme-toggle {
    padding: 10px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-raised);
    color: var(--text);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.theme-toggle:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark { display: none; }

/* ── Workspace ── */
.workspace {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 16px;
    padding: 16px;
    overflow: hidden;
}

.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-left {
    border-top: 3px solid var(--left-accent);
}

.panel-right {
    border-top: 3px solid var(--right-accent);
}

.editor-panel.is-fullscreen {
    position: fixed;
    inset: 16px;
    z-index: 1000;
    border-radius: var(--radius);
}

/* ── Panel head ── */
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--surface-raised);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.panel-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.badge-left {
    background: var(--left-accent-soft);
    color: var(--left-accent);
    border: 1px solid var(--left-accent);
}

.badge-right {
    background: var(--right-accent-soft);
    color: var(--right-accent);
    border: 1px solid var(--right-accent);
}

.view-tabs {
    display: flex;
    gap: 4px;
    background: var(--editor-bg);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.view-tab {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.view-tab:hover {
    color: var(--text);
    background: var(--surface);
}

.view-tab.active {
    background: var(--accent);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

/* ── Toolbar ── */
/* ── Toolbar collapse (mobile) ── */
.toolbar-collapse-btn {
    display: none;
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-raised);
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 8px;
}

.collapse-icon {
    transition: transform 0.2s;
}

.toolbar-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Mobile nav ── */
.mobile-nav {
    display: none;
    padding: 8px 12px;
    gap: 8px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.mobile-nav-btn {
    flex: 1;
    padding: 12px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-raised);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.mobile-nav-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.mobile-panel-toggle { display: none !important; }

.panel-toolbar {
    display: flex;
    flex-direction: column;
    padding: 14px 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.toolbar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    min-width: 42px;
}

.tool-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.tool-group-right {
    justify-content: flex-end;
    flex: 0 1 auto;
    margin-left: auto;
}

.tool-btn,
.file-btn {
    padding: 10px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-raised);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.tool-btn:hover,
.file-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.tool-btn-accent {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.tool-btn-accent:hover {
    background: var(--accent);
    color: #fff;
}

.file-btn.is-active,
.tool-btn.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.file-btn.is-active:hover,
.tool-btn.is-active:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

/* ── Panel content ── */
.panel-content {
    flex: 1;
    position: relative;
    min-height: 0;
    overflow: hidden;
    background: var(--editor-bg);
}

.view-pane {
    display: none;
    height: 100%;
    flex-direction: column;
    overflow: hidden;
}

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

.view-text .CodeMirror {
    height: 100% !important;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.6;
}

.view-tree,
.view-table {
    overflow: auto;
    padding: 16px;
}

.tree-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.mini-btn {
    padding: 10px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.mini-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ── Empty state ── */
.empty-state {
    display: none;
    position: absolute;
    inset: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 24px;
    background: var(--editor-bg);
    z-index: 2;
}

.empty-state.visible {
    display: flex;
}

.empty-icon {
    font-family: var(--font-mono);
    font-size: 2.5rem;
    color: var(--accent);
    opacity: 0.5;
    margin-bottom: 16px;
}

.empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-hint {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 28px;
    max-width: 340px;
}

.empty-hint kbd {
    display: inline-block;
    padding: 3px 8px;
    background: var(--kbd-bg);
    border-radius: 5px;
    font-size: 0.85rem;
    border: 1px solid var(--border);
    font-family: var(--font-mono);
}

.empty-actions {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
}

.empty-btn {
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 140px;
}

.empty-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.empty-btn-outline {
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
}

.empty-btn-outline:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.panel-status {
    padding: 10px 18px;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    min-height: 36px;
    flex-shrink: 0;
    background: var(--surface-raised);
}

.panel-status.success { color: var(--added); }
.panel-status.error { color: var(--removed); }

/* ── Center hub ── */
.center-hub {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    justify-content: center;
    padding: 8px 0;
}

.hub-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.hub-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.hub-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hub-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-raised);
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
}

.hub-btn:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.hub-btn-secondary:hover {
    border-color: var(--right-accent);
    background: var(--right-accent-soft);
    color: var(--right-accent);
}

.hub-arrow {
    font-size: 1.2rem;
    font-weight: 700;
    width: 24px;
    text-align: center;
}

.hub-card-compare {
    text-align: center;
}

.compare-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.compare-toggle input {
    display: none;
}

.compare-slider {
    position: relative;
    width: 56px;
    height: 30px;
    background: var(--border);
    border-radius: 15px;
    transition: background 0.2s;
}

.compare-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: var(--shadow-sm);
}

.compare-toggle input:checked + .compare-slider {
    background: var(--accent);
}

.compare-toggle input:checked + .compare-slider::after {
    transform: translateX(26px);
}

.compare-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.hub-legend {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
}

.leg {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.leg::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.leg-removed { color: var(--removed); }
.leg-removed::before { background: var(--removed); }

.leg-added { color: var(--added); }
.leg-added::before { background: var(--added); }

.leg-changed { color: var(--changed); }
.leg-changed::before { background: var(--changed); }

/* ── Diff summary bar ── */
.diff-bar,
.diff-summary {
    padding: 12px 24px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.diff-bar strong,
.diff-summary strong { color: var(--text); }

/* ── Footer SEO (collapsible, inside footer) ── */
.footer-seo {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 16px 8px;
}

.seo-details {
    margin: 0 auto;
}

.seo-summary {
    padding: 6px 0 2px;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    list-style: none;
    user-select: none;
    text-align: center;
    opacity: 0.85;
    transition: color 0.15s ease, opacity 0.15s ease;
}

.seo-summary:hover {
    color: var(--accent);
    opacity: 1;
}

.seo-summary::-webkit-details-marker {
    display: none;
}

.seo-summary::before {
    content: '▸ ';
    display: inline-block;
    font-size: 0.65rem;
    transition: transform 0.2s;
}

.seo-details[open] .seo-summary::before {
    transform: rotate(90deg);
}

.seo-body {
    padding: 12px 0 4px;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.6;
    max-height: 38vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid var(--border-light);
    margin-top: 8px;
    text-align: left;
}

.seo-body h2 {
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 8px;
}

.seo-body h3 {
    font-size: 0.85rem;
    color: var(--text);
    margin: 14px 0 6px;
}

.seo-body p {
    margin-bottom: 12px;
}

.seo-list {
    margin: 0 0 12px 18px;
}

.seo-list li {
    margin-bottom: 6px;
}

.seo-list-ordered {
    list-style: decimal;
}

.seo-body code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    padding: 2px 6px;
    background: var(--surface-raised);
    border-radius: 4px;
    border: 1px solid var(--border);
}

.seo-faq dt {
    font-weight: 600;
    color: var(--text);
    margin-top: 14px;
    margin-bottom: 4px;
}

.seo-faq dd {
    margin-left: 0;
    margin-bottom: 8px;
}

.seo-faq a {
    color: var(--accent);
    text-decoration: none;
}

.seo-faq a:hover {
    text-decoration: underline;
}

/* ── Site footer (compact) ── */
.site-footer {
    flex-shrink: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 10px 16px 6px;
    margin-top: auto;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px 20px;
    max-width: 1200px;
    margin: 0 auto;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.make-in-india {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: linear-gradient(135deg, #ff9933 0%, #ffffff 45%, #138808 100%);
    border-radius: 14px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.make-in-india-text {
    font-size: 0.72rem;
    font-weight: 700;
    color: #1a1a1a;
    background: rgba(255, 255, 255, 0.88);
    padding: 1px 7px;
    border-radius: 10px;
}

.india-flag {
    font-size: 0.95rem;
    line-height: 1;
}

.footer-about-line {
    text-align: center;
    line-height: 1.4;
}

.footer-about-line strong {
    color: var(--text);
    font-weight: 600;
}

.footer-about-line a,
.footer-copy a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.footer-about-line a:hover,
.footer-copy a:hover {
    text-decoration: underline;
}

.footer-copy {
    flex-shrink: 0;
    white-space: nowrap;
}

/* ── JSON Tree ── */
.json-tree {
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.7;
}

.tree-children {
    margin-left: 20px;
    border-left: 2px solid var(--border-light);
    padding-left: 10px;
}

.tree-children.collapsed { display: none; }

.tree-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    margin: 1px 0;
}

.tree-row.removed { background: var(--removed-bg); color: var(--removed); }
.tree-row.added { background: var(--added-bg); color: var(--added); }
.tree-row.changed { background: var(--changed-bg); color: var(--changed); }
.tree-row.same { color: var(--text-muted); }

.tree-toggle {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 10px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tree-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.tree-toggle.leaf { visibility: hidden; pointer-events: none; border: none; background: none; }

.tree-key { color: var(--accent); flex-shrink: 0; font-weight: 500; }
.tree-sep { color: var(--text-muted); }

.tree-value.string { color: #f9a8d4; }
.tree-value.number { color: #93c5fd; }
.tree-value.boolean { color: #c4b5fd; }
.tree-value.null { color: var(--text-muted); font-style: italic; }

[data-theme="light"] .tree-value.string { color: #be185d; }
[data-theme="light"] .tree-value.number { color: #1d4ed8; }
[data-theme="light"] .tree-value.boolean { color: #6d28d9; }

.tree-bracket { color: var(--text-muted); cursor: pointer; }
.tree-preview { color: var(--text-muted); font-size: 0.85em; margin-left: 4px; }

/* ── JSON Table ── */
.json-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-family: var(--font-mono);
    font-size: 13px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}

.json-table th,
.json-table td {
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    text-align: left;
}

.json-table th {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.json-table tr:last-child td { border-bottom: none; }
.json-table tr:nth-child(even) td { background: var(--surface-raised); }

/* ── Loading ── */
.loading { pointer-events: none; }

/* ── App loader overlay ── */
.app-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.app-loader[hidden] {
    display: none !important;
}

.loader-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 10, 20, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

[data-theme="light"] .loader-backdrop {
    background: rgba(240, 242, 248, 0.82);
}

.loader-card {
    position: relative;
    width: min(360px, 100%);
    padding: 32px 28px 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
    text-align: center;
    animation: loader-card-in 0.35s ease-out;
}

@keyframes loader-card-in {
    from { opacity: 0; transform: scale(0.92) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.loader-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 22px;
    height: 72px;
}

.loader-brace {
    font-family: var(--font-mono);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--accent);
    animation: loader-brace-pulse 1.2s ease-in-out infinite;
}

.loader-brace-r {
    animation-delay: 0.6s;
}

@keyframes loader-brace-pulse {
    0%, 100% { opacity: 0.35; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.05); }
}

.loader-core {
    position: relative;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-ring {
    position: absolute;
    inset: 0;
    border: 3px solid transparent;
    border-top-color: var(--accent);
    border-right-color: var(--left-accent);
    border-radius: 50%;
    animation: loader-spin 0.9s linear infinite;
}

.loader-ring-2 {
    inset: 8px;
    border-top-color: var(--right-accent);
    border-right-color: transparent;
    animation-direction: reverse;
    animation-duration: 1.3s;
}

.loader-dot {
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--accent);
    animation: loader-dot-pulse 1s ease-in-out infinite;
}

@keyframes loader-spin {
    to { transform: rotate(360deg); }
}

@keyframes loader-dot-pulse {
    0%, 100% { transform: scale(0.8); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 1; }
}

.loader-track {
    height: 4px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.loader-track-fill {
    display: block;
    height: 100%;
    width: 35%;
    background: linear-gradient(90deg, var(--accent), var(--left-accent), var(--right-accent));
    border-radius: 4px;
    animation: loader-track-slide 1.4s ease-in-out infinite;
}

@keyframes loader-track-slide {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(320%); }
}

.loader-message {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.loader-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
    min-height: 1.2em;
}

body.is-processing {
    overflow: hidden;
}

.table-truncate-note {
    margin-top: 12px;
    padding: 10px 14px;
    font-size: 0.85rem;
    color: var(--changed);
    background: var(--changed-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* ── Responsive ── */
@media (max-width: 1100px) {
    .workspace {
        flex-direction: column;
        overflow-y: auto;
        flex: 1;
        min-height: 400px;
    }

    .center-hub {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0;
        order: 2;
    }

    .panel-left { order: 1; }
    .panel-right { order: 3; }

    .hub-card {
        flex: 1;
        min-width: 160px;
    }

    .hub-actions {
        flex-direction: row;
    }

    .hub-btn {
        flex: 1;
        justify-content: center;
        padding: 12px;
    }

    .hub-btn-label { font-size: 0.85rem; }

    .editor-panel {
        min-height: 380px;
    }
}

@media (max-width: 768px) {
    .app {
        height: auto;
        min-height: 100dvh;
        max-height: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-nav {
        display: flex;
        position: sticky;
        top: 0;
        z-index: 50;
        box-shadow: var(--shadow-sm);
    }

    .workspace {
        display: flex;
        flex-direction: column;
        padding: 10px;
        gap: 12px;
        overflow-x: hidden;
        overflow-y: visible;
        flex: 0 0 auto;
        min-height: 0;
    }

    .editor-panel,
    .center-hub {
        display: flex !important;
        width: 100%;
        flex: 0 0 auto;
        min-height: 0;
    }

    .editor-panel {
        min-height: 55vh;
    }

    .center-hub {
        flex-direction: column;
        width: 100%;
        padding: 0;
        order: unset;
    }

    .panel-left,
    .panel-right {
        order: unset;
    }

    .panel-content {
        flex: 1;
        min-height: 240px;
        overflow: hidden;
    }

    .view-tree,
    .view-table {
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        max-height: 45vh;
    }

    .hub-actions {
        flex-direction: column;
    }

    .toolbar-collapse-btn {
        display: flex;
    }

    .panel-toolbar .toolbar-body {
        display: none;
    }

    .panel-toolbar.is-open .toolbar-body {
        display: flex;
    }

    .panel-toolbar.is-open .toolbar-collapse-btn .collapse-icon {
        transform: rotate(180deg);
    }

    .panel-head {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .view-tabs {
        justify-content: center;
    }

    .tool-btn,
    .file-btn {
        flex: 1 1 calc(50% - 4px);
        min-width: calc(50% - 4px);
        text-align: center;
        padding: 12px 10px;
    }

    .view-text .CodeMirror {
        font-size: 13px;
    }

    .theme-toggle {
        padding: 10px 14px;
        font-size: 0.85rem;
    }
}

@media (max-width: 640px) {
    .toolbar-row {
        flex-direction: column;
        align-items: stretch;
    }

    .tool-group-right {
        margin-left: 0;
        justify-content: flex-start;
    }

    .view-tab {
        padding: 10px 12px;
        font-size: 0.82rem;
        flex: 1;
    }

    .top-bar {
        padding: 10px 14px;
    }

    .tagline { display: none; }

    .brand-icon {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }

    .logo { font-size: 1rem; }

    .site-footer {
        padding: 8px 12px;
    }

    .footer-inner {
        flex-direction: column;
        gap: 6px;
        text-align: center;
    }

    .tool-btn,
    .file-btn {
        flex: 1 1 100%;
        min-width: 100%;
    }
}

/* ── 404 error page ── */
.error-page-body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-page {
    width: 100%;
    max-width: 480px;
    padding: 24px;
    text-align: center;
}

.error-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 48px 32px 40px;
    box-shadow: var(--shadow);
}

.error-code {
    display: block;
    font-size: 4rem;
    font-weight: 800;
    line-height: 1;
    color: var(--accent);
    opacity: 0.35;
    font-family: var(--font-mono);
    margin-bottom: 8px;
}

.error-braces {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 2rem;
    color: var(--left-accent);
    margin-bottom: 20px;
}

.error-braces-gap {
    color: var(--removed);
    font-weight: 700;
}

.error-page h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
}

.error-message {
    color: var(--text-muted);
    margin-bottom: 8px;
}

.error-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    opacity: 0.85;
    margin-bottom: 28px;
}

.error-home-btn {
    display: inline-block;
    padding: 12px 28px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.15s ease;
}

.error-home-btn:hover {
    background: var(--accent-hover);
}

.error-footer {
    margin-top: 24px;
    font-size: 0.85rem;
}

.error-footer a {
    color: var(--text-muted);
    text-decoration: none;
}

.error-footer a:hover {
    color: var(--accent);
}

