:root {
  --ink: #2a2118;
  --muted: #5e5246;
  --accent: #b8501e;
  --glass: rgb(255 252 247 / 62%);
  --glass-edge: rgb(255 255 255 / 70%);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
  background: #f3e3d0;
}

/* Painted warm backdrop that the glass panels blur. */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 20%, #f7b07a 0, transparent 40%),
    radial-gradient(circle at 85% 15%, #f4d27a 0, transparent 38%),
    radial-gradient(circle at 70% 85%, #e98f7d 0, transparent 42%),
    radial-gradient(circle at 20% 90%, #cfa0d6 0, transparent 38%),
    #f3e3d0;
}

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  border-radius: 20px;
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 10px 30px rgb(80 50 20 / 12%);
}

.top {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 16px 8px;
  text-align: center;
}

.pill {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 28px;
  padding: 6px;
  border: 1px solid var(--glass-edge);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(14px);
}

.pill a {
  padding: 6px 16px;
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
}

.pill a:hover,
.pill a:focus-visible { background: rgb(255 255 255 / 70%); outline: none; }

h1 { margin: 0 0 12px; font-size: clamp(2rem, 6vw, 3.2rem); line-height: 1.1; }
.lead { margin: 0 auto; max-width: 560px; color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
  gap: 20px;
  max-width: 1240px;
  margin: 32px auto;
  padding: 0 16px;
}

.loading-msg { grid-column: 1 / -1; text-align: center; color: var(--muted); }

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  border-radius: 20px;
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 10px 30px rgb(80 50 20 / 12%);
}

.card h2 { margin: 0; font-size: 1.15rem; }
.card .desc { margin: 0; color: var(--muted); font-size: 0.92rem; }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: rgb(42 33 24 / 8%); }

.seg button,
.actions button {
  padding: 5px 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.seg button[aria-pressed="true"] { background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / 15%); }
.actions button { background: var(--ink); color: #fff; }
.seg button:focus-visible,
.actions button:focus-visible { outline: 3px solid #e49a6b; outline-offset: 2px; }

.stage {
  position: relative;
  height: 300px;
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
}

.stage iframe { width: 100%; height: 100%; border: 0; display: block; }

.code {
  height: 300px;
  margin: 0;
  overflow: auto;
  border-radius: 14px;
  background: #1c1815;
  color: #f4e9dc;
  font: 0.78rem/1.5 ui-monospace, "Cascadia Code", Consolas, monospace;
  tab-size: 2;
}

.code code { display: block; padding: 14px; white-space: pre; }
.code:focus-visible { outline: 3px solid #e49a6b; }

.actions { display: flex; gap: 8px; }

.notes {
  max-width: 760px;
  margin: 40px auto 24px;
  padding: 8px 28px 20px;
}

.notes h2 { font-size: 1.2rem; }
.notes li { margin-bottom: 8px; color: var(--muted); }
.notes code { color: var(--ink); }

.foot { padding: 20px 16px 40px; text-align: center; color: var(--muted); font-size: 0.85rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
