:root {
  --bg: #0b1220;
  --bg-elev: #121b2f;
  --bg-card: #162036;
  --line: rgba(148, 163, 184, 0.16);
  --text: #e8eef8;
  --muted: #94a3b8;
  --accent: #3ee0c3;
  --accent-2: #5b8cff;
  --danger: #fb7185;
  --ok: #34d399;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --radius: 16px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(62, 224, 195, 0.12), transparent 50%),
    radial-gradient(900px 400px at 100% 0%, rgba(91, 140, 255, 0.14), transparent 45%),
    var(--bg);
}
a { color: var(--accent); text-decoration: none; }
.app-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: rgba(11, 18, 32, 0.72);
  backdrop-filter: blur(16px);
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 28px; padding: 0 8px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 700; font-size: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06221c;
}
.brand-name { font-weight: 700; letter-spacing: -0.02em; }
.brand-sub { font-size: 12px; color: var(--muted); }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a {
  color: var(--muted); padding: 10px 12px; border-radius: 10px; font-weight: 500;
}
.side-nav a:hover, .side-nav a.is-active {
  background: rgba(62, 224, 195, 0.1); color: var(--text);
}
.nav-label {
  margin: 16px 12px 6px; font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: #64748b;
}
.main-wrap { min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 28px; border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: 20px; font-weight: 650; letter-spacing: -0.03em; }
.pill {
  font-size: 12px; color: var(--muted); border: 1px solid var(--line);
  padding: 6px 10px; border-radius: 999px; background: var(--bg-elev);
}
.page { padding: 28px; max-width: 1280px; }
.lede { color: var(--muted); margin: 0 0 22px; max-width: 62ch; line-height: 1.5; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent), var(--bg-card);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 18px 16px;
}
.card h2, .card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 650; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.04em; margin-top: 6px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); }
.btn {
  border: 0; border-radius: 10px; padding: 9px 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; color: #06221c; background: var(--accent);
}
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.soft { background: rgba(91, 140, 255, 0.18); color: #dbe7ff; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.input, select, textarea {
  background: #0d1526; border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 9px 11px; font-family: inherit; width: 100%;
  margin-bottom: 10px;
  color-scheme: dark;
}
textarea { font-family: var(--mono); font-size: 12px; min-height: 110px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field { margin-bottom: 12px; }
.toast {
  background: rgba(62, 224, 195, 0.12); border: 1px solid rgba(62, 224, 195, 0.3);
  color: var(--text); padding: 12px 14px; border-radius: 12px; margin-bottom: 16px;
}
details.event {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px;
}
details.event summary { cursor: pointer; padding: 12px 14px; font-size: 13px; }
pre {
  font-family: var(--mono); font-size: 12px; background: #080d18; color: #d7e3f4;
  padding: 12px; margin: 0; overflow: auto; border-radius: 0 0 12px 12px;
}
.api-guide { margin-bottom: 16px; padding-top: 8px; }
.api-guide > summary {
  cursor: pointer; list-style: none; padding: 8px 6px 12px;
  font-size: 15px; font-weight: 650;
}
.api-guide > summary::-webkit-details-marker { display: none; }
.api-guide > summary::before {
  content: "▸ "; color: var(--accent); font-weight: 700;
}
.api-guide[open] > summary::before { content: "▾ "; }
.api-guide-body { padding-top: 4px; }
.api-guide pre {
  border-radius: 12px; margin-top: 8px; margin-bottom: 10px; max-height: 280px;
}
.guide-table { font-size: 13px; }
.guide-table code { font-size: 12px; }
.method { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--accent); letter-spacing: 0.04em; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs a {
  color: var(--muted); padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-elev); font-weight: 600; font-size: 13px;
}
.tabs a.is-on {
  background: var(--accent); color: #06221c; border-color: transparent;
}
.icon-btns { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-elev); color: var(--text); cursor: pointer;
  display: grid; place-items: center; padding: 0;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.icon-btn svg { width: 16px; height: 16px; }
dialog.modal {
  border: 1px solid var(--line); border-radius: 16px; padding: 0; width: min(520px, 92vw);
  background: var(--bg-card); color: var(--text); box-shadow: var(--shadow);
}
dialog.modal::backdrop { background: rgba(4, 8, 18, 0.72); }
.modal-inner { padding: 18px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.preview-img { width: 100%; max-width: 640px; border-radius: 16px; margin-top: 12px; border: 1px solid var(--line); display: block; }
.video-frame {
  position: relative; width: 100%; max-width: 280px; padding-top: 0; height: 158px;
  border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #080d18;
}
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-frame.compact { max-width: 210px; height: 118px; margin-top: 8px; }
.side-video { padding: 0 8px 16px; }
.side-video .stat-label { margin-bottom: 6px; }
.split { display: grid; grid-template-columns: 1.2fr 0.9fr; gap: 16px; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .grid-4, .grid-3, .grid-2, .split { grid-template-columns: 1fr; }
  .page { padding: 16px; }
}
