/* Theme palettes mapped onto Deck tokens.
   --o-green / --o-yellow / --o-red are status colors (ok / warn / down). Where a palette repurposes
   those slots (Hackerman, Matte Black, Vantablack, White…) a hue that fits the palette and keeps the
   meaning is used instead. --o-blue / --o-magenta / --o-cyan stay the palette's own: they only color
   terminal output. Palette blocks are not scoped to :root so a picker swatch can wear one. */
[data-theme="catppuccin"] {
  --o-bg0: #161622; --o-bg: #1e1e2e; --o-bg2: #313244; --o-bg3: #101019; --o-sel: #45475a; --o-muted: #585b70;
  --o-fg: #cdd6f4; --o-fg2: #bac2de; --o-accent: #89b4fa; --o-green: #a6e3a1; --o-yellow: #f9e2af; --o-red: #f38ba8;
  --o-blue: #89b4fa; --o-magenta: #f5c2e7; --o-cyan: #94e2d5;
}
[data-theme="catppuccin-latte"] {
  --o-bg0: #e3e4e8; --o-bg: #eff1f5; --o-bg2: #dce0e8; --o-bg3: #d7d8dc; --o-sel: #ccd0da; --o-muted: #acb0be;
  --o-fg: #4c4f69; --o-fg2: #5c5f77; --o-accent: #1e66f5; --o-green: #40a02b; --o-yellow: #df8e1d; --o-red: #d20f39;
  --o-blue: #1e66f5; --o-magenta: #ea76cb; --o-cyan: #179299;
}
[data-theme="ethereal"] {
  --o-bg0: #040816; --o-bg: #060B1E; --o-bg2: #131a3a; --o-bg3: #030610; --o-sel: #252e56; --o-muted: #6d7db6;
  --o-fg: #ffcead; --o-fg2: #c9b8a6; --o-accent: #7d82d9; --o-green: #92a593; --o-yellow: #E9BB4F; --o-red: #ED5B5A;
  --o-blue: #7d82d9; --o-magenta: #c89dc1; --o-cyan: #a3bfd1;
}
[data-theme="everforest"] {
  --o-bg0: #21272c; --o-bg: #2d353b; --o-bg2: #343f44; --o-bg3: #181d20; --o-sel: #3d484d; --o-muted: #475258;
  --o-fg: #d3c6aa; --o-fg2: #9da9a0; --o-accent: #7fbbb3; --o-green: #a7c080; --o-yellow: #dbbc7f; --o-red: #e67e80;
  --o-blue: #7fbbb3; --o-magenta: #d699b6; --o-cyan: #83c092;
}
[data-theme="flexoki-light"] {
  --o-bg0: #f2efe4; --o-bg: #FFFCF0; --o-bg2: #E6E4D9; --o-bg3: #e5e2d8; --o-sel: #CECDC3; --o-muted: #B7B5AC;
  --o-fg: #100F0F; --o-fg2: #403E3C; --o-accent: #205EA6; --o-green: #879A39; --o-yellow: #D0A215; --o-red: #D14D41;
  --o-blue: #205EA6; --o-magenta: #CE5D97; --o-cyan: #24837B;
}
[data-theme="hackerman"] {
  --o-bg0: #080910; --o-bg: #0B0C16; --o-bg2: #151828; --o-bg3: #06060c; --o-sel: #1f253a; --o-muted: #2d3450;
  --o-fg: #ddf7ff; --o-fg2: #b5c5db; --o-accent: #82FB9C; --o-green: #4fe88f; --o-yellow: #f2e46b; --o-red: #ff6b85;
  --o-blue: #829dd4; --o-magenta: #86a7df; --o-cyan: #7cf8f7;
}
[data-theme="kanagawa"] {
  --o-bg0: #17171e; --o-bg: #1f1f28; --o-bg2: #2a2a37; --o-bg3: #111116; --o-sel: #363646; --o-muted: #54546D;
  --o-fg: #dcd7ba; --o-fg2: #c8c093; --o-accent: #7e9cd8; --o-green: #98bb6c; --o-yellow: #e6c384; --o-red: #e46876;
  --o-blue: #7e9cd8; --o-magenta: #957fb8; --o-cyan: #7aa89f;
}
[data-theme="last-horizon"] {
  --o-bg0: #090809; --o-bg: #0c0b0c; --o-bg2: #181517; --o-bg3: #060606; --o-sel: #2e282a; --o-muted: #584e51;
  --o-fg: #FAFCFB; --o-fg2: #cfd3cd; --o-accent: #b59790; --o-green: #87a9b0; --o-yellow: #d4b483; --o-red: #d3705f;
  --o-blue: #b59790; --o-magenta: #c4d8e2; --o-cyan: #a5a0b6;
}
[data-theme="matte-black"] {
  --o-bg0: #0d0d0d; --o-bg: #121212; --o-bg2: #1e1e1e; --o-bg3: #090909; --o-sel: #2a2a2a; --o-muted: #3d3d3d;
  --o-fg: #bebebe; --o-fg2: #8a8a8d; --o-accent: #e68e0d; --o-green: #8fb069; --o-yellow: #FFC107; --o-red: #D35F5F;
  --o-blue: #e68e0d; --o-magenta: #D35F5F; --o-cyan: #bebebe;
}
[data-theme="miasma"] {
  --o-bg0: #191919; --o-bg: #222222; --o-bg2: #2c2c2c; --o-bg3: #121212; --o-sel: #383838; --o-muted: #555555;
  --o-fg: #c2c2b0; --o-fg2: #9a9a8c; --o-accent: #8f9a5a; --o-green: #7a9f6f; --o-yellow: #c9a554; --o-red: #c4604a;
  --o-blue: #8f9a5a; --o-magenta: #bb7744; --o-cyan: #c9a554;
}
[data-theme="nord"] {
  --o-bg0: #222730; --o-bg: #2e3440; --o-bg2: #3b4252; --o-bg3: #191c23; --o-sel: #434c5e; --o-muted: #4c566a;
  --o-fg: #d8dee9; --o-fg2: #adb5c4; --o-accent: #88c0d0; --o-green: #a3be8c; --o-yellow: #ebcb8b; --o-red: #d57780;
  --o-blue: #81a1c1; --o-magenta: #b48ead; --o-cyan: #8fbcbb;
}
[data-theme="osaka-jade"] {
  --o-bg0: #0c1512; --o-bg: #111c18; --o-bg2: #1a2b23; --o-bg3: #090f0d; --o-sel: #2a3d33; --o-muted: #53685B;
  --o-fg: #D6D5BC; --o-fg2: #81B8A8; --o-accent: #509475; --o-green: #63b07a; --o-yellow: #E5C736; --o-red: #FF5345;
  --o-blue: #509475; --o-magenta: #D2689C; --o-cyan: #2DD5B7;
}
[data-theme="retro-82"] {
  --o-bg0: #031222; --o-bg: #05182e; --o-bg2: #0a2540; --o-bg3: #020c17; --o-sel: #134e5a; --o-muted: #2a6b78;
  --o-fg: #f6dcac; --o-fg2: #a7c9c6; --o-accent: #faa968; --o-green: #3aa9a0; --o-yellow: #f2c35a; --o-red: #f85525;
  --o-blue: #3f8f8a; --o-magenta: #e97b3c; --o-cyan: #8cbfb8;
}
[data-theme="ristretto"] {
  --o-bg0: #211b1b; --o-bg: #2c2525; --o-bg2: #3d2f2a; --o-bg3: #181414; --o-sel: #403e41; --o-muted: #72696a;
  --o-fg: #e6d9db; --o-fg2: #c3b7b8; --o-accent: #f38d70; --o-green: #adda78; --o-yellow: #f9cc6c; --o-red: #fd6883;
  --o-blue: #f38d70; --o-magenta: #a8a9eb; --o-cyan: #85dacc;
}
[data-theme="rose-pine"] {
  --o-bg0: #f2e9e1; --o-bg: #faf4ed; --o-bg2: #f4ede8; --o-bg3: #f2e9e1; --o-sel: #dfdad9; --o-muted: #cecacd;
  --o-fg: #575279; --o-fg2: #6e6a86; --o-accent: #286983; --o-green: #56949f; --o-yellow: #ea9d34; --o-red: #b4637a;
  --o-blue: #286983; --o-magenta: #907aa9; --o-cyan: #d7827e;
}
[data-theme="vantablack"] {
  --o-bg0: #000000; --o-bg: #0b0b0b; --o-bg2: #161616; --o-bg3: #000000; --o-sel: #222222; --o-muted: #3d3d3d;
  --o-fg: #ffffff; --o-fg2: #b0b0b0; --o-accent: #cecece; --o-green: #9bc4a2; --o-yellow: #d9c38c; --o-red: #e08a8a;
  --o-blue: #8d8d8d; --o-magenta: #9b9b9b; --o-cyan: #b0b0b0;
}
[data-theme="white"] {
  --o-bg0: #f5f5f5; --o-bg: #ffffff; --o-bg2: #f0f0f0; --o-bg3: #f5f5f5; --o-sel: #dcdcdc; --o-muted: #a0a0a0;
  --o-fg: #000000; --o-fg2: #3a3a3a; --o-accent: #1a1a1a; --o-green: #2f8f5b; --o-yellow: #b7791f; --o-red: #c43d3d;
  --o-blue: #1a1a1a; --o-magenta: #2e2e2e; --o-cyan: #3e3e3e;
}

:root:not([data-theme="light"], [data-theme="dark"], :not([data-theme])) {
  --canvas:       var(--o-bg0);
  --surface:      var(--o-bg);
  --surface-2:    var(--o-bg2);
  --line:         var(--o-sel);
  --line-strong:  var(--o-muted);
  --ink:          var(--o-fg);
  --ink-2:        var(--o-fg2);
  --ink-3:        color-mix(in srgb, var(--o-fg) 55%, var(--o-bg));
  --accent:       var(--o-accent);
  --accent-hover: color-mix(in srgb, var(--o-accent) 85%, var(--o-fg));
  --accent-wash:  color-mix(in srgb, var(--o-accent) 16%, transparent);
  --ok:   var(--o-green);  --ok-wash:   color-mix(in srgb, var(--o-green) 16%, transparent);
  --warn: var(--o-yellow); --warn-wash: color-mix(in srgb, var(--o-yellow) 16%, transparent);
  --down: var(--o-red);    --down-wash: color-mix(in srgb, var(--o-red) 16%, transparent);
  --live: var(--o-accent); --live-wash: var(--accent-wash);
  --danger: var(--o-red);
  --on-accent: var(--o-bg);
  --surface-inverse: var(--o-bg3);
  --shadow-card: 0 1px 2px rgba(0,0,0,.3), 0 2px 8px rgba(0,0,0,.25);
  --shadow-pop:  0 14px 40px -12px rgba(0,0,0,.55);
  color-scheme: dark;
  --l-bg: var(--o-bg3); --l-bar: var(--o-bg0); --l-line: var(--o-sel); --l-ink: var(--o-fg);
  --l-dim: color-mix(in srgb, var(--o-fg) 55%, var(--o-bg3)); --l-mute: var(--o-muted);
  --l-err: var(--o-red); --l-err-bg: color-mix(in srgb, var(--o-red) 10%, transparent);
  --l-warn: var(--o-yellow); --l-warn-bg: color-mix(in srgb, var(--o-yellow) 8%, transparent);
  --l-acc: var(--o-accent); --l-ok: var(--o-green); --l-hit: color-mix(in srgb, var(--o-accent) 16%, transparent);
  --ansi-k: var(--l-dim); --ansi-r: var(--o-red); --ansi-g: var(--o-green); --ansi-y: var(--o-yellow);
  --ansi-b: var(--o-blue); --ansi-m: var(--o-magenta); --ansi-c: var(--o-cyan); --ansi-w: var(--o-fg);
}
:root:is([data-theme="catppuccin-latte"], [data-theme="flexoki-light"], [data-theme="rose-pine"], [data-theme="white"]) {
  --on-accent: #fff;
  --ok:   color-mix(in srgb, var(--o-green) 75%, var(--o-fg));
  --warn: color-mix(in srgb, var(--o-yellow) 65%, var(--o-fg));
  --surface-inverse: var(--o-fg);
  --shadow-card: 0 1px 2px rgba(23,26,33,.04), 0 2px 8px rgba(23,26,33,.05);
  --shadow-pop:  0 14px 40px -12px rgba(23,26,33,.22);
  color-scheme: light;
  --l-ok: var(--ok); --l-warn: var(--warn); --ansi-g: var(--ok); --ansi-y: var(--warn);
}
:root:is([data-theme="catppuccin-latte"], [data-theme="rose-pine"]) { --ink-3: color-mix(in srgb, var(--o-fg) 72%, var(--o-bg)); }
@supports (color: oklch(from red l c h)) {
  :root:is([data-theme="catppuccin-latte"], [data-theme="flexoki-light"], [data-theme="rose-pine"], [data-theme="white"]) {
    --ok:   oklch(from var(--o-green) calc(l - .1) c h);
    --warn: oklch(from var(--o-yellow) calc(l - .12) c h);
  }
}

/* Picker swatches for the built-in themes; the palettes above cover the rest. */
.theme-swatch[data-theme="light"] { --o-bg: #FFFFFF; --o-sel: #D3D8E2; --o-fg: #171A21; --o-accent: #2F6FEB; --o-green: #0E8C5A; --o-red: #CF463C; }
.theme-swatch[data-theme="dark"]  { --o-bg: #14171C; --o-sel: #363C46; --o-fg: #EDEFF2; --o-accent: #5B8DEF; --o-green: #3DD68C; --o-red: #F0665C; }
.theme-swatch[data-theme=""] {
  --o-bg: linear-gradient(135deg, #FFFFFF 50%, #14171C 50%); --o-sel: #D3D8E2;
  --o-fg: #878F9E; --o-accent: #2F6FEB; --o-green: #0E8C5A; --o-red: #CF463C;
}
