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

html, body {
  height: 100%;
  font-family: 'DM Sans', sans-serif;
  background: #fff;
  color: #111;
}

body {
  display: flex;
  flex-direction: column;
}

/* ── Top bar ───────────────────────────────────────── */
.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  height: 52px;
  border-bottom: 1px solid #efefef;
  background: #fff;
  z-index: 10;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: #666;
  text-decoration: none;
  padding: 5px 8px;
  border-radius: 7px;
  transition: background 0.15s, color 0.15s;
}
.back-btn:hover { background: #f4f4f4; color: #111; }

.topbar__sep { color: #ddd; font-size: 16px; user-select: none; }

.topbar__crumb { font-size: 13px; color: #999; }
.topbar__crumb--active { color: #111; font-weight: 500; }

/* ── Top page tabs ─────────────────────────────────── */
.top-tabs {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 16px;
  border-bottom: 1px solid #efefef;
  background: #fff;
}

.top-tab {
  border: 1px solid #e9ebf0;
  background: #f8f9fc;
  color: #5d6675;
  border-radius: 8px;
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.top-tab:hover {
  background: #f1f4fb;
  color: #2f3950;
}

.top-tab--active {
  background: #eef3ff;
  color: #224389;
  border-color: #d5dff7;
}

.view-panel { display: none; }
.view-panel--active { display: block; }

/* ── How it works section ─────────────────────────── */
.how-it-works {
  flex-shrink: 0;
  border-bottom: 1px solid #efefef;
  background: #fcfcfd;
}

.how-it-works__inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 20px 18px;
}

.how-it-works__title {
  font-size: 17px;
  line-height: 1.3;
  font-weight: 600;
  color: #16181d;
  margin-bottom: 8px;
}

.how-it-works__intro {
  font-size: 14px;
  line-height: 1.6;
  color: #525a67;
  margin-bottom: 14px;
}

.how-it-works__step {
  background: #fff;
  border: 1px solid #eceef2;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.how-it-works__step h3 {
  font-size: 14px;
  line-height: 1.35;
  font-weight: 600;
  color: #1f2430;
  margin-bottom: 6px;
}

.how-it-works__step p {
  font-size: 13px;
  line-height: 1.6;
  color: #5e6674;
  margin-bottom: 8px;
}

.how-it-works__code {
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #e6eaf1;
  background: #0f172a;
  color: #d9e3f0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
}

.how-it-works__code code {
  background: transparent;
  border: none;
  padding: 0;
  color: inherit;
}

.how-it-works__step p code {
  background: #eef3ff;
  border: 1px solid #d5dff7;
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #224389;
}

/* Tables inside steps */
.how-it-works__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 10px;
  margin-bottom: 2px;
}

.how-it-works__table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #999;
  padding: 6px 10px;
  border-bottom: 1px solid #eceef2;
}

.how-it-works__table td {
  padding: 7px 10px;
  border-bottom: 1px solid #f4f5f7;
  color: #5e6674;
  line-height: 1.5;
  vertical-align: top;
}

.how-it-works__table td:first-child {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #224389;
  white-space: nowrap;
  font-weight: 500;
}

.how-it-works__table tr:last-child td { border-bottom: none; }

/* Callout box */
.how-it-works__callout {
  background: #f0f4ff;
  border-left: 3px solid #4a7fff;
  border-radius: 0 8px 8px 0;
  padding: 10px 14px;
  font-size: 12.5px;
  color: #3a4a6b;
  line-height: 1.6;
  margin-top: 10px;
}

/* ── Split layout ──────────────────────────────────── */
.split {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

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

/* ── Code panel (left) ─────────────────────────────── */
.code-panel {
  width: 48%;
  min-width: 320px;
  border-right: 1px solid #efefef;
  display: flex;
  flex-direction: column;
  background: #0d1117;
  overflow: hidden;
}

.code-panel__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  height: 44px;
  background: #161b22;
  border-bottom: 1px solid #21262d;
}

.code-panel__tabs {
  display: flex;
  gap: 2px;
}

.code-tab {
  font-size: 12px;
  font-weight: 400;
  padding: 4px 10px;
  border-radius: 5px;
  color: #8b949e;
  cursor: pointer;
  user-select: none;
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.15s, color 0.15s;
}
.code-tab:hover { color: #c9d1d9; }

.code-tab--active {
  background: #21262d;
  color: #e6edf3;
}

.code-block { display: none; }
.code-block--active { display: block; }

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  color: #8b949e;
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.copy-btn:hover { background: #2d333b; color: #e6edf3; border-color: #444c56; }
.copy-btn--copied { color: #3fb950 !important; border-color: #3fb950 !important; }

.code-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
  scrollbar-width: thin;
  scrollbar-color: #30363d transparent;
}
.code-panel__body::-webkit-scrollbar { width: 6px; }
.code-panel__body::-webkit-scrollbar-track { background: transparent; }
.code-panel__body::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }

pre {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.7;
  color: #e6edf3;
  padding: 0 24px;
  white-space: pre;
  tab-size: 2;
}

/* Syntax colours */
.t-tag  { color: #7ee787; }
.t-attr { color: #79c0ff; }
.t-val  { color: #a5d6ff; }
.t-prop { color: #79c0ff; }
.t-num  { color: #f2cc60; }
.t-sel  { color: #7ee787; }
.t-at   { color: #ff7b72; }
.t-cmt  { color: #8b949e; font-style: italic; }
.t-str  { color: #a5d6ff; }
.t-fn   { color: #d2a8ff; }
.t-kw   { color: #ff7b72; }

.ln {
  display: inline-block;
  width: 36px;
  text-align: right;
  margin-right: 16px;
  color: #3d444d;
  user-select: none;
}

/* ── Playground (right) ────────────────────────────── */
.playground {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0a0a0f;
  overflow: hidden;
}

.playground__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 44px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
}

.playground__label {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.playground__palette-name {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.02em;
  font-family: 'DM Sans', sans-serif;
  transition: color 0.2s;
}

.playground__stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #0a0a0f;
}

/* WebGL canvas — fills the stage absolutely */
#shimmer-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  display: block;
}

/* UI overlay — sits on top, pushes controls to bottom */
.shimmer-ui {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
}

/* Bottom controls bar */
.shimmer-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, transparent 100%);
  pointer-events: auto;
}

/* Palette dot row */
.palette-dots {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.palette-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  outline: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  flex-shrink: 0;
  position: relative;
}

.palette-dot:hover {
  transform: scale(1.18);
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.palette-dot--active {
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.2), 0 2px 12px rgba(0,0,0,0.5);
  transform: scale(1.12);
}

/* Preview play button */
#play-btn {
  cursor: pointer;
  border: none;
  outline: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: 100px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(12px);
  color: rgba(255,255,255,0.9);
  font-size: 13px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  letter-spacing: 0.01em;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  white-space: nowrap;
  flex-shrink: 0;
}

#play-btn:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.25);
  transform: translateY(-1px);
}

#play-btn:active {
  transform: scale(0.97);
}

#play-btn.active {
  background: rgba(123,79,255,0.25);
  border-color: rgba(123,79,255,0.5);
}
