:root {
  --bg: #edf3fb;
  --surface: #ffffff;
  --surface-soft: #f7faff;
  --text: #122135;
  --muted: #5c6e88;
  --border: #d2deee;
  --primary: #115fcc;
  --primary-dark: #0a4391;
  --accent: #18375f;
  --ok-bg: #edf8ef;
  --ok-text: #23683d;
  --warn-bg: #fff4de;
  --warn-text: #8e5d00;
  --error-bg: #fff1f1;
  --error-text: #912121;
  --app-shell-max: 1220px;
  --rail-divider-color: #dde6f2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 15% 0%, #dceaff 0%, var(--bg) 42%);
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", "Noto Sans", sans-serif;
}

.hero {
  text-align: center;
  padding-block: 2rem 1.15rem;
}

.hero h1 {
  margin: 0;
  font-size: 2rem;
}

.hero p {
  margin: 0.65rem 0 0;
  color: var(--muted);
}

.layout {
  margin: 0 auto 1.5rem;
  display: grid;
  gap: 1rem;
}

@media (min-width: 1100px) {
  .layout {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.2fr);
    align-items: start;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  min-width: 0;
}

.panel h2,
.panel h3 {
  margin: 0;
}

.panel-head {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.panel-head--split {
  justify-content: space-between;
  flex-wrap: wrap;
}

.subtle,
.small-note,
.updated-at,
.guide-card p,
.guide-card li {
  color: var(--muted);
}

.subtle,
.small-note {
  margin: 0.3rem 0 0;
  line-height: 1.5;
}

.badge-row,
.status-strip,
.control-bar,
.action-row,
.export-actions,
.schema-actions,
.toolbar-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.28rem 0.66rem;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid #d4e0f2;
  background: #f4f8ff;
  color: #294a73;
}

.badge-success,
.status-pill--success {
  border-color: #cfe6d5;
  background: var(--ok-bg);
  color: var(--ok-text);
}

.status-pill--warning {
  border-color: #f3d49c;
  background: var(--warn-bg);
  color: var(--warn-text);
}

.status-pill--error {
  border-color: #efc4c4;
  background: var(--error-bg);
  color: var(--error-text);
}

.status-pill--muted {
  border-color: #d4dce9;
  background: #f6f8fc;
  color: #52637d;
}

.input-panel,
.output-panel,
.summary-card,
.detail-card,
.schema-card {
  display: grid;
  gap: 0.85rem;
}

.control-bar {
  margin-top: 0.25rem;
  align-items: end;
}

.field-inline {
  display: grid;
  gap: 0.34rem;
  font-size: 0.9rem;
  font-weight: 700;
}

.field-inline select,
.field-inline input,
textarea,
button {
  font: inherit;
}

select,
textarea {
  border: 1px solid #c1d1e7;
  border-radius: 10px;
  background: #fff;
  color: inherit;
}

select {
  min-width: 180px;
  padding: 0.58rem 0.68rem;
}

textarea {
  width: 100%;
  resize: vertical;
  padding: 0.78rem 0.84rem;
  line-height: 1.55;
}

.input-panel textarea,
.schema-card textarea {
  min-height: 280px;
  font-family: "IBM Plex Mono", "Consolas", "Courier New", monospace;
  font-size: 0.86rem;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 2px solid #9bc3ff;
  outline-offset: 2px;
}

button,
.upload-button {
  border-radius: 10px;
  padding: 0.62rem 0.88rem;
  font-weight: 700;
}

button {
  border: 0;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: var(--primary-dark);
}

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

button.secondary:hover:not(:disabled) {
  background: #112744;
}

button.ghost,
.upload-button {
  border: 1px solid #c0d1e9;
  background: #fff;
  color: #20344f;
}

button.ghost:hover:not(:disabled),
.upload-button:hover {
  background: #f4f8ff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.action-hint {
  min-height: 1.5rem;
}

.action-hint.is-error {
  color: var(--error-text);
}

.action-hint.is-success {
  color: var(--ok-text);
}

.action-hint.is-warning {
  color: var(--warn-text);
}

.summary-card,
.detail-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 0.86rem;
}

.message {
  margin: 0;
  padding: 0.74rem 0.8rem;
  border-radius: 10px;
  border: 1px solid transparent;
  line-height: 1.5;
}

.message.info {
  border-color: #c4d9ff;
  background: #eff5ff;
  color: #214f8f;
}

.message.success {
  border-color: #cde4d3;
  background: var(--ok-bg);
  color: var(--ok-text);
}

.message.warning {
  border-color: #f2d39c;
  background: var(--warn-bg);
  color: var(--warn-text);
}

.message.error {
  border-color: #efc4c4;
  background: var(--error-bg);
  color: var(--error-text);
}

.issue-list,
.log-list,
.schema-issues {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.issue-item,
.log-item,
.schema-issue {
  border: 1px solid #d5e1f1;
  border-radius: 10px;
  background: #fff;
  padding: 0.72rem 0.78rem;
  display: grid;
  gap: 0.28rem;
}

.issue-item__head,
.log-item__head,
.detail-head {
  display: flex;
  gap: 0.55rem;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

.detail-head--stack {
  align-items: stretch;
}

.issue-item__meta,
.log-item__meta,
.schema-issue__meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.result-toolbar {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

.tree-limit-control {
  min-width: 220px;
}

.tree-limit-control span {
  font-size: 0.78rem;
}

.tree-limit-control select {
  min-width: 220px;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.segment {
  border: 1px solid #c1d1e7;
  background: #fff;
  color: #213550;
  padding: 0.48rem 0.72rem;
  border-radius: 999px;
}

.segment.is-active {
  border-color: var(--primary);
  background: #e8f0ff;
  color: #0b4698;
}

.result-view {
  border: 1px solid #d5dfef;
  border-radius: 12px;
  background: #fff;
  min-height: 320px;
  max-height: min(62vh, 760px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.code-block {
  margin: 0;
  min-height: 320px;
  padding: 0.9rem;
  overflow: auto;
  font-family: "IBM Plex Mono", "Consolas", "Courier New", monospace;
  font-size: 0.84rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.tree-root {
  padding: 0.72rem 0.8rem;
  display: grid;
  gap: 0.45rem;
}

.tree-group {
  border-left: 2px solid #e0e8f4;
  padding-left: 0.72rem;
}

.tree-group details {
  padding: 0.28rem 0;
}

.tree-group summary {
  cursor: pointer;
  list-style: none;
}

.tree-group summary::-webkit-details-marker {
  display: none;
}

.tree-key,
.tree-type,
.tree-leaf {
  font-family: "IBM Plex Mono", "Consolas", "Courier New", monospace;
  font-size: 0.83rem;
}

.tree-key {
  color: #0f498d;
}

.tree-type {
  color: var(--muted);
}

.tree-leaf {
  padding: 0.18rem 0;
  overflow-wrap: anywhere;
}

.tree-empty {
  padding: 0.9rem;
  color: var(--muted);
}

.stats-grid {
  display: grid;
  gap: 0.68rem;
  padding: 0.84rem;
}

@media (min-width: 720px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.stat-card {
  border: 1px solid #d7e1ef;
  border-radius: 10px;
  background: #f9fbff;
  padding: 0.75rem;
  display: grid;
  gap: 0.22rem;
}

.stat-card span {
  font-size: 0.8rem;
  color: var(--muted);
}

.stat-card strong {
  font-size: 1.05rem;
}

.detail-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 0.78rem;
}

.detail-panel summary {
  cursor: pointer;
  font-weight: 700;
}

.detail-grid {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.8rem;
}

@media (min-width: 980px) {
  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .schema-card {
    grid-column: 1 / -1;
  }
}

.diff-rows {
  display: grid;
  gap: 0.45rem;
}

.diff-row {
  display: grid;
  gap: 0.45rem;
  border: 1px solid #d6e1f0;
  border-radius: 10px;
  background: #fff;
  padding: 0.62rem;
}

@media (min-width: 760px) {
  .diff-row {
    grid-template-columns: 1fr 1fr;
  }
}

.diff-row--unchanged {
  background: #fafcff;
}

.diff-row--added {
  border-color: #cde4d3;
  background: #f6fcf7;
}

.diff-row--removed {
  border-color: #efc8c8;
  background: #fff7f7;
}

.diff-row--changed {
  border-color: #f0d39f;
  background: #fffaf0;
}

.diff-cell {
  min-height: 1.6rem;
  display: grid;
  gap: 0.22rem;
}

.diff-cell strong {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.diff-cell pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "IBM Plex Mono", "Consolas", "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1.5;
}

.schema-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  color: #24405f;
}

.checkbox-inline input {
  margin: 0;
}

.schema-status {
  min-height: 1.4rem;
}

.schema-status.is-error {
  color: var(--error-text);
}

.schema-status.is-success {
  color: var(--ok-text);
}

.schema-status.is-warning {
  color: var(--warn-text);
}

.schema-issue__meta {
  font-family: "IBM Plex Mono", "Consolas", "Courier New", monospace;
}

.guide-layout {
  margin: 0 auto 1.45rem;
  display: grid;
  gap: 0.8rem;
}

@media (min-width: 900px) {
  .guide-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.guide-card {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 0.86rem;
}

.guide-card h2 {
  margin: 0;
  font-size: 1rem;
}

.guide-card p,
.guide-card ul,
.guide-card ol {
  margin: 0.58rem 0 0;
  line-height: 1.58;
}

.guide-card ul,
.guide-card ol {
  padding-left: 1.15rem;
}

.faq-card details {
  margin-top: 0.48rem;
  border: 1px solid #dbe6f5;
  border-radius: 10px;
  background: #f9fbff;
  padding: 0.5rem 0.62rem;
}

.faq-card summary {
  cursor: pointer;
  font-weight: 700;
}

.tool-footer {
  margin-top: 56px;
  padding-bottom: 28px;
}

.tool-footer__inner {
  text-align: left;
}

.tool-footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 12px;
}

.tool-footer__nav a {
  color: inherit;
  text-decoration: none;
}

.tool-footer__nav a:hover,
.tool-footer__nav a:focus-visible {
  text-decoration: underline;
}

.tool-footer__meta,
.tool-footer__note {
  margin: 0 0 10px;
  line-height: 1.6;
  font-size: 0.95rem;
  color: #4b5563;
}

.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;
}

.hidden {
  display: none !important;
}
