/* AI Detector widget — portable stylesheet.
 *
 * Lifted from the inline <style> of /tools/ai-detector/ so the same detector
 * can run on landing pages that use /css/landing.css. Those two are different
 * design systems: the tool page defines 27 :root custom properties, the
 * landing pages define none and use no var() at all. Dropping the widget's
 * markup onto a landing page without this file renders it unstyled, because
 * every colour in it resolves through var(--...).
 *
 * Everything here is scoped under .studio-wrap for that reason:
 *   - the tokens are declared ON .studio-wrap rather than :root, so they
 *     cannot repaint the host page
 *   - every selector is prefixed, so generic names the widget uses (.btn,
 *     .primary, .ghost) cannot collide with landing.css's own .btn
 *
 * Pair it with the markup block from /tools/ai-detector/, <div class="toast"
 * id="toast"></div>, and the two scripts (tools-common.js, ai-detector.js).
 * The script's element contract is: #editor #wordCount #runBtn #resultArea
 * #rpBadge #rpIdle #usage #sampleBtn #clearBtn #pasteBtn #toast.
 */

.studio-wrap {
--bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f6fb;
  --surface-3: #fafbff;
  --border: #e6e9f1;
  --border-strong: #d6dbe6;
  --ink: #0f1729;
  --ink-2: #344056;
  --muted: #6b7591;
  --muted-2: #9aa3b8;
  --brand: #3788d8;
  --brand-2: #2c6cb0;
  --brand-soft: #e3effb;
  --brand-softer: #eef5fc;
  --green: #119d5b;
  --green-soft: #e6f6ee;
  --red: #e11d48;
  --red-soft: #fde8ec;
  --amber: #f59e0b;
  --amber-soft: #fef3c7;
  --violet: #7c3aed;
  --violet-soft: #f3e8ff;

  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.04), 0 1px 1px rgba(15,23,42,.02);
  --shadow-md: 0 2px 6px rgba(15,23,42,.05), 0 8px 24px rgba(15,23,42,.04);
  --shadow-lg: 0 30px 80px -30px rgba(15,23,42,.22), 0 8px 24px -8px rgba(15,23,42,.10);
}

.studio-wrap /* =========================================================
   BUTTONS
   ========================================================= */
.btn { height: 38px; padding: 0 14px;
  border-radius: 10px;
  font-weight: 600; font-size: 13.5px;
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border);
  background: #fff; color: var(--ink-2);
  white-space: nowrap;
  text-decoration: none;
  transition: background .15s ease, transform .12s ease, box-shadow .2s ease, border-color .15s ease; }
.studio-wrap .btn:hover { background: var(--surface-2); }
.studio-wrap .btn.primary { background: linear-gradient(180deg, #4a99e6, #2c6cb0);
  border-color: transparent; color: #fff;
  box-shadow: 0 4px 10px rgba(55,136,216,.22), inset 0 1px 0 rgba(255,255,255,.2); }
.studio-wrap .btn.primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(55,136,216,.34); }
.studio-wrap .btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.studio-wrap .btn.ghost:hover { background: var(--surface-2); color: var(--ink-2); }
.studio-wrap .lp-cta .btn { height: 36px; }
.studio-wrap .det-promo .spark { width: 30px; height: 30px;
  flex: 0 0 30px;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  border-radius: 8px;
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 4px 10px rgba(124,58,237,.32); }
.studio-wrap .spin { animation: spin 1s linear infinite; }
.studio-wrap .cta-actions .btn.primary { height: 48px; padding: 0 22px; font-size: 15px; }
.studio-wrap .cta-actions .btn-ghost-dark { height: 48px; padding: 0 22px; font-size: 15px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.14);
  color: #fff;
  border-radius: 11px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease; }
.studio-wrap .cta-actions .btn-ghost-dark:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.24); }
.studio-wrap .ba-foot .btn.primary { height: 40px; padding: 0 16px;
  font-size: 13.5px; }
.studio-wrap .ts-cta .ghost { border: 1px solid var(--border); color: var(--ink-2); background: #fff; flex: 0 0 auto; padding: 0 20px; }
.studio-wrap /* ---------- STUDIO SHELL ---------- */
.studio-wrap { max-width: 1180px; margin: -16px auto 0; padding: 0 32px 10px; position: relative; z-index: 2; }
.studio-wrap .studio { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.studio-wrap .studio-head { display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fbfcfe, #fff);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.studio-wrap .studio-head .sh-left { display: flex; align-items: center; gap: 11px; min-width: 0; }
.studio-wrap .studio-head .sh-ic { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; background: var(--brand-softer); color: var(--brand); display: grid; place-items: center; }
.studio-wrap .studio-head .sh-title { font-weight: 800; font-size: 15px; letter-spacing: -.01em; }
.studio-wrap .studio-head .sh-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.studio-wrap /* usage meter */
.usage { display: flex; align-items: center; gap: 10px; }
.studio-wrap .usage .u-text { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.studio-wrap .usage .u-text b { color: var(--ink); }
.studio-wrap .usage .u-bar { width: 92px; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.studio-wrap .usage .u-bar > i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--brand), #5aa3e8); border-radius: 999px; transition: width .4s ease; }
.studio-wrap .usage.low .u-bar > i { background: linear-gradient(90deg, var(--amber), #f59e0b); }
.studio-wrap .usage.out .u-bar > i { background: linear-gradient(90deg, var(--red), #f43f5e); }
.studio-wrap .studio-grid { display: grid; grid-template-columns: 1fr 1.05fr; align-items: stretch; }
.studio-wrap .studio-left { padding: 20px; border-right: 1px solid var(--border); min-width: 0; border-bottom-left-radius: var(--radius-lg); }
.studio-wrap .left-sticky { position: sticky; top: 80px; }
.studio-wrap .studio-right { padding: 20px; min-width: 0; background: var(--surface-3); border-bottom-right-radius: var(--radius-lg); }
.studio-wrap .tool-bar .tb-btn { font-size: 12px; font-weight: 700; color: var(--ink-2); background: #fff; border: 1px solid var(--border); border-radius: 9px; padding: 7px 11px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.studio-wrap .tool-bar .tb-btn:hover { border-color: var(--brand); color: var(--brand); }
.studio-wrap .tool-bar .tb-note { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.studio-wrap /* ---------- RESULT ---------- */
.rp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.studio-wrap .rp-title { font-size: 11px; font-weight: 800; letter-spacing: .12em; color: var(--muted-2); }
.studio-wrap .rp-badge { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; padding: 4px 9px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.studio-wrap .rp-badge.scanning { background: var(--brand-softer); color: var(--brand); }
.studio-wrap .rp-badge.done { background: var(--green-soft); color: var(--green); }
.studio-wrap .rp-idle { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 360px; gap: 12px; color: var(--muted); }
.studio-wrap .rp-idle .ri-ic { width: 60px; height: 60px; border-radius: 16px; background: #fff; border: 1px solid var(--border); display: grid; place-items: center; color: var(--muted-2); }
.studio-wrap .rp-idle h3 { margin: 0; font-size: 16px; font-weight: 800; color: var(--ink-2); }
.studio-wrap .rp-idle p { margin: 0; font-size: 13px; max-width: 32ch; line-height: 1.5; }
.studio-wrap .rp-actions .btn { height: 38px; }
.studio-wrap .rp-actions .btn.pro-out { border-color: #e4d5fb; color: var(--violet); position: relative; }
.studio-wrap .rp-actions .btn.pro-out .pro-tag { font-size: 9px; font-weight: 800; background: var(--brand-soft); color: var(--brand); padding: 1px 5px; border-radius: 4px; margin-left: 2px; }
.studio-wrap .price-card .pc-cta.ghost { border: 1px solid var(--border); color: var(--ink-2); }
.studio-wrap /* ---------- RESPONSIVE ---------- */



/* AI Detector — prose text input (relaxed from the code editor) */
.text-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.studio-wrap .text-bar .tb-btn { font-size: 12px; font-weight: 700; color: var(--ink-2); background: #fff; border: 1px solid var(--border); border-radius: 9px; padding: 7px 11px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.studio-wrap .text-bar .tb-btn:hover { border-color: var(--brand); color: var(--brand); }
.studio-wrap .text-bar .sp { flex: 1; }
.studio-wrap .text-bar .tb-note { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.studio-wrap .text-input { width: 100%; min-height: 320px; resize: vertical; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; font-family: inherit; font-size: 15px; line-height: 1.62; color: var(--ink); background: #fff; }
.studio-wrap .text-input::placeholder { color: var(--muted-2); }
.studio-wrap .text-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-softer); }
.studio-wrap .text-run { height: 42px; padding: 0 20px; border-radius: 11px; border: 0; background: linear-gradient(180deg, #4a99e6, #2c6cb0); color: #fff; font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 4px 12px rgba(55,136,216,.26); cursor: pointer; margin-top: 12px; }
.studio-wrap .text-run:hover { transform: translateY(-1px); }
.studio-wrap /* Spectrum bar — What counts as AI text */
.spectrum { margin: 0 auto 26px; }
.studio-wrap .spectrum-bar { height: 14px; border-radius: 999px; background: linear-gradient(90deg, var(--green) 0%, var(--amber) 52%, var(--red) 100%); box-shadow: inset 0 1px 2px rgba(15,23,42,.10); }
.studio-wrap .spectrum-labels { display: flex; justify-content: space-between; margin-top: 10px; font-size: 12px; font-weight: 800; letter-spacing: .02em; color: var(--muted); }

@media (max-width: 720px) {
  .studio-wrap .lp-cta .btn.primary { height: 38px; padding: 0 14px; font-size: 13px; }
  .studio-wrap .cta-actions .btn.primary, .studio-wrap .cta-actions .btn-ghost-dark { width: 100%; justify-content: center; height: 46px; }
}

@media (max-width: 420px) {
  .studio-wrap .lp-cta .btn.primary { padding: 0 10px; font-size: 12.5px; height: 36px; }
  .studio-wrap .lp-cta .btn.primary svg { display: none; }
}

@media (max-width: 820px) {
  .studio-wrap .ba-foot .btn.primary { width: 100%; justify-content: center; }
}

@media (max-width: 640px) {
  .studio-wrap .cta-actions .btn, .studio-wrap .cta-actions .btn-ghost-dark { width: 100%; justify-content: center; }
}

@media (max-width: 920px) {
  .studio-wrap .studio-grid { grid-template-columns: 1fr; }
  .studio-wrap .left-sticky { position: static; top: auto; }
  .studio-wrap .studio-left { border-right: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
}

@media (max-width: 640px) {
  .studio-wrap { padding: 0 14px 10px; }
  .studio-wrap .studio-left, .studio-wrap .studio-right { padding: 14px; }
  .studio-wrap .studio-head { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: no-preference) {
  .studio-wrap html.js-anim .section .sec-head, .studio-wrap html.js-anim .section .sec-wrap, .studio-wrap html.js-anim .cov-note, .studio-wrap html.js-anim .hiw-steps-title, .studio-wrap html.js-anim .feat-grid, .studio-wrap html.js-anim .cov-grid, .studio-wrap html.js-anim .signal-list, .studio-wrap html.js-anim .rel-grid, .studio-wrap html.js-anim .steps, .studio-wrap html.js-anim .stat-callout, .studio-wrap html.js-anim .spectrum { opacity: 0;
    transform: translateY(22px);
    transition: opacity .7s cubic-bezier(.16,1,.3,1), transform .7s cubic-bezier(.16,1,.3,1); }
  .studio-wrap html.js-anim .sec-head.in, .studio-wrap html.js-anim .sec-wrap.in, .studio-wrap html.js-anim .cov-note.in, .studio-wrap html.js-anim .hiw-steps-title.in, .studio-wrap html.js-anim .feat-grid.in, .studio-wrap html.js-anim .cov-grid.in, .studio-wrap html.js-anim .signal-list.in, .studio-wrap html.js-anim .rel-grid.in, .studio-wrap html.js-anim .steps.in, .studio-wrap html.js-anim .stat-callout.in, .studio-wrap html.js-anim .spectrum.in { opacity: 1;
    transform: none; }
}
