.first-screen { align-content: start }
[hidden] { display: none !important; }

:root {
  --paper: #e8e2d4;
  --paper-deep: #ddd4c4;
  --ink: #17211d;
  --muted: #3e5149;
  --top: #101816;
  --top-text: #f6f1e6;
  --line: #d3c8b6;
  --chip: #fffdf8;
  --editor: #121a18;
  --editor-2: #1a2421;
  --editor-line: #2c3b36;
  --editor-text: #e7f2eb;
  --gold: #e2b15a;
  --mint: #8fd0b4;
  --rose: #e7a094;
  --focus: #0f6e62;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.45 "Segoe UI", "PingFang SC", "Hiragino Sans", "Noto Sans CJK SC", "Noto Sans KR", "Malgun Gothic", sans-serif;
}

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

button { cursor: pointer; }

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

.skip {
  position: absolute;
  left: 8px;
  top: -40px;
  background: var(--chip);
  color: var(--ink);
  padding: 6px 8px;
  z-index: 60;
  text-decoration: none;
}

.skip:focus { top: 8px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 48px;
  min-height: 48px;
  max-height: 48px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  background: var(--top);
  color: var(--top-text);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.03em;
  flex: 0 0 auto;
}

.brand svg { display: block; }

.tagline {
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #c9d6cf;
  font-size: 13px;
}

.lang-menu { position: relative; flex: 0 0 auto; }

.lang-menu summary {
  list-style: none;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid #3c4d46;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.lang-menu summary::-webkit-details-marker { display: none; }

.lang-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 168px;
  padding: 6px;
  background: var(--chip);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(16, 24, 22, 0.16);
  z-index: 40;
}

.lang-panel a {
  display: block;
  padding: 7px 8px;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
}

.lang-panel a[aria-current="page"] { background: #efe6d4; }

.lang-panel a:hover { background: #f3ecdf; }

.first-screen {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  height: calc(100vh - 48px);
  padding: 8px 14px 6px;
  gap: 6px;
  min-width: 0;
}

.first-screen > * { min-width: 0; }

.first-screen h1 {
  margin: 0;
  font-size: 20px;
  line-height: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-width: 0;
}

.tabs, .presets, .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.tab, .preset, .tool, .indent-control select, .mini {
  border: 1px solid #d5ccbc;
  background: var(--chip);
  color: var(--ink);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12.5px;
  line-height: 1.2;
  font-weight: 650;
}

.tab[aria-selected="true"], .preset[aria-pressed="true"], .mini[aria-selected="true"] {
  background: var(--top);
  color: var(--top-text);
  border-color: var(--top);
}

.tab:hover, .preset:hover, .tool:hover, .mini:hover { border-color: #1f6f5b; }

.indent-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.indent-control select { padding: 3px 4px; color: var(--ink); }

.statusline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  margin: 0;
  min-width: 0;
}

.badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
}

.badge.ok { background: #dff3e6; color: #145c38; }
.badge.bad { background: #fde4de; color: #8a2a1a; }

#status-detail {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12.5px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

.workbench { height: 100%; min-height: 0; }

.panel {
  display: grid;
  gap: 8px;
  height: 100%;
  min-height: 0;
}

.cols-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.cols-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.05fr); }

.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--editor);
  color: var(--editor-text);
  border: 1px solid var(--editor-line);
  border-radius: 10px;
  overflow: hidden;
}

.pane-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  min-height: 32px;
  padding: 0 8px;
  background: var(--editor-2);
  color: #d5e4dc;
  font-size: 12px;
  flex: 0 0 auto;
}

.pane-bar label { color: #d5e4dc; }

.grow { margin-left: auto; }

textarea, .tree, .diff-view, .code-view {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  margin: 0;
  border: 0;
  background: transparent;
  color: inherit;
  overflow: auto;
}

textarea {
  resize: none;
  padding: 8px 10px;
  font: 12.5px/1.45 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  caret-color: var(--gold);
}

.tree, .diff-view, .code-view {
  padding: 6px 8px 8px;
  font: 12.5px/1.45 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

.code-view { white-space: pre; }

.path-expr, .root-name {
  flex: 1 1 auto;
  min-width: 0;
  height: 22px;
  border: 1px solid #3a4b44;
  background: #101816;
  color: var(--gold);
  border-radius: 4px;
  padding: 0 6px;
  font: 12px/20px ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px 0;
}

.chip {
  border: 1px solid #3a4b44;
  background: #1c2824;
  color: var(--gold);
  border-radius: 999px;
  padding: 2px 8px;
  font: 11.5px/1.4 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

.mini {
  background: #24312d;
  color: #e7f2eb;
  border-color: #3a4b44;
  padding: 3px 7px;
}

.mini[aria-selected="true"] {
  background: var(--gold);
  color: #1c160c;
  border-color: var(--gold);
}

.t-node { margin: 0; }
.t-kids { margin-left: 14px; border-left: 1px solid #2c3b36; }
.t-row { display: flex; align-items: center; gap: 6px; min-height: 22px; min-width: 0; }
.twist, .twist.spacer {
  width: 16px;
  flex: 0 0 16px;
  border: 0;
  background: transparent;
  color: #9fb0a8;
  padding: 0;
}
.t-key { color: #f4f7f5; }
.t-type { border-radius: 999px; padding: 0 6px; font-size: 11px; line-height: 16px; background: #24312d; }
.t-string { color: var(--gold); }
.t-number { color: #9fd0e6; }
.t-boolean { color: var(--mint); }
.t-null { color: #8b9a94; }
.t-array { color: #d7c4f2; }
.t-object { color: #f0b59a; }
.t-count, .t-val { color: #b7c7bf; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.path-btn {
  margin-left: auto;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #8fd0b4;
  font-size: 11px;
  padding: 0 2px;
}
.pane-note { margin: 8px; color: #f0c7bd; }

.diff-summary { margin: 4px 2px 8px; color: #f6f1e6; font-weight: 700; }
.diff-row { margin: 0 0 6px; padding: 6px 8px; border-left: 3px solid transparent; border-radius: 6px; }
.diff-row.added { background: #163228; border-color: #3dbe86; }
.diff-row.removed { background: #3a201c; border-color: #e07a6a; }
.diff-row.changed { background: #3a3018; border-color: #e2b15a; }
.diff-path { margin: 0 0 4px; font-weight: 700; }
.diff-body { margin: 0; white-space: pre-wrap; color: #d5e4dc; }

.footer {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 22px;
  min-height: 22px;
  max-height: 22px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  color: #24312d;
  font-size: 12px;
  line-height: 22px;
}

.footer span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.docs {
  max-width: 920px;
  margin: 0 auto;
  padding: 8px 20px 72px;
}

.docs h2 { font-size: 22px; line-height: 1.3; margin: 28px 0 8px; letter-spacing: -0.02em; }
.docs h3 { font-size: 16px; margin: 0 0 4px; }
.docs p, .docs li { line-height: 1.55; }
.docs p { margin: 0 0 10px; }
.docs ol { margin: 0 0 8px; padding-left: 18px; }

.docs table { width: 100%; border-collapse: collapse; margin: 8px 0 12px; font-size: 14px; }
.docs caption { text-align: left; font-weight: 700; margin-bottom: 6px; }
.docs th, .docs td { border-bottom: 1px solid var(--line); text-align: left; padding: 7px 8px; vertical-align: top; }
.docs code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.92em; }

.faq { margin: 0 0 14px; }
.sponsors {
  margin-top: 28px;
  padding: 16px 16px 8px;
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.disclosure { margin: 0 0 12px; font-size: 15px; line-height: 1.5; color: var(--ink); }
.sponsor-list { list-style: none; margin: 0; padding: 0; }
.sponsor-list li { margin: 0 0 10px; }
.sponsor-list a { color: #0f5e52; font-weight: 700; }

.miss {
  min-height: calc(100vh - 48px);
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 28px 20px;
  max-width: 760px;
}

.miss h1 { margin: 0; font-size: 28px; white-space: nowrap; }
.lang-links { display: flex; flex-wrap: wrap; gap: 8px; }
.lang-links a {
  color: var(--ink);
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
  padding: 6px 10px;
}

@media (max-width: 960px) {
  .first-screen { height: auto; min-height: calc(100vh - 48px); }
  .workbench { min-height: 68vh; }
  .cols-2, .cols-3 { grid-template-columns: minmax(0, 1fr); }
  .pane { min-height: 240px; }
  .first-screen h1, .miss h1 { white-space: normal; }
  .footer { height: auto; max-height: none; white-space: normal; }
}
