/* ============================================================
   all_aiskills.css — KinaQuest · All AI Skills
   Visual language matches books_styles.css (books_all.html):
   same tokens, gradient background, pill links, chips, cards,
   dark footer and quick-view dialog.
   Themes follow customize.js: data-theme on <html>, --accent-color.
   ============================================================ */
:root {
  --bq-accent: var(--accent-color, #5b3ef5);
  --bq-accent-2: #2f80ff;
  --bq-ink: #12102e;
  --bq-muted: #5d5b7a;
  --bq-surface: #ffffff;
  --bq-bg-1: #fcfbff;
  --bq-bg-2: #ecebff;
  --bq-blob: #aebfff;
  --bq-wave: #c9bcff;
  --bq-font: 'Sora', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bq-ease: cubic-bezier(.3, .7, .2, 1);
  --bq-line: color-mix(in srgb, var(--bq-accent) 13%, transparent);
  --bq-tint: color-mix(in srgb, var(--bq-accent) 6%, var(--bq-bg-1));
}
[data-theme="dark"], [data-theme="dracula"], [data-theme="midnight"] {
  --bq-ink: #f1f0ff; --bq-muted: #a9a7cf; --bq-surface: #1d1b3a;
  --bq-bg-1: #0f0e22; --bq-bg-2: #171540; --bq-blob: #2b3a8f; --bq-wave: #3a2a85;
}
[data-theme="rose"] { --bq-bg-1: #fffafc; --bq-bg-2: #ffe6f0; --bq-blob: #ffc2d9; --bq-wave: #f7b6d2; }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-behavior: smooth; }
body { min-height: 100vh; display: flex; flex-direction: column; font-family: var(--bq-font); color: var(--bq-ink); background: var(--bq-bg-1); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid var(--bq-accent); outline-offset: 3px; }

/* ---------- Background (same as .bq-bg) ---------- */
.ak-bg {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background: var(--bq-bg-image, none) center / cover no-repeat, linear-gradient(135deg, var(--bq-bg-1) 20%, var(--bq-bg-2));
}
.ak-bg::before, .ak-bg::after { content: ""; position: absolute; border-radius: 50%; }
.ak-bg::before { width: 80vw; aspect-ratio: 1; right: -28vw; top: -52vw; opacity: .8; background: linear-gradient(200deg, var(--bq-blob), transparent 70%); }
.ak-bg::after { width: 80vw; height: 50vw; left: -26vw; bottom: -30vw; opacity: .75; background: linear-gradient(20deg, var(--bq-wave), transparent 75%); }

/* ---------- Layout + header ---------- */
.ak-all { flex: 1; padding: clamp(20px, 4vw, 64px); width: 100%; max-width: 1320px; margin: 0 auto; }
.ak-wrap { max-width: 1200px; margin: 0 auto; }
.ak-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: clamp(24px, 4vw, 48px); }
.ak-logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: clamp(1.4rem, 2.2vw, 2rem); letter-spacing: -.02em; color: var(--bq-accent); }
.ak-logo svg { width: 1.6em; height: 1.6em; stroke-width: 5; }
.ak-logo span { color: var(--bq-ink); }
.ak-head__nav { display: flex; gap: 10px; flex-wrap: wrap; margin-right: auto; margin-left: 12px; }
.ak-head__actions { display: flex; gap: 10px; }
.ak-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 999px; white-space: nowrap; text-decoration: none;
  font-size: .85rem; font-weight: 600; color: var(--bq-accent); border: 1.5px solid var(--bq-accent); transition: background .2s, color .2s;
}
.ak-pill:hover, .ak-pill--current { background: var(--bq-accent); color: #fff; }
.ak-icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bq-surface); border: 1px solid var(--bq-line); box-shadow: 0 6px 18px -10px rgba(60, 50, 140, .35);
  transition: transform .2s var(--bq-ease), color .2s;
}
.ak-icon-btn:hover { transform: translateY(-2px); color: var(--bq-accent); }
.ak-icon-btn svg { width: 19px; height: 19px; }
.ak-icon-btn .ti--sun { display: none; }
[data-theme="dark"] .ak-icon-btn .ti--moon, [data-theme="dracula"] .ak-icon-btn .ti--moon, [data-theme="midnight"] .ak-icon-btn .ti--moon { display: none; }
[data-theme="dark"] .ak-icon-btn .ti--sun, [data-theme="dracula"] .ak-icon-btn .ti--sun, [data-theme="midnight"] .ak-icon-btn .ti--sun { display: block; }

/* ---------- Title + tools ---------- */
.ak-main { min-width: 0; }
.ak-title { margin: 0; font-size: clamp(2.2rem, 4.6vw, 3.8rem); font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.ak-sub { margin: 10px 0 24px; color: var(--bq-muted); }
.ak-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; scroll-margin-top: 16px; }
.ak-input { padding: 12px 18px; border-radius: 999px; font: inherit; font-size: .92rem; color: var(--bq-ink); background: var(--bq-surface); border: 1px solid var(--bq-line); outline: 0; }
.ak-input:focus { border-color: var(--bq-accent); }
.ak-input::placeholder { color: var(--bq-muted); }
input.ak-input { flex: 1 1 260px; max-width: 380px; }
select.ak-input { cursor: pointer; }

/* ---------- Chips ---------- */
.ak-chips { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 12px; margin-bottom: 16px; scrollbar-width: none; }
.ak-chips::-webkit-scrollbar { display: none; }
.ak-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: 999px; white-space: nowrap; flex-shrink: 0;
  font-weight: 600; font-size: .9rem; background: var(--bq-surface); border: 1px solid var(--bq-line); transition: background .2s, color .2s;
}
.ak-chip svg { width: 16px; height: 16px; }
.ak-chip:hover { border-color: var(--bq-accent); }
.ak-chip[aria-pressed="true"] { color: #fff; background: var(--bq-accent); border-color: var(--bq-accent); }

/* ---------- Grid + cards ---------- */
.ak-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.ak-card {
  position: relative; display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: 18px;
  background: var(--bq-surface); border: 1px solid var(--bq-line); box-shadow: 0 10px 28px -20px rgba(60, 50, 140, .5);
  transition: transform .25s var(--bq-ease), box-shadow .25s;
}
.ak-card:hover { transform: translateY(-3px); box-shadow: 0 18px 34px -18px var(--bq-accent); }
.ak-card__body { display: flex; flex-direction: column; gap: 8px; flex: 1; width: 100%; text-align: left; cursor: pointer; }
.ak-card__body:focus-visible { outline-offset: 6px; }
.ak-card__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.ak-card__icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--bq-surface)); }
.ak-card__icon svg { width: 24px; height: 24px; }
.ak-badge {
  padding: 5px 11px; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap;
  color: var(--bq-accent); background: color-mix(in srgb, var(--bq-accent) 12%, transparent);
}
.ak-badge--new { color: #fff; background: #17a864; }
.ak-badge--free { color: #fff; background: #2f86f6; }
.ak-fmt { font-weight: 700; color: var(--bq-accent); }
.ak-card__t { font-size: 1.02rem; line-height: 1.2; font-weight: 800; letter-spacing: -.01em; }
.ak-card__d { font-size: .86rem; line-height: 1.45; color: var(--bq-muted); }
.ak-card__m { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .75rem; color: var(--bq-muted); opacity: .85; }
.ak-card__actions { display: flex; gap: 8px; margin-top: auto; }
.ak-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 14px; border-radius: 999px;
  font-size: .82rem; font-weight: 600; color: var(--bq-accent); border: 1.5px solid var(--bq-accent); transition: background .2s, color .2s;
}
.ak-btn svg { width: 16px; height: 16px; }
.ak-btn:hover { background: var(--bq-accent); color: #fff; }
.ak-btn--primary { color: #fff; border-color: transparent; background: linear-gradient(90deg, var(--bq-accent), var(--bq-accent-2)); box-shadow: 0 10px 24px -12px var(--bq-accent); }
.ak-btn--primary:hover { transform: translateY(-2px); }
.ak-btn[disabled] { opacity: .75; cursor: progress; }
.ak-btn.is-done, .ak-btn.is-done:hover { background: #17a864; border-color: #17a864; color: #fff; }
.ak-chips__sep { flex-shrink: 0; width: 1px; margin: 6px 4px; background: var(--bq-line); }
.ak-empty { padding: 60px 0; text-align: center; color: var(--bq-muted); }

/* ---------- How it works ---------- */
.ak-how { margin-top: clamp(32px, 5vw, 56px); padding: clamp(22px, 3vw, 32px); border-radius: 24px; background: var(--bq-surface); border: 1px solid var(--bq-line); }
.ak-how h2 { margin: 0 0 16px; padding-left: 14px; border-left: 4px solid var(--bq-accent); font-size: clamp(1.15rem, 2vw, 1.4rem); font-weight: 800; letter-spacing: -.02em; }
.ak-how ol { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; list-style: none; padding: 0; margin: 0; counter-reset: s; }
.ak-how li { counter-increment: s; position: relative; padding-left: 44px; font-size: .92rem; line-height: 1.5; color: var(--bq-muted); }
.ak-how li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: #fff; background: var(--bq-accent); }
.ak-how strong { color: var(--bq-ink); }
.ak-how code { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: .85em; padding: 1px 6px; border-radius: 6px; background: var(--bq-bg-2); }

/* ---------- Footer (same as .bq-footer) ---------- */
.ak-footer { margin-top: 40px; padding: clamp(40px, 5vw, 72px) clamp(20px, 4vw, 64px) 28px; color: #d8d6f5; background: #14113a; }
.ak-footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.ak-footer__brand { margin: 0 0 8px; font-size: 1.5rem; font-weight: 800; color: #fff; letter-spacing: -.02em; }
.ak-footer__about { margin: 0 0 16px; max-width: 32ch; line-height: 1.55; }
.ak-footer h3 { margin: 0 0 12px; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: #fff; }
.ak-footer nav { display: flex; flex-direction: column; gap: 10px; }
.ak-footer a { color: inherit; text-decoration: none; opacity: .85; }
.ak-footer a:hover { opacity: 1; text-decoration: underline; }
.ak-footer__copy { margin: 40px 0 0; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .85rem; opacity: .7; }

/* ---------- Toast ---------- */
.ak-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 1200; max-width: calc(100vw - 32px);
  padding: 12px 22px; border-radius: 999px; font-size: .88rem; font-weight: 600; color: #fff; background: var(--bq-accent);
  box-shadow: 0 14px 34px -12px rgba(20, 10, 80, .6);
}
.ak-toast[hidden] { display: none; }
.ak-toast.is-error { background: #d6336c; }

/* ---------- Modal (same as .bq-modal) ---------- */
.ak-modal { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px); margin: auto; padding: 0; border: 0; border-radius: 24px; color: var(--bq-ink); background: var(--bq-surface); box-shadow: 0 40px 90px -30px rgba(20, 10, 80, .7); }
.ak-modal[open] { animation: ak-pop .3s var(--bq-ease); }
.ak-modal::backdrop { background: rgba(18, 14, 50, .55); backdrop-filter: blur(4px); }
@keyframes ak-pop { from { opacity: 0; transform: translateY(16px) scale(.97); } }
body:has(.ak-modal[open]) { overflow: hidden; }
.ak-modal__body { position: relative; padding: clamp(20px, 3vw, 32px); overflow-y: auto; max-height: calc(100vh - 34px); }
.ak-modal__x { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--bq-bg-2); }
.ak-modal__x svg { width: 18px; height: 18px; }
.ak-modal__head { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; padding-right: 44px; }
.ak-modal__icon { flex-shrink: 0; width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; color: var(--c, var(--bq-accent)); background: color-mix(in srgb, var(--c, var(--bq-accent)) 14%, var(--bq-surface)); }
.ak-modal__icon svg { width: 30px; height: 30px; }
.ak-modal__kicker { margin: 0; font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--bq-accent); }
.ak-modal h2 { margin: 2px 0 0; font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 1.1; letter-spacing: -.03em; }
.ak-modal__meta { margin: 4px 0 0; font-size: .8rem; color: var(--bq-muted); }
.ak-modal__desc { margin: 0 0 20px; line-height: 1.6; color: var(--bq-muted); }
.ak-modal h3 { margin: 0 0 10px; font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--bq-muted); }
.ak-modal__cols { display: grid; grid-template-columns: 1fr 1.4fr; gap: 26px; margin-bottom: 22px; }
.ak-modal ul, .ak-modal ol { margin: 0; padding-left: 20px; font-size: .9rem; line-height: 1.55; color: var(--bq-muted); }
.ak-modal li + li { margin-top: 6px; }
.ak-prompts { list-style: none; padding: 0 !important; display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px !important; }
.ak-prompts li { margin: 0 !important; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; background: var(--bq-bg-2); }
.ak-prompts span { flex: 1; font-size: .88rem; color: var(--bq-ink); }
.ak-prompts button { flex-shrink: 0; font-size: .75rem; font-weight: 700; color: var(--bq-accent); padding: 4px 12px; border-radius: 999px; border: 1.5px solid var(--bq-accent); }
.ak-prompts button:hover { background: var(--bq-accent); color: #fff; }
.ak-preview { margin-bottom: 22px; border: 1px solid var(--bq-line); border-radius: 14px; overflow: hidden; }
.ak-preview summary { cursor: pointer; padding: 12px 16px; font-size: .86rem; font-weight: 600; background: var(--bq-tint); }
.ak-preview pre { margin: 0; padding: 16px; max-height: 280px; overflow: auto; font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: .78rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word; color: var(--bq-muted); background: var(--bq-bg-1); }
.ak-modal__actions { display: flex; gap: 12px; flex-wrap: wrap; }
.ak-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 26px; border-radius: 999px; font-weight: 600; color: #fff;
  background: linear-gradient(90deg, var(--bq-accent), var(--bq-accent-2)); box-shadow: 0 10px 24px -10px var(--bq-accent); transition: transform .2s var(--bq-ease);
}
.ak-cta:hover { transform: translateY(-2px); }
.ak-cta svg { width: 18px; height: 18px; }
.ak-cta--ghost { color: var(--bq-accent); background: transparent; box-shadow: none; border: 1.5px solid var(--bq-accent); }
.ak-cta--ghost:hover { background: var(--bq-accent); color: #fff; }
.ak-cta[disabled] { opacity: .75; cursor: progress; }
.ak-cta[hidden], .ak-preview[hidden], .ak-package[hidden], .ak-status[hidden] { display: none; }
.ak-cta.is-done, .ak-cta.is-done:hover { color: #fff; background: #17a864; border-color: #17a864; box-shadow: none; }
.ak-cta.is-error, .ak-cta.is-error:hover { color: #fff; background: #d6336c; border-color: #d6336c; box-shadow: none; }
.ak-prompts button.is-done { color: #fff; background: #17a864; border-color: #17a864; }
.ak-prompts button.is-error { color: #fff; background: #d6336c; border-color: #d6336c; }
.ak-status { margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; font-size: .85rem; font-weight: 600; color: #0b6b3a; background: color-mix(in srgb, #17a864 14%, var(--bq-surface)); }
.ak-status.is-error { color: #9d1c4b; background: color-mix(in srgb, #d6336c 14%, var(--bq-surface)); }
.ak-package { margin-bottom: 22px; padding: 16px; border-radius: 14px; border: 1px dashed var(--bq-line); background: var(--bq-tint); }
.ak-files { list-style: none; padding: 0 !important; display: flex; flex-direction: column; gap: 8px; }
.ak-files li { margin: 0 !important; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .85rem; }
.ak-files svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--c, var(--bq-accent)); }
.ak-files code { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: .82em; padding: 2px 8px; border-radius: 6px; background: var(--bq-surface); color: var(--bq-ink); }
.ak-files span { color: var(--bq-muted); }
.ak-package__note { margin: 12px 0 0; font-size: .82rem; color: var(--bq-muted); }

/* ---------- customize.js popup ---------- */
.custom-popup {
  position: fixed; z-index: 1300; width: 250px; padding: 16px; color: var(--bq-ink); background: var(--bq-surface);
  border: 1px solid var(--bq-line); border-radius: 18px; box-shadow: 0 30px 60px -20px rgba(20, 10, 80, .55);
}
.cp-customize-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cp-customize-title { font-weight: 800; font-size: 1rem; }
.cp-close-btn { width: 28px; height: 28px; border-radius: 50%; color: var(--bq-muted); }
.cp-close-btn:hover { background: var(--bq-bg-2); color: var(--bq-ink); }
.cp-section + .cp-section { margin-top: 14px; }
.cp-section-label { display: block; margin-bottom: 8px; font-size: .78rem; font-weight: 600; color: var(--bq-muted); }
.cp-theme-row, .cp-accent-row { display: flex; flex-wrap: wrap; gap: 8px; }
.cp-theme-btn { width: 38px; height: 38px; border-radius: 11px; font-size: 1.1rem; border: 1.5px solid var(--bq-line); background: var(--bq-bg-1); }
.cp-theme-btn.active { border-color: var(--bq-accent); background: color-mix(in srgb, var(--bq-accent) 12%, var(--bq-surface)); }
.cp-accent-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; box-shadow: 0 0 0 1px var(--bq-line); }
.cp-accent-dot.active { box-shadow: 0 0 0 2px var(--bq-surface), 0 0 0 4px var(--bq-accent); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .ak-head__nav { order: 3; width: 100%; margin-left: 0; }
  .ak-how ol, .ak-modal__cols { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .ak-footer__grid { grid-template-columns: 1fr 1fr; }
  .ak-footer__grid > div { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .ak-grid { grid-template-columns: 1fr; }
  .ak-modal__head { align-items: flex-start; }
  .ak-modal__actions .ak-cta { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
