/* The 2D pages (/2d/ and /2d/try/): talking pictures on Wireface 2D (/assets/2d/, copied in by deploy.ps1). Shared
   bits first (stages, badges, spinners, steps, tiles), then each page's own. No inline styles: the pages' scripts set
   anything dynamic through the CSSOM. */

/* --- shared ------------------------------------------------------------------------------------------------------- */
.twod-stage { position: relative; margin: 0; width: 100%; aspect-ratio: 1; border-radius: 22px; overflow: hidden;
  border: 1px solid var(--line); background: radial-gradient(70% 60% at 50% 42%, rgba(99, 102, 241, .16), transparent 70%), var(--night-2);
  --wf-box: #22d3ee; --wf-point: #fbbf24; --wf-dense: #a78bfa; --wf-mesh: #22d3ee; }
.twod-stage canvas, .twod-stage .twod-still { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.twod-still { object-fit: contain; }
.twod-who { position: absolute; left: 14px; top: 14px; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 6px 12px;
  border-radius: 999px; background: rgba(10, 18, 38, .8); border: 1px solid var(--line-2); font: 600 0.92rem var(--display);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.twod-who:has(strong:empty) { display: none; }
.twod-badge { font: 500 0.66rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--cyan); padding: 4px 7px;
  border-radius: 999px; background: rgba(34, 211, 238, .12); }
.twod-badge.src { color: #fbbf24; background: rgba(251, 191, 36, .12); }
.twod-badge:empty { display: none; }
.twod-caption { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 2; margin: 0;
  width: max-content; max-width: calc(100% - 28px); padding: 10px 14px; border-radius: 14px; background: rgba(10, 18, 38, .84);
  border: 1px solid var(--line-2); color: var(--text); font-size: 0.97rem; line-height: 1.45; transition: opacity .3s;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.twod-caption:empty { opacity: 0; }
.twod-stage .sound-row { top: 14px; right: 14px; }

.twod-spinner { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(34, 211, 238, .25);
  border-top-color: var(--cyan); animation: twod-spin .8s linear infinite; }
@keyframes twod-spin { to { transform: rotate(360deg); } }

/* detection steps: a list whose items carry data-status = waiting | active | done | failed | skipped */
.twod-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.twod-steps li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; align-items: start; color: var(--dim);
  font-size: 0.92rem; transition: color .3s; }
.twod-steps .mark { width: 15px; height: 15px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--line-2); }
.twod-steps .detail { display: block; color: var(--dim); font-size: 0.82rem; }
.twod-steps .ms { font: 500 0.75rem var(--mono); color: var(--dim); }
.twod-steps li[data-status="active"], .twod-steps li[data-status="done"] { color: var(--text); }
.twod-steps li[data-status="active"] .mark { border-color: rgba(34, 211, 238, .25); border-top-color: var(--cyan); animation: twod-spin .8s linear infinite; }
.twod-steps li[data-status="done"] .mark { border-color: #34d399; background: #34d399; box-shadow: inset 0 0 0 2px var(--night-2); }
.twod-steps li[data-status="failed"] .mark { border-color: #fbbf24; background: #fbbf24; box-shadow: inset 0 0 0 2px var(--night-2); }
.twod-steps li[data-status="skipped"] .mark { border-style: dashed; }

/* the finding-the-face card over a stage */
.twod-card { position: absolute; left: 14px; bottom: 14px; z-index: 3; width: min(340px, calc(100% - 28px)); padding: 12px 14px;
  border-radius: 16px; background: rgba(10, 18, 38, .9); border: 1px solid var(--line-2); box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .9);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.twod-card-title { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font: 600 0.98rem var(--display); }
.twod-card.done .twod-spinner { display: none; }

/* character tiles, filterable by art style */
.twod-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.twod-filters button { border: 1px solid var(--line-2); background: rgba(13, 22, 48, .55); color: var(--muted); border-radius: 999px;
  padding: 5px 11px; font: 500 0.82rem var(--body); cursor: pointer; }
.twod-filters button:hover { color: var(--text); border-color: rgba(34, 211, 238, .5); }
.twod-filters button[aria-pressed="true"] { color: var(--text); border-color: rgba(34, 211, 238, .8); background: rgba(34, 211, 238, .1); }
.twod-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.twod-tile { position: relative; padding: 0; aspect-ratio: 1; overflow: hidden; border-radius: 14px; border: 1px solid var(--line);
  background: #0a1226; cursor: pointer; color: var(--text); text-align: left; }
.twod-tile img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.twod-tile:hover img { transform: scale(1.06); }
.twod-tile:hover { border-color: rgba(34, 211, 238, .5); }
.twod-tile[aria-pressed="true"] { border-color: rgba(34, 211, 238, .9); box-shadow: 0 0 0 2px rgba(34, 211, 238, .35), 0 0 22px -6px rgba(34, 211, 238, .8); }
.twod-tile .label { position: absolute; inset: auto 0 0 0; padding: 18px 8px 7px; font: 600 0.84rem var(--body);
  background: linear-gradient(transparent, rgba(4, 8, 20, .92)); text-shadow: 0 1px 2px rgba(0, 0, 0, .8); }
.twod-tile .label small { display: table; margin-bottom: 3px; padding: 2px 6px; border-radius: 999px; background: rgba(4, 8, 20, .8);
  font: 500 0.6rem/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--cyan); }
.twod-tile.add { display: grid; place-items: center; align-content: center; gap: 4px; border-style: dashed; border-color: var(--line-2);
  color: var(--muted); font: 500 0.84rem var(--body); text-align: center; }
.twod-tile.add b { font: 300 2rem/1 var(--display); color: var(--cyan); }
.twod-tile.busy::after { content: ""; position: absolute; inset: 0; background: rgba(6, 11, 24, .55); }
.twod-skeleton { aspect-ratio: 1; border-radius: 14px; background: linear-gradient(100deg, #0d1630 30%, #16234a 50%, #0d1630 70%);
  background-size: 300% 100%; animation: twod-shimmer 1.3s linear infinite; }
@keyframes twod-shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }

.twod-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.twod-chips button { border: 1px solid var(--line-2); background: rgba(13, 22, 48, .55); color: var(--muted); border-radius: 999px;
  padding: 6px 12px; font: 500 0.84rem var(--body); cursor: pointer; }
.twod-chips button:hover { color: var(--text); border-color: rgba(34, 211, 238, .5); }
.twod-chips button[aria-pressed="true"] { color: var(--text); border-color: rgba(34, 211, 238, .8); background: rgba(34, 211, 238, .1); }
.twod-teeth { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; }
.twod-teeth button { display: grid; gap: 4px; justify-items: center; padding: 6px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(13, 22, 48, .55); color: var(--muted); font: 500 0.76rem var(--body); cursor: pointer; }
.twod-teeth button:hover { color: var(--text); border-color: rgba(34, 211, 238, .45); }
.twod-teeth button[aria-pressed="true"] { color: var(--text); border-color: rgba(34, 211, 238, .8); }
.twod-teeth img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 8px; background: #2a1016; }

@media (prefers-reduced-motion: reduce) {
  .twod-spinner, .twod-steps li[data-status="active"] .mark, .twod-skeleton { animation: none; }
}

/* --- /2d/ -------------------------------------------------------------------------------------------------------------- */
.twod-hero .twod-stage { max-width: 560px; justify-self: center; box-shadow: 0 40px 90px -40px rgba(99, 102, 241, .55); }
.twod-cast { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-top: 2.2rem; }
.twod-cast .twod-tile .label { font-size: 0.95rem; }
.twod-cast .twod-tile .label small { font-size: 0.64rem; }
.twod-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px; align-items: center; margin-top: 2.2rem; }
.twod-split .twod-stage { max-width: 520px; }
.twod-howto { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; counter-reset: s; }
.twod-howto li { padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: rgba(13, 22, 48, .6);
  transition: border-color .4s, background .4s; }
.twod-howto li h3 { font-size: 1.05rem; margin-bottom: 6px; display: flex; align-items: center; gap: 10px; }
.twod-howto li h3::before { counter-increment: s; content: counter(s); display: inline-grid; place-items: center; width: 26px; height: 26px;
  border-radius: 8px; font: 600 0.82rem var(--mono); color: #050914; background: var(--grad); }
.twod-howto li p { margin: 0; color: var(--muted); font-size: 0.93rem; }
.twod-howto li.on { border-color: rgba(34, 211, 238, .6); background: rgba(34, 211, 238, .06); }
.twod-play h3 { margin: 22px 0 10px; font: 500 0.78rem var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.twod-play h3:first-child { margin-top: 0; }
.twod-play .btn { margin-top: 16px; }
.twod-dev { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; margin-top: 2.2rem; align-items: start; }
@media (max-width: 860px) {
  .twod-split, .twod-dev { grid-template-columns: minmax(0, 1fr); }
  .twod-split .twod-stage { justify-self: center; }
}

/* --- /2d/try/ ------------------------------------------------------------------------------------------------------- */
.twod-try .try-stage { aspect-ratio: 1; }
.twod-try .try-head h1 { font-size: clamp(2.1rem, 4.2vw, 3.2rem); }
.twod-try .twod-handles { position: absolute; inset: 0; z-index: 3; cursor: move; touch-action: none; }
.twod-handle { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; padding: 0; border-radius: 50%;
  border: 2px solid #fff; background: rgba(251, 191, 36, .9); box-shadow: 0 0 0 3px rgba(0, 0, 0, .35); cursor: grab; touch-action: none; }
.twod-fit { margin-top: 14px; padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(251, 191, 36, .45);
  background: rgba(251, 191, 36, .06); color: var(--muted); font-size: 0.9rem; }
.twod-fit .try-row { margin-top: 10px; }
.twod-persona { margin-top: 14px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(13, 22, 48, .55);
  color: var(--muted); font-size: 0.9rem; }
.twod-persona strong { color: var(--text); }
.twod-persona em { display: block; margin-top: 4px; }

/* elements shown and hidden by the scripts (positioned ones would otherwise ignore the hidden attribute) */
.twod-still[hidden], .twod-card[hidden], .twod-handles[hidden], .twod-who[hidden], .twod-persona[hidden], .twod-fit[hidden] { display: none; }
.twod-stage .sound-hint { padding: 5px 10px; border-radius: 999px; background: rgba(10, 18, 38, .82); }
