/* Root container */
.adk-code{
  --adk-code-radius: 12px;
  --adk-code-pad: 16px;

  /* Theme CSS variables (overridden per theme) */
  --cb-bg: #1e1f29;
  --cb-panel: #2a2b36;
  --cb-fg: #eaeaea;
  --cb-muted: #a8acc5;
  --cb-accent: #8be9fd;

  --tok-keyword: #ff79c6;
  --tok-string: #f1fa8c;
  --tok-number: #bd93f9;
  --tok-attr: #50fa7b;
  --tok-func: #8be9fd;
  --tok-comment: #6272a4;
  --tok-operator: #ffb86c;
  --tok-punct: #eaeaea;

  border-radius: var(--adk-code-radius);
  overflow: hidden;
  background: var(--cb-bg);
  color: var(--cb-fg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* macOS-like header */
.adk-code__header{
  display:flex; align-items:center; gap:10px;
  background: var(--cb-panel);
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.adk-code__dot{
  width:12px; height:12px; border-radius:50%;
  display:inline-block;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.25);
}
.adk-code__dot--red{ background:#ff5f57; }
.adk-code__dot--yellow{ background:#ffbd2e; }
.adk-code__dot--green{ background:#28c840; }

.adk-code__filename{
  margin-left:4px;
  font-size:.9em; color: var(--cb-muted);
  flex:1 1 auto; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

.adk-code__copy{
  appearance:none; border:0; cursor:pointer;
  background:transparent; color:var(--cb-muted);
  font-size:.85em; padding:6px 10px; border-radius:8px;
}
.adk-code[data-copy="0"] .adk-code__copy{ display:none; }
.adk-code__copy:hover{ background:rgba(255,255,255,.06); color:var(--cb-fg); }

/* Code area */
.adk-code__pre{
  margin:0;
  padding: var(--adk-code-pad);
  overflow:auto;
  line-height: 1;
  tab-size: 2;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

/* Render surface (highlighted <code>) */
.adk-code__hl{
  display:flex;
  flex-direction: column;
  gap: 6px;
  font-family: inherit;
  line-height: 1;
  white-space: pre-wrap; /* default wrap ON */
  word-break: break-word;
}
.adk-code[data-wrap="0"] .adk-code__hl{
  white-space: pre;
  word-break: normal;
}

/* Visually hide raw <code> but keep it for copy/a11y */
.adk-code__code{
  position:absolute !important;
  width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0 0 0 0); white-space:pre;
  border:0;
}

/* Line numbers */
.adk-code[data-ln="1"] .adk-code__hl{
  counter-reset: line;
  padding-left: calc(var(--adk-code-pad) + 3.2em);
  position: relative;
}
.adk-code[data-ln="1"] .adk-code__line{
  display:block; position:relative;
  padding-left:.25em;
}
.adk-code[data-ln="1"] .adk-code__line::before{
  counter-increment: line;
  content: counter(line);
  position:absolute; left: -3.2em;
  width: 2.8em; text-align: right;
  color: var(--cb-muted);
  user-select: none;
}

/* Tokens */
.adk-token.keyword{ color: var(--tok-keyword); }
.adk-token.string{ color: var(--tok-string); }
.adk-token.number{ color: var(--tok-number); }
.adk-token.attr{ color: var(--tok-attr); }
.adk-token.func{ color: var(--tok-func); }
.adk-token.comment{ color: var(--tok-comment); font-style: italic; }
.adk-token.operator{ color: var(--tok-operator); }
.adk-token.punct{ color: var(--tok-punct); }

/* ---------- Themes (5 presets) ---------- */
/* 1) Nocturne (default) via root vars */

.adk-code[data-theme="solar"]{
  --cb-bg:#fdf6e3; --cb-panel:#eee8d5; --cb-fg:#073642; --cb-muted:#586e75; --cb-accent:#268bd2;
  --tok-keyword:#d33682; --tok-string:#2aa198; --tok-number:#6c71c4; --tok-attr:#859900;
  --tok-func:#268bd2; --tok-comment:#93a1a1; --tok-operator:#cb4b16; --tok-punct:#073642;
}
.adk-code[data-theme="classic"]{
  --cb-bg:#1b1b1b; --cb-panel:#242424; --cb-fg:#e6e6e6; --cb-muted:#a0a0a0; --cb-accent:#4aa3ff;
  --tok-keyword:#ff7ab2; --tok-string:#dfe06f; --tok-number:#8f9cff; --tok-attr:#86e3a5;
  --tok-func:#4aa3ff; --tok-comment:#6b6b6b; --tok-operator:#ffb86c; --tok-punct:#e6e6e6;
}
.adk-code[data-theme="neon"]{
  --cb-bg:#0c0f12; --cb-panel:#12161b; --cb-fg:#e9f1ff; --cb-muted:#7f8ba3; --cb-accent:#00e5ff;
  --tok-keyword:#ff3b80; --tok-string:#c4ff61; --tok-number:#8a7dff; --tok-attr:#3cfbb8;
  --tok-func:#00e5ff; --tok-comment:#60708b; --tok-operator:#ffb86c; --tok-punct:#e9f1ff;
}
.adk-code[data-theme="ocean"]{
  --cb-bg:#0f1720; --cb-panel:#18222e; --cb-fg:#eaf2fb; --cb-muted:#9db1c7; --cb-accent:#56ccf2;
  --tok-keyword:#f78fb3; --tok-string:#ffd866; --tok-number:#a29bfe; --tok-attr:#7bed9f;
  --tok-func:#56ccf2; --tok-comment:#6c7a8a; --tok-operator:#ffb86c; --tok-punct:#eaf2fb;
}
