/* ---------- BASE ---------- */
* { box-sizing: border-box; margin: 0; }

:root {
  --ink: #1e2430;
  --muted: #667085;
  --line: #e4e7ec;
  --accent: #4f46e5;
  --mono: ui-monospace, "SF Mono", Consolas, monospace;
}

body {
  min-height: 100vh;
  background: #f6f7fb;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.top { max-width: 1120px; margin: 0 auto; padding: 28px 16px 8px; }
.top h1 { font-size: clamp(24px, 4vw, 34px); letter-spacing: -.5px; }
.top p { color: var(--muted); margin-top: 6px; }

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 16px 32px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.examples { grid-column: 1 / -1; }
.panel { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.panel h2 { margin-bottom: 10px; font-size: 16px; }
.panel h2 small { color: var(--muted); font-size: 12.5px; font-weight: 400; margin-left: 4px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }
/* ---------- END BASE ---------- */

/* ---------- EXAMPLES ---------- */
.example-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  font: 600 13px system-ui, sans-serif;
  cursor: pointer;
}
.chip-btn:hover { border-color: #a5b4fc; }
.chip-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.note { min-height: 46px; margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: #eef2ff; color: #3730a3; font-size: 14.5px; line-height: 1.5; }
.btn {
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  font: 700 13px system-ui, sans-serif;
  cursor: pointer;
}
.btn.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.btn:focus-visible, .chip-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
/* ---------- END EXAMPLES ---------- */

/* ---------- PANELS ---------- */
#code {
  display: block;
  width: 100%;
  padding: 14px;
  border: 0;
  border-radius: 10px;
  background: #111827;
  color: #e5e7eb;
  font: 13.5px/1.6 var(--mono);
  tab-size: 2;
  resize: vertical;
}
#code:focus { outline: 3px solid #a5b4fc; }
.hint { margin-top: 8px; color: var(--muted); font-size: 12.5px; }

.frame { display: block; width: 100%; height: 340px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

.console { min-height: 92px; max-height: 200px; padding: 12px 14px; overflow-y: auto; border-radius: 10px; background: #111827; color: #e5e7eb; font: 13px/1.6 var(--mono); }
.console div { white-space: pre-wrap; overflow-wrap: anywhere; }
.console div::before { content: "> "; color: #6b7280; }
.console .err { color: #fca5a5; }
.console .empty { color: #6b7280; }
.console .empty::before { content: ""; }

.tree { padding: 12px; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: #fcfcfd; font: 13px/1.75 var(--mono); }
.tree ul { padding-left: 18px; border-left: 1px dashed #d0d5dd; list-style: none; }
.tree > ul { padding-left: 0; border: 0; }
.tree span { padding: 1px 4px; border-radius: 4px; white-space: nowrap; }
.tree .tag { color: #3730a3; font-weight: 700; }
.tree .attr { color: #92400e; font-weight: 400; }
.tree .text { color: var(--muted); }
.tree .changed > span { background: #dcfae6; }
/* ---------- END PANELS ---------- */

/* ---------- SMALL SCREENS ---------- */
@media (max-width: 860px) {
  .page { grid-template-columns: minmax(0, 1fr); }
  .note { min-height: 72px; }
}
/* ---------- END SMALL SCREENS ---------- */
