/* =============================================================
   Beauttytext — styles.css
   Developer-tool SaaS design system: neutral surfaces, one accent,
   semantic colors, tight type/spacing scale, minimal chrome.
   ============================================================= */

/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  /* Spacing scale (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Radius — small and consistent, never “bubbly” */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-full: 999px;

  /* Type scale */
  --text-caption: 12px;
  --text-small: 13px;
  --text-body: 15px;
  --text-lg: 17px;
  --text-h3: 19px;
  --text-h2: 25px;
  --text-h1: 32px;
  --leading-tight: 1.25;
  --leading-normal: 1.6;

  /* Fonts */
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Motion */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --dur: 160ms;

  /* Light palette */
  --bg: #fafafb;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --bg-inset: #f2f3f5;
  --border: #e4e6eb;
  --border-strong: #d3d6de;
  --text-primary: #0d0e14;
  --text-secondary: #4c515e;
  --text-muted: #8a8f9c;
  --text-on-accent: #ffffff;

  --accent: #2f5eea;
  --accent-hover: #2449c4;
  --accent-wash: rgba(47, 94, 234, 0.09);

  --success: #16794f;
  --success-bg: #e9f7f0;
  --warning: #9a5b0a;
  --warning-bg: #fbf1e2;
  --error: #c0271a;
  --error-bg: #fcedec;

  --shadow-xs: 0 1px 2px rgba(15, 15, 25, 0.05);
  --shadow-sm: 0 1px 2px rgba(15, 15, 25, 0.04), 0 4px 10px rgba(15, 15, 25, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 15, 25, 0.1);

  --header-h: 56px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0b10;
    --surface: #121319;
    --surface-elevated: #1a1c24;
    --bg-inset: #0e0f15;
    --border: #23252f;
    --border-strong: #33363f;
    --text-primary: #edeef3;
    --text-secondary: #a3a8b8;
    --text-muted: #6d7183;
    --text-on-accent: #ffffff;

    --accent: #5b86ff;
    --accent-hover: #7fa0ff;
    --accent-wash: rgba(91, 134, 255, 0.14);

    --success: #3ecf8e;
    --success-bg: #0f2a20;
    --warning: #e5a94f;
    --warning-bg: #2c220f;
    --error: #f0665c;
    --error-bg: #2c1414;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.45);
  }
}
:root[data-theme="dark"] {
  --bg: #0a0b10;
  --surface: #121319;
  --surface-elevated: #1a1c24;
  --bg-inset: #0e0f15;
  --border: #23252f;
  --border-strong: #33363f;
  --text-primary: #edeef3;
  --text-secondary: #a3a8b8;
  --text-muted: #6d7183;
  --text-on-accent: #ffffff;

  --accent: #5b86ff;
  --accent-hover: #7fa0ff;
  --accent-wash: rgba(91, 134, 255, 0.14);

  --success: #3ecf8e;
  --success-bg: #0f2a20;
  --warning: #e5a94f;
  --warning-bg: #2c220f;
  --error: #f0665c;
  --error-bg: #2c1414;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.45);
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
body {
  font-family: var(--sans);
  font-size: var(--text-body);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
ul { list-style: none; padding: 0; }
::selection { background: var(--accent); color: var(--text-on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-xs); }

/* Headings — compact hierarchy, no “hero” sizing */
h1, .h1 { font-size: var(--text-h1); font-weight: 700; line-height: var(--leading-tight); letter-spacing: -0.015em; }
h2, .h2 { font-size: var(--text-h2); font-weight: 700; line-height: var(--leading-tight); letter-spacing: -0.01em; }
h3, .h3 { font-size: var(--text-h3); font-weight: 600; line-height: var(--leading-tight); }
.text-lg { font-size: var(--text-lg); }
.text-small { font-size: var(--text-small); }
.text-caption { font-size: var(--text-caption); color: var(--text-muted); }
.text-mono { font-family: var(--mono); }

.pt-icon { display: inline-block; flex-shrink: 0; vertical-align: -3px; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: var(--space-5); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -100px; left: var(--space-4); padding: var(--space-2) var(--space-4); background: var(--accent); color: var(--text-on-accent); z-index: 9999; border-radius: var(--radius-sm); font-weight: 600; font-size: var(--text-small); transition: top var(--dur) var(--ease); }
.skip-link:focus { top: var(--space-4); }
.section { padding-block: var(--space-7); }
.section + .section { border-top: 1px solid var(--border); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); flex-wrap: wrap; }
.section-title { font-size: var(--text-h2); }
.section-lede { color: var(--text-secondary); max-width: 60ch; font-size: var(--text-small); margin-top: var(--space-1); }

/* =============================================================
   4. Buttons & form controls
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: 34px; padding-inline: var(--space-3); border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 500; font-size: var(--text-small); white-space: nowrap; color: var(--text-primary);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn:disabled { opacity: .5; pointer-events: none; }
.btn--primary { background: var(--accent); color: var(--text-on-accent); box-shadow: var(--shadow-xs); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--secondary { background: var(--surface); color: var(--text-primary); border-color: var(--border); }
.btn--secondary:hover { border-color: var(--border-strong); background: var(--bg-inset); }
.btn--ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn--ghost:hover { color: var(--text-primary); background: var(--bg-inset); }
.btn--sm { height: 28px; padding-inline: var(--space-2); font-size: var(--text-caption); gap: var(--space-1); }
.btn--icon { width: 30px; height: 30px; padding: 0; color: var(--text-secondary); border-radius: var(--radius-sm); }
.btn--icon:hover { color: var(--text-primary); background: var(--bg-inset); }
.btn--icon.is-active { color: var(--accent); background: var(--accent-wash); }
.btn--lang { width: auto; padding-inline: var(--space-2); gap: 3px; font-size: 10px; font-weight: 700; letter-spacing: .02em; }
.btn--lang span { text-transform: uppercase; }
.lang-picker { position: relative; }
.lang-menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 140px;
  background: var(--surface-elevated); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); z-index: 60; padding: var(--space-1); animation: pt-pop var(--dur) var(--ease);
}
.lang-menu-item { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); width: 100%; text-align: left; padding: var(--space-2) var(--space-2); border-radius: var(--radius-xs); font-size: var(--text-small); color: var(--text-primary); }
.lang-menu-item:hover { background: var(--accent-wash); color: var(--accent); }
.lang-menu-item.is-active { color: var(--accent); font-weight: 600; }
.lang-menu-item .pt-icon { color: var(--accent); }

input[type="text"], input[type="search"], input[type="number"] {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0 var(--space-3); color: var(--text-primary); height: 34px; font-size: var(--text-small);
  transition: border-color var(--dur) var(--ease);
}
input[type="text"]:focus, input[type="search"]:focus { border-color: var(--accent); }
input[type="text"]::placeholder { color: var(--text-muted); }
label { font-size: var(--text-small); color: var(--text-secondary); }

/* =============================================================
   5. Header / nav
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 500; height: var(--header-h);
  display: flex; align-items: center; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.brand { display: flex; align-items: center; gap: var(--space-2); font-weight: 600; font-size: var(--text-lg); color: var(--text-primary); }
.brand-mark { width: 24px; height: 24px; border-radius: var(--radius-xs); vertical-align: -6px; }
.brand-mark--dark { display: none; }
:root[data-theme="dark"] .brand-mark--light { display: none; }
:root[data-theme="dark"] .brand-mark--dark { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-mark--light { display: none; }
  :root:not([data-theme="light"]) .brand-mark--dark { display: inline; }
}
.main-nav { display: flex; align-items: center; gap: var(--space-5); }
.main-nav a { font-weight: 500; font-size: var(--text-small); color: var(--text-secondary); transition: color var(--dur) var(--ease); }
.main-nav a:hover { color: var(--text-primary); }
.nav-toggle { display: none; }
.header-actions { display: flex; align-items: center; gap: var(--space-1); }

.nav-dropdown { position: relative; }
.nav-dropdown-trigger { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; font-size: var(--text-small); color: var(--text-secondary); transition: color var(--dur) var(--ease); }
.nav-dropdown-trigger:hover, .nav-dropdown-trigger[aria-expanded="true"] { color: var(--text-primary); }
.nav-dropdown-trigger .pt-icon { color: var(--text-muted); transition: transform var(--dur) var(--ease); }
.nav-dropdown-trigger[aria-expanded="true"] .pt-icon { transform: rotate(180deg); }
.nav-dropdown-panel {
  position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  width: min(560px, 86vw); background: var(--surface-elevated); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); z-index: 60; padding: var(--space-3); animation: pt-pop var(--dur) var(--ease);
}
.tools-menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; }
.tools-menu-item { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2); border-radius: var(--radius-sm); font-size: var(--text-small); color: var(--text-primary); }
.tools-menu-item .pt-icon { color: var(--accent); flex-shrink: 0; }
.tools-menu-item:hover { background: var(--accent-wash); color: var(--accent); }
.tools-menu-viewall { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--border); font-size: var(--text-caption); font-weight: 600; color: var(--accent); }
.tools-menu-viewall:hover { color: var(--accent-hover); }

@media (max-width: 719px) {
  .main-nav { position: fixed; top: var(--header-h); right: 0; height: calc(100vh - var(--header-h)); height: calc(100dvh - var(--header-h)); width: min(78vw, 280px); background: var(--surface); border-left: 1px solid var(--border); flex-direction: column; align-items: stretch; padding: var(--space-5); gap: var(--space-4); transform: translateX(100%); transition: transform var(--dur) var(--ease); box-shadow: var(--shadow-md); overflow-y: auto; }
  .main-nav.is-open { transform: translateX(0); }
  .nav-toggle { display: inline-flex; }
  .nav-dropdown-trigger { width: 100%; justify-content: space-between; }
  .nav-dropdown-panel { position: static; transform: none; width: 100%; box-shadow: none; border: none; padding: var(--space-2) 0 0; margin-top: var(--space-2); animation: none; }
  .tools-menu-grid { grid-template-columns: 1fr; }
}

/* =============================================================
   6. Page / tool hero — compact header, not a marketing hero
   ============================================================= */
.hero { padding-block: var(--space-6) var(--space-4); }
.hero h1 { font-size: clamp(1.5rem, 3.4vw, var(--text-h1)); }
.hero .tagline { font-size: var(--text-lg); color: var(--text-secondary); max-width: 62ch; margin-top: var(--space-2); }
.hero .badges { display: flex; gap: var(--space-2); margin-top: var(--space-4); flex-wrap: wrap; }

.pill { display: inline-flex; align-items: center; gap: var(--space-1); padding: 2px var(--space-2); border-radius: var(--radius-full); background: var(--bg-inset); border: 1px solid var(--border); font-size: var(--text-caption); color: var(--text-secondary); font-weight: 500; }

.tool-hero { padding-block: var(--space-5) var(--space-3); }
.tool-hero h1 { font-size: clamp(1.35rem, 2.6vw, 1.85rem); }
.tool-hero p { color: var(--text-secondary); max-width: 62ch; margin-top: var(--space-1); font-size: var(--text-body); }
.breadcrumbs { font-size: var(--text-caption); color: var(--text-muted); margin-bottom: var(--space-2); display: flex; align-items: center; gap: var(--space-1); }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--text-primary); }

/* =============================================================
   7. Tool card — the centerpiece, minimal chrome
   ============================================================= */
.tool-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-3); max-width: 1180px; margin-inline: auto;
}
.tool-toolbar { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; justify-content: space-between; margin-bottom: var(--space-2); }
.format-picker { position: relative; display: flex; gap: var(--space-2); align-items: center; flex: 1 1 240px; min-width: 200px; }
.format-picker input { width: 100%; padding-left: var(--space-3); }
.format-current-label { font-size: var(--text-caption); color: var(--text-muted); padding: 0 var(--space-1) var(--space-1); display: block; }
.format-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; width: min(380px, 90vw); max-height: 340px; overflow-y: auto;
  background: var(--surface-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md); z-index: 60; padding: var(--space-2);
  animation: pt-pop var(--dur) var(--ease);
}
.fd-group-title { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: var(--space-2) var(--space-2) var(--space-1); font-weight: 600; }
.fd-item { display: block; width: 100%; text-align: left; padding: var(--space-2) var(--space-2); border-radius: var(--radius-xs); font-size: var(--text-small); color: var(--text-primary); }
.fd-item:hover { background: var(--accent-wash); color: var(--accent); }
.fd-empty { padding: var(--space-4); color: var(--text-muted); text-align: center; font-size: var(--text-small); }
.tool-actions-top { display: flex; gap: var(--space-1); flex-wrap: wrap; }

.file-info { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; background: var(--bg-inset); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); margin-bottom: var(--space-2); font-size: var(--text-caption); }
.file-info span { color: var(--text-secondary); }
.file-info span:first-child { color: var(--text-primary); font-weight: 600; display: inline-flex; align-items: center; gap: var(--space-1); }

.detect-banner { display: flex; align-items: center; gap: var(--space-2); background: var(--accent-wash); border: 1px solid var(--accent); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); margin-bottom: var(--space-2); font-size: var(--text-small); color: var(--text-primary); }
.detect-banner span { flex: 1; display: flex; align-items: center; gap: var(--space-2); }

.tool-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-2); }
.pane { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--surface); min-height: 320px; }
.pane-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-1) var(--space-1) var(--space-1) var(--space-3); border-bottom: 1px solid var(--border); background: var(--bg-inset); flex-wrap: wrap; min-height: 40px; }
.pane-title { font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.pane-tools { display: flex; gap: 2px; }
.pane-status { padding: var(--space-1) var(--space-3); font-size: var(--text-caption); color: var(--text-muted); border-top: 1px solid var(--border); background: var(--bg-inset); font-family: var(--mono); }

.ops-column { display: flex; flex-direction: column; gap: var(--space-3); }
.pane-ops { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; padding: var(--space-1) 0; }
.ad-slot.ad-slot--between { margin-block: 0; min-height: 120px; width: 100%; max-width: 160px; }

.editor-wrap { flex: 1; min-height: 280px; display: flex; position: relative; }
.editor-wrap .CodeMirror { flex: 1; height: auto; width: 100%; }

.view-switch { display: flex; gap: var(--space-4); border-bottom: none; }
.vs-item { position: relative; display: inline-flex; align-items: center; gap: var(--space-1); padding: var(--space-1) 0; font-size: var(--text-caption); font-weight: 500; color: var(--text-muted); border-bottom: 2px solid transparent; }
.vs-item:hover { color: var(--text-primary); }
.vs-item.is-active { color: var(--accent); border-color: var(--accent); }

.view-panes { position: relative; flex: 1; display: flex; }
.tree-view, .table-view { flex: 1; overflow: auto; padding: var(--space-2); font-size: var(--text-small); }
.preview-view { flex: 1; width: 100%; border: 0; background: #fff; min-height: 280px; }
.raw-view { flex: 1; overflow: auto; padding: var(--space-3); margin: 0; font-family: var(--mono); font-size: var(--text-small); white-space: pre-wrap; word-break: break-word; color: var(--text-primary); }
.tree-toobig { color: var(--text-muted); padding: var(--space-5); text-align: center; font-size: var(--text-small); }

.result-banner { margin-top: var(--space-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); font-size: var(--text-small); display: flex; gap: var(--space-2); align-items: flex-start; animation: pt-fade var(--dur) var(--ease); }
.result-banner .pt-icon { margin-top: 2px; flex-shrink: 0; }
.result-banner strong { font-weight: 600; display: block; }
.result-banner--success { background: var(--success-bg); color: var(--success); }
.result-banner--error { background: var(--error-bg); color: var(--error); }
.rb-detail { font-weight: 400; font-size: var(--text-caption); opacity: .92; display: block; margin-top: 2px; font-family: var(--mono); }

.result-actions { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-2); position: relative; }
.download-menu { position: absolute; bottom: calc(100% + 6px); left: 0; background: var(--surface-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); display: flex; overflow: hidden; z-index: 40; animation: pt-pop var(--dur) var(--ease); }
.download-menu button { padding: var(--space-2) var(--space-3); font-size: var(--text-caption); font-weight: 600; border-right: 1px solid var(--border); color: var(--text-primary); }
.download-menu button:last-child { border-right: none; }
.download-menu button:hover { background: var(--bg-inset); color: var(--accent); }

.privacy-badge { margin-top: var(--space-3); display: flex; align-items: center; justify-content: center; gap: var(--space-1); text-align: center; font-size: var(--text-caption); color: var(--text-muted); }
.privacy-badge strong { color: var(--text-secondary); font-weight: 500; }
.limits-note { text-align: center; font-size: var(--text-caption); color: var(--text-muted); margin-top: 2px; }

@media (min-width: 960px) {
  .tool-grid { grid-template-columns: 1fr auto 1fr; align-items: stretch; }
  .ops-column { justify-content: center; align-items: stretch; }
  .ad-slot.ad-slot--between { margin-inline: auto; }
  .pane-ops { flex-direction: column; padding-inline: var(--space-1); justify-content: center; }
}

/* Fullscreen mode */
.tool-card.is-fullscreen {
  position: fixed; inset: 0; z-index: 2000; border-radius: 0; max-width: none; border: none;
  display: flex; flex-direction: column; overflow: auto;
}
.tool-card.is-fullscreen .tool-grid { flex: 1; }
.tool-card.is-fullscreen .pane { min-height: 0; }

/* Discreet drop hint — only appears while dragging a file over */
.dropzone-hint {
  position: absolute; inset: var(--space-2); display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px dashed var(--accent); border-radius: var(--radius-md);
  font-weight: 500; font-size: var(--text-small); color: var(--accent); pointer-events: none; opacity: 0;
  transition: opacity var(--dur) var(--ease); z-index: 5; backdrop-filter: blur(2px);
}
.editor-wrap.is-dragover .dropzone-hint { opacity: 1; }

/* =============================================================
   8. Search / replace bar
   ============================================================= */
.search-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); padding: var(--space-2) var(--space-3); background: var(--bg-inset); border-bottom: 1px solid var(--border); font-size: var(--text-small); animation: pt-fade var(--dur) var(--ease); }
.search-bar .sb-query, .search-bar .sb-replacement { height: 30px; padding: 0 var(--space-2); font-size: var(--text-small); flex: 1 1 130px; }
.sb-toggle { width: 28px; height: 28px; padding: 0; border-radius: var(--radius-xs); background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; }
.sb-toggle:hover { color: var(--text-primary); }
.sb-toggle.is-active { background: var(--accent-wash); color: var(--accent); border-color: var(--accent); }
.sb-count { color: var(--text-muted); white-space: nowrap; font-size: var(--text-caption); padding-inline: var(--space-1); }
.sb-prev, .sb-next, .sb-close { width: 28px; height: 28px; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xs); color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; }
.sb-prev:hover, .sb-next:hover, .sb-close:hover { color: var(--text-primary); border-color: var(--border-strong); }
.sb-replace-row { display: flex; gap: var(--space-1); flex: 1 1 100%; }
.pt-search-match { background: color-mix(in srgb, var(--warning) 38%, transparent); border-radius: 2px; }

/* =============================================================
   9. JSON/XML tree viewer + table
   ============================================================= */
.tree-toolbar { display: flex; gap: var(--space-2); align-items: center; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); background: var(--bg-inset); flex-wrap: wrap; }
.tree-toolbar input { height: 28px; font-size: var(--text-caption); flex: 1 1 150px; }
.tn { font-family: var(--mono); }
.tn-row { display: flex; align-items: center; gap: var(--space-1); padding: 2px var(--space-1); border-radius: var(--radius-xs); cursor: default; }
.tn-row:hover { background: var(--bg-inset); }
.tn-row.tn-match { background: color-mix(in srgb, var(--warning) 20%, transparent); }
.tn-toggle { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.tn-toggle .pt-icon { transition: transform var(--dur) var(--ease); }
.tn.is-open > .tn-row .tn-toggle .pt-icon { transform: rotate(90deg); }
.tn-toggle--empty { visibility: hidden; }
.tn-key { color: var(--accent); font-weight: 600; }
.tn-colon { color: var(--text-muted); }
.tn-type { font-size: 10px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); background: var(--bg-inset); border-radius: var(--radius-xs); padding: 0 4px; }
.tn-value { color: var(--text-secondary); }
.tn-value--string { color: var(--success); }
.tn-value--number { color: var(--warning); }
.tn-value--boolean, .tn-value--null { color: var(--accent); }
.tn-children { margin-left: 1rem; border-left: 1px solid var(--border); padding-left: var(--space-2); }
.tn-actions { margin-left: auto; display: none; gap: 2px; }
.tn-row:hover .tn-actions { display: flex; }
.tn-action { width: 22px; height: 22px; padding: 0; color: var(--text-muted); border-radius: var(--radius-xs); display: inline-flex; align-items: center; justify-content: center; }
.tn-action:hover { color: var(--accent); background: var(--accent-wash); }

.table-scroll { overflow-x: auto; }
.data-table { border-collapse: collapse; width: 100%; font-size: var(--text-small); font-family: var(--mono); }
.data-table th, .data-table td { border: 1px solid var(--border); padding: var(--space-1) var(--space-2); text-align: left; white-space: nowrap; }
.data-table th { background: var(--bg-inset); position: sticky; top: 0; font-weight: 600; color: var(--text-secondary); }
.table-note { color: var(--text-muted); font-size: var(--text-caption); padding: var(--space-2); }

/* =============================================================
   10. Ad placeholders — discreet, clearly not part of the tool
   ============================================================= */
.ad-slot {
  position: relative; border: 1px dashed var(--border-strong); border-radius: var(--radius-md);
  min-height: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-muted); background: var(--bg-inset); margin-block: var(--space-5);
}
.ad-slot::before {
  content: attr(data-ad-label); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted);
}
.ad-slot[data-size="rectangle"] { min-height: 250px; max-width: 300px; margin-inline: auto; }
.ad-slot [data-ad-close] { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xs); color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; }
.ad-slot [data-ad-close]:hover { color: var(--text-primary); }
.ad-sidebar { display: none; }
@media (min-width: 1280px) {
  .with-sidebar { display: grid; grid-template-columns: 1fr 280px; gap: var(--space-6); align-items: start; }
  .ad-sidebar { display: block; position: sticky; top: calc(var(--header-h) + var(--space-4)); }
}
.ad-floating { position: fixed; right: var(--space-4); bottom: var(--space-4); z-index: 300; width: 200px; min-height: 64px; margin: 0; box-shadow: var(--shadow-md); }
@media (max-width: 719px) { .ad-floating { display: none; } }

dialog#adInterstitial { border: none; border-radius: var(--radius-lg); padding: 0; max-width: 380px; width: 90vw; box-shadow: var(--shadow-md); background: var(--surface-elevated); color: var(--text-primary); }
dialog#adInterstitial::backdrop { background: rgba(8, 9, 14, .55); }
.interstitial-inner { padding: var(--space-5); text-align: center; }
.interstitial-inner .success-line { display: flex; align-items: center; justify-content: center; gap: var(--space-2); color: var(--success); font-weight: 600; font-size: var(--text-small); }
.interstitial-inner .ad-slot { margin-block: var(--space-4) 0; }

/* =============================================================
   11. Popular tools / feature cards / how it works
   ============================================================= */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--space-3); }
.tool-tile { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.tool-tile:hover { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.tool-tile .tile-icon { color: var(--accent); margin-bottom: var(--space-1); }
.tool-tile strong { font-size: var(--text-small); font-weight: 600; color: var(--text-primary); }
.tool-tile span { color: var(--text-muted); font-size: var(--text-caption); }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-5); }
.step { display: flex; flex-direction: column; gap: var(--space-2); }
.step-num { width: 26px; height: 26px; border-radius: var(--radius-sm); background: var(--accent-wash); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: var(--text-caption); }
.step h3 { font-size: var(--text-lg); }
.step p { color: var(--text-secondary); font-size: var(--text-small); }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--space-5); }
.feature { display: flex; flex-direction: column; gap: var(--space-1); }
.feature .feature-icon { color: var(--accent); margin-bottom: var(--space-1); }
.feature h3 { font-size: var(--text-body); font-weight: 600; }
.feature p { color: var(--text-muted); font-size: var(--text-small); }

.formats-list { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.formats-list .pill { font-weight: 500; }
.format-group-title { font-weight: 600; font-size: var(--text-small); margin: var(--space-4) 0 var(--space-2); color: var(--text-secondary); }
.format-group-title:first-child { margin-top: 0; }

/* =============================================================
   12. FAQ
   ============================================================= */
.faq-list { max-width: 760px; margin-inline: auto; display: flex; flex-direction: column; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item summary { cursor: pointer; font-weight: 500; font-size: var(--text-body); padding: var(--space-3) 0; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); color: var(--text-primary); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .pt-icon { color: var(--text-muted); transition: transform var(--dur) var(--ease); flex-shrink: 0; }
.faq-item[open] summary .pt-icon { transform: rotate(180deg); }
.faq-item p { padding: 0 0 var(--space-3); color: var(--text-secondary); font-size: var(--text-small); max-width: 68ch; }

/* =============================================================
   13. Footer
   ============================================================= */
.site-footer { border-top: 1px solid var(--border); padding-block: var(--space-6) var(--space-4); margin-top: var(--space-6); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-5); margin-bottom: var(--space-5); }
.footer-grid h4 { font-size: var(--text-caption); text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: var(--space-2); font-weight: 600; }
.footer-grid li { margin-bottom: var(--space-2); }
.footer-grid a { color: var(--text-secondary); font-size: var(--text-small); }
.footer-grid a:hover { color: var(--accent); }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2); padding-top: var(--space-4); border-top: 1px solid var(--border); font-size: var(--text-caption); color: var(--text-muted); }

/* =============================================================
   14. Legal / static content pages
   ============================================================= */
.prose { max-width: 720px; margin-inline: auto; }
.prose h2 { margin-top: var(--space-6); margin-bottom: var(--space-2); font-size: var(--text-h3); }
.prose p, .prose li { color: var(--text-secondary); margin-bottom: var(--space-3); font-size: var(--text-body); }
.prose li { margin-left: var(--space-5); list-style: disc; }

/* =============================================================
   15. Settings panel
   ============================================================= */
#settingsPanel { position: fixed; right: var(--space-4); top: calc(var(--header-h) + var(--space-2)); width: 250px; background: var(--surface-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: var(--space-4); z-index: 400; font-size: var(--text-small); animation: pt-pop var(--dur) var(--ease); }
#settingsPanel .settings-title { font-size: var(--text-caption); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: var(--space-3); }
#settingsPanel .settings-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); gap: var(--space-2); }
#settingsPanel .settings-row:last-child { margin-bottom: 0; }
#settingsPanel label { font-weight: 500; color: var(--text-primary); }
#settingsPanel input[type="number"] { width: 60px; height: 28px; }

/* =============================================================
   16. Dialogs (clear confirm)
   ============================================================= */
dialog#clearDialog { border: none; border-radius: var(--radius-lg); padding: var(--space-5); max-width: 340px; width: 90vw; box-shadow: var(--shadow-md); background: var(--surface-elevated); color: var(--text-primary); }
dialog#clearDialog::backdrop { background: rgba(8, 9, 14, .5); }
dialog#clearDialog p { margin-bottom: var(--space-4); font-size: var(--text-body); }
dialog#clearDialog .dialog-actions { display: flex; gap: var(--space-2); justify-content: flex-end; }
dialog { animation: pt-pop var(--dur) var(--ease); }

/* =============================================================
   17. Toast
   ============================================================= */
.pt-toast { position: fixed; left: 50%; bottom: var(--space-5); transform: translate(-50%, 8px); display: inline-flex; align-items: center; gap: var(--space-2); background: var(--text-primary); color: var(--bg); padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); font-size: var(--text-small); font-weight: 500; opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); z-index: 3000; box-shadow: var(--shadow-md); }
.pt-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.pt-toast .pt-icon { color: var(--success); }

/* =============================================================
   18. CodeMirror theme integration
   ============================================================= */
.CodeMirror { font-family: var(--mono); font-size: 13.5px; height: 100%; background: var(--surface); color: var(--text-primary); line-height: 1.6; }
.CodeMirror-gutters { background: var(--surface); border-right: 1px solid var(--border); }
.CodeMirror-linenumber { color: var(--text-muted); }
.CodeMirror-cursor { border-left: 1.5px solid var(--accent); }
.CodeMirror-selected { background: var(--accent-wash) !important; }
.CodeMirror-activeline-background { background: var(--bg-inset); }
.CodeMirror-matchingbracket { color: var(--success) !important; font-weight: 700; }

/* =============================================================
   19. Keyframes
   ============================================================= */
@keyframes pt-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pt-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* =============================================================
   20. Responsive — mobile prioritizes the tool; touch targets grow
   ============================================================= */
@media (max-width: 719px) {
  .btn { min-height: 40px; }
  .btn--icon { min-width: 38px; min-height: 38px; }
  .sb-toggle, .sb-prev, .sb-next, .sb-close { width: 34px; height: 34px; }
  .tool-card { padding: var(--space-2); }
  .hero, .tool-hero { padding-block: var(--space-4) var(--space-3); }
  .section { padding-block: var(--space-6); }
}
@media (min-width: 540px) { }
@media (min-width: 720px) { }
@media (min-width: 1280px) { }
@media (min-width: 1600px) { .container { max-width: 1320px; } }
