/* 页面基础 - 与项目主题统一 */
:root {
  --bg-start: #0a0e27;
  --bg-end: #1a0f3d;
  --card-bg: rgba(15, 18, 45, 0.85);
  --text: #f0f4ff;
  --muted: rgba(240, 244, 255, 0.72);
  --accent: #4f7fff;
  --accent-2: #a855ff;
  --accent-3: #ff6b6b;
  --success: #4caf50;
  --warning: #ff9800;
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
  --border: rgba(255, 255, 255, 0.1);
  --radius: 16px;
  --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 20% 25%, rgba(79, 127, 255, 0.4), transparent 45%),
    radial-gradient(circle at 80% 35%, rgba(168, 85, 255, 0.35), transparent 50%),
    radial-gradient(circle at 50% 90%, rgba(255, 107, 107, 0.2), transparent 50%),
    linear-gradient(135deg, var(--bg-start), var(--bg-end));
  color: var(--text);
  overflow-x: hidden;
}

.page { min-height: 100vh; width: 100%; display: block; padding: 0; }
.scene { position: relative; width: 100%; min-height: 100vh; padding: 0; }

.glow {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 35% 40%, rgba(79, 127, 255, 0.3), transparent 50%),
    radial-gradient(circle at 65% 25%, rgba(168, 85, 255, 0.25), transparent 50%),
    radial-gradient(circle at 50% 85%, rgba(255, 107, 107, 0.15), transparent 45%);
  filter: blur(28px);
  animation: drift 20s ease-in-out infinite;
  border-radius: 0;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(8px, -14px) scale(1.03); }
}

.card {
  position: relative; width: 100%; min-height: 100vh; padding: 40px;
  border-radius: 0; background: var(--card-bg); box-shadow: none; border: 0;
  backdrop-filter: blur(16px); overflow: hidden; z-index: 1;
}

/* ── Header ── */
.header {
  position: relative; margin-bottom: 32px; text-align: center; min-height: 40px;
}

.back-button {
  position: absolute; top: 0; left: 0;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid rgba(79, 127, 255, 0.45);
  background: linear-gradient(135deg, rgba(79, 127, 255, 0.22), rgba(168, 85, 255, 0.16));
  color: var(--text); text-decoration: none;
  font-size: 0.88rem; font-weight: 600; line-height: 1;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.back-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(79, 127, 255, 0.28);
  border-color: rgba(79, 127, 255, 0.75);
}

.back-icon { font-size: 1rem; }

.title {
  margin: 0; font-size: clamp(2rem, 5vw, 2.5rem); letter-spacing: -0.02em;
  background: linear-gradient(135deg, #4f7fff, #a855ff);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

.subtitle {
  margin: 8px 0 0; font-size: clamp(0.95rem, 2.4vw, 1.1rem); color: var(--muted);
}

.section { margin-bottom: 24px; }

/* ── Prompt Box ── */
.prompt-box {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(79, 127, 255, 0.15), rgba(168, 85, 255, 0.1));
  border: 1px solid rgba(79, 127, 255, 0.3);
  animation: pulse-border 3s ease-in-out infinite;
}

.prompt-icon { font-size: 1.6rem; animation: bounce 2s ease-in-out infinite; }
.prompt-text { margin: 0; font-size: 1rem; font-weight: 500; color: var(--text); }

@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 127, 255, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(79, 127, 255, 0); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ── Toolbar ── */
.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap;
}

.toolbar-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(135deg, rgba(79, 127, 255, 0.18), rgba(168, 85, 255, 0.12));
  color: var(--text); font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, opacity 160ms ease;
  line-height: 1;
}

.toolbar-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, rgba(79, 127, 255, 0.3), rgba(168, 85, 255, 0.22));
}

.toolbar-btn:active { transform: translateY(0); }

.toolbar-btn:disabled {
  opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none;
}

.toolbar-btn.parse-btn { border-color: rgba(79, 127, 255, 0.4); }
.toolbar-btn.minify-btn {
    border-color: rgba(168, 85, 255, 0.4);
}

.toolbar-btn.validate-btn {
    border-color: rgba(76, 175, 80, 0.4);
}
.toolbar-btn.import-btn { border-color: rgba(76, 175, 80, 0.4); }
.toolbar-btn.export-btn {
    border-color: rgba(79, 127, 255, 0.4);
}
.toolbar-btn.copy-btn { border-color: rgba(255, 152, 0, 0.4); }
.toolbar-btn.clear-btn { border-color: rgba(255, 107, 107, 0.4); }

.btn-icon { font-size: 1.1rem; }

/* ── Editor ── */
.editor-container {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}

.editor-pane {
  display: flex; flex-direction: column; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.3); overflow: hidden; min-height: 200px;
}

.pane-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06); flex-shrink: 0;
}

.pane-tabs {
  display: flex; align-items: center; gap: 12px;
}

.pane-title {
  font-size: 0.85rem; font-weight: 600; color: var(--muted); letter-spacing: 0.03em;
}

.view-tab {
  font-size: 0.78rem; padding: 3px 10px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1); background: transparent;
  color: rgba(240, 244, 255, 0.5); cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
  user-select: none;
}

.view-tab:hover {
  background: rgba(79, 127, 255, 0.12);
  color: rgba(240, 244, 255, 0.8);
  border-color: rgba(79, 127, 255, 0.3);
}

.view-tab.active {
  background: rgba(79, 127, 255, 0.2);
  color: var(--text);
  border-color: rgba(79, 127, 255, 0.45);
}

.pane-stats {
  font-size: 0.78rem; color: rgba(240, 244, 255, 0.5);
  font-family: var(--font-mono);
}

.json-editor {
  flex: 1; width: 100%; min-height: 320px; padding: 16px;
  border: none; background: transparent; color: var(--text);
  font-family: var(--font-mono); font-size: 0.88rem; line-height: 1.6;
  resize: vertical; outline: none; tab-size: 2;
}

.json-editor::placeholder { color: rgba(240, 244, 255, 0.3); }

.output-wrapper {
  flex: 1; overflow: auto; min-height: 320px; max-height: 600px;
}

.json-output {
  margin: 0; padding: 16px;
  font-family: var(--font-mono); font-size: 0.88rem; line-height: 1.6;
  word-break: break-word; color: var(--text); tab-size: 2; white-space: pre-wrap;
}

/* ── JSON Tree ── */
.json-tree {
  font-family: var(--font-mono); font-size: 0.88rem; line-height: 1.7;
  color: var(--text); white-space: normal;
}

.json-row { display: block; padding-left: 0; line-height: 1.7; }
.json-entry { display: inline; }
.json-root { display: block; }

.json-toggle {
  display: inline-block; width: 14px; height: 14px; line-height: 14px;
  text-align: center; font-size: 0.65rem; color: #7f848e;
  cursor: default; user-select: none; vertical-align: middle; margin-right: 2px;
}

.json-toggle.collapsible {
  cursor: pointer; color: #9ca3af; transition: color 120ms ease;
}

.json-toggle.collapsible:hover { color: #e5c07b; }

.json-children {
  display: block; padding-left: 20px;
  border-left: 1px solid rgba(229, 192, 123, 0.15);
  margin-left: 6px;
}

.json-bracket { color: #7f848e; }

.json-ellipsis {
  color: #7f848e; font-style: italic; font-size: 0.82rem;
}

.json-key { color: #e5c07b; }
.json-colon { color: #7f848e; margin-right: 2px; }
.json-comma { color: #7f848e; }
.json-entry-footer { padding-left: 0; }

.json-string { color: #98c379; }
.json-number { color: #d19a66; }
.json-boolean { color: #c678dd; }
.json-null { color: #7f848e; font-style: italic; }

.json-type-label {
  display: inline-block; font-size: 0.6rem; font-weight: 500; font-style: normal;
  color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 3px; padding: 0 4px; margin-left: 4px;
  line-height: 1.3; vertical-align: middle; letter-spacing: 0.02em;
}

/* ── Error ── */
.error-box {
  padding: 16px 20px; border-radius: 12px;
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.35);
}

.error-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}

.error-icon { font-size: 1.2rem; }
.error-title { font-weight: 600; color: var(--accent-3); font-size: 0.95rem; }

.error-detail {
  margin: 0; padding: 12px 16px; border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  font-family: var(--font-mono); font-size: 0.85rem; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word; color: #ffab91;
}

/* ── Examples ── */
.examples-container {
  padding: 14px 18px; border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(79, 127, 255, 0.15);
}

.examples-label {
  display: block; font-size: 0.85rem; color: var(--muted);
  font-weight: 500; margin-bottom: 10px;
}

.example-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.example-chip {
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid rgba(79, 127, 255, 0.3);
  background: rgba(79, 127, 255, 0.1);
  color: var(--text); font-size: 0.82rem; cursor: pointer;
  transition: background 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.example-chip:hover {
  background: rgba(79, 127, 255, 0.25);
  border-color: rgba(79, 127, 255, 0.6);
  transform: translateY(-1px);
}

/* ── Privacy ── */
.privacy-section { margin-top: 32px; }

.privacy-note {
  padding: 14px 18px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.82rem; color: var(--muted); text-align: center; margin: 0;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .card { padding: 24px 16px; }
  .editor-container { grid-template-columns: 1fr; }
  .json-editor { min-height: 200px; }
  .output-wrapper { min-height: 200px; max-height: 400px; }
  .toolbar { gap: 8px; }
  .toolbar-btn { padding: 8px 14px; font-size: 0.82rem; }
  .btn-text { display: none; }
}
