/* ==========================================================================
   Easy JSON Formatter – app styles (index.html)
   ========================================================================== */

/* ── App shell ─────────────────────────────────────────────────────────── */
.app {
  --code-fs: 13px;
  --code-lh: 20px;
  --iw: 20px;

  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
  min-height: 540px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px 4px;
}
.app.fs-s { --code-fs: 12px; --code-lh: 18px; }
.app.fs-l { --code-fs: 15px; --code-lh: 23px; }
.app.iw-4 { --iw: 32px; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  font-size: .85rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { background: var(--surface); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn .i { color: var(--muted); }
.btn:hover .i { color: inherit; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(79, 70, 229, .3);
}
.btn-primary .i { color: inherit; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-danger:hover { color: var(--err); border-color: color-mix(in srgb, var(--err) 45%, var(--border)); background: var(--err-soft); }
.btn-danger:hover .i { color: var(--err); }

.btn[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent);
}
.btn[aria-pressed="true"] .i { color: var(--accent); }

.btn-sm { height: 30px; padding: 0 10px; font-size: .8rem; gap: 6px; }
.btn-sm .i { width: 15px; height: 15px; }

kbd {
  font-family: var(--mono);
  font-size: .72rem;
  line-height: 1;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--panel);
  color: var(--text);
  white-space: nowrap;
}

/* ── Toolbar ───────────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.tb-group { display: flex; align-items: center; gap: 6px; }
.tb-sep { width: 1px; height: 22px; background: var(--border); margin: 0 2px; }
.tb-spacer { flex: 1; }

.select-wrap { position: relative; display: inline-flex; align-items: center; }
.select-wrap > .i { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.select-wrap > .chev { left: auto; right: 9px; width: 14px; height: 14px; }
.select {
  appearance: none;
  -webkit-appearance: none;
  height: 34px;
  padding: 0 30px 0 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.select:hover { border-color: var(--border-strong); background: var(--surface); }
.select.active { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); color: var(--accent); }
.select option { background: var(--panel); color: var(--text); }

/* ── Workspace (two panels + splitter) ─────────────────────────────────── */
.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, var(--left, 1fr)) 12px minmax(0, var(--right, 1fr));
}
.workspace.max-out { grid-template-columns: minmax(0, 1fr); }
.workspace.max-out #inputPanel,
.workspace.max-out .splitter { display: none; }

.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.panel:focus-within {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.splitter {
  position: relative;
  cursor: col-resize;
  touch-action: none;
  border-radius: 6px;
}
.splitter::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  width: 4px; height: 44px;
  transform: translate(-50%, -50%);
  border-radius: 4px;
  background: var(--border-strong);
  transition: background .15s, height .15s;
}
.splitter:hover::after,
.splitter.dragging::after,
.splitter:focus-visible::after { background: var(--accent); height: 72px; }
.splitter:focus-visible { outline: none; }
body.resizing { cursor: col-resize; user-select: none; }

/* ── Panel header ──────────────────────────────────────────────────────── */
.panel-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  min-height: 48px;
  padding: 7px 8px 7px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .84rem;
  font-weight: 650;
  letter-spacing: -.005em;
  min-width: 0;
}
.badge {
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.badge.accent { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.panel-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.panel-actions .btn-sm { margin-left: 4px; }

/* Segmented control (tabs and settings) */
.seg {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.seg button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 550;
  transition: background .15s, color .15s;
}
.seg button .i { width: 14px; height: 14px; }
.seg button:hover:not(:disabled) { color: var(--text); }
.seg button[aria-selected="true"],
.seg button[aria-checked="true"] {
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.seg button:disabled { opacity: .4; cursor: not-allowed; }

/* Search */
.search {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 140px;
  max-width: 260px;
  min-width: 110px;
  height: 30px;
  padding: 0 4px 0 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.search > .i { width: 14px; height: 14px; color: var(--faint); }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: .8rem;
}
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { display: none; }
.search:focus-within { border-color: var(--accent); background: var(--panel); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-count { font-family: var(--mono); font-size: .7rem; color: var(--faint); white-space: nowrap; }
.search-nav { display: flex; }
.search-nav .icon-btn { width: 22px; height: 22px; }
.search-nav .icon-btn .i { width: 13px; height: 13px; }

/* ── Editor (input) ────────────────────────────────────────────────────── */
.editor {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  font-family: var(--mono);
  font-size: var(--code-fs);
  line-height: var(--code-lh);
}
.gutter {
  position: relative;
  flex-shrink: 0;
  min-width: 44px;
  overflow: hidden;
  padding: 14px 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  color: var(--faint);
  text-align: right;
  user-select: none;
  font-variant-numeric: tabular-nums;
}
.gutter-inner { position: relative; will-change: transform; }
.gutter-nums { position: relative; z-index: 1; padding: 0 10px 0 12px; white-space: pre; }
.err-mark {
  position: absolute;
  left: 0; right: 0;
  height: var(--code-lh);
  background: var(--err-soft);
  box-shadow: inset 3px 0 0 var(--err);
}
.code-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  padding: 14px 16px;
  white-space: pre;
  overflow: auto;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  tab-size: 2;
  caret-color: var(--accent);
}
.code-input::placeholder { color: var(--faint); }
.code-input:focus-visible { outline: none; }

.drop-overlay {
  position: absolute;
  inset: 56px 10px 10px;
  z-index: 5;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 75%, var(--accent-soft));
  color: var(--accent);
  font-weight: 600;
  font-size: .92rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}
.drop-overlay .i { width: 28px; height: 28px; }
.panel.dragging .drop-overlay { opacity: 1; }

/* ── Output ────────────────────────────────────────────────────────────── */
.output {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  font-family: var(--mono);
  font-size: var(--code-fs);
  line-height: var(--code-lh);
}
.output:focus-visible { outline: none; }

/* Empty state */
.empty {
  height: 100%;
  min-height: 240px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  font-family: var(--sans);
  color: var(--muted);
}
.empty-mark {
  width: 56px; height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 18px;
}
.empty h3 { font-size: 1rem; font-weight: 650; color: var(--text); }
.empty p { font-size: .86rem; max-width: 320px; }
.empty-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.empty-keys { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; font-size: .78rem; color: var(--faint); margin-top: 6px; }
.empty-keys span { display: inline-flex; align-items: center; gap: 4px; }

/* Tree view */
.tree { padding: 10px 14px 28px 6px; min-width: max-content; }
.row {
  position: relative;
  padding-left: 20px;
  padding-right: 8px;
  white-space: pre;
  border-radius: 4px;
}
.row[data-path] { cursor: pointer; }
.row:hover { background: var(--surface); }
.row.sel { background: var(--selected); box-shadow: inset 2px 0 0 var(--accent); }
.tg {
  position: absolute;
  left: 2px;
  top: calc((var(--code-lh) - 16px) / 2);
  width: 16px; height: 16px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--faint);
  display: grid;
  place-items: center;
}
.tg:hover { color: var(--text); background: var(--surface-2); }
.tg .i { width: 12px; height: 12px; stroke-width: 2.5; transition: transform .15s; }
.node.collapsed > .row > .tg .i { transform: rotate(-90deg); }
.kids {
  margin-left: 9px;
  padding-left: calc(var(--iw) - 9px);
  border-left: 1px solid var(--guide);
}
.node:hover > .kids { border-left-color: var(--border-strong); }
.ph { display: none; color: var(--faint); }
.node.collapsed > .kids,
.node.collapsed > .close { display: none; }
.node.collapsed > .row > .ph { display: inline; }
.cnt {
  font-family: var(--sans);
  font-size: .72rem;
  padding: 1px 7px;
  margin: 0 4px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}
.meta-cnt { font-family: var(--sans); font-size: .7rem; color: var(--faint); margin-left: 6px; opacity: 0; transition: opacity .15s; }
.row:hover > .meta-cnt { opacity: 1; }
.no-ix .ix, .no-ix .ix + .p { display: none; }

/* Code view */
.code { padding: 10px 0 28px; min-width: max-content; counter-reset: ln; }
.cl {
  position: relative;
  display: block;
  min-height: var(--code-lh);
  padding: 0 16px 0 calc(var(--ln-w, 3ch) + 30px);
  white-space: pre;
}
.cl::before {
  content: counter(ln);
  counter-increment: ln;
  position: absolute;
  left: 0;
  width: calc(var(--ln-w, 3ch) + 14px);
  text-align: right;
  color: var(--faint);
  user-select: none;
  font-variant-numeric: tabular-nums;
}
.cl:hover { background: var(--surface); }
.plain { padding: 14px 16px; white-space: pre; }

/* Wrapping */
.out-wrap .tree, .out-wrap .code { min-width: 0; }
.out-wrap .row, .out-wrap .cl, .out-wrap .plain { white-space: pre-wrap; word-break: break-all; }

/* Syntax colors */
.k  { color: var(--key); }
.s  { color: var(--str); }
.n  { color: var(--num); }
.b  { color: var(--bool); }
.nl { color: var(--null); font-style: italic; }
.p  { color: var(--punct); }
.ix { color: var(--faint); user-select: none; }
.hit { background: var(--hit); border-radius: 2px; box-shadow: 0 0 0 1px var(--hit); }
.hit-cur { background: var(--hit-cur); color: #111 !important; box-shadow: 0 0 0 1px var(--hit-cur); }
.cl.hit, .cl.hit-cur { border-radius: 0; box-shadow: none; }

/* Error card */
.err-card {
  margin: 16px;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--err) 35%, transparent);
  border-radius: var(--radius);
  background: var(--err-soft);
  font-family: var(--sans);
  font-size: .88rem;
}
.err-title { display: flex; align-items: center; gap: 8px; color: var(--err); font-weight: 650; font-size: .95rem; }
.err-title .i { width: 18px; height: 18px; }
.err-msg { margin-top: 6px; font-family: var(--mono); font-size: .8rem; color: var(--text); word-break: break-word; }
.err-loc { margin-top: 4px; color: var(--muted); font-size: .82rem; }
.err-hint { margin-top: 10px; padding-left: 10px; border-left: 3px solid color-mix(in srgb, var(--err) 50%, transparent); color: var(--text); }
.err-snippet {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
}
.err-snippet .caret { color: var(--err); font-weight: 700; }
.err-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* Warnings */
.notice {
  margin: 12px 12px 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  border-radius: 8px;
  background: var(--warn-soft);
  font-family: var(--sans);
  font-size: .82rem;
}
.notice-title { display: flex; align-items: center; gap: 6px; font-weight: 650; color: var(--warn); }
.notice ul { list-style: none; margin-top: 6px; display: grid; gap: 2px; }
.notice li button {
  border: 0;
  background: transparent;
  text-align: left;
  font-size: .8rem;
  color: var(--text);
  padding: 2px 0;
}
.notice li button:hover { text-decoration: underline; }
.notice code { font-family: var(--mono); font-size: .78rem; }

/* ── Status bar ────────────────────────────────────────────────────────── */
.statusbar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 30px;
  padding: 0 4px;
  font-size: .76rem;
  color: var(--muted);
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  font-weight: 600;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.valid { color: var(--ok); background: var(--ok-soft); }
.pill.error { color: var(--err); background: var(--err-soft); }
.pill.warn  { color: var(--warn); background: var(--warn-soft); }
.sb-item { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.sb-right { margin-left: auto; display: flex; align-items: center; gap: 14px; min-width: 0; }
.path-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: 46ch;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-family: var(--mono);
  font-size: .74rem;
  padding: 2px 4px;
  border-radius: 4px;
}
.path-btn span { overflow: hidden; text-overflow: ellipsis; }
.path-btn:hover { background: var(--accent-soft); }
.path-btn .i { width: 13px; height: 13px; }

/* ── Dialogs ───────────────────────────────────────────────────────────── */
.modal {
  margin: auto;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.modal::backdrop { background: rgba(8, 10, 14, .5); backdrop-filter: blur(2px); }
.modal[open] { animation: pop .16s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 14px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 1rem; font-weight: 650; }
.modal-body { padding: 6px 20px 20px; overflow: auto; }
.modal-sm { width: min(400px, calc(100vw - 32px)); }
.modal-sm .modal-body { padding-top: 16px; }
.field-label { display: block; margin-bottom: 6px; font-size: .85rem; font-weight: 600; }
.field-hint { margin-top: 8px; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.text-input.text-input-wide { width: 100%; height: 38px; font-size: .9rem; }
.text-input:user-invalid { border-color: var(--err); }
.class-btn .lbl { display: inline-block; max-width: 12ch; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); font-size: .76rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.kb-list { display: grid; grid-template-columns: 1fr auto; gap: 0; font-size: .87rem; }
.kb-list dt, .kb-list dd { padding: 10px 0; border-bottom: 1px solid var(--border); }
.kb-list dd { display: flex; gap: 4px; justify-content: flex-end; align-items: center; color: var(--faint); }
.kb-list dt:last-of-type, .kb-list dd:last-of-type { border-bottom: 0; }

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.set-row:last-child { border-bottom: 0; }
.set-row label, .set-label { font-size: .9rem; font-weight: 550; cursor: pointer; }
.set-desc { display: block; font-size: .78rem; font-weight: 400; color: var(--muted); margin-top: 2px; }

.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 38px; height: 22px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.switch::before {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
  transition: transform .15s;
}
.switch:checked { background: var(--accent); border-color: var(--accent); }
.switch:checked::before { transform: translateX(16px); }

.noscript {
  margin: 0 16px 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--warn-soft);
  color: var(--text);
  text-align: center;
}

/* ── Content (guide, features, FAQ) ────────────────────────────────────── */
.content {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 64px 24px 72px;
}
.section-head { text-align: center; max-width: 680px; margin: 0 auto 28px; }
.section-head h2 { font-size: 1.6rem; font-weight: 750; letter-spacing: -.025em; line-height: 1.25; }
.section-head p { margin-top: 8px; color: var(--muted); }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.feature {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.feature:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-2px); }
.fi {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 12px;
}
.fi .i { width: 18px; height: 18px; }
.feature h3 { font-size: .95rem; font-weight: 650; margin-bottom: 4px; }
.feature p { font-size: .86rem; color: var(--muted); line-height: 1.6; }

.guide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 56px;
}
.card {
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
}
.card.wide { grid-column: 1 / -1; }
.card h2 { font-size: 1.18rem; font-weight: 700; letter-spacing: -.015em; margin-bottom: 10px; }
.card h3 { font-size: .96rem; font-weight: 650; margin: 18px 0 6px; }
.card p, .card li { font-size: .92rem; line-height: 1.75; color: var(--muted); }
.card p + p { margin-top: 10px; }
.card ol, .card ul { padding-left: 1.3em; display: grid; gap: 4px; }
.card strong { color: var(--text); font-weight: 600; }
.card code {
  font-family: var(--mono);
  font-size: .82em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.card kbd { font-size: .74rem; }

.faq { margin-top: 56px; }
.faq-list { max-width: 820px; margin: 0 auto; }
.faq details { border-bottom: 1px solid var(--border); }
.faq details:first-child { border-top: 1px solid var(--border); }
.faq summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 2px;
  font-weight: 600;
  cursor: pointer;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '';
  width: 10px; height: 10px;
  flex-shrink: 0;
  border-right: 2px solid var(--faint);
  border-bottom: 2px solid var(--faint);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .2s;
}
.faq details[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.faq details p { padding: 0 2px 18px; color: var(--muted); line-height: 1.75; font-size: .94rem; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .btn .lbl-opt { display: none; }
}

@media (max-width: 860px) {
  .app { height: auto; min-height: 0; padding: 10px 12px 4px; }
  .toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 -12px;
    padding: 2px 12px 4px;
    scrollbar-width: none;
  }
  .toolbar::-webkit-scrollbar { display: none; }
  .tb-spacer { display: none; }
  .workspace {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(260px, 42vh) minmax(340px, 62vh);
    gap: 10px;
  }
  .workspace.max-out { grid-template-rows: minmax(340px, 80vh); }
  .splitter { display: none; }
  .max-btn { display: none; }
  .search { flex: 1 1 100%; order: 10; }
  .statusbar { flex-wrap: wrap; row-gap: 2px; padding: 4px; }
  .sb-right { margin-left: 0; }
  .guide { grid-template-columns: minmax(0, 1fr); }
  .content { padding: 48px 16px 56px; }
  .section-head h2 { font-size: 1.35rem; }
  .card { padding: 20px; }
}

@media (max-width: 480px) {
  .panel-head { padding-left: 12px; }
  .btn-sm .lbl { display: none; }
  .btn-sm { width: 30px; padding: 0; }
  .sb-hide-sm { display: none; }
}

/* ── Late additions: icon swaps and container-aware panel headers ──────── */
.max-btn .i-min { display: none; }
.max-btn[aria-pressed="true"] .i-max { display: none; }
.max-btn[aria-pressed="true"] .i-min { display: block; }
.node.collapsed > .row > .meta-cnt { display: none; }

.panel { container-type: inline-size; }
@container (max-width: 860px) {
  .panel-actions .btn-sm .lbl { display: none; }
  .panel-actions .btn-sm { width: 30px; padding: 0; }
  .panel-actions .btn-sm.class-btn { width: auto; padding: 0 8px; }
  .panel-actions .class-btn .lbl { display: inline-block; }
}
@container (max-width: 500px) {
  .search { flex: 1 1 100%; order: 10; }
}

/* ── Input format toggle, settings text field, query mode ─────────────── */
.seg-sm button { height: 22px; padding: 0 8px; font-size: .72rem; }
.text-input {
  width: 150px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: var(--mono);
  font-size: .82rem;
}
.text-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--panel); }
.search.is-query { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); background: var(--accent-soft); }
.search.is-query input { font-family: var(--mono); font-size: .76rem; }
.search.is-query .search-nav { display: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Tool pages: breadcrumb, intro, code snippet ──────────────────────── */
.crumbs { font-size: .84rem; color: var(--muted); margin-bottom: 16px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: '›'; margin-right: 6px; color: var(--faint); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.intro h2 { font-size: 1.45rem; letter-spacing: -.02em; }
.intro .lead { font-size: 1rem; color: var(--muted); line-height: 1.75; }
.snippet {
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--mono);
  font-size: .8rem;
  line-height: 1.65;
  color: var(--text);
  overflow-x: auto;
  white-space: pre;
}
.content .guide:first-child, .content .crumbs + .guide { margin-top: 0; }

/* ── Tools grid ────────────────────────────────────────────────────────── */
.tools-section { margin-top: 56px; }
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}
.tool-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.tool-link strong { font-size: .9rem; font-weight: 650; }
.tool-link span { font-size: .78rem; color: var(--muted); }
.tool-link:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.tool-link[aria-current="page"] { border-color: var(--accent); background: var(--accent-soft); }
.guide-tight { margin-top: 16px; }

/* Code text: no ligatures (!= must stay !=), 4-column tabs for Go/C output */
.code-input, .output, .snippet, .err-snippet, .card code, kbd { font-variant-ligatures: none; }
.output, .code-input, .snippet { tab-size: 4; }
.card .snippet code { padding: 0; border: 0; background: none; font-size: inherit; color: inherit; }
