*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #0a0c10;
  --surface: rgba(18, 22, 32, 0.72);
  --surface-border: rgba(120, 140, 180, 0.16);
  --text: #e8ecf4;
  --muted: #8b95a8;
  --accent: #5eead4;
  --accent-dim: rgba(94, 234, 212, 0.12);
  --violet: #a78bfa;
  --error: #f87171;
  --ok: #4ade80;
  --radius: 16px;
  --font: "Outfit", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --jd-add-bg: rgba(34, 197, 94, 0.12);
  --jd-add-bd: rgba(34, 197, 94, 0.4);
  --jd-del-bg: rgba(239, 68, 68, 0.12);
  --jd-del-bd: rgba(248, 113, 113, 0.45);
  --jd-mod-bg: rgba(251, 191, 36, 0.1);
  --jd-mod-bd: rgba(251, 191, 36, 0.45);

  --diff-a: #fb7185;
  --diff-b: #34d399;

  --json-caret: #f1f5f9;
  --json-key: #7dd3fc;
  --json-str: #86efac;
  --json-num: #fde68a;
  --json-bool: #f9a8d4;
  --json-null: #cbd5e1;
  --json-punct: #c7d2fe;
  --json-esc: #ddd6fe;
  --json-plain: #e2e8f0;

  /* Native selects / dropdown list contrast (paired with html color-scheme) */
  --control-select-bg: rgba(22, 30, 46, 0.98);
}

html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f1f5f9;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-border: rgba(15, 23, 42, 0.1);
  --text: #0f172a;
  --muted: #475569;
  --accent: #0d9488;
  --accent-dim: rgba(13, 148, 136, 0.12);
  --violet: #7c3aed;
  --error: #dc2626;
  --ok: #15803d;
  --jd-add-bg: rgba(22, 163, 74, 0.08);
  --jd-add-bd: rgba(34, 197, 94, 0.5);
  --jd-del-bg: rgba(220, 38, 38, 0.08);
  --jd-del-bd: rgba(220, 38, 38, 0.4);
  --jd-mod-bg: rgba(234, 179, 8, 0.12);
  --jd-mod-bd: rgba(202, 138, 4, 0.5);
  --diff-a: #e11d48;
  --diff-b: #059669;

  --json-caret: #0f172a;
  --json-key: #0369a1;
  --json-str: #047857;
  --json-num: #b45309;
  --json-bool: #be185d;
  --json-null: #64748b;
  --json-punct: #4338ca;
  --json-esc: #6d28d9;
  --json-plain: #334155;
  --control-select-bg: #ffffff;
}

html[data-theme="light"] body {
  color: var(--text);
  background: var(--bg);
}

html[data-theme="light"] .bg-grid {
  background-image:
    linear-gradient(rgba(13, 148, 136, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13, 148, 136, 0.04) 1px, transparent 1px);
}

html[data-theme="light"] .glow-1 {
  background: radial-gradient(circle, #99f6e4 0%, transparent 70%);
  opacity: 0.42;
}

html[data-theme="light"] .glow-2 {
  background: radial-gradient(circle, #ddd6fe 0%, transparent 70%);
  opacity: 0.35;
}

html[data-theme="light"] .tabs__btn--active {
  color: var(--bg);
  background: linear-gradient(135deg, #14b8a6 0%, #6366f1 110%);
}

html[data-theme="light"] .theme-toggle .theme-toggle__track {
  box-shadow:
    inset 0 2px 4px rgba(15, 23, 42, 0.08),
    0 1px 3px rgba(15, 23, 42, 0.04);
}

.compare-side.mix-warn .compare-field {
  border-color: rgba(234, 179, 8, 0.6) !important;
  box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.12);
}

.compare-verdict__mode {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  opacity: 0.85;
  color: var(--muted);
}

.diff-json-sheet {
  margin-top: 0.85rem;
  padding: 1rem 1.15rem;
  margin-bottom: 0.85rem;
  border-radius: 14px;
}

.diff-json-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.diff-json-head .diff-title {
  margin: 0;
}

.diff-json-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.95rem;
  font-size: 0.68rem;
  color: var(--muted);
}

.diff-json-legend .lg {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font);
}

.diff-json-legend i {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 3px;
  flex-shrink: 0;
}

.lg i {
  display: inline-block;
}

.lg--add i {
  background: var(--jd-add-bg);
  border: 1px solid var(--jd-add-bd);
}

.lg--del i {
  background: var(--jd-del-bg);
  border: 1px solid var(--jd-del-bd);
}

.lg--chg i {
  background: var(--jd-mod-bg);
  border: 1px solid var(--jd-mod-bd);
}

.lg--eq i {
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.28);
}

.jd-scroll {
  max-height: min(640px, 75vh);
  overflow: auto;
  padding: 0.35rem;
  margin: -0.35rem;
  border-radius: 10px;
  scrollbar-width: thin;
}

.jd-root {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.5;
}

.jd-node--eq .jd-pre-same {
  margin: 0;
}

.jd-pre-same {
  margin: 0;
  padding: 0.75rem;
  white-space: pre-wrap;
  word-break: break-all;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(148, 163, 184, 0.06);
  color: var(--muted);
}

.jd-snippet-del,
.jd-snippet-add {
  display: inline-block;
  vertical-align: middle;
}

.jd-snippet-del {
  background: linear-gradient(to bottom, transparent 45%, rgba(248, 113, 113, 0.2) 45%);
}

.jd-snippet-add {
  text-decoration-thickness: 1px;
  background: linear-gradient(to bottom, transparent 45%, rgba(52, 211, 153, 0.25) 45%);
}

.jd-pair-inline {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.5rem 0.65rem;
  align-items: start;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--jd-mod-bd);
  background: var(--jd-mod-bg);
  margin: 0.25rem 0;
}

.jd-pair-inline code {
  font-family: var(--mono);
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.jd-pair-arr {
  font-size: 1.05rem;
  color: var(--accent);
}

.jd-br-open {
  display: inline-block;
  margin-bottom: 0.35rem;
  opacity: 0.75;
  font-family: var(--mono);
}

.jd-meta {
  font-family: var(--font);
}

.jd-meta-soft {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.65rem;
}

.jd-count {
  display: inline-block;
  padding: 0 0.35rem;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.jd-arrow-meta {
  margin-inline: 0.35rem;
  opacity: 0.85;
}

.jd-tree-arr,
.jd-tree-obj {
  padding: 0.75rem;
  margin: 0.35rem 0;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(148, 163, 184, 0.04);
}

.jd-children {
  margin-left: 0.85rem;
  padding-left: 0.85rem;
  border-left: 2px solid rgba(148, 163, 184, 0.2);
}

.jd-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.5rem 0.85rem;
  align-items: start;
  margin: 0.45rem 0;
}

.jd-idx {
  font-size: 0.72rem;
  color: var(--muted);
  min-width: 2.65rem;
  text-align: right;
}

.jd-row-add .jd-row-body {
  border-radius: 10px;
  border: 1px solid var(--jd-add-bd);
  background: linear-gradient(135deg, var(--jd-add-bg), rgba(52, 211, 153, 0.02));
}

.jd-row-del .jd-row-body {
  border-radius: 10px;
  border: 1px solid var(--jd-del-bd);
  background: linear-gradient(315deg, var(--jd-del-bg), rgba(248, 113, 113, 0.04));
}

.jd-only.jd-only-add pre,
.jd-only.jd-only-del pre {
  margin: 0;
  border: none;
  background: transparent;
}

.jd-only.jd-only-add {
  overflow: hidden;
  border-radius: 10px;
}

.jd-only.jd-only-del {
  overflow: hidden;
  border-radius: 10px;
}

.jd-prop {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 0 0.4rem;
  align-items: start;
  margin: 0.45rem 0;
}

.jd-prop-inner {
  grid-column: 1 / -1;
  padding-left: 0.95rem;
  margin-top: 0.4rem;
  border-radius: 8px;
}

.jd-prop-add {
  grid-template-columns: auto auto minmax(0, 1fr);
  padding: 0.4rem;
  margin: 0.35rem 0;
  border-radius: 10px;
  border: 1px solid var(--jd-add-bd);
  background: var(--jd-add-bg);
}

.jd-prop-del {
  grid-template-columns: auto auto minmax(0, 1fr);
  padding: 0.4rem;
  margin: 0.35rem 0;
  border-radius: 10px;
  border: 1px solid var(--jd-del-bd);
  background: var(--jd-del-bg);
}

.jd-prop-mix {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}

.jd-prop-mix .jd-prop-inner {
  flex: 1 1 100%;
  padding-left: 0;
}

.jd-k {
  color: var(--accent);
}

.jd-prop-mix > .jd-k {
  align-self: center;
}

.jd-colon {
  color: var(--muted);
}

.jd-snippet-del code,
.jd-snippet-add code {
  color: inherit;
}

del.jd-snippet,
ins.jd-snippet {
  background: transparent;
}

.jd-br-close {
  display: block;
  margin-top: 0.65rem;
  opacity: 0.75;
  font-family: var(--mono);
}

.jd-prop-block {
  border-left-width: 0;
}

.diff-cell--pulse {
  position: relative;
  border-style: dashed !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 1px rgba(94, 234, 212, 0.15), 0 4px 20px rgba(94, 234, 212, 0.08);
}

.diff-pulse {
  display: inline-block;
  position: absolute;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  top: -0.06rem;
  right: -0.06rem;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(94, 234, 212, 0.7);
}

html[data-theme="light"] .diff-cell--pulse {
  border-color: #0ea5e9 !important;
  box-shadow:
    0 0 0 1px rgba(14, 165, 233, 0.2),
    0 4px 14px rgba(14, 165, 233, 0.12);
}

html[data-theme="light"] .diff-pulse {
  background: #0ea5e9;
  box-shadow: 0 0 8px rgba(14, 165, 233, 0.75);
}

.abbr-diff {
  font-weight: 600;
  font-family: var(--mono);
}

.diff-ab {
  color: var(--diff-a);
}

.diff-ak {
  color: var(--diff-b);
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(94, 234, 212, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(94, 234, 212, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

.glow {
  position: fixed;
  width: min(560px, 90vw);
  height: min(560px, 90vh);
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.glow-1 {
  top: -120px;
  right: -80px;
  background: radial-gradient(circle, #2dd4bf 0%, transparent 70%);
}

.glow-2 {
  bottom: -160px;
  left: -100px;
  background: radial-gradient(circle, #7c3aed 0%, transparent 70%);
  opacity: 0.28;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2.75rem);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}


.head {
  text-align: center;
  margin-bottom: 1.65rem;
  position: relative;
  padding-inline: clamp(2.75rem, 8vw, 4rem);
  padding-block: 0.25rem;
}

.head__theme {
  position: absolute;
  right: clamp(0.25rem, 2vw, 0.75rem);
  top: -0.1rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.theme-toggle {
  width: 3.125rem;
  height: 1.625rem;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.theme-toggle:hover {
  opacity: 0.85;
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 999px;
}

.theme-toggle__track {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
  position: relative;
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.theme-toggle__thumb {
  position: absolute;
  top: 50%;
  transform: translate(0.12rem, -50%);
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: linear-gradient(145deg, #fbbf24 10%, #f59e0b 90%);
  box-shadow:
    0 1px 6px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.44);
  transition:
    transform 0.35s cubic-bezier(0.4, 1.55, 0.5, 1),
    background 0.25s ease;
}

html[data-theme="light"] .theme-toggle__thumb {
  transform: translate(1.5rem, -50%);
  background: linear-gradient(145deg, #38bdf8, #818cf8);
  box-shadow:
    0 1px 8px rgba(37, 99, 235, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

html[data-theme="light"] .theme-toggle__track {
  border-color: rgba(51, 65, 85, 0.2);
}

.theme-follow {
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.35rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition:
    color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.theme-follow:hover {
  color: var(--text);
  border-color: var(--accent);
}

.theme-follow:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-follow.theme-follow--active {
  color: var(--accent);
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow: 0 0 0 1px var(--accent-dim);
}

html[data-theme="light"] .theme-follow.theme-follow--active {
  border-color: rgba(37, 99, 235, 0.35);
}

.title {
  font-size: clamp(1.85rem, 4.5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
  line-height: 1.15;
}

.title .accent {
  color: var(--accent);
  font-weight: 600;
}

.sub {
  margin: 0 auto;
  max-width: 32rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.tabs__btn {
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.6rem 1.35rem;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.tabs__btn:hover {
  color: var(--text);
  border-color: rgba(167, 139, 250, 0.4);
}

.tabs__btn--active {
  color: var(--bg);
  background: linear-gradient(135deg, var(--accent) 0%, #7dd3fc 100%);
  border-color: transparent;
  box-shadow: 0 10px 32px rgba(45, 212, 191, 0.25);
}

.tabs__btn:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
}

.panel-view {
  animation: fv 0.25s ease;
}

.panel-view--hidden {
  display: none;
}

@keyframes fv {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.glass {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.input-hero {
  padding: 1.35rem 1.4rem 1rem;
  margin-bottom: 1.75rem;
}

.input-hero__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.input-hero__label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.input-hero__detected {
  font-size: 0.76rem;
  color: var(--muted);
  max-width: 100%;
}

.detected-strong {
  color: var(--text);
  font-weight: 600;
}

.field--hero {
  min-height: 100px;
  border-radius: 12px;
}

.input-hero__bar {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.65rem;
}

.assume-block {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
  max-width: 48rem;
}

.assume-label {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.assume-label__hint {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
  opacity: 0.9;
}

.assume-help {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--muted);
}

.assume-label select {
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 0.38rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--surface-border);
  background: rgba(6, 8, 12, 0.75);
  color: var(--text);
}

.hint--master {
  margin-top: 0.5rem;
  min-height: 1.35em;
}

.outputs-head {
  margin-bottom: 1rem;
  text-align: center;
}

.outputs-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.outputs-sub {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.output-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.out-card {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--surface-border);
  background: rgba(6, 8, 12, 0.4);
  gap: 0.55rem;
  transition: border-color 0.2s;
}

.out-card:hover {
  border-color: rgba(94, 234, 212, 0.2);
}

.out-card__meta {
  flex-shrink: 0;
}

.out-card__title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.out-card__short {
  margin: 0.2rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.out-card .out-card__field {
  min-height: 4.25rem;
  font-size: 0.8rem;
  line-height: 1.45;
}

.out-card .out-card__hl {
  margin: 0;
  overflow: auto;
  max-height: 22rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.out-card .out-card__hl .json-hl-code {
  display: block;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.5;
}

.crypto-hl-out {
  margin: 0;
  overflow: auto;
  max-height: min(70vh, 32rem);
}

.crypto-hl-out .json-hl-code {
  display: block;
  min-height: 10rem;
}

.json-hl-code .jtk-hexpair {
  color: var(--json-num);
}

.json-hl-code .jtk-uuid-seg {
  color: var(--json-key);
}

.json-hl-code .jtk-pem-hd {
  color: var(--violet);
  font-weight: 600;
}

.json-hl-code .jtk-pem-body {
  color: var(--muted);
}

.btn-copy {
  align-self: flex-start;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  border: 1px solid rgba(167, 139, 250, 0.4);
  background: rgba(167, 139, 250, 0.1);
  color: var(--violet);
  cursor: pointer;
  transition: background 0.2s;
}

.btn-copy:hover {
  background: rgba(167, 139, 250, 0.18);
}

.output-placeholder {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.output-placeholder--err {
  color: var(--error);
}

.compare-intro {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
}

.json-intro {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
}

.crypto-intro {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
  max-width: 48rem;
  margin-left: auto;
  margin-right: auto;
}

.crypto-tools {
  padding: 1.15rem 1.2rem;
  margin-bottom: 1.25rem;
}

.crypto-tools__controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.crypto-tools__row {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

.crypto-tools__row--hidden {
  display: none !important;
}

.crypto-tools__label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.crypto-tools__select {
  font-family: var(--font);
  font-size: 0.875rem;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--surface-border);
  background-color: var(--control-select-bg);
  color: var(--text);
  cursor: pointer;
  width: 100%;
  max-width: 28rem;
}

.crypto-tools__select option,
.crypto-tools__select optgroup {
  background-color: var(--control-select-bg);
  color: var(--text);
}

.assume-label select {
  background-color: var(--control-select-bg);
  color: var(--text);
}

.assume-label select option,
.assume-label select optgroup {
  background-color: var(--control-select-bg);
  color: var(--text);
}

.crypto-tools__input-num {
  max-width: 12rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--surface-border);
  background: rgba(8, 10, 18, 0.25);
  color: var(--text);
}

html[data-theme="light"] .crypto-tools__input-num {
  background: rgba(255, 255, 255, 0.7);
}

.crypto-tools__textarea {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.45;
  width: 100%;
}

.crypto-tools__textarea--key {
  min-height: 120px;
}

.crypto-tools__textarea--out {
  min-height: 220px;
  background: rgba(8, 10, 18, 0.35);
}

html[data-theme="light"] .crypto-tools__textarea--out {
  background: rgba(241, 245, 249, 0.85);
}

.crypto-tools__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.35rem 0 0.65rem;
}

.crypto-hint {
  margin: 0.85rem 0 0;
  font-size: 0.8rem;
  color: var(--error);
  min-height: 1.25em;
}

.json-tools {
  padding: 1.15rem 1.2rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius);
}

.json-tools__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

.json-tools__col {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
}

.json-tools__row {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.json-tools__label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.json-tools__textarea {
  width: 100%;
  min-height: 200px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.45;
}

.json-tools__textarea--out {
  background: rgba(8, 10, 18, 0.35);
}

html[data-theme="light"] .json-tools__textarea--out {
  background: rgba(241, 245, 249, 0.85);
}

/* ----- JSON syntax highlight (lexer overlay + output) ----- */
.json-hl-stack {
  position: relative;
  display: grid;
  isolation: isolate;
}

.json-hl-stack > .json-hl-mirror,
.json-hl-stack > .json-hl-edit {
  grid-area: 1 / 1;
}

.json-hl-mirror.field {
  margin: 0;
  resize: none;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.json-hl-code {
  display: block;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.45;
  min-height: 100%;
}

.json-hl-code .jtk-str--key,
.json-hl-code .jtk-key {
  color: var(--json-key);
}

.json-hl-code .jtk-str {
  color: var(--json-str);
}

.json-hl-code .jtk-num {
  color: var(--json-num);
}

.json-hl-code .jtk-bool {
  color: var(--json-bool);
}

.json-hl-code .jtk-null {
  color: var(--json-null);
}

.json-hl-code .jtk-punct {
  color: var(--json-punct);
}

.json-hl-code .jtk-esc {
  color: var(--json-esc);
}

.json-hl-code .jtk-plain {
  color: var(--json-plain);
}

.json-hl-code .jtk-ws {
  color: inherit;
  opacity: 0.4;
}

.json-hl-code .jtk-str--broken {
  color: var(--json-str);
  opacity: 0.92;
}

.json-hl-edit.field {
  z-index: 1;
  color: transparent !important;
  caret-color: var(--json-caret);
  background: transparent !important;
}

.json-hl-edit.field::selection {
  background: rgba(94, 234, 212, 0.22);
}

html[data-theme="light"] .json-hl-edit.field::selection {
  background: rgba(13, 148, 136, 0.2);
}

.json-hl-output.field {
  margin: 0;
  resize: vertical;
  overflow: auto;
  max-height: 70vh;
}

.json-hl-output .json-hl-code.json-hl-code--scroll {
  min-height: 12rem;
}

.json-tools__newdoc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  align-items: center;
  margin-bottom: 0.65rem;
}

.json-tools__newdoc-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.json-intro code {
  font-family: var(--mono);
  font-size: 0.88em;
  color: var(--accent);
}

.json-tools__actions,
.json-tools__convert {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.json-tools__convert {
  margin-top: 0.15rem;
}

.json-tools__btn {
  font-size: 0.8125rem;
  padding: 0.45rem 0.85rem;
}

.json-tools__select {
  flex: 1;
  min-width: 140px;
  font-family: var(--font);
  font-size: 0.8125rem;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--surface-border);
  background-color: var(--control-select-bg);
  color: var(--text);
  cursor: pointer;
}

.json-tools__select option,
.json-tools__select optgroup {
  background-color: var(--control-select-bg);
  color: var(--text);
}

.json-tools__select:focus-visible {
  outline: 2px solid rgba(94, 234, 212, 0.45);
  outline-offset: 1px;
}

.json-tools__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;
}

.json-tools__out-bar {
  display: flex;
  justify-content: flex-end;
}

.json-validator {
  min-height: 0;
}

.json-validator:empty {
  display: none;
}

/* JSON error / validation cards */
.jev {
  margin-top: 0.35rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
}

.jev--ok {
  border-color: rgba(74, 222, 128, 0.4);
  background: rgba(74, 222, 128, 0.08);
}

.jev-hd {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.45rem;
}

.jev-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--error);
  background: rgba(248, 113, 113, 0.15);
}

.jev-icon-ok {
  color: var(--ok);
  background: rgba(74, 222, 128, 0.15);
}

.jev-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.jev-msg,
.jev-loc {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.jev-loc {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.jev-code {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: rgba(8, 10, 18, 0.55);
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

html[data-theme="light"] .jev-code {
  background: rgba(15, 23, 42, 0.06);
}

.jev-line-num {
  display: inline-block;
  min-width: 2.25rem;
  padding-right: 0.65rem;
  margin-right: 0.65rem;
  text-align: right;
  color: var(--muted);
  user-select: none;
}

.jev-line-body {
  color: var(--text);
}

.jev-line-body--hit {
  background: rgba(248, 113, 113, 0.2);
}

.jev-pointer-row {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.2;
}

.jev-pointer-spacer {
  display: inline-block;
}

.jev-caret {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--error);
  vertical-align: middle;
}

.compare-panels {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  align-items: stretch;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.compare-side {
  padding: 1.15rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.compare-side__hd {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.compare-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
}

.compare-badge--a {
  background: rgba(94, 234, 212, 0.15);
  color: var(--accent);
  border: 1px solid rgba(94, 234, 212, 0.35);
}

.compare-badge--b {
  background: rgba(167, 139, 250, 0.15);
  color: var(--violet);
  border: 1px solid rgba(167, 139, 250, 0.35);
}

.compare-side__tag {
  font-size: 0.72rem;
  color: var(--muted);
}

.compare-field {
  min-height: 140px;
}

.compare-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(120, 140, 180, 0.1) 30%,
    rgba(120, 140, 180, 0.1) 70%,
    transparent 100%
  );
  border-left: 1px solid var(--surface-border);
  border-right: 1px solid var(--surface-border);
}

.compare-vs__icon {
  font-size: 1.35rem;
  color: var(--muted);
}

.compare-verdict {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  border-radius: 14px;
  margin-bottom: 1rem;
}

.compare-verdict[hidden] {
  display: none !important;
}

.compare-verdict--ok {
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.06);
}

.compare-verdict--bad {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.06);
}

.compare-verdict--warn {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.06);
}

.compare-verdict__icon {
  font-size: 1.6rem;
  line-height: 1;
}

.compare-verdict__title {
  margin: 0;
  font-weight: 600;
  font-size: 1rem;
}

.compare-verdict__detail {
  margin: 0.35rem 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.diff-box {
  padding: 1rem 1.15rem;
  border-radius: 14px;
  margin-bottom: 0;
}

.diff-box[hidden] {
  display: none !important;
}

.diff-title {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.diff-hint-muted {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.diff-bytes-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.diff-cell {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.35rem 0.45rem;
  border-radius: 10px;
  border: 1px solid var(--surface-border);
  font-family: var(--mono);
  font-size: 0.75rem;
  background: rgba(6, 8, 12, 0.45);
}

.diff-cell--bad {
  border-color: rgba(248, 113, 113, 0.5);
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.1);
}

.diff-idx {
  font-size: 0.65rem;
  color: var(--muted);
}

.diff-pair {
  font-variant-numeric: tabular-nums;
}

.diff-slash {
  color: var(--muted);
  opacity: 0.6;
}

.panels {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.panel {
  padding: 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

.panel--uuid {
  border-right: 1px solid transparent;
}

.panel--b64 {
  border-left: 1px solid transparent;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.panel-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel--uuid .panel-label {
  color: var(--accent);
}

.panel--b64 .panel-label {
  color: var(--violet);
}

.field {
  flex: 1;
  width: 100%;
  min-height: 120px;
  padding: 0.9rem 1rem;
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text);
  background: rgba(6, 8, 12, 0.55);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field::placeholder {
  color: rgba(139, 149, 168, 0.45);
}

.field:focus {
  outline: none;
  border-color: rgba(94, 234, 212, 0.35);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.panel--b64 .field:focus {
  border-color: rgba(167, 139, 250, 0.4);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.12);
}

/* Light mode: fields must override dark rgba() backgrounds above */
html[data-theme="light"] .field,
html[data-theme="light"] .assume-label select {
  background: #ffffff;
  color: var(--text);
  border-color: rgba(15, 23, 42, 0.14);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

html[data-theme="light"] .field::placeholder {
  color: #64748b;
  opacity: 1;
}

html[data-theme="light"] .assume-label select {
  background:
    linear-gradient(to bottom, #ffffff 0%, #f8fafc 100%);
}

html[data-theme="light"] .field:focus {
  border-color: rgba(13, 148, 136, 0.45);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.16);
}

html[data-theme="light"] .panel--b64 .field:focus {
  border-color: rgba(124, 58, 237, 0.4);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.14);
}

html[data-theme="light"] .compare-field {
  background: #ffffff;
}

html[data-theme="light"] .out-card {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(15, 23, 42, 0.09);
}

html[data-theme="light"] .out-card:hover {
  border-color: rgba(13, 148, 136, 0.3);
}

html[data-theme="light"] .out-card .out-card__field {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.1);
}

html[data-theme="light"] .input-hero.glass,
html[data-theme="light"] .compare-panels.glass {
  box-shadow:
    0 8px 28px rgba(15, 23, 42, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.hint {
  margin: 0.6rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  min-height: 1.2em;
}

.hint.ok {
  color: var(--ok);
}

.hint.err {
  color: var(--error);
}

.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(120, 140, 180, 0.12) 20%,
    rgba(120, 140, 180, 0.12) 80%,
    transparent 100%
  );
  border-left: 1px solid var(--surface-border);
  border-right: 1px solid var(--surface-border);
}

.divider-icon {
  font-size: 1.25rem;
  color: var(--muted);
  opacity: 0.85;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.btn-icon:hover:not(:disabled) {
  color: var(--text);
  border-color: rgba(94, 234, 212, 0.35);
  background: var(--accent-dim);
}

.btn-icon:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.25rem;
}

.btn {
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--surface-border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: rgba(167, 139, 250, 0.35);
  background: rgba(167, 139, 250, 0.06);
}

.status {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 1.5em;
  margin-top: 1rem;
}

.status.flash-ok {
  color: var(--ok);
}

@media (max-width: 760px) {
  .panels {
    grid-template-columns: 1fr;
  }

  .json-tools__grid {
    grid-template-columns: 1fr;
  }

  .compare-panels {
    grid-template-columns: 1fr;
  }

  .compare-vs {
    width: 100%;
    height: 40px;
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--surface-border);
    border-bottom: 1px solid var(--surface-border);
  }

  .compare-vs__icon {
    transform: rotate(90deg);
  }

  .divider {
    width: 100%;
    height: 44px;
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--surface-border);
    border-bottom: 1px solid var(--surface-border);
    background: linear-gradient(
      90deg,
      transparent 0%,
      rgba(120, 140, 180, 0.08) 50%,
      transparent 100%
    );
  }

  .divider-icon {
    transform: rotate(90deg);
  }

  .panel--uuid {
    border-right: none;
  }

  .panel--b64 {
    border-left: none;
  }
}
