:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --ink: #1d1d1f;
  --muted: #86868b;
  --line: rgba(0, 0, 0, 0.08);
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.06);
  --radius: 22px;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.page {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 10px 16px 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto 1fr;
  gap: 10px 16px;
  min-height: 100vh;
  min-height: 100dvh;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  width: fit-content;
  background: #e8e8ed;
  border-radius: 980px;
  margin: 0;
  align-self: center;
}

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  height: 32px;
  padding: 0 14px;
  border-radius: 980px;
  font: 600 13px/1 var(--sans);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  white-space: nowrap;
}

.tab.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.view {
  display: none;
}

.view.is-active {
  display: contents;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 0;
  flex-wrap: wrap;
  align-self: center;
  min-width: 0;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: 0;
  background: #e8e8ed;
  color: var(--ink);
  height: 32px;
  padding: 0 13px;
  border-radius: 980px;
  font: 500 13px/1 var(--sans);
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
  white-space: nowrap;
}

.btn:hover {
  background: #dedee3;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--blue);
  color: #fff;
}

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

.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 0;
  width: 100%;
  grid-column: 1 / -1;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  height: 100%;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 12px 16px 8px;
}

.panel-head h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

textarea,
.tree-wrap {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 10px 10px;
  border-radius: 14px;
  background: #fbfbfc;
  border: 1px solid var(--line);
}

textarea {
  resize: none;
  padding: 14px 16px;
  font: 14px/1.7 var(--mono);
  color: #111;
  outline: none;
}

textarea::placeholder {
  color: #b0b0b5;
}

.tree-wrap {
  padding: 12px 16px 16px;
  overflow: auto;
  font: 13.5px/1.7 var(--mono);
}

.placeholder {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 15px;
  padding: 28px 8px;
}

.error {
  color: #d70015;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  padding: 12px 4px;
}

.node {
  position: relative;
}

.row {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  min-height: 22px;
  border-radius: 4px;
  padding: 0 4px;
}

.row:hover {
  background: rgba(0, 0, 0, 0.04);
}

.toggle {
  width: 14px;
  height: 16px;
  margin-top: 3px;
  border: 0;
  background: transparent;
  color: #5f6368;
  cursor: pointer;
  font-size: 10px;
  line-height: 16px;
  flex: 0 0 14px;
}

.toggle:empty {
  cursor: default;
}

.key {
  color: #881280;
  font-weight: 500;
}

.colon {
  color: #202124;
  margin-right: 6px;
}

.string { color: #1a1aa6; }
.number { color: #1c00cf; }
.boolean { color: #0d904f; }
.null { color: #5f6368; }
.punct { color: #202124; }
.count { color: #80868b; font-size: 12px; margin-left: 6px; }

.children {
  margin-left: 14px;
  padding-left: 0;
}

.children.hidden {
  display: none;
}

.time-workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 0;
  width: 100%;
  grid-column: 1 / -1;
}

.time-card {
  height: 100%;
}

.time-body {
  padding: 8px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.field input {
  height: 48px;
  border: 1px solid var(--line);
  background: #fbfbfc;
  border-radius: 14px;
  padding: 0 16px;
  font: 500 16px/1 var(--sans);
  color: var(--ink);
  outline: none;
}

.field input:focus {
  border-color: rgba(0, 113, 227, 0.45);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.08);
}

.chip-row {
  display: flex;
  gap: 8px;
}

.chip {
  appearance: none;
  border: 0;
  height: 32px;
  padding: 0 14px;
  border-radius: 980px;
  background: #e8e8ed;
  color: var(--ink);
  font: 500 13px/1 var(--sans);
  cursor: pointer;
}

.chip.is-active {
  background: var(--blue);
  color: #fff;
}

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

.result-item {
  background: #fbfbfc;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
}

.result-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.result-item strong {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  word-break: break-all;
}

@media (max-width: 900px) {
  .page {
    padding: 10px 10px 10px;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    gap: 8px;
  }

  .tabs {
    grid-column: 1;
    grid-row: 1;
  }

  .toolbar {
    grid-column: 1;
    grid-row: 2;
  }

  .workspace,
  .time-workspace {
    grid-column: 1;
    grid-row: 3;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
}
