:root {
  color-scheme: light;
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-muted: #eef3f2;
  --text: #17211f;
  --muted: #5f6f6b;
  --border: #cfd9d6;
  --accent: #0d7a66;
  --accent-strong: #07594a;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --ok: #117a3f;
  --ok-bg: #ebf8ef;
  --neutral-bg: #edf2f7;
  --key: #7c3aed;
  --string: #0d7a66;
  --number: #b45309;
  --literal: #1d4ed8;
  --token-match: #fff3b0;
  --token-selected: #ffd166;
  --shadow: 0 18px 50px rgba(23, 33, 31, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(13, 122, 102, 0.09), rgba(244, 247, 245, 0) 280px),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

button,
select {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

button {
  cursor: pointer;
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  padding: 0 16px;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary {
  background: var(--surface);
  color: var(--accent-strong);
}

button.secondary:hover {
  background: var(--surface-muted);
}

select {
  padding: 0 36px 0 12px;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 3.6rem;
  line-height: 0.98;
}

h2 {
  font-size: 1rem;
}

.header-actions,
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.toolbar label {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.editor-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
}

.panel-heading span {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

textarea {
  display: block;
  width: 100%;
  min-height: 520px;
  resize: vertical;
  border: 0;
  outline: 0;
  padding: 16px;
  background: var(--surface);
  color: var(--text);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.94rem;
  line-height: 1.58;
  tab-size: 2;
}

textarea::placeholder {
  color: #8a9794;
}

textarea.has-error {
  background: #fff9f8;
  box-shadow: inset 0 0 0 2px rgba(180, 35, 24, 0.32);
}

.copy-buffer {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.json-preview {
  width: 100%;
  min-height: 520px;
  max-height: 70vh;
  margin: 0;
  overflow: auto;
  padding: 16px;
  background: var(--surface);
  color: var(--text);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.94rem;
  line-height: 1.58;
  tab-size: 2;
  white-space: pre;
}

.json-preview.empty {
  color: #8a9794;
}

.json-token {
  border-radius: 4px;
  cursor: pointer;
  padding: 1px 0;
}

.json-token.key {
  color: var(--key);
  font-weight: 700;
}

.json-token.string {
  color: var(--string);
}

.json-token.number {
  color: var(--number);
}

.json-token.literal {
  color: var(--literal);
  font-weight: 700;
}

.json-token.punctuation {
  color: var(--muted);
}

.json-token.matched {
  background: var(--token-match);
}

.json-token.selected {
  background: var(--token-selected);
  outline: 2px solid rgba(180, 83, 9, 0.24);
}

.status-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: stretch;
  margin-top: 14px;
}

.status,
.summary {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.status {
  min-height: 72px;
  padding: 16px;
  color: var(--muted);
  font-weight: 700;
}

.status.valid {
  border-color: rgba(17, 122, 63, 0.35);
  background: var(--ok-bg);
  color: var(--ok);
}

.status.invalid {
  border-color: rgba(180, 35, 24, 0.35);
  background: var(--danger-bg);
  color: var(--danger);
}

.status.neutral {
  background: var(--neutral-bg);
}

.error-details {
  margin-top: 10px;
  border: 1px solid rgba(180, 35, 24, 0.35);
  border-radius: 8px;
  background: var(--danger-bg);
  box-shadow: var(--shadow);
}

.error-meta {
  padding: 12px 14px 0;
  color: var(--danger);
  font-weight: 800;
}

.error-details pre {
  margin: 0;
  overflow: auto;
  padding: 12px 14px 14px;
  color: var(--text);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre;
}

.error-char {
  border-radius: 3px;
  background: #ffb4ab;
  color: #5c1110;
  font-weight: 800;
  padding: 0 2px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, 1fr));
  margin: 0;
  overflow: hidden;
}

.summary div {
  padding: 12px 16px;
  border-left: 1px solid var(--border);
}

.summary div:first-child {
  border-left: 0;
}

dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

dd {
  margin: 4px 0 0;
  font-weight: 800;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
}

body > .site-footer {
  width: min(1180px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 24px;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Consent bar */
#consent-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--surface);
  border-top: 2px solid var(--border);
  box-shadow: 0 -6px 32px rgba(23, 33, 31, 0.12);
}

.consent-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  max-width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 0;
}

.consent-text {
  flex: 1 1 300px;
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--text);
}

.consent-text a {
  color: var(--accent);
  text-decoration: none;
}

.consent-text a:hover {
  text-decoration: underline;
}

.consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.consent-actions button {
  font-size: 0.84rem;
  min-height: 36px;
  padding: 0 14px;
  white-space: nowrap;
}

.consent-deny {
  color: var(--muted) !important;
  border-color: var(--border) !important;
}

.consent-deny:hover {
  background: var(--surface-muted) !important;
}

@media (max-width: 600px) {
  .consent-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .consent-actions {
    flex-direction: column;
  }

  .consent-actions button {
    width: 100%;
  }
}

.legal-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 16px 64px;
}

.legal-page .back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 32px;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}

.legal-page .back-link:hover {
  text-decoration: underline;
}

.legal-page h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.legal-page .updated {
  margin: 0 0 32px;
  color: var(--muted);
  font-size: 0.88rem;
}

.legal-page h2 {
  font-size: 1.05rem;
  margin: 28px 0 8px;
}

.legal-page p,
.legal-page ul {
  margin: 0 0 16px;
  line-height: 1.7;
  color: var(--text);
  font-size: 0.95rem;
}

.legal-page ul {
  padding-left: 20px;
}

.legal-page li {
  margin-bottom: 6px;
}

@media (max-width: 780px) {
  .app-shell {
    width: min(100% - 24px, 1180px);
    padding: 24px 0;
  }

  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 2.35rem;
  }

  .workspace,
  .status-row {
    grid-template-columns: 1fr;
  }

  textarea,
  .json-preview {
    min-height: 320px;
  }

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

  .summary div,
  .summary div:first-child {
    border-left: 0;
    border-top: 1px solid var(--border);
  }

  .summary div:first-child {
    border-top: 0;
  }
}
