/* The Cortex palette, rebuilt in CSS. demo.js renders into it. Sizes are in
   em so one rule (.palette font-size) scales the whole thing to its stage. */

@property --c1 { syntax: "<color>"; inherits: true; initial-value: #7b5cff; }
@property --c2 { syntax: "<color>"; inherits: true; initial-value: #ff5f87; }
@property --c3 { syntax: "<color>"; inherits: true; initial-value: #ffb547; }
@property --c4 { syntax: "<color>"; inherits: true; initial-value: #2a1f7a; }

/* ---------- Stage: the animated wallpaper behind the glass ---------- */

.stage {
  --c1: #7b5cff; --c2: #ff5f87; --c3: #ffb547; --c4: #2a1f7a;
  position: relative;
  container-type: inline-size;
  isolation: isolate;
  overflow: hidden;
  border-radius: var(--radius, 22px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--c4);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.8);
  transition: --c1 1.2s ease, --c2 1.2s ease, --c3 1.2s ease, --c4 1.2s ease;
}
.stage-bg { position: absolute; inset: -20%; z-index: -1; }
.stage-bg span {
  position: absolute;
  width: 70%;
  height: 70%;
  border-radius: 50%;
  mix-blend-mode: normal;
  will-change: transform;
}
.stage-bg span:nth-child(1) { left: -5%; top: -5%; background: radial-gradient(closest-side, var(--c1), transparent); animation: orb-a 14s ease-in-out infinite alternate; }
.stage-bg span:nth-child(2) { right: -10%; top: 0; background: radial-gradient(closest-side, var(--c2), transparent); animation: orb-b 17s ease-in-out infinite alternate; }
.stage-bg span:nth-child(3) { right: 0; bottom: -10%; background: radial-gradient(closest-side, var(--c3), transparent); animation: orb-c 12s ease-in-out infinite alternate; }
.stage-bg span:nth-child(4) { left: 10%; bottom: -15%; width: 60%; background: radial-gradient(closest-side, var(--c1), transparent); opacity: 0.8; animation: orb-d 19s ease-in-out infinite alternate; }
.stage-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.12;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes orb-a { to { transform: translate(18%, 14%) scale(1.15); } }
@keyframes orb-b { to { transform: translate(-16%, 18%) scale(0.9); } }
@keyframes orb-c { to { transform: translate(-20%, -12%) scale(1.2); } }
@keyframes orb-d { to { transform: translate(24%, -10%) scale(1.1); } }

.stage-inner { padding: clamp(14px, 5.5cqw, 52px); }

/* ---------- The glass palette ---------- */

.palette {
  --sel: linear-gradient(90deg, rgba(108, 80, 236, 0.95), rgba(160, 90, 222, 0.92));
  position: relative;
  font-size: clamp(11px, 1.75cqw, 15px);
  line-height: 1.35;
  color: #fff;
  text-align: left;
  border-radius: 1.4em;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.04) 38%, rgba(255, 255, 255, 0.1)),
    rgba(22, 14, 56, 0.34);
  backdrop-filter: blur(28px) saturate(185%);
  -webkit-backdrop-filter: blur(28px) saturate(185%);
  border: 1px solid rgba(255, 255, 255, 0.26);
  box-shadow:
    0 2.5em 5em -1.5em rgba(12, 6, 40, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  overflow: hidden;
  cursor: text;
}

.pal-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.8em;
  height: 3.6em;
  padding: 0 1.3em;
}
.pal-search::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 196, 120, 0.55) 55%, rgba(255, 255, 255, 0.08));
}
.pal-search .ic { width: 1.35em; height: 1.35em; flex: none; color: #ffc27a; stroke-width: 2; }
.pal-query { position: relative; flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; }
.pal-input, .pal-mirror {
  font: inherit;
  font-size: 1.4em;
  letter-spacing: -0.01em;
  color: #fff;
}
.pal-input {
  position: absolute;
  inset: 0;
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  caret-color: #fff;
  opacity: 0;
}
.pal-input::placeholder { color: rgba(255, 255, 255, 0.45); }
.pal-mirror { white-space: pre; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.pal-mirror.is-placeholder { color: rgba(255, 255, 255, 0.5); }
.pal-caret {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-left: 1px;
  vertical-align: -0.18em;
  background: #fff;
  border-radius: 1px;
  animation: caret 1.05s steps(1) infinite;
}
.pal-mirror.is-placeholder .pal-caret { margin: 0 2px 0 0; }
@keyframes caret { 50% { opacity: 0; } }
.palette.is-live .pal-input { opacity: 1; }
.palette.is-live .pal-mirror { display: none; }

.pal-body {
  position: relative;
  display: grid;
  grid-template-columns: 1.12fr 1fr;
  gap: 0.9em;
  height: 24.5em;
  padding: 0.7em;
}
.pal-body.is-grid { grid-template-columns: 1fr; grid-template-rows: 1fr auto; gap: 0; padding: 0; }
.pal-body.preview-only { grid-template-columns: 1fr; }
.pal-body.preview-only .pal-list { display: none; }

/* List */
.pal-list { position: relative; overflow: hidden; }
.pal-sel {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3.6em;
  border-radius: 0.8em;
  background: var(--sel);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 0.5em 1.4em -0.5em rgba(70, 40, 190, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.28s cubic-bezier(.3, .7, .2, 1), height 0.28s, width 0.28s, opacity 0.2s;
  opacity: 0;
}
.pal-sel.is-on { opacity: 1; }
.pal-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.85em;
  height: 3.6em;
  padding: 0 0.9em 0 1em;
  border-radius: 0.8em;
}
.pal-row.is-new { animation: row-in 0.42s cubic-bezier(.2, .8, .2, 1) both; }
.pal-row.is-flash::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.35);
  animation: flash 0.5s ease-out forwards;
}
@keyframes row-in { from { opacity: 0; transform: translateY(0.6em); } to { opacity: 1; transform: none; } }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
.pal-row > .ic, .pal-row > .pal-lead { flex: none; width: 1.55em; height: 1.55em; color: rgba(255, 255, 255, 0.82); }
.pal-lead { display: inline-flex; align-items: center; justify-content: center; font-size: 1em; }
.pal-lead.emoji { font-size: 1.35em; width: 1.2em; height: 1.2em; }
.pal-swatch { width: 1.7em; height: 1.7em; border-radius: 0.35em; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35); }
.pal-thumb {
  position: relative;
  width: 2.2em;
  height: 1.7em;
  border-radius: 0.25em;
  background: #f4f4f6;
  overflow: hidden;
}
.pal-thumb::before { content: ""; position: absolute; left: 18%; top: 22%; width: 64%; height: 10%; background: #c9c9d1; border-radius: 1px; box-shadow: 0 0.35em 0 #dcdce2; }
.pal-thumb::after { content: ""; position: absolute; right: 12%; bottom: 14%; width: 26%; height: 18%; background: #0a84ff; border-radius: 2px; }
.pal-text { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.pal-title { font-size: 1.04em; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-title.mono { font-family: var(--mono); font-size: 0.98em; letter-spacing: 0; }
.pal-sub { display: flex; align-items: center; gap: 0.4em; font-size: 0.8em; color: rgba(255, 255, 255, 0.66); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-app { flex: none; width: 1em; height: 1em; border-radius: 0.24em; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); }
.pal-badge {
  flex: none;
  font-family: var(--mono);
  font-size: 0.76em;
  padding: 0.2em 0.5em;
  border-radius: 0.35em;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.14);
}
.pal-tags { display: inline-flex; gap: 0.35em; }
.pal-kbd { flex: none; width: 2em; text-align: right; font-size: 0.74em; color: rgba(255, 255, 255, 0.5); }
.pal-row.is-sel .pal-sub { color: rgba(255, 255, 255, 0.85); }
.pal-row.is-sel .pal-badge { background: rgba(255, 255, 255, 0.24); color: #fff; }
.pal-row.is-sel .pal-kbd { color: rgba(255, 255, 255, 0.75); }
.pal-row.is-dim .pal-title, .pal-row.is-dim .pal-sub, .pal-row.is-dim > .ic { opacity: 0.5; }
.pal-row.is-done .pal-title { text-decoration: line-through; opacity: 0.6; }
.pal-row.is-leaving { animation: row-out 0.45s ease forwards; }
@keyframes row-out { to { opacity: 0; transform: translateX(1.5em); } }
.pal-empty { padding: 1.4em 1em; color: rgba(255, 255, 255, 0.6); font-size: 0.95em; }

/* Grid (emoji, symbols) */
.pal-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--cols, 14), 1fr);
  align-content: start;
  gap: 0.25em;
  padding: 0.8em 1.4em;
  overflow: hidden;
}
.pal-grid .pal-sel { right: auto; width: 3.4em; height: 3.4em; border-radius: 0.75em; }
.pal-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 3.4em;
  font-size: 1em;
}
.pal-cell .emoji { font-size: 1.9em; line-height: 1; }
.pal-cell .ic { width: 1.9em; height: 1.9em; color: #fff; stroke-width: 1.5; }
.pal-cell.is-new { animation: cell-in 0.35s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes cell-in { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
.pal-detail {
  display: flex;
  align-items: center;
  gap: 1em;
  height: 5.6em;
  padding: 0 1.8em;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}
.pal-detail .big { font-size: 2.6em; line-height: 1; }
.pal-detail .ic { width: 2.6em; height: 2.6em; stroke-width: 1.4; }
.pal-detail strong { display: block; font-size: 1.05em; }
.pal-detail small { display: block; font-size: 0.8em; color: rgba(255, 255, 255, 0.65); font-family: var(--mono); }
.pal-detail .aside { margin-left: auto; display: flex; align-items: center; gap: 0.5em; font-size: 0.82em; color: rgba(255, 255, 255, 0.7); }
.pal-detail .aside .emoji { font-size: 1.6em; }
.pal-tones { display: flex; gap: 0.2em; margin-left: auto; padding: 0.25em; border-radius: 0.8em; background: rgba(255, 255, 255, 0.12); animation: row-in 0.3s both; }
.pal-tones span { display: inline-flex; width: 2.2em; height: 2.2em; align-items: center; justify-content: center; font-size: 1.45em; border-radius: 0.5em; transition: background 0.2s; }
.pal-tones span.is-on { background: var(--sel); }

/* Preview pane */
.pal-preview {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 1em;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.pv { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.pv.is-in { animation: pv-in 0.32s ease both; }
@keyframes pv-in { from { opacity: 0; transform: translateY(0.3em); } to { opacity: 1; transform: none; } }
.pv-head { padding: 1.05em 1.3em 0.9em; border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
.pv-head h4 { margin: 0; font-size: 1.08em; font-weight: 650; display: flex; align-items: center; gap: 0.5em; }
.pv .ic { width: 1.2em; height: 1.2em; flex: none; }
.pv-head h4 .ic { width: 1.3em; height: 1.3em; }
.pv-head p { margin-top: 0.3em; font-size: 0.8em; color: rgba(255, 255, 255, 0.65); }
.pv-label { font-size: 0.72em; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(255, 255, 255, 0.6); }
.pv-body { flex: 1; min-height: 0; padding: 1em 1.3em; overflow: hidden; font-size: 0.98em; }
.pv-foot { padding: 0.8em 1.3em; border-top: 1px solid rgba(255, 255, 255, 0.12); font-size: 0.78em; color: rgba(255, 255, 255, 0.62); display: flex; justify-content: space-between; gap: 1em; }
.pv-foot code, .pv code { font-family: var(--mono); font-size: 0.92em; padding: 0.1em 0.35em; border-radius: 0.3em; background: rgba(0, 0, 0, 0.22); border: 0; white-space: nowrap; }
.pv pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.92em;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: rgba(255, 255, 255, 0.95);
}
.pv pre.block { margin: 0.7em 0; padding: 0.7em 0.85em; border-radius: 0.6em; background: rgba(0, 0, 0, 0.25); white-space: pre; }
.pv p + p { margin-top: 0.6em; }
.pv .md p { font-size: 0.95em; color: rgba(255, 255, 255, 0.9); }
.pv .md strong { color: #fff; }
.pv .k { color: #d7c4ff; }
.pv .s { color: #ffd59a; }
.pv .n { color: #9ff0d0; }
.pv .ph {
  display: inline-block;
  padding: 0 0.35em;
  border-radius: 0.3em;
  background: rgba(255, 200, 120, 0.25);
  color: #ffe2b8;
  transition: background 0.4s;
}
.pv .ph.is-resolved { background: rgba(140, 255, 200, 0.22); color: #c9ffe6; animation: pop 0.4s ease; }
@keyframes pop { 50% { transform: scale(1.12); } }
.pv .strip { text-decoration: line-through; color: #ff9fb3; transition: opacity 0.5s, max-width 0.6s; display: inline-block; max-width: 30em; overflow: hidden; vertical-align: bottom; white-space: nowrap; }
.pv .strip.is-gone { opacity: 0; max-width: 0; }
.pv .big-result { font-size: 2.3em; font-weight: 650; letter-spacing: -0.02em; margin-top: 0.15em; word-break: break-all; }
.pv .muted { color: rgba(255, 255, 255, 0.62); font-size: 0.9em; }
.pv .swatch-lg { height: 5.5em; border-radius: 0.6em; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3); margin-bottom: 1em; }
.pv dl { display: grid; grid-template-columns: auto 1fr; gap: 0.35em 1em; margin: 0; font-size: 0.88em; }
.pv dt { color: rgba(255, 255, 255, 0.55); }
.pv dd { margin: 0; font-family: var(--mono); }
.pv .check { display: flex; align-items: center; gap: 0.6em; margin: 0.45em 0; }
.pv .box { width: 1em; height: 1em; border-radius: 0.22em; border: 1.5px solid rgba(255, 255, 255, 0.7); display: inline-flex; align-items: center; justify-content: center; font-size: 0.85em; transition: background 0.25s; }
.pv .check.is-done .box { background: rgba(255, 255, 255, 0.85); color: #3a2a80; }
.pv .check.is-done span:last-child { text-decoration: line-through; opacity: 0.6; }
.pv .bar { height: 0.55em; border-radius: 1em; background: rgba(255, 255, 255, 0.15); overflow: hidden; margin: 0.35em 0 0.9em; }
.pv .bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #9ff0d0, #ffd59a); animation: grow 0.9s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes grow { from { width: 0 !important; } }
.pv table { width: 100%; border-collapse: collapse; font-size: 0.88em; }
.pv th { text-align: left; font-weight: 500; color: rgba(255, 255, 255, 0.55); padding-bottom: 0.4em; }
.pv td { padding: 0.35em 0; font-family: var(--mono); border-top: 1px solid rgba(255, 255, 255, 0.1); }
.pv tr.is-killed td { text-decoration: line-through; opacity: 0.5; }
.pv .ok { display: inline-flex; align-items: center; gap: 0.4em; margin-top: 0.9em; color: #9ff0d0; font-weight: 600; animation: pv-in 0.3s both; }
.pv .qr { display: grid; grid-template-columns: repeat(21, 1fr); width: 9.5em; aspect-ratio: 1; padding: 0.6em; background: #fff; border-radius: 0.5em; margin-top: 0.4em; }
.pv .qr i { background: #1b1240; }
.pv .qr b { background: transparent; }
.pv .dialog { width: 78%; margin: 0.2em auto 0.9em; padding: 0.9em; border-radius: 0.7em; background: #f5f5f7; color: #1d1d1f; font-size: 0.78em; box-shadow: 0 0.6em 1.4em rgba(0, 0, 0, 0.25); }
.pv .dialog b { display: block; margin-bottom: 0.2em; }
.pv .dialog .btns { display: flex; justify-content: flex-end; gap: 0.4em; margin-top: 0.7em; }
.pv .dialog .btns span { padding: 0.15em 0.9em; border-radius: 0.35em; background: #e1e1e6; }
.pv .dialog .btns span:last-child { background: #0a84ff; color: #fff; }
.pv mark { background: rgba(255, 210, 110, 0.55); color: #fff; border-radius: 0.2em; padding: 0 0.1em; }
.pv .chips { display: flex; flex-wrap: wrap; gap: 0.4em; margin-top: 0.6em; }
.pv .chip { font-size: 0.8em; padding: 0.15em 0.55em; border-radius: 1em; background: rgba(255, 255, 255, 0.16); }
.pv .stream span { animation: pv-in 0.25s both; }

/* Footer hints */
.pal-footer {
  display: flex;
  align-items: center;
  gap: 1.3em;
  height: 2.9em;
  padding: 0 1.3em;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  white-space: nowrap;
  overflow: hidden;
}
.pal-hint { display: inline-flex; align-items: center; gap: 0.5em; font-size: 0.8em; color: rgba(255, 255, 255, 0.72); }
.pal-hint kbd, .pal-keys kbd {
  height: auto;
  min-width: 0;
  padding: 0.15em 0.45em;
  font-family: var(--font);
  font-size: 0.9em;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0.35em;
  vertical-align: baseline;
}

/* Toast, keystrokes and the try-it badge */
.pal-toast {
  position: absolute;
  left: 50%;
  bottom: 4em;
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  max-width: 85%;
  padding: 0.65em 1.1em;
  font-size: 0.92em;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 999px;
  background: rgba(16, 10, 40, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 1em 2em -0.8em rgba(0, 0, 0, 0.6);
  transform: translate(-50%, 1em) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.35s cubic-bezier(.2, .9, .3, 1.2);
  z-index: 5;
}
.pal-toast.is-on { opacity: 1; transform: translate(-50%, 0) scale(1); }
.pal-toast .ic { width: 1.2em; height: 1.2em; color: #8ff0c4; flex: none; stroke-width: 2.2; }

.pal-keys {
  position: absolute;
  right: 1em;
  top: 0.75em;
  display: flex;
  gap: 0.3em;
  font-size: 1.15em;
  z-index: 6;
  pointer-events: none;
}
.pal-keys kbd {
  min-width: 1.9em;
  padding: 0.3em 0.55em;
  text-align: center;
  background: rgba(20, 12, 50, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-color: rgba(255, 255, 255, 0.3);
  border-bottom-width: 2px;
  box-shadow: 0 0.6em 1.2em -0.5em rgba(0, 0, 0, 0.6);
  animation: key-pop 0.9s ease forwards;
}
@keyframes key-pop {
  0% { opacity: 0; transform: translateY(0.4em) scale(0.85); }
  15% { opacity: 1; transform: none; }
  25% { transform: translateY(0.12em); border-bottom-width: 1px; }
  40% { transform: none; border-bottom-width: 2px; }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-0.3em); }
}

.try-badge {
  position: absolute;
  top: clamp(8px, 1.6cqw, 16px);
  right: clamp(10px, 2cqw, 20px);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(20, 12, 50, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  font-family: inherit;
}
.try-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: #8ff0c4; box-shadow: 0 0 0 0 rgba(143, 240, 196, 0.7); animation: ping 1.8s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 7px rgba(143, 240, 196, 0); } 100% { box-shadow: 0 0 0 0 rgba(143, 240, 196, 0); } }

/* Narrow stages (phones, small cards): no preview pane, fewer hints. */
@container (max-width: 600px) {
  .palette { font-size: 12px; }
  .pal-body { grid-template-columns: 1fr; height: 22em; }
  .pal-body:not(.is-grid):not(.preview-only) .pal-preview { display: none; }
  .pal-grid { --cols: 8; }
  .pal-hint:nth-child(n + 3) { display: none; }
  .pal-grid { padding: 0.6em 0.8em; }
  .pal-detail { padding: 0 1em; }
  .try-badge { font-size: 11.5px; padding: 5px 10px; }
  [data-stage] > .stage-inner { padding-top: 46px; }
}

/* ---------- Mini demos in the extras cards ---------- */

.card-stage { flex: 1; display: flex; flex-direction: column; justify-content: center; margin: 0 20px 20px; border-radius: 16px; }
.card-stage .stage-inner { padding: clamp(14px, 6cqw, 30px); }
.card-stage .palette { font-size: clamp(10px, 2.4cqw, 13px); }
.card-stage .pal-body { height: 17em; }

.mini-recog .pal-preview .pv-body { font-size: 0.92em; }
.mini-ai .pal-body, .mini-color .pal-body { height: 15em; }
.pv .loupe-row { display: flex; gap: 0.5em; margin-bottom: 0.9em; }
.pv .loupe-row span { flex: 1; height: 2.2em; border-radius: 0.45em; position: relative; transition: transform 0.3s; }
.pv .loupe-row span.is-picked { transform: translateY(-0.25em); box-shadow: 0 0 0 2px #fff, 0 0.6em 1.2em -0.3em rgba(0, 0, 0, 0.5); }

.sync-scene { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.6em; font-size: clamp(10px, 2.6cqw, 13px); color: #fff; }
.sync-mac { padding: 0.8em; border-radius: 1em; }
.sync-mac h5 { margin: 0 0 0.6em; font-size: 0.85em; font-weight: 650; display: flex; align-items: center; gap: 0.4em; }
.sync-mac h5 .ic { width: 1.2em; height: 1.2em; }
.sync-mac ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35em; min-height: 8.5em; }
.sync-mac li { font-size: 0.78em; padding: 0.45em 0.6em; border-radius: 0.5em; background: rgba(255, 255, 255, 0.12); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-mac li.is-new { animation: row-in 0.45s both; background: rgba(160, 120, 255, 0.55); }
.sync-mid { position: relative; width: 3.4em; display: flex; flex-direction: column; align-items: center; gap: 0.3em; }
.sync-server { width: 2.6em; height: 2.6em; border-radius: 0.7em; display: flex; align-items: center; justify-content: center; }
.sync-server .ic { width: 1.4em; height: 1.4em; }
.sync-mid small { font-size: 0.65em; opacity: 0.75; text-align: center; }
.sync-packet { position: absolute; top: 0.55em; left: -40%; width: 1.5em; height: 1.5em; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: #ffd59a; color: #3a2470; opacity: 0; }
.sync-packet .ic { width: 0.95em; height: 0.95em; stroke-width: 2.2; }
.sync-packet.is-go { animation: packet 1.6s ease-in-out forwards; }
@keyframes packet { 0% { left: -60%; opacity: 0; } 15% { opacity: 1; } 45%, 55% { left: 0.95em; } 85% { opacity: 1; } 100% { left: 140%; opacity: 0; } }

.scroll-scene { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8em; font-size: clamp(10px, 2.6cqw, 13px); color: #fff; }
.scroll-dev { padding: 0.8em; border-radius: 1em; display: flex; flex-direction: column; gap: 0.6em; }
.scroll-dev header { display: flex; align-items: center; justify-content: space-between; font-size: 0.85em; font-weight: 650; }
.scroll-dev header .ic { width: 1.3em; height: 1.3em; }
.scroll-doc { position: relative; height: 7.5em; border-radius: 0.6em; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.scroll-doc .lines { position: absolute; left: 0.7em; right: 0.7em; top: 0.6em; display: flex; flex-direction: column; gap: 0.45em; animation: doc-up 3.2s ease-in-out infinite alternate; }
.scroll-dev.is-mouse .scroll-doc .lines { animation-name: doc-down; }
.scroll-doc .lines i { display: block; height: 0.5em; border-radius: 1em; background: rgba(255, 255, 255, 0.45); }
.scroll-doc .lines i:nth-child(3n) { width: 60%; }
.scroll-doc .lines i:nth-child(4n + 1) { width: 85%; background: rgba(255, 210, 140, 0.7); }
@keyframes doc-up { from { transform: translateY(0); } to { transform: translateY(-5em); } }
@keyframes doc-down { from { transform: translateY(-5em); } to { transform: translateY(0); } }
.scroll-gesture { display: flex; align-items: center; gap: 0.5em; font-size: 0.75em; opacity: 0.85; }
.scroll-gesture .ic { width: 1.2em; height: 1.2em; animation: nudge 3.2s ease-in-out infinite alternate; }
.scroll-dev.is-mouse .scroll-gesture .ic { animation-name: nudge-down; }
@keyframes nudge { from { transform: translateY(0.3em); } to { transform: translateY(-0.3em); } }
@keyframes nudge-down { from { transform: translateY(-0.3em); } to { transform: translateY(0.3em); } }
.toggle { width: 2.2em; height: 1.3em; border-radius: 1em; background: rgba(255, 255, 255, 0.25); position: relative; transition: background 0.3s; }
.toggle::after { content: ""; position: absolute; top: 0.15em; left: 0.15em; width: 1em; height: 1em; border-radius: 50%; background: #fff; transition: transform 0.3s; }
.toggle.is-on { background: #34c759; }
.toggle.is-on::after { transform: translateX(0.9em); }
.glass {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05) 40%, rgba(255, 255, 255, 0.1)), rgba(22, 14, 56, 0.34);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 1.5em 3em -1em rgba(12, 6, 40, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

@media (prefers-reduced-motion: reduce) {
  .stage-bg span, .scroll-doc .lines, .scroll-gesture .ic { animation: none !important; }
}
