/* Base reset & typography */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 1px 1px, color-mix(in oklab, var(--ink) 7%, transparent) 1px, transparent 0) 0 0 / 22px 22px,
    var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* Smooth cross-document transitions only when reduced motion is not requested */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--a1);
  color: var(--on-a1);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { left: 12px; }

:focus-visible {
  outline: 2px solid var(--a1);
  outline-offset: 2px;
}

/* Scrollbar styling with standard properties + legacy WebKit fallback */
.scroller {
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  scrollbar-width: thin;
}

@supports not (scrollbar-color: auto) {
  .scroller {
    scrollbar-width: auto;
  }
  .scroller::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  .scroller::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 999px;
  }
  .scroller::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
  }
}

/* ---------- Top Navigation Bar ---------- */
.topbar {
  height: 52px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklab, var(--bg2) 86%, transparent);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.brand:hover { color: var(--a1); }

.brand-mark {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 6px;
  display: block;
}

.crumb-sep {
  color: var(--ink3);
  font-family: var(--mono);
  font-size: 0.875rem;
  user-select: none;
}

.crumb-cur {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.local-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: var(--bg);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink2);
  white-space: nowrap;
}
.local-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}

.cmd-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink2);
  font-family: var(--mono);
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}
.cmd-btn:hover {
  border-color: var(--a1);
  color: var(--ink);
}
.cmd-btn kbd {
  font-family: inherit;
  font-size: 0.72rem;
  color: var(--ink3);
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1;
  transition: border-color 0.16s ease, transform 0.25s cubic-bezier(.34,1.56,.64,1);
}
.icon-btn:hover {
  border-color: var(--a1);
  transform: rotate(-16deg) scale(1.06);
}

/* Pure CSS theme icon branching (stays accurate even without JS) */
.theme-toggle .ico-light { display: none; }
.theme-toggle .ico-dark  { display: inline; }

:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-toggle .ico-dark { display: none; }
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-toggle .ico-light { display: inline; }

@media (prefers-color-scheme: dark) {
  :root:has(> head > meta[name="color-scheme"][content="light dark"]) .theme-toggle .ico-dark { display: none; }
  :root:has(> head > meta[name="color-scheme"][content="light dark"]) .theme-toggle .ico-light { display: inline; }
}

.back-blog {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink2);
  text-decoration: none;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.16s ease, background 0.16s ease;
  white-space: nowrap;
}
.back-blog:hover {
  color: var(--a2);
  background: var(--a2soft);
}

/* ---------- Home Page (/) ---------- */
.home-wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 64px 24px 80px;
}

.home-hero {
  margin-bottom: 48px;
}

.home-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--a1);
  margin: 0 0 14px;
}

.home-title {
  margin: 0 0 14px;
  font-family: var(--sans);
  font-weight: 800;
  font-size: clamp(2.125rem, calc(1.2rem + 2.6vw), 3.25rem);
  letter-spacing: -0.035em;
  line-height: 1.06;
  color: var(--ink);
}

.home-sub {
  margin: 0;
  max-width: 52ch;
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.65;
  color: var(--ink2);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--ink);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--lift);
  border-color: var(--a1);
}

.tool-preview {
  height: 156px;
  padding: 18px 20px;
  background: var(--code-bg);
  border-bottom: 1px solid var(--line2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.json-mini {
  width: 100%;
  max-width: 310px;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.62;
  color: var(--ink);
  background: var(--bg2);
  border: 1px solid var(--line2);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.json-mini .ln { display: flex; gap: 10px; white-space: pre; }
.json-mini .n { color: var(--ink3); user-select: none; width: 1.2em; text-align: right; }
.json-mini .k { color: var(--syn-key); }
.json-mini .s { color: var(--syn-str); }
.json-mini .b { color: var(--syn-bool); }
.json-mini .num { color: var(--syn-num); }
.json-mini .p { color: var(--syn-punct); }

.tool-body {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.tool-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.tool-row h2 {
  margin: 0;
  font-family: var(--sans);
  font-weight: 800;
  font-size: 1.1875rem;
  letter-spacing: -0.02em;
}

.tool-tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--bg3);
  color: var(--ink2);
}

.tool-body p {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-size: 0.96875rem;
  line-height: 1.62;
  color: var(--ink2);
}

.tool-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
}

.tool-open {
  font-weight: 600;
  color: var(--a1);
}

.tool-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink3);
}

.tool-slot {
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  color: var(--ink2);
  min-height: 240px;
  background: color-mix(in oklab, var(--bg2) 45%, transparent);
}
.tool-slot-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px dashed var(--line);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--ink3);
  margin-bottom: 4px;
}
.tool-slot strong {
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--ink2);
}
.tool-slot span {
  font-family: var(--serif);
  font-size: 0.9rem;
  color: var(--ink3);
  max-width: 28ch;
}

.home-foot {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 24px 40px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink2);
}
.home-foot .spring { flex: 1; }
.home-foot a { color: var(--ink2); text-decoration: none; }
.home-foot a:hover { color: var(--a1); }

/* ---------- Tool Workbench (/json/) ---------- */
body.workbench-page {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
}

.tb-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tb-sep {
  width: 1px;
  height: 18px;
  background: var(--line);
  margin: 0 2px;
}

.seg {
  display: inline-flex;
  padding: 2px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--line);
}

.seg button {
  border: 0;
  background: transparent;
  color: var(--ink2);
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
  white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] {
  background: var(--bg2);
  color: var(--ink);
  font-weight: 500;
  box-shadow: 0 1px 2px oklch(0 0 0 / 0.1);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.btn:hover:not(:disabled) {
  border-color: var(--a1);
  color: var(--a1);
}
.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}
.btn[aria-pressed="true"] {
  border-color: var(--a1);
  background: var(--a1soft);
  color: var(--a1);
}
.btn.primary {
  background: var(--a1);
  border-color: var(--a1);
  color: var(--on-a1);
}
.btn.primary:hover:not(:disabled) {
  filter: brightness(1.06);
  color: var(--on-a1);
}
.btn.subtle {
  background: transparent;
  border-color: transparent;
  color: var(--ink2);
}
.btn.subtle:hover:not(:disabled) {
  background: var(--bg3);
  border-color: transparent;
  color: var(--ink);
}
.btn.sm {
  height: 26px;
  padding: 0 9px;
  font-size: 0.75rem;
}

/* Split workspace */
.workspace {
  --split: 44%;
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, var(--split)) 7px minmax(300px, 1fr);
}

.pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--code-bg);
  position: relative;
}

.pane-head {
  height: 38px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line2);
  background: var(--bg2);
  flex: 0 0 auto;
}

.pane-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink2);
  white-space: nowrap;
}

.pane-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.char-counter {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink2);
  white-space: nowrap;
}
.char-counter.is-warn { color: var(--warn); }
.char-counter.is-over { color: var(--err); font-weight: 500; }

/* Draggable split handle */
.splitter {
  background: var(--line2);
  cursor: col-resize;
  position: relative;
  transition: background 0.15s ease;
  touch-action: none;
}
.splitter::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 32px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: var(--ink3);
  opacity: 0.45;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.splitter:hover,
.splitter.is-dragging {
  background: var(--a1soft);
}
.splitter:hover::after,
.splitter.is-dragging::after {
  opacity: 1;
  background: var(--a1);
}

/* Banners inside panes */
.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 14px;
  font-size: 0.8125rem;
  border-bottom: 1px solid var(--line2);
  flex: 0 0 auto;
}
.banner[hidden] { display: none; }
.banner.warn {
  background: var(--errsoft);
  color: var(--err);
  border-bottom-color: color-mix(in oklab, var(--err) 28%, transparent);
}
.banner.hint {
  background: var(--a2soft);
  color: var(--ink);
  border-bottom-color: color-mix(in oklab, var(--a2) 30%, transparent);
}
.banner-msg {
  font-family: var(--sans);
  font-size: 0.8125rem;
}

/* Input editor */
.input-wrap {
  flex: 1 1 0;
  min-height: 0;
  position: relative;
  display: flex;
}

.json-input {
  flex: 1 1 0;
  width: 100%;
  height: 100%;
  border: 0;
  resize: none;
  margin: 0;
  padding: 16px 18px;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.84375rem;
  line-height: 1.65;
  tab-size: 2;
  outline: none;
}
.json-input::placeholder {
  color: var(--ink3);
}

.drop-overlay {
  position: absolute;
  inset: 10px;
  border: 2px dashed var(--a1);
  border-radius: var(--radius-md);
  background: color-mix(in oklab, var(--bg2) 92%, transparent);
  display: grid;
  place-items: center;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--a1);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.14s ease;
}
.pane.is-drop .drop-overlay { opacity: 1; }

/* Search box in output header */
.search-box {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 6px 0 9px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--bg);
  min-width: 0;
}
.search-box:focus-within {
  border-color: var(--a1);
}
.search-box input {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.75rem;
  width: 138px;
  outline: none;
  min-width: 0;
}
.search-box input::placeholder { color: var(--ink3); }
.search-count {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink3);
  white-space: nowrap;
}
.search-nav {
  border: 0;
  background: transparent;
  color: var(--ink2);
  width: 20px;
  height: 20px;
  border-radius: 4px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  padding: 0;
}
.search-nav:hover:not(:disabled) { background: var(--bg3); color: var(--ink); }
.search-nav:disabled { opacity: 0.35; cursor: default; }

/* Output viewport */
.output-body {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
  padding: 16px 18px 28px;
  position: relative;
}

.empty-state {
  height: 100%;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  color: var(--ink2);
  padding: 24px;
}
.empty-braces {
  font-family: var(--mono);
  font-size: 1.75rem;
  color: var(--ink3);
  letter-spacing: 0.08em;
}
.empty-state p {
  margin: 0;
  font-family: var(--serif);
  font-size: 1rem;
  max-width: 36ch;
}
.empty-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 6px;
}

/* Error diagnostic card */
.error-card {
  max-width: 680px;
  margin: 12px auto;
  border: 1px solid color-mix(in oklab, var(--err) 35%, var(--line));
  border-radius: var(--radius-md);
  background: var(--bg2);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.error-head {
  padding: 12px 16px;
  background: var(--errsoft);
  border-bottom: 1px solid color-mix(in oklab, var(--err) 22%, transparent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.error-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--err);
}
.error-loc {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink2);
}
.error-msg {
  padding: 12px 16px 0;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--ink);
  word-break: break-word;
}
.error-snippet {
  margin: 12px 16px 16px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  border: 1px solid var(--line2);
  font-family: var(--mono);
  font-size: 0.78125rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
}
.err-line { display: flex; gap: 12px; }
.err-line.is-err { background: var(--errsoft); margin: 0 -12px; padding: 0 12px; }
.err-ln { color: var(--ink3); user-select: none; min-width: 3ch; text-align: right; }
.err-caret { color: var(--err); font-weight: 700; }

/* Tree view */
.json-tree {
  font-family: var(--mono);
  font-size: 0.84375rem;
  line-height: 1.65;
  color: var(--ink);
  padding-left: 16px;
}

.jt-node { position: relative; }

.jt-line {
  display: flex;
  align-items: baseline;
  gap: 0;
  padding: 0 6px;
  border-radius: 5px;
  position: relative;
  min-height: 1.65em;
}
.jt-line:hover {
  background: color-mix(in oklab, var(--ink) 5%, transparent);
}

.jt-toggle {
  border: 0;
  background: transparent;
  color: var(--ink3);
  width: 18px;
  height: 18px;
  margin-left: -18px;
  padding: 0;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  font-size: 0.65rem;
  border-radius: 4px;
  flex: 0 0 auto;
  transition: color 0.12s ease, transform 0.14s ease;
}
.jt-toggle:hover { color: var(--a1); background: var(--a1soft); }
.jt-node.is-collapsed > .jt-line .jt-toggle { transform: rotate(-90deg); }

.jt-children {
  padding-left: 20px;
  margin-left: 7px;
  border-left: 1px solid var(--line2);
}
.jt-node.is-collapsed > .jt-children,
.jt-node.is-collapsed > .jt-close-line {
  display: none;
}

.jt-summary {
  display: none;
  margin: 0 5px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--bg3);
  color: var(--ink2);
  font-size: 0.72rem;
  cursor: pointer;
}
.jt-node.is-collapsed > .jt-line .jt-summary { display: inline-block; }
.jt-collapsed-close { display: none; }
.jt-node.is-collapsed > .jt-line .jt-collapsed-close { display: inline; }

.jt-key   { color: var(--syn-key); }
.jt-str   { color: var(--syn-str); white-space: pre-wrap; overflow-wrap: anywhere; }
.jt-num   { color: var(--syn-num); }
.jt-bool  { color: var(--syn-bool); font-weight: 500; }
.jt-null  { color: var(--syn-null); font-style: italic; }
.jt-punct { color: var(--syn-punct); }

.jt-actions {
  margin-left: auto;
  padding-left: 12px;
  display: inline-flex;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  flex: 0 0 auto;
}
.jt-line:hover .jt-actions,
.jt-line:focus-within .jt-actions {
  opacity: 1;
  pointer-events: auto;
}
.jt-act {
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--ink2);
  font-family: var(--mono);
  font-size: 0.675rem;
  padding: 1px 6px;
  border-radius: 4px;
  cursor: pointer;
}
.jt-act:hover { border-color: var(--a1); color: var(--a1); }

mark.jt-hit {
  background: var(--mark-bg);
  color: var(--ink);
  border-radius: 2px;
  padding: 0 1px;
}
mark.jt-hit.is-current {
  background: var(--mark-cur);
  outline: 1.5px solid var(--a2);
}

/* Raw view */
.raw-view {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  font-family: var(--mono);
  font-size: 0.84375rem;
  line-height: 1.65;
  margin: 0;
}
.raw-gutter {
  padding-right: 14px;
  margin-right: 14px;
  border-right: 1px solid var(--line2);
  text-align: right;
  color: var(--ink3);
  user-select: none;
  font-variant-numeric: tabular-nums;
  white-space: pre;
}
.raw-code {
  margin: 0;
  white-space: pre;
  overflow-x: visible;
}
.raw-view.is-wrap .raw-code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Status bar */
.statusbar {
  height: 30px;
  padding: 0 16px;
  border-top: 1px solid var(--line);
  background: var(--bg2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink2);
  flex: 0 0 auto;
  overflow: hidden;
}
.status-left, .status-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  white-space: nowrap;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink3);
}
.status-pill.is-ok .status-dot { background: var(--ok); }
.status-pill.is-ok { color: var(--ok); }
.status-pill.is-err .status-dot { background: var(--err); }
.status-pill.is-err { color: var(--err); }
.status-pill.is-warn .status-dot { background: var(--warn); }
.status-pill.is-warn { color: var(--warn); }

.path-preview {
  color: var(--a1);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 36vw;
}

/* ---------- Command Palette (<dialog>) ---------- */
.palette {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg2);
  color: var(--ink);
  width: min(460px, calc(100vw - 32px));
  box-shadow: var(--lift);
  overflow: hidden;
  margin-top: min(16vh, 120px);
}
.palette::backdrop {
  background: oklch(0.12 0.01 60 / 0.45);
  backdrop-filter: blur(4px);
}
.palette-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line2);
  display: flex;
  align-items: center;
  gap: 10px;
}
.palette-input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.9375rem;
  outline: none;
}
.palette-input::placeholder { color: var(--ink3); }
.palette-esc {
  font-family: var(--mono);
  font-size: 0.6875rem;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
  color: var(--ink3);
}
.palette-list {
  padding: 6px;
  max-height: 300px;
  overflow-y: auto;
}
.palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.875rem;
}
.palette-item:hover,
.palette-item.is-active {
  background: var(--a1soft);
  color: var(--a1);
}
.palette-item small {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink2);
}
.palette-empty {
  padding: 22px 14px;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink3);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 42px;
  transform: translate(-50%, 10px);
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 0.75rem;
  box-shadow: var(--lift);
  opacity: 0;
  pointer-events: none;
  z-index: 90;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 404 Page ---------- */
.nf-wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 120px 24px 80px;
  text-align: center;
}
.nf-code {
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0.12em;
  color: var(--a1);
  margin-bottom: 10px;
}
.nf-wrap h1 {
  margin: 0 0 12px;
  font-size: 2rem;
  letter-spacing: -0.03em;
}
.nf-wrap p {
  margin: 0 0 24px;
  font-family: var(--serif);
  color: var(--ink2);
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  body.workbench-page {
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(260px, 42vh) minmax(320px, 1fr);
  }
  .splitter { display: none; }
  .pane + .pane { border-top: 1px solid var(--line); }
  .local-pill { display: none; }
  .search-box input { width: 104px; }
  .path-preview { display: none; }
}

@media (max-width: 680px) {
  .home-wrap { padding: 42px 18px 60px; }
  .tools-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .cmd-btn span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
