/* docs.github.io site — shared styles for landing, editor, and docs pages.
   Light theme is applied via .light on <html> or <body>. */
:root {
  /* dark (default) */
  --bg:        #0a0e17;
  --bg-2:      #11151f;
  --card:      #161b28;
  --card-hi:   #1d2335;
  --input-bg:  #0e1320;
  --border:    #262c3d;
  --border-hi: #3a4258;
  --text:      #e6e9ef;
  --text-dim:  #a4adc2;
  --muted:     #6f7793;
  --accent:    #f08a5f;
  --accent-hi: #ffa074;
  --accent-bg: #1d130a;
  --accent-soft: rgba(240,138,95,.08);
  --ok:        #5bd497;
  --warn:      #fbbf24;
  --bad:       #ff6b6b;
  --info:      #7eb6ff;
  --purple:    #c084fc;
  --grid:      rgba(255,255,255,.04);
  --r-sm: 6px; --r-md: 12px; --r-lg: 18px;
  --shadow: 0 10px 40px rgba(0,0,0,.5);
  --shadow-sm: 0 4px 18px rgba(0,0,0,.35);
  --mono: "SF Mono", Menlo, Consolas, ui-monospace, monospace;
}

html.light, body.light {
  --bg:        #f6f7fb;
  --bg-2:      #ffffff;
  --card:      #ffffff;
  --card-hi:   #f3f5fa;
  --input-bg:  #fbfbfd;
  --border:    #e3e6ee;
  --border-hi: #c0c6d6;
  --text:      #1a1f2e;
  --text-dim:  #4a546c;
  --muted:     #7c849c;
  --accent:    #d96f3f;
  --accent-hi: #b85a2d;
  --accent-bg: #fde3d3;
  --accent-soft: rgba(217,111,63,.07);
  --ok:        #1f9d6b;
  --warn:      #a37300;
  --bad:       #c0392b;
  --info:      #2563eb;
  --purple:    #7c3aed;
  --grid:      rgba(20,28,48,.05);
  --shadow:    0 10px 40px rgba(20,28,48,.10);
  --shadow-sm: 0 4px 14px rgba(20,28,48,.08);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
               Inter, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  scroll-behavior: smooth;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body {
  background:
    radial-gradient(1200px 700px at 10% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(900px 600px at 100% 100%, rgba(126,182,255,.04), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg) 100%);
  background-attachment: fixed;
}
body.light {
  background:
    radial-gradient(1200px 700px at 10% -10%, rgba(217,111,63,.08), transparent 60%),
    radial-gradient(900px 600px at 100% 100%, rgba(37,99,235,.06), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, #eef0f6 100%);
  background-attachment: fixed;
}
a { color: var(--accent); text-decoration: none; transition: color .12s; }
a:hover { color: var(--accent-hi); }
code, pre, kbd { font-family: var(--mono); }
code {
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 2px 6px; font-size: .9em;
}
pre {
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px 18px; overflow: auto;
  font-size: 13px; line-height: 1.55;
}
pre code { background: transparent; border: none; padding: 0; }
kbd {
  background: var(--card-hi); border: 1px solid var(--border-hi);
  border-bottom-width: 2px; border-radius: var(--r-sm);
  padding: 2px 8px; font-size: .85em; color: var(--text);
  white-space: nowrap;   /* keep "↻ Resume" together — don't break inside the chip */
  display: inline-block;
}

/* Inline <code> shouldn't break mid-token either; the parent paragraph
   will wrap around them as units. Long URLs in <pre> blocks already get
   their own wrap rules. */
p code, li code, td code, .note-os code, .feature p code, .feature h3 code {
  white-space: nowrap;
}

/* Feature card paragraphs: avoid auto-hyphenation, prefer balanced wrapping
   when the browser supports it. */
.feature p, .feature h3, .note-os, .platform .file {
  hyphens: manual;
  text-wrap: pretty;
}

/* ── top nav ── */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  border-bottom: 1px solid var(--border);
  transition: background .2s;
}
.theme-toggle {
  background: var(--card); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 6px 10px; cursor: pointer;
  font-size: 14px; line-height: 1;
  transition: all .15s;
}
.theme-toggle:hover { background: var(--card-hi); color: var(--text); border-color: var(--border-hi); }
.nav-inner {
  max-width: 1240px; margin: 0 auto;
  padding: 14px clamp(16px, 3vw, 28px);
  display: flex; align-items: center; gap: 24px;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 16px; color: var(--text);
}
.nav-brand .logo {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #ffb78d 0%, #f08a5f 40%, #d96f3f 100%);
  color: #0a0e17; font-size: 18px;
}
.nav-links {
  display: flex; gap: 20px; margin-left: auto;
  align-items: center;
}
.nav-links a {
  color: var(--text-dim); font-size: 14px; font-weight: 500;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-links .nav-cta {
  background: var(--accent); color: #0a0e17;
  padding: 7px 14px; border-radius: var(--r-sm);
  font-weight: 600;
}
.nav-links .nav-cta:hover { background: var(--accent-hi); color: #0a0e17; }

/* ── hero (landing page) ── */
.hero {
  max-width: 1240px; margin: 0 auto;
  padding: clamp(70px, 11vw, 130px) clamp(16px, 3vw, 28px) clamp(50px, 7vw, 90px);
  text-align: center;
  position: relative;
}
.hero::before {
  /* faint grid backdrop */
  content: ''; position: absolute; inset: 40px 0 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(closest-side at 50% 40%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(closest-side at 50% 40%, #000 30%, transparent 75%);
  z-index: 0;
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero h1 {
  font-size: clamp(34px, 5.5vw, 64px);
  margin: 12px 0 16px;
  letter-spacing: -.02em;
  line-height: 1.05;
  background: linear-gradient(180deg, var(--text), var(--text-dim));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero .accent-glow {
  background: linear-gradient(135deg, #ffb78d 0%, var(--accent) 50%, #d96f3f 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero .tag {
  display: inline-block;
  padding: 4px 14px;
  background: var(--accent-bg);
  border: 1px solid rgba(240,138,95,.3);
  border-radius: 999px;
  color: var(--accent);
  font-size: 12px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
}
.hero p.lead {
  font-size: clamp(16px, 1.8vw, 20px);
  color: var(--text-dim);
  max-width: 720px; margin: 0 auto 32px;
}
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 24px;
  border-radius: var(--r-md);
  font-weight: 600; font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer; transition: all .15s;
}
.btn-primary {
  background: var(--accent); color: #0a0e17;
}
.btn-primary:hover { background: var(--accent-hi); transform: translateY(-1px); color: #0a0e17; }
.btn-ghost {
  background: transparent; border-color: var(--border-hi); color: var(--text);
}
.btn-ghost:hover { background: var(--card); border-color: var(--accent); color: var(--text); }
.btn-small {
  padding: 7px 14px; font-size: 13px;
}

/* ── container ── */
.container {
  max-width: 1240px; margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 28px) clamp(40px, 6vw, 80px);
}
.section {
  padding: clamp(40px, 6vw, 80px) 0;
  border-top: 1px solid var(--border);
}
.section h2 {
  font-size: clamp(24px, 3vw, 34px);
  margin: 0 0 14px;
  letter-spacing: -.01em;
}
.section .lead {
  color: var(--text-dim); max-width: 720px;
  margin-bottom: 36px;
}

/* ── feature grid — deterministic 3 columns on wide, 2 on mid, 1 on phone ── */
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 720px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1080px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.feature {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 24px 22px 22px;
  display: flex; flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.feature::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--accent-soft), transparent 55%);
  opacity: 0; transition: opacity .18s;
  pointer-events: none;
}
.feature:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
}
.feature:hover::before { opacity: 1; }
.feature .icon-box {
  width: 48px; height: 48px;
  display: inline-grid; place-items: center;
  border-radius: 12px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-soft);
  color: var(--accent);
  margin-bottom: 10px;
  position: relative; z-index: 1;
}
.feature .icon-box svg,
.feature .icon-box iconify-icon { width: 24px; height: 24px; font-size: 24px; }

/* Iconify <iconify-icon> sizing helpers */
iconify-icon { display: inline-block; vertical-align: -.125em; }
.btn iconify-icon { font-size: 18px; }
.platform iconify-icon { font-size: 38px; color: var(--text); }
.feature h3 { margin: 0; font-size: 17px; position: relative; z-index: 1; }
.feature p { margin: 0; color: var(--text-dim); font-size: 14px; line-height: 1.55; position: relative; z-index: 1; }

/* Hero stat strip beneath the CTA */
.hero-stats {
  display: inline-flex; flex-wrap: wrap; gap: 14px;
  margin-top: 30px;
  font-size: 13px;
  color: var(--text-dim);
}
.hero-stat b { color: var(--text); font-weight: 700; }
.hero-stat-dot { color: var(--muted); }

/* Inline action icons (CTA buttons) */
.btn .ic { width: 18px; height: 18px; flex-shrink: 0; font-size: 18px; }

/* ── download platforms ── */
.platforms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 24px;
}
.platform {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 22px 20px;
  text-align: center;
  transition: all .15s;
}
.platform:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.platform .glyph { font-size: 38px; display: block; margin-bottom: 6px; }
.platform h3 { margin: 4px 0 4px; font-size: 16px; }
.platform .file { color: var(--muted); font-size: 12px; font-family: var(--mono); display: block; margin-bottom: 14px; }

/* ── first-run note card (replaces the old blockquote) ── */
.note-card {
  margin-top: 32px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.note-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  background: var(--input-bg);
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.note-head iconify-icon {
  font-size: 20px; color: var(--accent);
}
.note-head h4 { margin: 0; font-size: 15px; font-weight: 700; }
.note-body { padding: 18px; }
.note-os {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.note-os:last-of-type { border-bottom: none; }
.note-os iconify-icon {
  font-size: 24px; color: var(--text-dim);
  align-self: start; padding-top: 2px;
}
.note-os b { color: var(--text); font-weight: 700; }
.note-os pre {
  margin: 8px 0 0; padding: 10px 14px;
  font-size: 12.5px;
  background: var(--input-bg);
  border: 1px solid var(--border);
}
.note-hint {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: 12.5px;
}

/* ── footer ── */
.footer {
  margin-top: 40px;
  padding: 28px 0;
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: 13px;
  text-align: center;
}
.footer a { color: var(--text-dim); }

/* ── docs/editor layouts ── */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  max-width: 1240px; margin: 0 auto;
  padding: 24px clamp(16px, 3vw, 28px) 80px;
}
.sidebar {
  position: sticky; top: 80px; align-self: start;
  border-right: 1px solid var(--border);
  padding-right: 18px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.sidebar h4 {
  font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
  margin: 18px 0 8px;
}
.sidebar a {
  display: block; color: var(--text-dim);
  padding: 5px 10px; border-radius: var(--r-sm);
  font-size: 13.5px;
}
.sidebar a:hover { background: var(--card); color: var(--text); }
.sidebar a.active {
  background: var(--accent-bg); color: var(--accent);
  border-left: 2px solid var(--accent);
  padding-left: 8px;
}
.content { min-width: 0; }
.content h1 { font-size: clamp(28px, 3.5vw, 40px); margin: 0 0 8px; letter-spacing: -.01em; }
.content h2 {
  font-size: clamp(20px, 2.4vw, 26px); margin: 36px 0 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.content h3 { font-size: 17px; margin: 24px 0 8px; color: var(--text); }
.content p { color: var(--text-dim); }
.content ul, .content ol { color: var(--text-dim); }
.content li { margin: 4px 0; }
.content table {
  width: 100%; border-collapse: collapse; margin: 14px 0;
  font-size: 14px;
}
.content th, .content td {
  text-align: left; padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}
.content th { color: var(--text); font-weight: 600; background: var(--input-bg); }
.content td { color: var(--text-dim); }
blockquote {
  margin: 16px 0;
  padding: 12px 16px;
  background: var(--input-bg);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--text-dim);
}

/* ── editor ── */
.editor-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.editor-toolbar .spacer { flex: 1; }
.editor-toolbar input[type=search] {
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 8px 12px;
  color: var(--text); font-size: 14px;
  width: 280px;
}
.editor-toolbar input:focus { outline: none; border-color: var(--accent); }

.probe-list {
  display: flex; flex-direction: column; gap: 10px;
  max-height: calc(100vh - 240px); overflow-y: auto; padding-right: 6px;
}
.probe-row {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px 12px;
  display: flex; flex-direction: column;
  gap: 8px;
  transition: border-color .12s, box-shadow .12s;
}
.probe-row:hover {
  border-color: var(--border-hi);
  box-shadow: var(--shadow-sm);
}
.probe-row.custom {
  border-left: 3px solid var(--accent);
  padding-left: 13px;
}
.probe-row .row-head {
  display: flex; align-items: flex-start; gap: 10px;
}
.probe-row .row-head .title {
  font-weight: 600; color: var(--text); font-size: 14.5px;
  flex: 1; min-width: 0; line-height: 1.4;
}
.probe-row .id-pill {
  font-family: var(--mono); font-size: 11px;
  color: var(--muted);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 2px 8px;
  flex-shrink: 0;
}
.probe-row .badges { display: flex; gap: 6px; flex-wrap: wrap; }
.probe-row .cat {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase;
}
.probe-row .cat iconify-icon { font-size: 11px; }
.probe-row .cat.identity   { background: rgba(126,182,255,.14); color: var(--info); }
.probe-row .cat.jailbreak  { background: rgba(192,132,252,.14); color: var(--purple); }
.probe-row .cat.china      { background: rgba(251,191,36,.14); color: var(--warn); }
.probe-row .cat.trick      { background: rgba(240,138,95,.14); color: var(--accent); }
.probe-row .cat.capability { background: rgba(91,212,151,.14); color: var(--ok); }
.probe-row .cat.custom-tag { background: var(--accent-bg); color: var(--accent); }
.probe-row .prompt {
  color: var(--text-dim); font-size: 13px;
  font-family: var(--mono);
  white-space: pre-wrap;
  overflow-wrap: break-word;   /* break long tokens only when needed, not mid-character */
  word-break: normal;
  max-height: 76px; overflow: hidden;
  position: relative;
  padding: 10px 14px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  line-height: 1.55;
}
.probe-row .prompt::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0;
  height: 22px;
  background: linear-gradient(to bottom, transparent, var(--input-bg));
  pointer-events: none;
}
.probe-row .keywords {
  display: flex; gap: 8px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--muted);
  margin-top: 2px;
}
.probe-row .kw {
  display: inline-flex; align-items: center; gap: 4px;
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis;
  white-space: normal;          /* let commas/spaces wrap; no mid-word ellipsis */
  overflow-wrap: break-word;
  line-height: 1.4;
}
.probe-row .kw iconify-icon { font-size: 13px; }
.probe-row .kw.expect { color: var(--ok); }
.probe-row .kw.red    { color: var(--bad); }
.probe-row .row-foot {
  display: flex; align-items: center; gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.probe-row .row-foot .spacer { flex: 1; }
.probe-row .actions { display: flex; gap: 6px; }
.probe-row .actions button {
  background: var(--input-bg); border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 10px; border-radius: var(--r-sm);
  font-size: 12px; cursor: pointer; transition: all .12s;
  display: inline-flex; align-items: center; gap: 4px;
}
.probe-row .actions button iconify-icon { font-size: 14px; }
.probe-row .actions button:hover {
  color: var(--text); border-color: var(--border-hi);
  background: var(--card-hi);
}
.probe-row .actions .danger:hover {
  color: var(--bad); border-color: rgba(255,107,107,.4);
  background: var(--bad-bg);
}

/* ── modal (editor form) ── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(2,6,16,.7);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg);
  width: min(720px, 96vw); max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow);
}
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px; }
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: 6px;
}
.field input[type=text], .field textarea, .field select {
  width: 100%;
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 12px; font-size: 14px;
  color: var(--text);
  font-family: inherit;
}
.field textarea { font-family: var(--mono); resize: vertical; min-height: 90px; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent);
}
.field .hint { color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.modal-foot {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--input-bg);
}
.modal .close { margin-left: auto; cursor: pointer; color: var(--muted); border: none; background: transparent; font-size: 22px; padding: 0 4px; }
.modal .close:hover { color: var(--text); }

/* ── stats bar ── */
.stats {
  display: flex; gap: 20px; flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 18px;
}
.stats .stat { display: flex; flex-direction: column; gap: 2px; }
.stats .stat .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stats .stat .value { font-size: 22px; font-weight: 700; color: var(--text); }
.stats .stat.accent .value { color: var(--accent); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--card); border: 1px solid var(--border-hi);
  border-left: 3px solid var(--ok);
  padding: 12px 18px; border-radius: var(--r-md);
  box-shadow: var(--shadow);
  z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }
.toast.error { border-left-color: var(--bad); }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; border-right: none; padding-right: 0; max-height: none; }
  .nav-links { gap: 14px; }
}
