:root {
  --bg: #ece4d5;
  --panel: rgba(252, 247, 239, 0.76);
  --panel-strong: rgba(255, 252, 247, 0.88);
  --ink: #18243a;
  --muted: #71809a;
  --line: rgba(24, 36, 58, 0.08);
  --blue: #3e63ff;
  --green: #2e7d69;
  --amber: #d59a39;
  --violet: #655eff;
  --rose: #d4637b;
  --shadow: 0 24px 80px rgba(19, 30, 47, 0.12);
  --bg-gradient: radial-gradient(circle at 12% 20%, rgba(62, 99, 255, 0.12), transparent 22%), radial-gradient(circle at 87% 14%, rgba(213, 154, 57, 0.14), transparent 26%), linear-gradient(180deg, #f0e9dd 0%, #e6ddcc 100%);
  --hero-bg: radial-gradient(circle at 78% 18%, rgba(62, 99, 255, 0.08), transparent 22%), linear-gradient(135deg, rgba(255, 251, 245, 0.94), rgba(252, 246, 237, 0.76));
  --text-gradient: linear-gradient(135deg, #d37c86 0%, #879bc9 50%, #76a495 100%);
  --hover-spectral-glow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 0 4px 1px rgba(255, 255, 255, 0.9),
    0 0 12px 3px rgba(255, 190, 80, 0.5),
    0 4px 20px 5px rgba(255, 80, 100, 0.35),
    0 8px 32px 8px rgba(60, 100, 250, 0.2);
  --hero-panel-bg:
    radial-gradient(circle at 85% 15%, rgba(230, 180, 170, 0.28), transparent 45%),
    radial-gradient(circle at 20% 80%, rgba(200, 210, 230, 0.22), transparent 50%),
    radial-gradient(circle at 50% 40%, rgba(240, 220, 200, 0.18), transparent 55%),
    linear-gradient(180deg, rgba(252, 248, 243, 0.95), rgba(245, 240, 232, 0.85));
  --btn-grad1: #1c2740;
  --btn-grad2: #131d30;
  --api-shell-bar-bg: linear-gradient(180deg, rgba(255,255,255,0.78), rgba(255,255,255,0.62));
  --api-shell-bar-border: color-mix(in oklch, var(--ink) 8%, transparent);
  --api-shell-bar-shadow: 0 10px 24px rgba(24, 36, 58, 0.07), inset 0 1px 0 rgba(255,255,255,0.62);
  --api-sidebar-bg: radial-gradient(circle at top left, rgba(96, 122, 255, 0.18), transparent 38%), linear-gradient(180deg, rgba(17, 28, 48, 0.94), rgba(14, 23, 39, 0.92));
  --api-sidebar-fg: rgba(255, 252, 248, 0.96);
  --api-sidebar-muted: rgba(236, 228, 218, 0.72);
  --api-sidebar-border: rgba(255, 255, 255, 0.08);
  --api-sidebar-shadow: 0 24px 50px rgba(16, 24, 40, 0.22), inset 0 1px 0 rgba(255,255,255,0.08);
  --api-sidebar-card-bg: rgba(255, 255, 255, 0.045);
  --api-sidebar-card-hover: rgba(255, 255, 255, 0.08);
  --api-sidebar-card-border: rgba(255,255,255,0.08);
  --api-sidebar-card-hover-border: rgba(255,255,255,0.18);
  --api-sidebar-card-selected-bg: linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.06)), rgba(50, 76, 186, 0.26);
  --api-sidebar-card-selected-border: rgba(96, 122, 255, 0.95);
  --api-sidebar-card-selected-shadow: inset 0 0 0 1px rgba(150, 175, 255, 0.18), 0 10px 26px rgba(43, 73, 179, 0.18);
  --api-sidebar-scroll: rgba(255,255,255,0.16);
  --api-workspace-bg: linear-gradient(180deg, rgba(255,252,247,0.88), rgba(255,251,245,0.82));
  --api-workspace-border: rgba(255,255,255,0.7);
  --api-workspace-shadow: 0 24px 56px rgba(24, 36, 58, 0.1), inset 0 1px 0 rgba(255,255,255,0.74);
  --api-binding-panel-bg: linear-gradient(180deg, rgba(255,255,255,0.3), rgba(255,255,255,0.16)), rgba(12, 20, 34, 0.26);
  --api-binding-panel-border: rgba(255,255,255,0.12);
  --api-binding-panel-shadow: 0 18px 36px rgba(16, 24, 40, 0.16), inset 0 1px 0 rgba(255,255,255,0.08);
  --api-surface-border: color-mix(in oklch, var(--ink) 8%, transparent);
  --api-input-bg: rgba(255, 255, 255, 0.72);
  --api-input-border: color-mix(in oklch, var(--ink) 10%, transparent);
  --api-input-focus-bg: rgba(255,255,255,0.92);
  --api-list-item-bg: rgba(255, 255, 255, 0.5);
  --api-list-item-hover-bg: rgba(255,255,255,0.78);
  --api-list-item-selected-bg: linear-gradient(90deg, rgba(46, 125, 105, 0.08), rgba(255,255,255,0.66));
  --api-ghost-bg: rgba(255,255,255,0.22);
  --api-ghost-hover-bg: rgba(24,36,58,0.08);
  --ambient-blue-bg: rgba(62, 99, 255, 0.2);
  --ambient-amber-bg: rgba(46, 125, 105, 0.14);
  --mark-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 243, 248, 0.8) 100%);
  --mark-shadow: inset 1.5px 1.5px 3px rgba(255, 255, 255, 1), inset -1.5px -1.5px 3px rgba(200, 205, 215, 0.5), 0 5px 12px rgba(0, 0, 0, 0.08);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --graph-head-bg: #2c2a24;
  --graph-bg-center: #3a3630;
  --graph-bg-mid: #2a2720;
  --graph-bg-edge: #1e1c17;
  --graph-node-hub: 180, 170, 150;
  --graph-node-core: 160, 150, 130;
  --graph-node-skill: 140, 132, 115;
  --graph-edge: 150, 140, 120;
  --graph-label: 190, 180, 160;
  --graph-glow: 210, 200, 180;
  --graph-eyebrow: rgba(180, 170, 150, 0.6);
  --graph-title: rgba(220, 210, 190, 0.9);
}

html[data-theme="dark"] {
  --bg: #0f1219;
  --panel: rgba(26, 30, 38, 0.76);
  --panel-strong: rgba(30, 35, 45, 0.88);
  --ink: #f0f2f5;
  --muted: #8b94a5;
  --line: rgba(255, 255, 255, 0.08);
  --blue: #5b7eff;
  --green: #37a88d;
  --amber: #e6ab45;
  --violet: #847aff;
  --rose: #e8758e;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  --bg-gradient: radial-gradient(circle at 12% 20%, rgba(91, 126, 255, 0.12), transparent 22%), radial-gradient(circle at 87% 14%, rgba(230, 171, 69, 0.14), transparent 26%), linear-gradient(180deg, #161a22 0%, #0f1219 100%);
  --hero-bg: radial-gradient(circle at 78% 18%, rgba(91, 126, 255, 0.08), transparent 22%), linear-gradient(135deg, rgba(30, 35, 45, 0.94), rgba(20, 24, 31, 0.76));
  --text-gradient: linear-gradient(135deg, #f5a9b1 0%, #aabdf0 50%, #9ddcc6 100%);
  --hover-spectral-glow:
    inset 0 1px 0 rgba(255,255,255,0.2),
    0 0 2px 1px rgba(255,255,255,0.7),
    0 0 10px 3px rgba(255,220,100,0.6),
    0 0 22px 6px rgba(255,60,50,0.4),
    0 0 40px 10px rgba(40,0,180,0.35),
    0 0 60px 16px rgba(0,100,255,0.2);
  --hero-panel-bg:
    radial-gradient(circle at 85% 15%, rgba(120, 140, 200, 0.18), transparent 45%),
    radial-gradient(circle at 20% 80%, rgba(100, 130, 180, 0.14), transparent 50%),
    radial-gradient(circle at 50% 40%, rgba(80, 95, 140, 0.12), transparent 55%),
    linear-gradient(180deg, rgba(28, 32, 42, 0.95), rgba(20, 24, 32, 0.88));
  --btn-grad1: #354157;
  --btn-grad2: #21293a;
  --api-shell-bar-bg: linear-gradient(180deg, rgba(29, 34, 44, 0.9), rgba(20, 24, 32, 0.78));
  --api-shell-bar-border: rgba(255,255,255,0.08);
  --api-shell-bar-shadow: 0 12px 26px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.04);
  --api-sidebar-bg: radial-gradient(circle at top left, rgba(91, 126, 255, 0.18), transparent 38%), linear-gradient(180deg, rgba(15, 20, 30, 0.96), rgba(11, 15, 24, 0.94));
  --api-sidebar-fg: rgba(240, 242, 245, 0.96);
  --api-sidebar-muted: rgba(166, 175, 191, 0.76);
  --api-sidebar-border: rgba(255,255,255,0.08);
  --api-sidebar-shadow: 0 24px 56px rgba(0,0,0,0.38), inset 0 1px 0 rgba(255,255,255,0.04);
  --api-sidebar-card-bg: rgba(255,255,255,0.035);
  --api-sidebar-card-hover: rgba(255,255,255,0.065);
  --api-sidebar-card-border: rgba(255,255,255,0.07);
  --api-sidebar-card-hover-border: rgba(255,255,255,0.14);
  --api-sidebar-card-selected-bg: linear-gradient(180deg, rgba(91, 126, 255, 0.16), rgba(255,255,255,0.03));
  --api-sidebar-card-selected-border: rgba(91, 126, 255, 0.88);
  --api-sidebar-card-selected-shadow: inset 0 0 0 1px rgba(133, 160, 255, 0.16), 0 12px 26px rgba(36, 54, 108, 0.28);
  --api-sidebar-scroll: rgba(255,255,255,0.12);
  --api-workspace-bg: linear-gradient(180deg, rgba(26, 30, 38, 0.92), rgba(20, 24, 31, 0.88));
  --api-workspace-border: rgba(255,255,255,0.08);
  --api-workspace-shadow: 0 24px 56px rgba(0,0,0,0.34), inset 0 1px 0 rgba(255,255,255,0.04);
  --api-binding-panel-bg: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02)), rgba(19, 24, 36, 0.82);
  --api-binding-panel-border: rgba(255,255,255,0.08);
  --api-binding-panel-shadow: 0 20px 38px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.04);
  --api-surface-border: rgba(255,255,255,0.08);
  --api-input-bg: rgba(255,255,255,0.06);
  --api-input-border: rgba(255,255,255,0.08);
  --api-input-focus-bg: rgba(255,255,255,0.09);
  --api-list-item-bg: rgba(255,255,255,0.05);
  --api-list-item-hover-bg: rgba(255,255,255,0.08);
  --api-list-item-selected-bg: linear-gradient(90deg, rgba(55, 168, 141, 0.14), rgba(255,255,255,0.04));
  --api-ghost-bg: rgba(255,255,255,0.06);
  --api-ghost-hover-bg: rgba(255,255,255,0.1);
  --ambient-blue-bg: rgba(91, 126, 255, 0.15);
  --ambient-amber-bg: rgba(55, 168, 141, 0.12);
  --mark-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 243, 248, 0.8) 100%);
  --mark-shadow: inset 1.5px 1.5px 3px rgba(255, 255, 255, 1), inset -1.5px -1.5px 3px rgba(200, 205, 215, 0.5), 0 5px 12px rgba(0, 0, 0, 0.3);
  --graph-head-bg: #1a1b2e;
  --graph-bg-center: #1e1f35;
  --graph-bg-mid: #141524;
  --graph-bg-edge: #0e0f1c;
  --graph-node-hub: 200, 200, 215;
  --graph-node-core: 170, 175, 190;
  --graph-node-skill: 140, 145, 160;
  --graph-edge: 150, 150, 170;
  --graph-label: 190, 190, 205;
  --graph-glow: 220, 220, 235;
  --graph-eyebrow: rgba(180, 180, 200, 0.6);
  --graph-title: rgba(220, 220, 235, 0.9);
}

html[data-theme="nature"] {
  --bg: #ebf0ea;
  --panel: rgba(242, 247, 241, 0.76);
  --panel-strong: rgba(247, 252, 246, 0.88);
  --ink: #2a3328;
  --muted: #6b7a67;
  --line: rgba(42, 51, 40, 0.08);
  --blue: #3d867c;
  --green: #599142;
  --amber: #c48b3b;
  --violet: #7a6a9b;
  --rose: #c56978;
  --shadow: 0 24px 80px rgba(42, 51, 40, 0.12);
  --bg-gradient: radial-gradient(circle at 12% 20%, rgba(61, 134, 124, 0.12), transparent 22%), radial-gradient(circle at 87% 14%, rgba(89, 145, 66, 0.12), transparent 26%), linear-gradient(180deg, #f0f5ef 0%, #e2e8e0 100%);
  --hero-bg: radial-gradient(circle at 78% 18%, rgba(61, 134, 124, 0.08), transparent 22%), linear-gradient(135deg, rgba(250, 255, 249, 0.94), rgba(240, 245, 239, 0.76));
  --text-gradient: linear-gradient(135deg, #a5b687 0%, #81a49e 50%, #b39b7a 100%);
  --hover-spectral-glow:
    inset 0 1px 0 rgba(255,255,255,0.7),
    0 0 3px 1px rgba(255,255,255,0.8),
    0 0 10px 3px rgba(180,255,150,0.5),
    0 4px 22px 5px rgba(50,180,200,0.35),
    0 8px 36px 8px rgba(100,80,200,0.2);
  --hero-panel-bg:
    radial-gradient(circle at 85% 15%, rgba(140, 190, 160, 0.22), transparent 45%),
    radial-gradient(circle at 20% 80%, rgba(170, 200, 160, 0.18), transparent 50%),
    radial-gradient(circle at 50% 40%, rgba(150, 180, 140, 0.14), transparent 55%),
    linear-gradient(180deg, rgba(248, 252, 247, 0.95), rgba(238, 244, 237, 0.88));
  --btn-grad1: #3b4d36;
  --btn-grad2: #273623;
  --api-shell-bar-bg: linear-gradient(180deg, rgba(247,252,246,0.82), rgba(240,246,238,0.68));
  --api-shell-bar-border: rgba(42, 51, 40, 0.08);
  --api-shell-bar-shadow: 0 10px 24px rgba(42, 51, 40, 0.08), inset 0 1px 0 rgba(255,255,255,0.62);
  --api-sidebar-bg: radial-gradient(circle at top left, rgba(89, 145, 66, 0.14), transparent 38%), linear-gradient(180deg, rgba(38, 50, 35, 0.95), rgba(28, 38, 26, 0.94));
  --api-sidebar-fg: rgba(243, 248, 239, 0.96);
  --api-sidebar-muted: rgba(209, 223, 201, 0.72);
  --api-sidebar-border: rgba(255,255,255,0.08);
  --api-sidebar-shadow: 0 24px 50px rgba(42, 51, 40, 0.2), inset 0 1px 0 rgba(255,255,255,0.06);
  --api-sidebar-card-bg: rgba(255,255,255,0.045);
  --api-sidebar-card-hover: rgba(255,255,255,0.075);
  --api-sidebar-card-border: rgba(255,255,255,0.08);
  --api-sidebar-card-hover-border: rgba(255,255,255,0.16);
  --api-sidebar-card-selected-bg: linear-gradient(180deg, rgba(89, 145, 66, 0.16), rgba(255,255,255,0.04));
  --api-sidebar-card-selected-border: rgba(117, 172, 92, 0.9);
  --api-sidebar-card-selected-shadow: inset 0 0 0 1px rgba(184, 214, 168, 0.14), 0 12px 26px rgba(54, 86, 44, 0.2);
  --api-sidebar-scroll: rgba(255,255,255,0.12);
  --api-workspace-bg: linear-gradient(180deg, rgba(247,252,246,0.9), rgba(240,245,239,0.84));
  --api-workspace-border: rgba(255,255,255,0.72);
  --api-workspace-shadow: 0 24px 56px rgba(42, 51, 40, 0.1), inset 0 1px 0 rgba(255,255,255,0.72);
  --api-binding-panel-bg: linear-gradient(180deg, rgba(255,255,255,0.28), rgba(255,255,255,0.16)), rgba(45, 62, 37, 0.24);
  --api-binding-panel-border: rgba(255,255,255,0.12);
  --api-binding-panel-shadow: 0 18px 36px rgba(42, 51, 40, 0.16), inset 0 1px 0 rgba(255,255,255,0.08);
  --api-surface-border: rgba(42, 51, 40, 0.08);
  --api-input-bg: rgba(250,255,249,0.78);
  --api-input-border: rgba(42, 51, 40, 0.1);
  --api-input-focus-bg: rgba(255,255,255,0.94);
  --api-list-item-bg: rgba(255,255,255,0.52);
  --api-list-item-hover-bg: rgba(255,255,255,0.8);
  --api-list-item-selected-bg: linear-gradient(90deg, rgba(89, 145, 66, 0.1), rgba(255,255,255,0.68));
  --api-ghost-bg: rgba(255,255,255,0.24);
  --api-ghost-hover-bg: rgba(42,51,40,0.08);
  --ambient-blue-bg: rgba(61, 134, 124, 0.2);
  --ambient-amber-bg: rgba(89, 145, 66, 0.14);
  --mark-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 243, 248, 0.8) 100%);
  --mark-shadow: inset 1.5px 1.5px 3px rgba(255, 255, 255, 1), inset -1.5px -1.5px 3px rgba(200, 205, 215, 0.5), 0 5px 12px rgba(0, 0, 0, 0.12);
  --graph-head-bg: #1f2e1f;
  --graph-bg-center: #243024;
  --graph-bg-mid: #1a261a;
  --graph-bg-edge: #121e12;
  --graph-node-hub: 170, 195, 160;
  --graph-node-core: 150, 175, 140;
  --graph-node-skill: 130, 155, 120;
  --graph-edge: 130, 160, 120;
  --graph-label: 175, 200, 165;
  --graph-glow: 200, 225, 190;
  --graph-eyebrow: rgba(150, 180, 140, 0.6);
  --graph-title: rgba(200, 225, 190, 0.9);
}

html[data-theme="stellar"] {
  /* 星辰 — 沐浴星光 */
  --bg: #0b0e1a;
  --panel: rgba(18, 22, 40, 0.82);
  --panel-strong: rgba(22, 27, 48, 0.9);
  --ink: #e4ddd0;
  --muted: #8e8ba8;
  --line: rgba(200, 190, 170, 0.08);

  /* Accent palette: warm starlight + cool moonlight */
  --blue: #7ea8d8;
  --green: #5fbfa3;
  --amber: #c9a455;
  --violet: #a494e0;
  --rose: #d4897a;

  --shadow: 0 24px 80px rgba(0, 0, 0, 0.55);

  --bg-gradient:
    radial-gradient(ellipse at 18% 22%, rgba(201, 164, 85, 0.08), transparent 30%),
    radial-gradient(circle at 82% 12%, rgba(126, 168, 216, 0.06), transparent 25%),
    radial-gradient(circle at 50% 85%, rgba(164, 148, 224, 0.05), transparent 35%),
    linear-gradient(175deg, #10142a 0%, #0b0e1a 50%, #090c16 100%);

  --hero-bg:
    radial-gradient(ellipse at 72% 20%, rgba(201, 164, 85, 0.06), transparent 28%),
    radial-gradient(circle at 25% 75%, rgba(126, 168, 216, 0.04), transparent 30%),
    linear-gradient(145deg, rgba(22, 28, 52, 0.96), rgba(14, 18, 34, 0.82));

  --text-gradient: linear-gradient(135deg, #dbc18a 0%, #a8c4e0 50%, #89d4b8 100%);

  --hover-spectral-glow:
    inset 0 1px 0 rgba(201, 164, 85, 0.15),
    0 0 3px 1px rgba(201, 164, 85, 0.3),
    0 0 12px 3px rgba(201, 164, 85, 0.15),
    0 4px 24px 6px rgba(126, 168, 216, 0.12),
    0 8px 40px 10px rgba(164, 148, 224, 0.08);

  --hero-panel-bg:
    radial-gradient(circle at 80% 15%, rgba(201, 164, 85, 0.1), transparent 40%),
    radial-gradient(circle at 15% 75%, rgba(126, 168, 216, 0.08), transparent 45%),
    radial-gradient(circle at 50% 45%, rgba(164, 148, 224, 0.06), transparent 50%),
    linear-gradient(180deg, rgba(20, 25, 48, 0.96), rgba(14, 18, 36, 0.9));

  --btn-grad1: #2a3050;
  --btn-grad2: #181c34;
  --api-shell-bar-bg: linear-gradient(180deg, rgba(21, 27, 48, 0.92), rgba(14, 18, 36, 0.82));
  --api-shell-bar-border: rgba(201, 164, 85, 0.12);
  --api-shell-bar-shadow: 0 12px 28px rgba(0,0,0,0.32), inset 0 1px 0 rgba(201,164,85,0.05);
  --api-sidebar-bg: radial-gradient(circle at top left, rgba(201, 164, 85, 0.14), transparent 38%), linear-gradient(180deg, rgba(15, 19, 36, 0.97), rgba(10, 13, 26, 0.95));
  --api-sidebar-fg: rgba(228, 221, 208, 0.96);
  --api-sidebar-muted: rgba(182, 173, 196, 0.74);
  --api-sidebar-border: rgba(201, 164, 85, 0.12);
  --api-sidebar-shadow: 0 24px 56px rgba(0,0,0,0.34), inset 0 1px 0 rgba(201,164,85,0.05);
  --api-sidebar-card-bg: rgba(201,164,85,0.045);
  --api-sidebar-card-hover: rgba(201,164,85,0.075);
  --api-sidebar-card-border: rgba(201,164,85,0.08);
  --api-sidebar-card-hover-border: rgba(201,164,85,0.16);
  --api-sidebar-card-selected-bg: linear-gradient(180deg, rgba(201,164,85,0.14), rgba(126,168,216,0.05));
  --api-sidebar-card-selected-border: rgba(201,164,85,0.82);
  --api-sidebar-card-selected-shadow: inset 0 0 0 1px rgba(201,164,85,0.12), 0 12px 28px rgba(33, 39, 74, 0.28);
  --api-sidebar-scroll: rgba(201,164,85,0.14);
  --api-workspace-bg: linear-gradient(180deg, rgba(22, 27, 48, 0.92), rgba(14, 18, 36, 0.88));
  --api-workspace-border: rgba(201, 164, 85, 0.12);
  --api-workspace-shadow: 0 24px 56px rgba(0,0,0,0.34), inset 0 1px 0 rgba(201,164,85,0.05);
  --api-binding-panel-bg: linear-gradient(180deg, rgba(201,164,85,0.05), rgba(255,255,255,0.02)), rgba(18, 22, 40, 0.84);
  --api-binding-panel-border: rgba(201,164,85,0.12);
  --api-binding-panel-shadow: 0 18px 36px rgba(0,0,0,0.26), inset 0 1px 0 rgba(201,164,85,0.05);
  --api-surface-border: rgba(201,190,170,0.1);
  --api-input-bg: rgba(201,164,85,0.045);
  --api-input-border: rgba(201,190,170,0.1);
  --api-input-focus-bg: rgba(201,164,85,0.08);
  --api-list-item-bg: rgba(201,164,85,0.04);
  --api-list-item-hover-bg: rgba(201,164,85,0.075);
  --api-list-item-selected-bg: linear-gradient(90deg, rgba(201,164,85,0.1), rgba(126,168,216,0.04));
  --api-ghost-bg: rgba(201,164,85,0.06);
  --api-ghost-hover-bg: rgba(201,164,85,0.12);
  --ambient-blue-bg: rgba(126, 168, 216, 0.1);
  --ambient-amber-bg: rgba(201, 164, 85, 0.08);
  --mark-bg: linear-gradient(135deg, rgba(228, 221, 208, 0.95) 0%, rgba(215, 208, 195, 0.85) 100%);
  --mark-shadow: inset 1.5px 1.5px 3px rgba(255, 255, 255, 0.8), inset -1.5px -1.5px 3px rgba(180, 170, 150, 0.4), 0 5px 12px rgba(0, 0, 0, 0.4);

  --graph-head-bg: #12162c;
  --graph-bg-center: #181d38;
  --graph-bg-mid: #10142a;
  --graph-bg-edge: #0a0d1a;
  --graph-node-hub: 201, 164, 85;
  --graph-node-core: 164, 148, 224;
  --graph-node-skill: 126, 168, 216;
  --graph-edge: 140, 135, 170;
  --graph-label: 200, 190, 175;
  --graph-glow: 220, 200, 160;
  --graph-eyebrow: rgba(201, 164, 85, 0.5);
  --graph-title: rgba(228, 221, 208, 0.9);
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "DM Sans", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background: var(--bg-gradient);
  transition: background 0.5s ease, color 0.5s ease;
}

body.page-home {
  min-height: 100vh;
}

body.page-subpage {
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Shell ── */

.site-shell {
  position: relative;
  min-height: 100vh;
  padding: 24px;
  overflow: clip;
}

/* ── Ambient blurs ── */

.ambient {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  opacity: 0;
  z-index: -1;
  will-change: transform, opacity;
  contain: strict;
}

.ambient-blue {
  top: -15vh;
  right: -5vw;
  width: 65vw;
  height: 60vh;
  background: var(--ambient-blue-bg);
}

.ambient-amber {
  left: -10vw;
  bottom: -20vh;
  width: 70vw;
  height: 65vh;
  background: var(--ambient-amber-bg);
}

@keyframes ambientFadeIn {
  0% { opacity: 0; transform: scale(0.9); }
  100% { opacity: 0.85; transform: scale(1); }
}

@keyframes ambientFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(4vw, -5vh) scale(1.05); }
  66% { transform: translate(-3vw, 4vh) scale(0.95); }
}

.ambient-blue { animation: ambientFadeIn 2s 0.4s var(--ease-out-expo) forwards, ambientFloat 30s 2.4s ease-in-out infinite; }
.ambient-amber { animation: ambientFadeIn 2s 0.7s var(--ease-out-expo) forwards, ambientFloat 36s 2.7s ease-in-out infinite; }

/* ── Grid noise ── */

.grid-noise {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at center, black 24%, transparent 88%);
  opacity: 0.12;
  pointer-events: none;
}

/* ── Z-index ── */

.site-header,
.home-hero,
.page-hero,
.feature-card,
.timeline-card,
.note-card,
.learn-card,
.info-panel,
.feed-board article {
  position: relative;
  z-index: 1;
}

/* Backdrop blur: only on floating chrome that overlaps ambient blurs */
.site-header,
.home-hero {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* ── Header ── */

.site-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 30px;
  box-shadow: var(--shadow);
  opacity: 0;
  animation: slideDown 0.5s var(--ease-out-expo) 0s forwards;
  transition: background 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
  max-width: 1360px;
  margin: 0 auto;
  view-transition-name: site-header;
}

.site-header > .site-nav {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.site-header.compact {
  position: sticky;
  top: 24px;
  z-index: 50;
}

@keyframes slideDown {
  0% { opacity: 0; transform: translateY(-20px); }
  100% { opacity: 1; transform: translateY(0); }
}

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

.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  width: 46px;
  height: 46px;
  padding: 6px;
  border-radius: 16px;
  background: var(--mark-bg);
  box-shadow: var(--mark-shadow);
  transition: transform 0.4s var(--ease-out-expo), background 0.5s ease, box-shadow 0.5s ease;
}

.brand-block:hover .brand-mark,
.sidebar-header:hover .brand-mark {
  transform: rotate(90deg) scale(1.08);
}

.brand-mark span {
  position: relative;
  transition: transform 0.5s var(--ease-out-expo), border-radius 0.5s var(--ease-out-expo);
}

/* 1: Top-Left (Navy Hex/Squircle) */
.brand-mark span:nth-child(1) { 
  background: #18243a;
  border-radius: 6px;
  transform: scale(0.9);
  box-shadow: 
    inset 1px 1px 2.5px rgba(255, 255, 255, 0.25),
    inset -1.5px -1.5px 3px rgba(0, 0, 0, 0.5),
    1.5px 2px 4px rgba(0, 0, 0, 0.3);
}

/* 2: Top-Right (Blue Organic Triangle) */
.brand-mark span:nth-child(2) { 
  background: #3e63ff;
  border-radius: 50% 50% 50% 15%;
  transform: rotate(-135deg) scale(0.85);
  box-shadow: 
    inset -1.5px -1.5px 2.5px rgba(255, 255, 255, 0.6),
    inset 1.5px 1.5px 3px rgba(0, 0, 0, 0.3),
    1px 1px 3px rgba(0, 0, 0, 0.2);
}

/* 3: Bottom-Left (Amber Circle) */
.brand-mark span:nth-child(3) { 
  background: #d59a39;
  border-radius: 50%;
  transform: scale(0.92);
  box-shadow: 
    inset 1px 1px 2.5px rgba(255, 255, 255, 0.6),
    inset -1.5px -1.5px 3px rgba(0, 0, 0, 0.3),
    1.5px 2px 4px rgba(0, 0, 0, 0.2);
}

/* 4: Bottom-Right (Green Blob/Clover) */
.brand-mark span:nth-child(4) { 
  background: #2e7d69;
  border-radius: 35% 65% 55% 45% / 45% 55% 65% 35%;
  transform: scale(0.9);
  box-shadow: 
    inset 1px 1px 2.5px rgba(255, 255, 255, 0.5),
    inset -1.5px -1.5px 3px rgba(0, 0, 0, 0.3),
    1.5px 2px 4px rgba(0, 0, 0, 0.2);
}

.brand-block:hover .brand-mark span:nth-child(1),
.sidebar-header:hover .brand-mark span:nth-child(1) {
  transform: scale(1.05) rotate(-15deg);
}
.brand-block:hover .brand-mark span:nth-child(2),
.sidebar-header:hover .brand-mark span:nth-child(2) {
  transform: rotate(-105deg) scale(0.95);
}
.brand-block:hover .brand-mark span:nth-child(3),
.sidebar-header:hover .brand-mark span:nth-child(3) {
  transform: scale(1.05);
}
.brand-block:hover .brand-mark span:nth-child(4),
.sidebar-header:hover .brand-mark span:nth-child(4) {
  transform: scale(1.05) rotate(20deg);
  border-radius: 50% 50% 35% 65% / 65% 35% 50% 50%;
}

.brand-text p,
.eyebrow,
.panel-head p {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand-text h1 {
  margin: 0;
  font-family: "Fraunces", "Noto Sans SC", serif;
  font-size: 26px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.site-nav {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 28px;
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
}

.site-nav a {
  position: relative;
  transition: color 200ms ease;
}

.site-nav a::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--blue);
  border-radius: 1px;
  transition: width 0.3s var(--ease-out-expo), left 0.3s var(--ease-out-expo);
}

.site-nav a.is-active::after,
.site-nav a:hover::after {
  width: 100%;
  left: 0;
}

.site-nav a.is-active,
.site-nav a:hover {
  color: var(--ink);
}

/* ── Buttons ── */

.header-button,
.primary-action,
.secondary-action,
.feature-card a,
.workflow-grid a,
.info-panel a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  transition:
    transform 280ms var(--ease-out-expo),
    box-shadow 280ms ease,
    border-color 180ms ease;
}

.header-button,
.primary-action {
  padding: 17px 24px;
  background: linear-gradient(180deg, var(--btn-grad1), var(--btn-grad2));
  color: #fff;
  font-weight: 800;
  box-shadow: 0 18px 32px rgba(19, 29, 48, 0.18);
  position: relative;
  overflow: hidden;
}

.header-button::before,
.primary-action::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(62, 99, 255, 0.3), rgba(62, 99, 255, 0));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.header-button:hover::before,
.primary-action:hover::before {
  opacity: 1;
}

.secondary-action {
  padding: 16px 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
  font-weight: 800;
}

.header-button:hover,
.primary-action:hover,
.secondary-action:hover,
.feature-card a:hover,
.workflow-grid a:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 44px rgba(19, 29, 48, 0.22);
}

/* ── Hero ── */

.home-hero {
  min-height: calc(100vh - 24px * 2 - 96px - 24px);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
  gap: 24px;
  max-width: 1360px;
  margin: 24px auto 0;
  padding: 32px;
  background: var(--hero-bg);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 38px;
  box-shadow: var(--shadow);
  opacity: 0;
  animation: heroReveal 0.6s var(--ease-out-expo) 0.05s forwards;
}

@keyframes heroReveal {
  0% { opacity: 0; transform: translateY(30px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.hero-intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.hero-intro .eyebrow {
  opacity: 0;
  animation: fadeUp 0.5s var(--ease-out-expo) 0.1s forwards;
}

.hero-intro h2 {
  margin: 0;
  max-width: 7ch;
  font-family: "Fraunces", "Noto Sans SC", serif;
  font-size: clamp(3.1rem, 4.8vw, 5.6rem);
  line-height: 0.92;
  letter-spacing: -0.045em;
  font-weight: 900;
  opacity: 0;
  animation: fadeUp 0.5s var(--ease-out-expo) 0.12s forwards;
}

.hero-intro h2 span {
  display: block;
  color: var(--blue);
  letter-spacing: -0.03em;
}

/* Typewriter cursor — zero layout width, visual via box-shadow */
.hero-intro h2 .typewriter-cursor {
  display: inline-block;
  width: 0;
  height: 0.85em;
  vertical-align: baseline;
  position: relative;
  top: 0.04em;
  box-shadow: 3px 0 0 var(--ink);
  animation: cursorBlink 0.6s steps(1) infinite;
}

.hero-intro h2 span .typewriter-cursor {
  box-shadow: 3px 0 0 var(--blue);
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 26px;
  opacity: 0;
  animation: fadeUp 0.5s var(--ease-out-expo) 0.25s forwards;
}

.system-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding: 0;
  width: fit-content;
  opacity: 0;
  animation: fadeUp 0.5s var(--ease-out-expo) 0.2s forwards;
}

.system-status:hover {
  transform: none;
}

.status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  position: relative;
}

.status-indicator::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--green);
  animation: radarPulse 2s linear infinite;
}

@keyframes radarPulse {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(2); opacity: 0; }
}

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

.status-text span {
  font-size: 10px;
  font-weight: 700;
  color: color-mix(in oklch, var(--muted), transparent 20%);
  letter-spacing: 0.08em;
}

.status-text strong {
  font-family: "DM Mono", monospace;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: -0.01em;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  opacity: 0;
  animation: fadeUp 0.7s var(--ease-out-expo) 1.25s forwards;
}

.hero-tags span,
.badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.hero-tags span:first-child,
.signal .badge {
  background: rgba(46, 125, 105, 0.12);
  color: var(--green);
}

.hero-tags span:last-child {
  background: rgba(62, 99, 255, 0.12);
  color: var(--blue);
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  font-size: 13px;
  color: var(--muted);
  opacity: 0;
  animation: fadeUp 0.7s var(--ease-out-expo) 1.4s forwards;
}

.hero-meta strong {
  color: var(--ink);
  font-weight: 800;
}

.hero-meta .hero-divider {
  width: 1px;
  height: 12px;
  background: rgba(24, 36, 58, 0.14);
}

@keyframes fadeUp {
  0% { opacity: 0; transform: translateY(16px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ── Hero Panel ── */

.hero-panel {
  align-self: center;
  padding: 20px;
  background: var(--hero-panel-bg);
  border: 1px solid rgba(24, 36, 58, 0.06);
  border-radius: 30px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5),
    0 24px 48px rgba(19, 30, 47, 0.08);
  opacity: 0;
  animation: panelFadeIn 0.5s var(--ease-out-expo) 0.1s forwards;
}

@keyframes panelFadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 12px;
}

.panel-head span {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

/* ── Tool Links ── */

.tool-link {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  margin-top: 12px;
  background: var(--panel-strong);
  border: 1px solid rgba(24, 36, 58, 0.05);
  border-radius: 24px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.56);
  transition:
    transform 320ms var(--ease-out-expo),
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 320ms ease;
  opacity: 0;
  animation: cardReveal 0.6s var(--ease-out-expo) forwards;
}

.tool-link:nth-child(2) { animation-delay: 0.8s; }
.tool-link:nth-child(3) { animation-delay: 0.95s; }
.tool-link:nth-child(4) { animation-delay: 1.1s; }
.tool-link:nth-child(5) { animation-delay: 1.25s; }
.tool-link:nth-child(6) { animation-delay: 1.4s; }

@keyframes cardReveal {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}

.tool-link:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: rgba(24, 36, 58, 0.1);
  box-shadow: var(--hover-spectral-glow);
}

.tool-link.signal {
  box-shadow:
    inset 4px 0 0 var(--green),
    inset 0 1px 0 rgba(255, 255, 255, 0.56);
}

.tool-link.signal:hover {
  box-shadow:
    inset 4px 0 0 var(--green),
    inset 0 1px 0 rgba(255, 255, 255, 0.56),
    0 12px 32px rgba(46, 125, 105, 0.15);
}

.tool-link.commerce,
.commerce .badge {
  box-shadow:
    inset 4px 0 0 var(--amber),
    inset 0 1px 0 rgba(255, 255, 255, 0.56);
}

.tool-link.commerce:hover {
  box-shadow:
    inset 4px 0 0 var(--amber),
    inset 0 1px 0 rgba(255, 255, 255, 0.56),
    0 12px 32px rgba(213, 154, 57, 0.15);
}

.commerce .badge {
  color: #8c5b0c;
  background: rgba(213, 154, 57, 0.15);
}

.tool-link.preview,
.preview .badge {
  box-shadow:
    inset 4px 0 0 var(--violet),
    inset 0 1px 0 rgba(255, 255, 255, 0.56);
}

.tool-link.preview:hover {
  box-shadow:
    inset 4px 0 0 var(--violet),
    inset 0 1px 0 rgba(255, 255, 255, 0.56),
    0 12px 32px rgba(101, 94, 255, 0.15);
}

.preview .badge {
  color: var(--violet);
  background: rgba(101, 94, 255, 0.12);
}

.tool-link.ops {
  box-shadow:
    inset 4px 0 0 var(--ink),
    inset 0 1px 0 rgba(255, 255, 255, 0.56);
}

.tool-link.ops:hover {
  box-shadow:
    inset 4px 0 0 var(--ink),
    inset 0 1px 0 rgba(255, 255, 255, 0.56),
    0 12px 32px rgba(24, 36, 58, 0.12);
}

.tool-link.image,
.image .badge {
  box-shadow:
    inset 4px 0 0 var(--blue),
    inset 0 1px 0 rgba(255, 255, 255, 0.56);
}

.tool-link.image:hover {
  box-shadow:
    inset 4px 0 0 var(--blue),
    inset 0 1px 0 rgba(255, 255, 255, 0.56),
    0 12px 32px rgba(62, 99, 255, 0.15);
}

.image .badge {
  color: var(--blue);
  background: rgba(62, 99, 255, 0.12);
}

.tool-link.formula,
.formula .badge {
  box-shadow:
    inset 4px 0 0 var(--green),
    inset 0 1px 0 rgba(255, 255, 255, 0.56);
}

.tool-link.formula:hover {
  box-shadow:
    inset 4px 0 0 var(--green),
    inset 0 1px 0 rgba(255, 255, 255, 0.56),
    0 12px 32px rgba(46, 125, 105, 0.15);
}

.formula .badge {
  color: var(--green);
  background: rgba(46, 125, 105, 0.12);
}

.tool-link strong {
  display: block;
  font-family: "Fraunces", "Noto Sans SC", serif;
  font-size: 21px;
  line-height: 1.1;
  font-weight: 900;
}

.tool-link p {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.tool-link em {
  font-style: normal;
  font-size: 15px;
  font-weight: 800;
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 12px;
  background: rgba(24, 36, 58, 0.04);
  transition: background 0.2s ease, color 0.2s ease, transform 0.3s var(--ease-out-expo);
}

.tool-link:hover em {
  background: var(--ink);
  color: var(--bg);
  transform: translateX(2px);
}

/* ── Carousel (hero panel infinite scroll) ── */

.carousel-wrapper {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  perspective: 1200px;
}

.carousel-wrapper.is-dragging { cursor: grabbing; }

.hero-panel.carousel-wrapper {
  transition:
    background 0.5s ease,
    border-color 0.5s ease,
    box-shadow 0.5s ease,
    transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.hero-panel.carousel-wrapper:hover,
.hero-panel.carousel-wrapper.is-dragging {
  transition:
    background 0.5s ease,
    border-color 0.5s ease,
    box-shadow 0.5s ease,
    transform 0.08s ease-out;
}

.panel-head span {
  font-size: 11px;
  font-weight: 500;
  color: color-mix(in oklch, var(--muted), transparent 30%);
}

.carousel-viewport {
  --card-h: 76px;
  --card-gap: 12px;
  height: calc(var(--card-h) * 4 + var(--card-gap) * 3);
  overflow: hidden;
  position: relative;
  border-radius: 24px;
  padding: 0 18px;
  margin: 0 -18px;
  mask-image: linear-gradient(to bottom, transparent 0%, black 5%, black 95%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 5%, black 95%, transparent 100%);
}

.carousel-track {
  display: flex;
  flex-direction: column;
  gap: var(--card-gap);
  will-change: transform;
}

.carousel-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  height: var(--card-h);
  background: var(--panel-strong);
  border: 1px solid rgba(24, 36, 58, 0.08);
  border-radius: 22px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 1px 2px rgba(19, 30, 47, 0.06),
    0 4px 12px rgba(19, 30, 47, 0.06);
  transition:
    transform 280ms var(--ease-out-expo),
    box-shadow 280ms ease,
    border-color 200ms ease;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
  pointer-events: auto;
  position: relative;
  overflow: hidden;
}

.carousel-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  opacity: 0.7;
  transition: opacity 200ms ease, top 200ms var(--ease-out-expo), bottom 200ms var(--ease-out-expo);
}

.carousel-card:hover::before { opacity: 1; top: 12px; bottom: 12px; }

.carousel-card.signal::before  { background: var(--green);  }
.carousel-card.commerce::before{ background: var(--amber);  }
.carousel-card.preview::before { background: var(--violet); }
.carousel-card.formula::before { background: var(--blue);   }
.carousel-card.image::before   { background: var(--rose);   }

.carousel-card:hover {
  transform: translateY(-2px) scale(1.012);
  border-color: rgba(24, 36, 58, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 6px 24px rgba(19, 30, 47, 0.1),
    0 1px 4px rgba(19, 30, 47, 0.06);
}

.carousel-card.signal:hover  { box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 6px 24px rgba(46,125,105,0.15), 0 1px 4px rgba(46,125,105,0.08); }
.carousel-card.commerce:hover{ box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 6px 24px rgba(213,154,57,0.15), 0 1px 4px rgba(213,154,57,0.08); }
.carousel-card.preview:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 6px 24px rgba(101,94,255,0.15), 0 1px 4px rgba(101,94,255,0.08); }
.carousel-card.formula:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 6px 24px rgba(62,99,255,0.15), 0 1px 4px rgba(62,99,255,0.08); }
.carousel-card.image:hover   { box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 6px 24px rgba(212,99,123,0.15), 0 1px 4px rgba(212,99,123,0.08); }

.carousel-card:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.carousel-card strong {
  font-family: "Fraunces", "Noto Sans SC", serif;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.carousel-card .desc {
  margin-top: 1px;
  font-size: 12.5px;
  color: color-mix(in oklch, var(--muted), var(--ink) 10%);
  font-weight: 500;
  line-height: 1.3;
}

.carousel-card em {
  font-style: normal;
  padding: 8px 14px;
  background: var(--ink);
  color: rgba(255, 255, 255, 0.92);
  font-weight: 700;
  font-size: 12px;
  border-radius: 12px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 280ms var(--ease-out-expo), opacity 200ms ease;
  opacity: 0.85;
}

/* ── Animated Icons for Buttons ── */

.carousel-card:hover .icon-book .book-left,
.feature-card:hover .icon-book .book-left,
.note-card:hover .icon-book .book-left,
.learn-card:hover .icon-book .book-left {
  animation: book-flip-left 0.6s ease-out forwards;
}
.carousel-card:hover .icon-book .book-right,
.feature-card:hover .icon-book .book-right,
.note-card:hover .icon-book .book-right,
.learn-card:hover .icon-book .book-right {
  animation: book-flip-right 0.6s ease-out 0.1s forwards;
}
@keyframes book-flip-left {
  0% { transform: skewY(0deg); }
  50% { transform: skewY(-8deg); }
  100% { transform: skewY(0deg); }
}
@keyframes book-flip-right {
  0% { transform: skewY(0deg); }
  50% { transform: skewY(8deg); }
  100% { transform: skewY(0deg); }
}

.carousel-card:hover .icon-rocket,
.feature-card:hover .icon-rocket,
.note-card:hover .icon-rocket {
  animation: rocket-shake 0.4s infinite alternate ease-in-out;
}
.carousel-card:hover .icon-rocket .rocket-exhaust,
.feature-card:hover .icon-rocket .rocket-exhaust,
.note-card:hover .icon-rocket .rocket-exhaust {
  animation: exhaust-flicker 0.2s infinite alternate;
}
@keyframes rocket-shake {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-1px, 1px); }
  50% { transform: translate(1px, -1px); }
  75% { transform: translate(-1px, -1px); }
  100% { transform: translate(1px, 1px); }
}
@keyframes exhaust-flicker {
  0% { opacity: 0.5; transform: scaleY(1); transform-origin: top; }
  100% { opacity: 1; transform: scaleY(1.3); transform-origin: top; }
}

.carousel-card:hover .icon-eye .eye-pupil,
.feature-card:hover .icon-eye .eye-pupil,
.note-card:hover .icon-eye .eye-pupil {
  animation: eye-look 1.5s infinite ease-in-out;
}
@keyframes eye-look {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(2px, -1px); }
  50% { transform: translate(0, 0); }
  75% { transform: translate(-2px, 1px); }
}

.carousel-card:hover .icon-check,
.feature-card:hover .icon-check,
.note-card:hover .icon-check {
  animation: check-scale 0.4s ease-out forwards;
}
.carousel-card:hover .icon-check .check-path,
.feature-card:hover .icon-check .check-path,
.note-card:hover .icon-check .check-path {
  stroke-dasharray: 10;
  stroke-dashoffset: 10;
  animation: check-draw 0.5s ease-out forwards;
}
@keyframes check-scale {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
@keyframes check-draw {
  0% { stroke-dashoffset: 10; }
  100% { stroke-dashoffset: 0; }
}

.carousel-card:hover .icon-chart .chart-bar,
.feature-card:hover .icon-chart .chart-bar {
  transform-origin: bottom;
  animation: chart-grow 0.8s ease-out forwards;
}
.carousel-card:hover .icon-chart .bar-1,
.feature-card:hover .icon-chart .bar-1 { animation-delay: 0s; }
.carousel-card:hover .icon-chart .bar-2,
.feature-card:hover .icon-chart .bar-2 { animation-delay: 0.1s; }
.carousel-card:hover .icon-chart .bar-3,
.feature-card:hover .icon-chart .bar-3 { animation-delay: 0.2s; }
@keyframes chart-grow {
  0% { transform: scaleY(0.4); }
  50% { transform: scaleY(1.3); }
  100% { transform: scaleY(1); }
}

.carousel-card:hover em {
  transform: translateY(-1px);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .carousel-card,
  .carousel-card::before,
  .carousel-card em { transition-duration: 0.01ms !important; }
}

/* Dark theme carousel overrides */
html[data-theme="dark"] .carousel-card {
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .carousel-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 6px 24px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .carousel-card em {
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
}

html[data-theme="dark"] .carousel-card:hover em {
  background: rgba(255, 255, 255, 0.2);
}

html[data-theme="dark"] .carousel-card .desc {
  color: var(--muted);
}

html[data-theme="dark"] .carousel-card.signal:hover  { box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 6px 24px rgba(55,168,141,0.2); }
html[data-theme="dark"] .carousel-card.commerce:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 6px 24px rgba(230,171,69,0.2); }
html[data-theme="dark"] .carousel-card.preview:hover  { box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 6px 24px rgba(132,122,255,0.2); }
html[data-theme="dark"] .carousel-card.formula:hover  { box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 6px 24px rgba(91,126,255,0.2); }
html[data-theme="dark"] .carousel-card.image:hover    { box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 6px 24px rgba(232,117,142,0.2); }

/* Stellar theme carousel overrides */
html[data-theme="stellar"] .carousel-card {
  border-color: rgba(201, 164, 85, 0.12);
  background: rgba(28, 34, 60, 0.25);
  box-shadow:
    inset 0 1px 0 rgba(201, 164, 85, 0.08),
    0 2px 8px rgba(0, 0, 0, 0.35);
}

html[data-theme="stellar"] .carousel-card:hover {
  border-color: rgba(201, 164, 85, 0.15);
  box-shadow:
    inset 0 1px 0 rgba(201, 164, 85, 0.1),
    0 6px 24px rgba(0, 0, 0, 0.4);
}

html[data-theme="stellar"] .carousel-card em {
  background: rgba(201, 164, 85, 0.12);
  color: var(--ink);
}

html[data-theme="stellar"] .carousel-card:hover em {
  background: rgba(201, 164, 85, 0.22);
}

html[data-theme="stellar"] .carousel-card .desc {
  color: var(--muted);
}

html[data-theme="stellar"] .carousel-card.signal:hover  { box-shadow: inset 0 1px 0 rgba(201,164,85,0.06), 0 6px 24px rgba(95,191,163,0.18); }
html[data-theme="stellar"] .carousel-card.commerce:hover { box-shadow: inset 0 1px 0 rgba(201,164,85,0.06), 0 6px 24px rgba(201,164,85,0.2); }
html[data-theme="stellar"] .carousel-card.preview:hover  { box-shadow: inset 0 1px 0 rgba(201,164,85,0.06), 0 6px 24px rgba(164,148,224,0.2); }
html[data-theme="stellar"] .carousel-card.formula:hover  { box-shadow: inset 0 1px 0 rgba(201,164,85,0.06), 0 6px 24px rgba(126,168,216,0.18); }
html[data-theme="stellar"] .carousel-card.image:hover    { box-shadow: inset 0 1px 0 rgba(201,164,85,0.06), 0 6px 24px rgba(212,137,122,0.18); }

/* ── Subpage layout ── */

.page-stack {
  position: relative;
  z-index: 1;
  max-width: 1360px;
  margin: 24px auto 0;
  display: grid;
  gap: 24px;
}

.page-hero {
  padding: 28px 30px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 30px;
  box-shadow: var(--shadow);
  opacity: 0;
  animation: fadeUp 0.8s var(--ease-out-expo) 0.2s forwards;
}

.page-hero h2 {
  margin: 0;
  font-family: "Fraunces", "Noto Sans SC", serif;
  font-size: clamp(2.8rem, 4.2vw, 4rem);
  line-height: 0.96;
  letter-spacing: -0.04em;
}

.page-hero p:last-child {
  max-width: 720px;
  margin: 14px 0 0;
  font-size: 16px;
  line-height: 1.7;
  color: var(--muted);
}

.page-hero.section-divider {
  padding: 20px 30px;
  margin-top: 12px;
}

.page-hero.section-divider h2 {
  font-size: clamp(1.4rem, 2.4vw, 1.7rem);
}

/* ── Card Grid ── */

.card-grid {
  display: grid;
  gap: 18px;
}

.card-grid.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-grid.three-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-card,
.timeline-card,
.note-card {
  padding: 24px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 28px;
  box-shadow: var(--shadow);
  opacity: 0;
  animation: fadeUp 0.7s var(--ease-out-expo) forwards;
  transition: transform 320ms var(--ease-out-expo), box-shadow 320ms ease, background 0.5s ease, border-color 0.5s ease;
}

.feature-card:hover,
.note-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--hover-spectral-glow);
}

.card-grid .feature-card:nth-child(1) { animation-delay: 0.35s; }
.card-grid .feature-card:nth-child(2) { animation-delay: 0.45s; }
.card-grid .feature-card:nth-child(3) { animation-delay: 0.55s; }
.card-grid .feature-card:nth-child(4) { animation-delay: 0.65s; }
.card-grid .feature-card:nth-child(5) { animation-delay: 0.75s; }

.feature-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.status-pill.live {
  background: rgba(46, 125, 105, 0.12);
  color: var(--green);
  position: relative;
}

.status-pill.live::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 6px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.feature-card h3,
.timeline-card h3 {
  margin: 18px 0 10px;
  font-family: "Fraunces", "Noto Sans SC", serif;
  font-size: 28px;
  line-height: 1;
}

.feature-card p,
.timeline-card li,
.workflow-grid p,
.feed-board p,
.info-panel span {
  color: var(--muted);
  line-height: 1.7;
}

.feature-card ul,
.timeline-card ul {
  padding-left: 18px;
  margin: 16px 0 22px;
}

.feature-card a,
.workflow-grid a {
  padding: 14px 18px;
  width: fit-content;
  background: rgba(24, 36, 58, 0.06);
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s ease, transform 280ms var(--ease-out-expo), box-shadow 280ms ease;
}

.feature-card a:hover {
  background: var(--ink);
  color: var(--bg);
}

/* ── Note Cards (Skill showcase) ── */

.note-card h3 {
  margin: 12px 0 0;
  font-family: "Fraunces", "Noto Sans SC", serif;
  font-size: 18px;
  line-height: 1;
}

.note-card p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 20px;
}

.note-card .badge.skill-violet {
  background: rgba(101, 94, 255, 0.12);
  color: var(--violet);
}

.note-card .badge.skill-blue {
  background: rgba(62, 99, 255, 0.12);
  color: var(--blue);
}

.note-card .badge.skill-amber {
  background: rgba(213, 154, 57, 0.15);
  color: var(--amber);
}

.note-card a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(24, 36, 58, 0.06);
  border-radius: 8px;
  transition: background 0.2s ease, color 0.2s ease;
}

.note-card a:hover {
  background: var(--ink);
  color: var(--bg);
}

/* ── Learn Cards (Recommended Learning) ── */

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

.learn-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 32px;
  padding: 28px 32px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 28px;
  box-shadow:
    inset 4px 0 0 var(--rose, #d4637b),
    inset 0 1px 0 rgba(255, 255, 255, 0.56),
    var(--shadow);
  opacity: 0;
  animation: fadeUp 0.7s var(--ease-out-expo) 0.5s forwards;
  transition: transform 320ms var(--ease-out-expo), box-shadow 320ms ease, background 0.5s ease, border-color 0.5s ease;
}

.learn-card:hover {
  transform: translateY(-4px) scale(1.005);
  box-shadow:
    inset 4px 0 0 var(--rose, #d4637b),
    var(--hover-spectral-glow);
}

.learn-card-content {
  min-width: 0;
}

.learn-card h3 {
  margin: 14px 0 8px;
  font-family: "Fraunces", "Noto Sans SC", serif;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 900;
}

.learn-card p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
  margin: 0 0 14px;
  max-width: 640px;
}

.learn-provider {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.badge.skill-rose {
  background: rgba(212, 99, 123, 0.12);
  color: var(--rose, #d4637b);
}

.learn-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.learn-tags span {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(24, 36, 58, 0.04);
  color: var(--muted);
  letter-spacing: 0.02em;
}

.learn-card > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 18px;
  font-weight: 800;
  font-size: 15px;
  white-space: nowrap;
  background: rgba(212, 99, 123, 0.08);
  color: var(--rose, #d4637b);
  transition: background 0.25s ease, color 0.25s ease, transform 280ms var(--ease-out-expo);
}

.learn-card > a:hover {
  background: var(--rose, #d4637b);
  color: #fff;
  transform: translateX(3px);
}

/* ── Hero Divider ── */

.hero-divider {
  display: inline-block;
  width: 1px;
  height: 12px;
  background: rgba(24, 36, 58, 0.14);
}

/* ── Info Panel ── */

.info-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: start;
  padding: 24px 26px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 28px;
  box-shadow: var(--shadow);
  opacity: 0;
  animation: fadeUp 0.7s var(--ease-out-expo) 0.85s forwards;
  transition: background 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}

/* ── Graph Panel (Obsidian-style) ── */

.graph-panel {
  border-radius: 28px;
  overflow: hidden;
  opacity: 0;
  animation: fadeUp 0.7s var(--ease-out-expo) 0.9s forwards;
  position: relative;
  z-index: 1;
}

.graph-head {
  padding: 24px 28px 16px;
  background: var(--graph-head-bg);
  transition: background 0.5s ease;
}

.graph-head .eyebrow {
  color: var(--graph-eyebrow);
}

.graph-head h3 {
  margin: 0;
  font-family: "Fraunces", "Noto Sans SC", serif;
  font-size: 26px;
  color: var(--graph-title);
}

.graph-container {
  position: relative;
  width: 100%;
  height: 380px;
  background: radial-gradient(ellipse at 50% 50%, var(--graph-bg-center) 0%, var(--graph-bg-mid) 50%, var(--graph-bg-edge) 100%);
  transition: background 0.5s ease;
}

.graph-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.info-panel.split {
  grid-template-columns: minmax(220px, 0.6fr) 1fr;
}

.info-panel h3 {
  margin: 0;
  font-family: "Fraunces", "Noto Sans SC", serif;
  font-size: 28px;
}

.domain-list,
.role-list {
  display: grid;
  gap: 12px;
}

.domain-list div,
.role-list div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  transition: padding-left 0.3s var(--ease-out-expo);
}

.domain-list div:hover,
.role-list div:hover {
  padding-left: 8px;
}

.domain-list strong,
.role-list strong {
  font-weight: 800;
  font-family: "DM Mono", monospace;
  font-size: 14px;
}

/* ── Workflow Grid ── */

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.workflow-grid article {
  padding: 22px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.workflow-grid span {
  display: inline-flex;
  margin-bottom: 40px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.workflow-grid h3 {
  margin: 0 0 10px;
  font-family: "Fraunces", "Noto Sans SC", serif;
  font-size: 26px;
  line-height: 1;
}

.workflow-grid a {
  margin-top: 16px;
}

/* ── Feed Board ── */

.feed-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.feed-board article {
  padding: 20px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.feed-board strong {
  font-size: 22px;
  line-height: 1;
}

/* ── Responsive ── */

@media (max-width: 1240px) {
  body.page-home {
    height: auto;
    overflow: auto;
  }

  .site-shell {
    min-height: 100vh;
  }

  .home-hero,
  .card-grid.two-up,
  .card-grid.three-up,
  .workflow-grid,
  .feed-board,
  .info-panel,
  .info-panel.split {
    grid-template-columns: 1fr;
  }

  .home-hero {
    min-height: auto;
  }

  .hero-intro h2 {
    max-width: none;
    font-size: clamp(2.2rem, 9vw, 3.6rem);
    line-height: 1.15;
  }
}

@media (max-width: 920px) {
  .site-shell {
    padding: 16px;
  }

  .site-header {
    flex-wrap: wrap;
    padding: 16px;
    border-radius: 24px;
    gap: 16px;
  }

  .site-header > .site-nav {
    position: static;
    transform: none;
    width: 100%;
    order: 3;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
  }

  .brand-text h1 {
    font-size: 15px;
  }

  .brand-text p {
    font-size: 9px;
  }

  .header-button {
    font-size: 13px;
    padding: 10px 16px;
  }

  .home-hero,
  .page-hero,
  .feature-card,
  .timeline-card,
  .note-card,
  .learn-card,
  .workflow-grid article {
    padding: 20px;
  }

  .hero-actions {
    flex-wrap: wrap;
  }

  .tool-link,
  .learn-card {
    grid-template-columns: 1fr;
  }

  .domain-list div,
  .role-list div {
    flex-direction: column;
    gap: 6px;
  }
}

/* ── SPA Navigation Overrides ── */
.spa-navigated .site-header { animation-delay: 0s !important; }
.spa-navigated .home-hero { animation-delay: 0s !important; }
.spa-navigated .hero-intro .eyebrow { animation-delay: 0.1s !important; }
.spa-navigated .hero-intro h2 { animation-delay: 0.1s !important; }
.spa-navigated .system-status { animation-delay: 0.15s !important; }
.spa-navigated .hero-tags { animation-delay: 0.15s !important; }
.spa-navigated .hero-meta { animation-delay: 0.2s !important; }
.spa-navigated .hero-panel { animation-delay: 0.1s !important; }
.spa-navigated .tool-link, 
.spa-navigated .card-grid .feature-card { animation-delay: 0.05s !important; }
.spa-navigated .page-hero { animation-delay: 0s !important; }
.spa-navigated .info-panel { animation-delay: 0.1s !important; }
.spa-navigated .learn-card { animation-delay: 0.05s !important; }

/* ── Accessibility: Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .ambient {
    opacity: 0.6 !important;
    animation: none !important;
  }
}

/* ── Footer ── */

.site-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 20px 24px;
  margin-top: 16px;
  font-size: 11px;
  font-weight: 500;
  color: color-mix(in oklch, var(--muted), transparent 40%);
  letter-spacing: 0.02em;
}

.footer-sep {
  opacity: 0.4;
}

/* ═══════════════════════════════════════════════════
   Workspace Shell
   ═══════════════════════════════════════════════════ */

body.page-workspace {
  overflow: hidden;
}

body.page-workspace .site-shell {
  padding: 0;
  display: block;
  height: 100vh;
  overflow: hidden;
  animation: none;
}

/* ── Sidebar ── */

.workspace-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 60px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: hidden;
  z-index: 40;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: width 0.32s var(--ease-out-expo);
  will-change: width;
}

.workspace-sidebar:hover {
  width: 200px;
}

.sidebar-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  min-height: 56px;
}

.workspace-sidebar .brand-mark {
  width: 28px;
  height: 28px;
  padding: 3px;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-family: "DM Sans", "Noto Sans SC", sans-serif;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.25s ease 0.05s;
}

.workspace-sidebar:hover .sidebar-brand-text {
  opacity: 1;
}

.sidebar-section-label {
  padding: 14px 16px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.25s ease 0.05s;
}

.workspace-sidebar:hover .sidebar-section-label {
  opacity: 1;
}

.sidebar-tools {
  flex: 1;
  padding: 6px 8px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-tool-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s var(--ease-out-expo);
  font-family: "DM Sans", "Noto Sans SC", sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  text-align: left;
}

.sidebar-tool-item:hover {
  background: var(--line);
  color: var(--ink);
}

.sidebar-tool-item:active {
  transform: scale(0.97);
}

.sidebar-tool-item.active {
  background: color-mix(in oklch, var(--blue) 10%, transparent);
  color: var(--ink);
}

/* Tool icon (single character) */

.tool-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
  transition:
    box-shadow 0.28s ease,
    transform 0.28s var(--ease-out-expo),
    background 0.28s ease;
}

.sidebar-tool-item.signal .tool-icon {
  background: color-mix(in oklch, var(--green) 12%, transparent);
  color: var(--green);
}
.sidebar-tool-item.commerce .tool-icon {
  background: color-mix(in oklch, var(--blue) 12%, transparent);
  color: var(--blue);
}
.sidebar-tool-item.preview .tool-icon {
  background: color-mix(in oklch, var(--amber) 12%, transparent);
  color: var(--amber);
}
.sidebar-tool-item.formula .tool-icon {
  background: color-mix(in oklch, var(--violet) 12%, transparent);
  color: var(--violet);
}
.sidebar-tool-item.image .tool-icon {
  background: color-mix(in oklch, var(--rose) 12%, transparent);
  color: var(--rose);
}

/* Hover glow on sidebar tool icons — mirrors homepage spectral glow */
.sidebar-tool-item:hover .tool-icon {
  transform: translateY(-2px) scale(1.08);
}
.sidebar-tool-item.signal:hover .tool-icon {
  box-shadow:
    0 0 0 1.5px rgba(46, 125, 105, 0.25),
    0 2px 8px rgba(46, 125, 105, 0.3),
    0 4px 16px rgba(46, 125, 105, 0.15);
}
.sidebar-tool-item.commerce:hover .tool-icon {
  box-shadow:
    0 0 0 1.5px rgba(62, 99, 255, 0.25),
    0 2px 8px rgba(62, 99, 255, 0.3),
    0 4px 16px rgba(62, 99, 255, 0.15);
}
.sidebar-tool-item.preview:hover .tool-icon {
  box-shadow:
    0 0 0 1.5px rgba(213, 154, 57, 0.25),
    0 2px 8px rgba(213, 154, 57, 0.3),
    0 4px 16px rgba(213, 154, 57, 0.15);
}
.sidebar-tool-item.formula:hover .tool-icon {
  box-shadow:
    0 0 0 1.5px rgba(101, 94, 255, 0.25),
    0 2px 8px rgba(101, 94, 255, 0.3),
    0 4px 16px rgba(101, 94, 255, 0.15);
}
.sidebar-tool-item.image:hover .tool-icon {
  box-shadow:
    0 0 0 1.5px rgba(212, 99, 123, 0.25),
    0 2px 8px rgba(212, 99, 123, 0.3),
    0 4px 16px rgba(212, 99, 123, 0.15);
}

.sidebar-tool-item.active .tool-icon {
  box-shadow: 0 0 0 2px currentColor;
}

.tool-name {
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.25s ease 0.05s;
}

.workspace-sidebar:hover .tool-name {
  opacity: 1;
}

/* Sidebar footer */

.sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
  text-decoration: none;
}

.sidebar-link:hover {
  background: var(--line);
  color: var(--ink);
}

/* ── Animated Tool Icons in Sidebar Footer ── */

.sidebar-link:hover .icon-grid .grid-1 { animation: grid-pop 0.4s ease forwards; animation-delay: 0s; }
.sidebar-link:hover .icon-grid .grid-2 { animation: grid-pop 0.4s ease forwards; animation-delay: 0.05s; }
.sidebar-link:hover .icon-grid .grid-4 { animation: grid-pop 0.4s ease forwards; animation-delay: 0.1s; }
.sidebar-link:hover .icon-grid .grid-3 { animation: grid-pop 0.4s ease forwards; animation-delay: 0.15s; }

@keyframes grid-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

.sidebar-link:hover .icon-home {
  animation: home-bounce 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}
.sidebar-link:hover .icon-home .home-door {
  transform-origin: bottom;
  animation: door-slide 0.4s ease forwards;
}

.sidebar-link:hover .icon-plug {
  animation: plug-bob 0.35s ease forwards;
}

.sidebar-link:hover .icon-plug .plug-prong-left,
.sidebar-link:hover .icon-plug .plug-prong-right {
  animation: plug-prong-spark 0.35s ease forwards;
}

@keyframes home-bounce {
  0% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}
@keyframes door-slide {
  0% { transform: scaleY(1); }
  40% { transform: scaleY(0); }
  100% { transform: scaleY(1); }
}

@keyframes plug-bob {
  0% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
  100% { transform: translateY(0); }
}

@keyframes plug-prong-spark {
  0% { transform: translateY(0); }
  50% { transform: translateY(-1px); }
  100% { transform: translateY(0); }
}

.sidebar-link-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-link-label {
  opacity: 0;
  transition: opacity 0.25s ease;
}

.workspace-sidebar:hover .sidebar-link-label {
  opacity: 1;
}

/* ── Main content area ── */

.workspace-main {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 0;
  left: 60px;
  right: 0;
  bottom: 0;
}

.workspace-header {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.workspace-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workspace-header-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex: 1;
  min-width: 0;
  margin-left: 20px;
}

.workspace-title h1 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  font-family: "DM Sans", "Noto Sans SC", sans-serif;
  color: var(--ink);
}

.workspace-tool-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-signal { background: color-mix(in oklch, var(--green) 14%, transparent); color: var(--green); }
.badge-commerce { background: color-mix(in oklch, var(--blue) 14%, transparent); color: var(--blue); }
.badge-preview { background: color-mix(in oklch, var(--amber) 14%, transparent); color: var(--amber); }
.badge-formula { background: color-mix(in oklch, var(--violet) 14%, transparent); color: var(--violet); }
.badge-image { background: color-mix(in oklch, var(--rose) 14%, transparent); color: var(--rose); }

.workspace-route-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  flex: 1;
  max-width: min(52vw, 680px);
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
}

.workspace-route-status[data-state="healthy"] {
  color: var(--muted);
}

.workspace-route-status[data-state="unconfigured"] {
  opacity: 0.82;
}

.workspace-route-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  flex-shrink: 0;
  background: var(--green);
  animation: workspace-route-pulse 2s ease-in-out infinite;
}

.workspace-route-status[data-state="healthy"] .workspace-route-dot {
  background: var(--green);
  animation: workspace-route-pulse 2s ease-in-out infinite;
}

.workspace-route-status[data-state="unhealthy"] .workspace-route-dot {
  background: var(--rose);
  animation: none;
}

.workspace-route-status[data-state="unconfigured"] .workspace-route-dot {
  background: color-mix(in oklch, var(--muted) 72%, white 28%);
  animation: none;
}

.workspace-route-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

@keyframes workspace-route-pulse {
  0%, 100% { opacity: 0.58; }
  50% { opacity: 1; }
}

.workspace-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.ws-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.ws-action-btn:hover {
  background: var(--line);
  color: var(--ink);
}

.ws-action-btn:hover .icon-external .ext-arrow {
  animation: external-fly 0.5s ease forwards;
}

@keyframes external-fly {
  0% { transform: translate(0, 0); }
  50% { transform: translate(3px, -3px); opacity: 0; }
  51% { transform: translate(-3px, 3px); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: translate(0, 0); }
}

/* ── iframe content ── */

.workspace-content {
  flex: 1;
  position: relative;
  background: var(--bg);
}

.workspace-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
  border-radius: 0;
}

html[data-theme="dark"] .workspace-iframe,
html[data-theme="stellar"] .workspace-iframe {
  background: #0f1219;
}

/* ── Loading state ── */

.workspace-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
  z-index: 5;
  transition: opacity 0.3s ease;
}

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

.loading-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--blue);
  animation: ws-spin 0.7s linear infinite;
}

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

.workspace-loading p {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  font-family: "DM Sans", "Noto Sans SC", sans-serif;
}

/* ── Mobile: bottom tab bar ── */

@media (max-width: 768px) {
  .workspace-header {
    height: auto;
    min-height: 52px;
    padding: 10px 12px;
    gap: 10px;
  }

  .workspace-title {
    min-width: 0;
    flex: 1;
  }

  .workspace-title h1 {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .workspace-header-side {
    margin-left: 0;
    gap: 8px;
    flex: 1;
  }

  .workspace-route-status {
    max-width: min(60vw, 280px);
  }

  .workspace-route-text {
    font-size: 11px;
  }

  .workspace-sidebar {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    height: auto;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--line);
  }

  .workspace-main {
    left: 0;
    bottom: 52px;
  }

  .sidebar-header,
  .sidebar-footer,
  .sidebar-section-label {
    display: none;
  }

  .sidebar-tools {
    flex-direction: row;
    padding: 6px;
    gap: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: center;
  }

  .sidebar-tool-item {
    flex-direction: column;
    padding: 6px 10px;
    gap: 3px;
    font-size: 10px;
    border-radius: 8px;
  }

  .tool-icon {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }

  .tool-name {
    opacity: 1 !important;
  }
}

/* ── Global Iframe Pool ── */
.muxing-iframe-pool {
  position: fixed;
  overflow: hidden;
  transition: opacity 0.3s ease;
  z-index: 10;
  /* Hidden by default — only shown on workspace page via JS */
  opacity: 0;
  pointer-events: none;
  left: -9999px;
  top: 0;
  width: 0;
  height: 0;
}
.muxing-iframe-pool .workspace-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}
html[data-theme="dark"] .muxing-iframe-pool .workspace-iframe,
html[data-theme="stellar"] .muxing-iframe-pool .workspace-iframe {
  background: #0f1219;
}

/* ═══════════════════════════════════════════════════
   API Configuration Center
   ═══════════════════════════════════════════════════ */

/* ── Runtime Status ── */

#runtimeStatus {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 10px;
  background: rgba(24, 36, 58, 0.04);
  transition: background 0.3s ease, color 0.3s ease;
}

#runtimeStatus::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

#runtimeStatus[data-state="ok"] {
  color: var(--green);
  background: rgba(46, 125, 105, 0.08);
}

#runtimeStatus[data-state="ok"]::before {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

#runtimeStatus[data-state="error"] {
  color: var(--rose);
  background: rgba(212, 99, 123, 0.08);
}

#runtimeStatus[data-state="error"]::before {
  background: var(--rose);
  box-shadow: 0 0 6px var(--rose);
}

html[data-theme="dark"] #runtimeStatus {
  background: rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] #runtimeStatus[data-state="ok"] {
  background: rgba(55, 168, 141, 0.1);
}

html[data-theme="dark"] #runtimeStatus[data-state="error"] {
  background: rgba(232, 117, 142, 0.1);
}

/* ── Layout ── */

.api-layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 22px;
  min-height: 680px;
}

.api-sidebar-column {
  display: grid;
  grid-template-rows: minmax(360px, 1.08fr) minmax(260px, 0.92fr);
  gap: 18px;
  min-height: 680px;
}

@media (max-width: 1024px) {
  .api-layout {
    grid-template-columns: 1fr;
  }

  .api-sidebar-column {
    grid-template-rows: auto auto;
    min-height: 0;
  }
}

/* ── Global Bar ── */

.api-global-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: var(--api-shell-bar-bg);
  border: 1px solid var(--api-shell-bar-border);
  border-radius: 18px;
  box-shadow: var(--api-shell-bar-shadow);
  opacity: 0;
  animation: fadeUp 0.5s var(--ease-out-expo) 0.15s forwards;
  backdrop-filter: blur(12px);
}

.api-global-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.api-global-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.api-global-status strong {
  font-family: "DM Sans", "Noto Sans SC", sans-serif;
  font-size: 15px;
  font-weight: 800;
}

.api-global-model {
  display: block;
  font-family: "DM Mono", monospace;
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

.api-global-actions {
  display: flex;
  gap: 8px;
}

/* ── Status Dot ── */

.api-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.api-dot.idle {
  background: var(--muted);
  opacity: 0.4;
}

.api-dot.ok {
  background: var(--green);
  box-shadow: 0 0 4px color-mix(in oklch, var(--green), transparent 50%);
}

.api-dot.error {
  background: var(--rose);
  box-shadow: 0 0 4px color-mix(in oklch, var(--rose), transparent 50%);
}

/* ── Badges ── */

.api-badge-default {
  background: rgba(46, 125, 105, 0.12) !important;
  color: var(--green) !important;
  font-size: 10px !important;
  padding: 4px 10px !important;
}

.api-tag {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(101, 94, 255, 0.1);
  color: var(--violet);
}

.api-latency {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  color: var(--muted);
}

.api-model-count {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

/* ── Pool Panel (left) ── */

.api-pool-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 20px 18px;
  background: var(--api-sidebar-bg);
  color: var(--api-sidebar-fg);
  border: 1px solid var(--api-sidebar-border);
  border-radius: 30px;
  box-shadow: var(--api-sidebar-shadow);
  opacity: 0;
  animation: fadeUp 0.6s var(--ease-out-expo) 0.2s forwards;
  min-height: 0;
  overflow: hidden;
}

.api-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.api-panel-head h3 {
  margin: 0;
  font-family: "Fraunces", "Noto Sans SC", serif;
  font-size: 19px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.api-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--api-sidebar-muted);
}

/* ── Node List ── */

.api-node-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.api-node-list::-webkit-scrollbar {
  width: 4px;
}

.api-node-list::-webkit-scrollbar-thumb {
  background: var(--api-sidebar-scroll);
  border-radius: 2px;
}

.api-node-card {
  padding: 16px 16px 15px;
  border-radius: 20px;
  border: 1px solid var(--api-sidebar-card-border);
  background: var(--api-sidebar-card-bg);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.22s var(--ease-out-expo),
    box-shadow 0.22s ease;
}

.api-node-card:hover {
  background: var(--api-sidebar-card-hover);
  border-color: var(--api-sidebar-card-hover-border);
  transform: translateY(-2px);
}

.api-node-card.selected {
  border-color: var(--api-sidebar-card-selected-border);
  background: var(--api-sidebar-card-selected-bg);
  box-shadow: var(--api-sidebar-card-selected-shadow);
}

/* Node status accent — subtle left bar on selected node */
.api-node-card.selected.ok {
  border-left-color: var(--green);
  border-left-width: 3px;
}
.api-node-card.selected.error {
  border-left-color: var(--rose);
  border-left-width: 3px;
}

html[data-theme="dark"] .api-node-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
}
html[data-theme="dark"] .api-node-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.12);
}
html[data-theme="dark"] .api-node-card.selected {
  background: rgba(91, 126, 255, 0.08);
}

html[data-theme="stellar"] .api-node-card {
  background: rgba(201, 164, 85, 0.04);
  border-color: rgba(201, 164, 85, 0.08);
}
html[data-theme="stellar"] .api-node-card:hover {
  background: rgba(201, 164, 85, 0.07);
  border-color: rgba(201, 164, 85, 0.14);
}
html[data-theme="stellar"] .api-node-card.selected {
  border-color: var(--amber);
  background: rgba(201, 164, 85, 0.08);
}

html[data-theme="nature"] .api-node-card {
  background: rgba(42, 51, 40, 0.03);
  border-color: rgba(42, 51, 40, 0.08);
}
html[data-theme="nature"] .api-node-card:hover {
  background: rgba(42, 51, 40, 0.06);
  border-color: rgba(42, 51, 40, 0.14);
}
html[data-theme="nature"] .api-node-card.selected {
  border-color: var(--blue);
  background: rgba(61, 134, 124, 0.06);
}

.api-node-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.api-node-info {
  min-width: 0;
}

.api-node-info strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.api-node-url {
  display: block;
  font-family: "DM Mono", monospace;
  font-size: 11px;
  color: var(--api-sidebar-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
}

.api-node-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.api-node-empty {
  text-align: center;
  padding: 24px;
  color: var(--api-sidebar-muted);
  font-size: 13px;
}

/* ── Detail Panel (right) ── */

.api-detail-panel {
  padding: 0;
  background: var(--api-workspace-bg);
  border: 1px solid var(--api-workspace-border);
  border-radius: 34px;
  box-shadow: var(--api-workspace-shadow);
  opacity: 0;
  animation: fadeUp 0.6s var(--ease-out-expo) 0.28s forwards;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(100vh - 280px);
}

.api-binding-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 20px 18px 18px;
  background: var(--api-binding-panel-bg);
  border: 1px solid var(--api-binding-panel-border);
  border-radius: 28px;
  box-shadow: var(--api-binding-panel-shadow);
  opacity: 0;
  animation: fadeUp 0.6s var(--ease-out-expo) 0.24s forwards;
  overflow: hidden;
  backdrop-filter: blur(14px);
}

.api-binding-panel-head {
  align-items: flex-start;
}

.api-binding-panel-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.api-binding-panel-body {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.api-binding-panel-body::-webkit-scrollbar {
  width: 4px;
}

.api-binding-panel-body::-webkit-scrollbar-thumb {
  background: var(--api-sidebar-scroll);
  border-radius: 2px;
}

/* ── Empty State ── */

.api-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 56px 48px;
  text-align: center;
}

.api-empty-icon {
  color: var(--muted);
  opacity: 0.22;
}

.api-empty-state h3 {
  margin: 0;
  font-family: "Fraunces", "Noto Sans SC", serif;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.api-empty-state p {
  max-width: 320px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.65;
}

/* ── Detail Content ── */

.api-detail-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.api-detail-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.api-detail-scroll::-webkit-scrollbar {
  width: 4px;
}

.api-detail-scroll::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 2px;
}

/* ── Form ── */

.api-detail-form {
  padding: 28px 28px 24px;
  border-bottom: 1px solid var(--api-surface-border);
}

.api-form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.api-form-header h3 {
  margin: 0;
  font-family: "Fraunces", "Noto Sans SC", serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.api-form-actions {
  display: flex;
  gap: 8px;
}

.api-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 18px;
}

@media (max-width: 768px) {
  .api-form-grid {
    grid-template-columns: 1fr;
  }
}

.api-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.api-field-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.api-field input {
  padding: 12px 15px;
  border-radius: 16px;
  border: 1px solid var(--api-input-border);
  background: var(--api-input-bg);
  font-family: "DM Sans", "Noto Sans SC", sans-serif;
  font-size: 13px;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  outline: none;
}

/* URL and API Key fields keep monospace for readability */
.api-field input[type="url"],
.api-field input[type="password"],
#fieldApiKey {
  font-family: "DM Mono", monospace;
}

html[data-theme="dark"] .api-field input,
html[data-theme="stellar"] .api-field input {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="nature"] .api-field input {
  background: rgba(242, 247, 241, 0.6);
}

.api-field input:focus {
  border-color: color-mix(in oklch, var(--blue) 72%, white);
  background: var(--api-input-focus-bg);
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--blue) 10%, transparent);
}

.api-field input::placeholder {
  color: color-mix(in oklch, var(--muted), transparent 40%);
}

.api-key-wrapper {
  position: relative;
}

.api-key-wrapper input {
  width: 100%;
  padding-right: 40px;
}

.api-key-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.2s ease;
}

.api-key-toggle:hover {
  color: var(--ink);
}

.api-form-footer {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
}

/* ── Buttons ── */

.api-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  font-family: "DM Sans", "Noto Sans SC", sans-serif;
  font-weight: 700;
  border-radius: 999px;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s var(--ease-out-expo),
    box-shadow 0.2s ease;
}

.api-btn:active {
  transform: scale(0.97);
}

.api-btn-primary {
  padding: 11px 18px;
  background: linear-gradient(180deg, #192746, #0f1830);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 10px 22px rgba(19, 29, 48, 0.18);
}

.api-btn-primary:hover {
  box-shadow: 0 14px 26px rgba(19, 29, 48, 0.24);
  transform: translateY(-2px);
}

.api-btn-secondary {
  padding: 11px 18px;
  background: rgba(24, 36, 58, 0.05);
  color: var(--ink);
  font-size: 13px;
  border: 1px solid color-mix(in oklch, var(--ink) 8%, transparent);
}

html[data-theme="dark"] .api-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
}

.api-btn-secondary:hover {
  background: rgba(24, 36, 58, 0.12);
}

html[data-theme="dark"] .api-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

.api-btn-ghost {
  padding: 8px 14px;
  background: var(--api-ghost-bg);
  color: var(--muted);
  font-size: 12px;
}

.api-btn-ghost:hover {
  background: var(--api-ghost-hover-bg);
  color: var(--ink);
}

.api-btn-danger {
  padding: 8px 14px;
  background: rgba(212, 99, 123, 0.08);
  color: var(--rose);
  font-size: 12px;
}

.api-btn-danger:hover {
  background: var(--rose);
  color: #fff;
}

.api-btn-sm {
  padding: 6px 10px;
  font-size: 11px;
  border-radius: 8px;
}

.api-btn-xs {
  padding: 4px 8px;
  font-size: 10px;
  border-radius: 6px;
}

.api-btn-add {
  width: 100%;
  justify-content: center;
  padding: 14px;
  border-radius: 18px;
}

.api-btn-send {
  width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
  border-radius: 12px;
  flex-shrink: 0;
}

.api-btn-send.streaming {
  background: var(--rose);
}

/* ── Spinner ── */

.api-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ws-spin 0.6s linear infinite;
}

.api-btn-secondary .api-spinner {
  border-color: var(--line);
  border-top-color: var(--ink);
}

/* ── Model Section ── */

.api-model-section {
  padding: 24px 28px;
  border-bottom: 1px solid var(--api-surface-border);
}

.api-model-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}

.api-model-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  font-family: "DM Sans", "Noto Sans SC", sans-serif;
}

.api-model-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.api-model-search {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
  font-family: "DM Sans", "Noto Sans SC", sans-serif;
  font-size: 12px;
  color: var(--ink);
  outline: none;
  width: 160px;
  transition: border-color 0.2s ease;
}

html[data-theme="dark"] .api-model-search,
html[data-theme="stellar"] .api-model-search {
  background: rgba(255, 255, 255, 0.06);
}

.api-model-search:focus {
  border-color: var(--blue);
}

.api-model-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
}

.api-model-list::-webkit-scrollbar {
  width: 3px;
}
.api-model-list::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 2px;
}

.api-model-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.api-model-group + .api-model-group {
  margin-top: 8px;
}

.api-model-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
}

.api-model-group-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.api-model-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(24, 36, 58, 0.04);
}

.api-model-group-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.api-model-group[data-model-type="image"] .api-model-group-title {
  color: var(--amber);
}

.api-model-group[data-model-type="text"] .api-model-group-title {
  color: var(--blue);
}

.api-model-group[data-model-type="audioVideo"] .api-model-group-title {
  color: var(--green);
}

.api-model-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--api-surface-border);
  background: var(--api-list-item-bg);
  transition: background 0.15s ease, transform 0.15s var(--ease-out-expo), border-color 0.15s ease;
}

html[data-theme="dark"] .api-model-item {
  background: rgba(255, 255, 255, 0.04);
}

html[data-theme="stellar"] .api-model-item {
  background: rgba(201, 164, 85, 0.04);
}

.api-model-item:hover {
  background: var(--api-list-item-hover-bg);
  border-color: color-mix(in oklch, var(--blue) 18%, transparent);
  transform: translateX(3px);
}

html[data-theme="dark"] .api-model-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

html[data-theme="stellar"] .api-model-item:hover {
  background: rgba(201, 164, 85, 0.07);
}

.api-model-item.is-default {
  border-left: 3px solid var(--green);
  background: var(--api-list-item-selected-bg);
}

html[data-theme="dark"] .api-model-item.is-default {
  background: rgba(55, 168, 141, 0.06);
}

.api-model-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.api-model-name code {
  font-family: "DM Mono", monospace;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}

.api-model-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.api-model-empty {
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ── Binding Section ── */

.api-binding-section {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.api-binding-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.api-binding-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}

.api-hint {
  font-size: 11px;
  color: var(--muted);
}

.api-binding-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.api-binding-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--api-binding-panel-border);
  background: var(--api-sidebar-card-bg);
  gap: 12px;
  transition: background 0.15s ease, transform 0.15s var(--ease-out-expo), border-color 0.15s ease;
}

.api-binding-item:hover {
  background: var(--api-sidebar-card-hover);
  border-color: var(--api-sidebar-card-hover-border);
  transform: translateX(3px);
}

html[data-theme="dark"] .api-binding-item {
  background: rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .api-binding-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

html[data-theme="stellar"] .api-binding-item {
  background: rgba(201, 164, 85, 0.04);
}

html[data-theme="stellar"] .api-binding-item:hover {
  background: rgba(201, 164, 85, 0.07);
}

.api-binding-tool {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.api-binding-icon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.api-binding-icon.signal { background: color-mix(in oklch, var(--green) 14%, transparent); color: var(--green); }
.api-binding-icon.commerce { background: color-mix(in oklch, var(--blue) 14%, transparent); color: var(--blue); }
.api-binding-icon.preview { background: color-mix(in oklch, var(--amber) 14%, transparent); color: var(--amber); }
.api-binding-icon.formula { background: color-mix(in oklch, var(--violet) 14%, transparent); color: var(--violet); }
.api-binding-icon.image { background: color-mix(in oklch, var(--rose) 14%, transparent); color: var(--rose); }

.api-binding-control {
  flex: 1;
  min-width: 0;
}

.api-select {
  width: 100%;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--api-input-border);
  background: var(--api-input-bg);
  font-family: "DM Mono", monospace;
  font-size: 11px;
  color: var(--ink);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371809a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
}

html[data-theme="dark"] .api-select,
html[data-theme="stellar"] .api-select {
  background-color: rgba(255, 255, 255, 0.06);
}

.api-select:focus {
  border-color: var(--blue);
}

.api-binding-select {
  max-width: 280px;
}

/* ── Chat Section ── */

.api-chat-section {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-top: 1px solid var(--api-surface-border);
  background: linear-gradient(180deg, color-mix(in oklch, var(--api-input-bg) 55%, transparent), color-mix(in oklch, var(--api-input-bg) 30%, transparent));
}

.api-chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  border-bottom: 1px solid var(--api-surface-border);
}

.api-chat-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}

.api-chat-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.api-chat-controls .api-select {
  width: auto;
  min-width: 180px;
}

.api-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 120px;
  max-height: 240px;
}

.api-chat-messages::-webkit-scrollbar {
  width: 3px;
}
.api-chat-messages::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 2px;
}

.api-chat-welcome {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
}

.api-chat-welcome p {
  font-size: 13px;
  color: var(--muted);
  max-width: 280px;
  line-height: 1.6;
}

.api-chat-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.6;
  animation: fadeUp 0.25s var(--ease-out-expo) forwards;
}

.api-chat-bubble.user {
  align-self: flex-end;
  background: linear-gradient(180deg, var(--btn-grad1), var(--btn-grad2));
  color: #fff;
  border-bottom-right-radius: 6px;
}

.api-chat-bubble.assistant {
  align-self: flex-start;
  background: rgba(24, 36, 58, 0.08);
  border-bottom-left-radius: 6px;
}

html[data-theme="dark"] .api-chat-bubble.assistant {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="stellar"] .api-chat-bubble.assistant {
  background: rgba(201, 164, 85, 0.08);
}

html[data-theme="nature"] .api-chat-bubble.assistant {
  background: rgba(42, 51, 40, 0.06);
}

.api-chat-role {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
  opacity: 0.55;
}

.api-chat-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "DM Sans", "Noto Sans SC", sans-serif;
}

.api-chat-text.is-loading {
  min-height: 20px;
  display: flex;
  align-items: center;
}

.api-chat-loader {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.api-chat-loader span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: color-mix(in oklch, var(--blue) 62%, white 38%);
  animation: apiChatPulse 1s ease-in-out infinite;
}

.api-chat-loader span:nth-child(2) {
  animation-delay: 0.16s;
}

.api-chat-loader span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes apiChatPulse {
  0%,
  80%,
  100% {
    transform: translateY(0) scale(0.85);
    opacity: 0.42;
  }
  40% {
    transform: translateY(-3px) scale(1);
    opacity: 1;
  }
}

.api-chat-input-row {
  display: flex;
  gap: 10px;
  padding: 14px 24px 18px;
  align-items: flex-end;
  border-top: 1px solid var(--line);
}

.api-chat-input-row textarea {
  flex: 1;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
  font-family: "DM Sans", "Noto Sans SC", sans-serif;
  font-size: 13px;
  color: var(--ink);
  resize: none;
  outline: none;
  max-height: 120px;
  line-height: 1.5;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.api-chat-input-row textarea::placeholder {
  color: color-mix(in oklch, var(--muted), transparent 40%);
}

html[data-theme="dark"] .api-chat-input-row textarea,
html[data-theme="stellar"] .api-chat-input-row textarea {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="nature"] .api-chat-input-row textarea {
  background: rgba(242, 247, 241, 0.6);
}

.api-chat-input-row textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--blue) 10%, transparent);
}

/* ── Toast ── */

.api-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
  font-family: "DM Sans", "Noto Sans SC", sans-serif;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s var(--ease-out-expo);
  pointer-events: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.api-toast.ok {
  background: var(--green);
  color: #fff;
}

.api-toast.error {
  background: var(--rose);
  color: #fff;
}

.api-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.api-toast-icon {
  font-size: 16px;
  font-weight: 800;
}

/* ── Set-default button inline ── */

.api-set-default {
  white-space: nowrap;
}

/* ── API-specific theme overrides: Stellar ── */

html[data-theme="stellar"] .api-pool-panel,
html[data-theme="stellar"] .api-detail-panel,
html[data-theme="stellar"] .api-global-bar,
html[data-theme="stellar"] .api-binding-panel {
  border-color: rgba(201, 164, 85, 0.12);
}

html[data-theme="stellar"] .api-btn-primary {
  background: linear-gradient(180deg, #2a3050, #181c34);
}

html[data-theme="stellar"] .api-btn-secondary {
  background: rgba(201, 164, 85, 0.06);
}

html[data-theme="stellar"] .api-btn-secondary:hover {
  background: rgba(201, 164, 85, 0.12);
}

html[data-theme="stellar"] .api-model-search {
  background: rgba(201, 164, 85, 0.04);
}

html[data-theme="stellar"] .api-select {
  background-color: rgba(201, 164, 85, 0.04);
}

html[data-theme="stellar"] .api-field input {
  background: rgba(201, 164, 85, 0.04);
}

html[data-theme="stellar"] .api-chat-input-row textarea {
  background: rgba(201, 164, 85, 0.04);
}

/* ── API-specific theme overrides: Nature ── */

html[data-theme="nature"] .api-pool-panel,
html[data-theme="nature"] .api-detail-panel,
html[data-theme="nature"] .api-global-bar,
html[data-theme="nature"] .api-binding-panel {
  border-color: rgba(42, 51, 40, 0.1);
}

html[data-theme="nature"] .api-btn-secondary {
  background: rgba(42, 51, 40, 0.05);
}

html[data-theme="nature"] .api-btn-secondary:hover {
  background: rgba(42, 51, 40, 0.1);
}

html[data-theme="nature"] .api-model-search {
  background: rgba(242, 247, 241, 0.6);
}

html[data-theme="nature"] .api-select {
  background-color: rgba(242, 247, 241, 0.6);
}
