:root {
  --border: #bfc4ca;
  --border-dark: #9ea4aa;
  --text: #17212b;
  --muted: #68727f;
  --panel: #ffffff;
  --chrome-top: #f5f5f5;
  --chrome-bottom: #d9d9d9;
  --toolbar-top: #fafafa;
  --toolbar-bottom: #ececec;
  --active: #ffffff;
  --line-bg: #f4f6f8;
  --blue: #1264b0;
  --green: #1d7a43;
  --red: #b12626;
  --orange: #a45d00;
  --purple: #7d3aa8;
  --selection: rgba(18, 100, 176, 0.2);
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  color: var(--text);
  background: #f6f7f9;
}

button,
textarea {
  font: inherit;
}

.json-app {
  display: grid;
  grid-template-rows: 48px 49px minmax(0, 1fr) 38px;
  height: 100vh;
  min-height: 420px;
  background: var(--panel);
  border-top: 1px solid #d8d8d8;
}

.tabs {
  display: flex;
  align-items: end;
  gap: 4px;
  padding: 5px 5px 0;
  background: linear-gradient(var(--chrome-top), var(--chrome-bottom));
  border-bottom: 1px solid var(--border);
}

.tab {
  min-width: 92px;
  height: 41px;
  padding: 0 17px;
  color: #111;
  background: linear-gradient(#fbfbfb, #e7e7e7);
  border: 1px solid var(--border-dark);
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  cursor: pointer;
  font-size: 20px;
}

.tab.is-active {
  position: relative;
  z-index: 1;
  height: 43px;
  background: var(--active);
  font-weight: 700;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 14px;
  overflow-x: auto;
  white-space: nowrap;
  background: linear-gradient(var(--toolbar-top), var(--toolbar-bottom));
  border-bottom: 1px solid #d0d4d8;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.toolbar-group {
  display: flex;
  align-items: center;
  min-height: 24px;
}

.toolbar-group + .toolbar-group {
  margin-left: 14px;
  padding-left: 14px;
  border-left: 2px solid #c5c5c5;
}

.toolbar button {
  min-height: 34px;
  padding: 3px 8px;
  color: #142638;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  font-size: 20px;
}

.toolbar button:hover,
.toolbar button:focus-visible {
  background: #fff;
  border-color: #b9c4d0;
  outline: none;
}

.workspace {
  position: relative;
  min-height: 0;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.workspace.is-dragging::after {
  content: "Drop JSON file to load";
  position: absolute;
  inset: 12px;
  display: grid;
  place-items: center;
  color: var(--blue);
  background: rgba(235, 244, 255, 0.86);
  border: 2px dashed #5b97d2;
  border-radius: 6px;
  font-size: 22px;
  font-weight: 700;
  z-index: 5;
}

.view-panel {
  display: none;
  width: 100%;
  height: 100%;
}

.view-panel.is-active {
  display: flex;
}

.editor-shell {
  min-width: 0;
  min-height: 0;
  background: #fff;
}

.line-numbers {
  flex: 0 0 auto;
  min-width: 44px;
  padding: 8px 8px 8px 4px;
  overflow: hidden;
  color: #8b949e;
  background: var(--line-bg);
  border-right: 1px solid #dfe3e8;
  text-align: right;
  white-space: pre;
  user-select: none;
  font: 20px/1.45 Consolas, "Courier New", monospace;
}

.editor-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.highlight-layer,
#json-editor {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 7px 8px;
  border: 0;
  white-space: pre;
  overflow: auto;
  tab-size: 2;
  font: 20px/1.45 Consolas, "Courier New", monospace;
}

.highlight-layer {
  color: var(--text);
  background: #fff;
  pointer-events: none;
}

#json-editor {
  z-index: 1;
  width: 100%;
  height: 100%;
  resize: none;
  color: transparent;
  caret-color: #111;
  background: transparent;
  outline: none;
}

#json-editor::placeholder {
  color: transparent;
}

#json-editor.is-empty {
  color: #6d7680;
}

#json-editor.is-empty::placeholder {
  color: #6d7680;
}

#json-editor::selection {
  background: var(--selection);
}

.token-key {
  color: var(--blue);
}

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

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

.token-boolean {
  color: var(--purple);
  font-weight: 700;
}

.token-null {
  color: var(--red);
  font-weight: 700;
}

.viewer-panel {
  min-height: 0;
  overflow: auto;
  padding: 10px 12px 24px;
  font: 15px/1.55 Consolas, "Courier New", monospace;
}

.viewer-empty {
  margin: auto;
  max-width: 560px;
  color: var(--muted);
  text-align: center;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
}

.tree {
  display: none;
  width: 100%;
}

.tree.has-content {
  display: block;
}

.tree details {
  margin-left: 18px;
}

.tree > details {
  margin-left: 0;
}

.tree summary {
  cursor: pointer;
  user-select: none;
}

.tree summary::marker {
  color: #5f6b76;
}

.tree-row {
  min-height: 24px;
}

.tree-key {
  color: var(--blue);
  font-weight: 700;
}

.tree-meta {
  color: var(--muted);
  margin-left: 6px;
}

.tree-value {
  margin-left: 6px;
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 10px;
  overflow: hidden;
  color: #5f6872;
  background: linear-gradient(#f7f7f7, #e4e4e4);
  border-top: 1px solid #fff;
  font: 16px/1.2 Consolas, "Courier New", monospace;
}

#status-message {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#status-message.success {
  color: #19713a;
}

#status-message.error {
  color: #b12626;
}

#status-meta {
  flex: 0 0 auto;
}

@media (max-width: 860px) {
  .json-app {
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }

  .tabs {
    min-height: 45px;
  }

  .tab {
    min-width: 80px;
    font-size: 17px;
  }

  .toolbar {
    align-content: start;
    align-items: start;
    flex-wrap: wrap;
    gap: 4px 0;
    padding: 6px 8px;
  }

  .toolbar button {
    min-height: 30px;
    font-size: 15px;
  }

  .toolbar-extra {
    order: 4;
  }

  .line-numbers,
  .highlight-layer,
  #json-editor {
    font-size: 15px;
  }

  .status-bar {
    align-items: start;
    flex-direction: column;
    padding: 6px 8px;
    font-size: 13px;
  }
}
