:root {
  color-scheme: light;
  --bg: oklch(97.2% 0.012 180);
  --bg-wash: oklch(94.8% 0.025 178);
  --surface: oklch(99% 0.006 180);
  --surface-soft: oklch(96.2% 0.012 185);
  --surface-quiet: oklch(93.8% 0.015 188);
  --ink: oklch(22% 0.022 220);
  --ink-strong: oklch(15% 0.024 220);
  --muted: oklch(48% 0.025 220);
  --muted-2: oklch(59% 0.02 220);
  --line: oklch(88.5% 0.016 200);
  --line-strong: oklch(81% 0.024 196);
  --primary: oklch(44% 0.09 184);
  --primary-strong: oklch(35% 0.085 184);
  --primary-soft: oklch(93.5% 0.042 184);
  --danger: oklch(48% 0.14 35);
  --warning: oklch(54% 0.12 78);
  --code-bg: oklch(21% 0.035 220);
  --code-ink: oklch(92% 0.015 190);
  --focus: 0 0 0 3px oklch(75% 0.09 184 / 0.32);
  --shadow-sm: 0 1px 2px oklch(28% 0.03 220 / 0.06);
  --shadow-md: 0 18px 44px oklch(35% 0.035 220 / 0.09);
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 10px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, var(--bg-wash), transparent 310px),
    var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: oklch(98% 0.008 180 / 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  color: var(--ink-strong);
  font-size: 1rem;
  font-weight: 820;
  letter-spacing: 0;
}

.brand small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 680;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  width: 34px;
  height: 34px;
  padding: 6px;
  border: 1px solid oklch(76% 0.07 184);
  border-radius: var(--radius);
  background: var(--primary);
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 0.22);
}

.brand-mark span {
  border-radius: 3px;
  background: oklch(95% 0.026 178);
}

.brand-mark span:nth-child(2),
.brand-mark span:nth-child(3) {
  opacity: 0.72;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 52px) 42px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.tool-nav {
  position: sticky;
  top: 92px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.nav-head {
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface), var(--surface-soft));
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--primary-strong);
  font-size: 0.74rem;
  font-weight: 820;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav-title {
  margin: 0;
  color: var(--ink-strong);
  font-size: 1.05rem;
  line-height: 1.2;
}

.search-field {
  width: 100%;
  min-height: 42px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.tool-list {
  display: grid;
  max-height: calc(100vh - 224px);
  overflow: auto;
  padding: 8px;
}

.tool-link {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  min-height: 62px;
  padding: 10px;
  border-radius: var(--radius);
  color: var(--muted);
}

.tool-link:hover,
.tool-link:focus-visible {
  background: var(--surface-soft);
  outline: 0;
}

.tool-link.active {
  color: var(--ink-strong);
  background: var(--primary-soft);
}

.tool-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: var(--radius);
  color: oklch(98% 0.006 180);
  background: var(--tool-color, var(--primary));
  font-size: 0.78rem;
  font-weight: 860;
}

.tool-name {
  display: block;
  color: inherit;
  font-weight: 780;
  line-height: 1.18;
}

.tool-desc {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.workbench {
  min-width: 0;
}

.tool-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.tool-heading h1 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 2.15rem;
  line-height: 1.06;
  letter-spacing: 0;
}

.tool-heading p:not(.eyebrow) {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.privacy-chip {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid oklch(80% 0.052 184);
  border-radius: 999px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  font-size: 0.84rem;
  font-weight: 780;
  white-space: nowrap;
}

.privacy-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 4px oklch(82% 0.08 184 / 0.28);
}

.tool-mount {
  padding: 0;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.82fr);
  gap: 18px;
  align-items: stretch;
}

.single-grid {
  grid-template-columns: minmax(0, 1fr);
}

.input-panel,
.output-panel,
.mini-panel,
.info-band {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.input-panel,
.output-panel {
  padding: 18px;
}

.mini-panel {
  padding: 14px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  color: var(--ink-strong);
  font-size: 1rem;
  line-height: 1.25;
}

.field-stack {
  display: grid;
  gap: 12px;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 730;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: oklch(98% 0.006 180);
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus,
.btn:focus-visible,
.related-tools a:focus-visible {
  border-color: var(--primary);
  box-shadow: var(--focus);
  outline: 0;
}

textarea {
  min-height: 220px;
  resize: vertical;
  line-height: 1.5;
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--primary);
}

input[type="color"] {
  min-height: 42px;
  padding: 4px;
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
}

.check-row label {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--primary);
  color: oklch(98% 0.006 180);
  font-weight: 820;
  cursor: pointer;
  transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.btn:hover {
  background: var(--primary-strong);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn.secondary {
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: var(--surface);
}

.btn.secondary:hover {
  background: var(--surface-soft);
}

.btn.warning {
  background: var(--danger);
}

.btn.icon {
  width: 42px;
  padding: 0;
}

.result-grid {
  display: grid;
  gap: 10px;
}

.metric {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.metric span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 780;
  text-transform: uppercase;
}

.metric strong,
.metric code {
  overflow-wrap: anywhere;
  color: var(--ink-strong);
  font-size: 1.02rem;
}

pre {
  overflow: auto;
  max-height: 420px;
  margin: 0;
  padding: 14px;
  border: 1px solid oklch(29% 0.035 220);
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-ink);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.status {
  min-height: 24px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.status.ok {
  color: var(--primary-strong);
}

.status.err {
  color: var(--danger);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  background: var(--surface-quiet);
}

canvas.preview {
  width: min(100%, 256px);
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.preview-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.info-band {
  margin-top: 18px;
  padding: 20px;
  box-shadow: none;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 0.9fr;
  gap: 18px;
}

.info-band h2 {
  margin: 0 0 8px;
  color: var(--ink-strong);
  font-size: 1rem;
  line-height: 1.25;
}

.info-band p {
  margin: 0;
  color: var(--muted);
  line-height: 1.58;
}

.info-band ol {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.58;
}

.related-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.related-block > span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 780;
  text-transform: uppercase;
}

.related-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.related-tools a {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 0.86rem;
  font-weight: 720;
}

.related-tools a:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 1080px) {
  .layout,
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .tool-nav {
    position: static;
  }

  .tool-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .site-header,
  .site-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .site-header {
    position: static;
  }

  .header-actions {
    justify-content: flex-start;
    overflow: auto;
  }

  .app-shell {
    padding: 16px 14px 32px;
  }

  .tool-heading {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .tool-heading h1 {
    font-size: 1.62rem;
  }

  .privacy-chip {
    width: max-content;
  }

  .tool-list,
  .field-row {
    grid-template-columns: 1fr;
  }

  .tool-list {
    display: flex;
    overflow-x: auto;
    max-height: none;
    padding-bottom: 10px;
    scroll-snap-type: x proximity;
  }

  .tool-link {
    flex: 0 0 230px;
    min-height: 56px;
    scroll-snap-align: start;
  }

  .input-panel,
  .output-panel,
  .info-band {
    padding: 16px;
  }
}
