:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #14141f;
  --bg-tertiary: #1e1e2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #00d4ff;
  --accent-secondary: #00ff88;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --radius-md: 12px;
}

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

html, body {
  width: 600px; height: 600px; overflow: hidden;
  background: #000;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 18px;
  line-height: 1.3;
}

#app { width: 100%; height: 100%; position: relative; }

.screen {
  width: 100%; height: 100%; position: absolute; top: 0; left: 0;
  display: flex; flex-direction: column;
}
.screen.hidden { display: none; }

.focusable {
  transition: box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  border: 2px solid transparent; cursor: pointer; outline: none;
}
.focusable:focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 20px var(--focus-glow);
}
.hidden { display: none !important; }

/* ---- top / bottom bars ---- */
.topbar {
  flex: 0 0 auto;
  padding: 18px 20px 14px;
  background: var(--bg-secondary);
  border-bottom: 1px solid #00000080;
}
.title { font-size: 30px; font-weight: 700; letter-spacing: 0.5px; }
.subtitle { font-size: 15px; color: var(--text-secondary); margin-top: 2px; }

.hintbar {
  flex: 0 0 auto;
  display: flex; gap: 22px; align-items: center;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid #00000080;
  font-size: 14px; color: var(--text-secondary);
}
.hint b { color: var(--accent); font-weight: 700; }

.content {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 16px 20px;
}

.section-label {
  font-size: 13px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted); margin: 18px 4px 8px;
}

/* ---- big buttons (home / samples) ---- */
.btn {
  display: flex; flex-direction: column; justify-content: center;
  width: 100%; min-height: 88px;
  padding: 14px 18px 14px 22px;
  margin-bottom: 14px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  text-align: left;
  position: relative;
  color: var(--text-primary);
}
.btn::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px;
  width: 4px; border-radius: 4px; background: var(--accent);
}
.btn-label { font-size: 20px; font-weight: 600; }
.btn-sub { font-size: 14px; color: var(--text-secondary); margin-top: 3px; }
.btn.ghost::before { background: var(--text-muted); }

.recent-item {
  display: flex; flex-direction: column;
  width: 100%; min-height: 64px; justify-content: center;
  padding: 10px 16px; margin-bottom: 10px;
  background: var(--bg-tertiary); border-radius: var(--radius-md);
  text-align: left; color: var(--text-primary);
}
.ri-name { font-size: 17px; font-weight: 600; }
.ri-meta {
  font-size: 13px; color: var(--text-secondary); margin-top: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.recent-clear {
  width: 100%; min-height: 48px; margin-top: 4px;
  background: var(--bg-secondary); border-radius: var(--radius-md);
  color: var(--danger); font-size: 15px; font-weight: 600;
}

/* ---- viewer toolbar ---- */
.viewer-bar { padding: 10px 12px; }
.toolbar { display: flex; gap: 8px; align-items: stretch; }
.tool {
  flex: 1 1 auto; min-height: 44px;
  background: var(--bg-tertiary); border-radius: 10px;
  color: var(--text-primary); font-size: 15px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.tool[data-action="back"] { flex: 0 0 48px; font-size: 26px; line-height: 1; }
.meta {
  margin-top: 8px; font-size: 13px; color: var(--text-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---- tree ---- */
.tree {
  padding: 6px 8px 24px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 16px;
}
.row {
  display: flex; align-items: center;
  min-height: 44px;
  padding: 4px 8px;
  border-radius: 8px;
}
.row:focus { background: #00d4ff14; }
.twist {
  flex: 0 0 18px; width: 18px; text-align: center;
  margin-right: 4px; font-size: 12px;
}
.tw-on { color: var(--accent); }
.tw-off { color: var(--text-muted); }
.rowbody {
  flex: 1 1 auto; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.k { color: var(--accent); }
.colon { color: var(--text-secondary); }
.idx { color: var(--text-muted); }
.rootlabel { color: var(--text-secondary); font-style: italic; }
.brace { color: var(--text-secondary); }
.count {
  color: var(--text-muted); font-size: 13px;
  background: #ffffff10; padding: 1px 7px; border-radius: 10px;
}
.v-str { color: var(--accent-secondary); }
.v-num { color: #7fd1ff; }
.v-bool { color: #ff9f6b; }
.v-null { color: var(--text-muted); }
.tree-note {
  padding: 12px 10px; color: var(--text-muted); font-size: 14px;
}

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%);
  max-width: 520px;
  background: var(--bg-tertiary);
  border: 1px solid #ffffff1a;
  color: var(--text-primary);
  padding: 12px 20px; border-radius: 24px;
  font-size: 15px; font-weight: 600;
  box-shadow: 0 8px 30px #000000aa;
  opacity: 0; transition: opacity 0.2s ease;
  pointer-events: none; z-index: 50;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; }

/* scrollbar (thin, dark) */
.content::-webkit-scrollbar { width: 6px; }
.content::-webkit-scrollbar-thumb { background: #ffffff22; border-radius: 3px; }
