/* A1ZW playtest pages. Phone first (390 px), scales up to wide screens (1440 px).
   Tokens follow the A1ZW site (Lamplight night: deep navy, warm lamp amber). */
@font-face {
  font-family: "Pixelify Sans";
  src: url("/fonts/pixelify-sans-var-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #07090f;
  --surface: #111827;
  --surface-2: #1a2333;
  --line: #2a3448;
  --ink: #ecebe7;
  --muted: #cbbfa6;
  --accent: #ffaa33;
  --accent-ink: #07090f;
  --danger: #ff8a80;
  --focus: #4da8ff;
  --radius: 14px;
  --gap: clamp(16px, 2.2vw, 28px);
  --font-display: "Pixelify Sans", system-ui, sans-serif;
  --font-text: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--font-text);
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

h1,
h2 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0 0 0.5em;
}
h1 {
  font-size: clamp(1.9rem, 1.4rem + 2.4vw, 3rem);
}
h2 {
  font-size: 1.25rem;
  margin-top: 1.2em;
}
.card > h2:first-child {
  margin-top: 0;
}

.bar {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 14px var(--gap);
  border-bottom: 1px solid var(--line);
}
.brand {
  font: 700 1.35rem/1 var(--font-display);
  color: var(--accent);
  letter-spacing: 0.04em;
}
.bar-tag {
  color: var(--muted);
  font-size: 0.9rem;
}

.page {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: var(--gap) 16px;
  display: grid;
  gap: var(--gap);
  align-content: start;
}

.foot {
  padding: 18px var(--gap) 28px;
  text-align: center;
  font-size: 0.9rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(18px, 3vw, 32px);
}
.card.center {
  text-align: center;
}
.card > :last-child {
  margin-bottom: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.meta {
  margin: 0;
}
.pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
}
.tips {
  margin: 0;
  padding-left: 1.2em;
}
.tips li + li {
  margin-top: 6px;
}
.small {
  font-size: 0.9rem;
  color: var(--muted);
}
.consent-text {
  margin-top: 0;
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  background: var(--surface-2);
  border-radius: 8px;
}

/* Form controls: large tap targets (min 44 px) */
.check,
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 12px;
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
}
.check input,
.choice input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
  flex: none;
}
fieldset {
  border: 0;
  margin: 0 0 18px;
  padding: 0;
  min-width: 0;
}
legend,
.field {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}
.qn {
  display: inline-grid;
  place-items: center;
  width: 1.7em;
  height: 1.7em;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font: 700 0.85rem/1 var(--font-display);
}
.q {
  margin-bottom: 22px;
}
textarea {
  width: 100%;
  min-height: 96px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}
.scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.scale-opt {
  position: relative;
}
.scale-opt input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.scale-opt span {
  display: grid;
  place-items: center;
  min-height: 48px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font: 700 1.1rem/1 var(--font-display);
}
.scale-opt input:checked + span {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.scale-opt input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.scale-ends {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  min-width: 160px;
  padding: 12px 26px;
  margin-top: 8px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 700 1.2rem/1 var(--font-display);
  cursor: pointer;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}
.link-btn {
  padding: 12px 8px;
}
.error {
  color: var(--danger);
  font-weight: 600;
}

/* Art feedback: deterrents only (no right-click, no drag, no selection). */
.art-frame {
  position: relative;
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-2);
  aspect-ratio: 1 / 1;
  width: min(100%, 72vh);
  justify-self: center;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.art-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}
.art-frame img:not([src]) {
  visibility: hidden;
}
.watermark {
  position: absolute;
  inset: -50%;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 36px 52px;
  rotate: -30deg;
  pointer-events: none;
  font: 700 clamp(1rem, 0.8rem + 1.2vw, 1.6rem) / 1 var(--font-display);
  color: rgb(255 255 255 / 0.22);
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.45);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.art-status {
  position: absolute;
  inset: auto 0 0;
  padding: 10px 14px;
  background: rgb(7 9 15 / 0.75);
  font-size: 0.95rem;
}
.art-status:empty {
  display: none;
}
.note {
  margin: -8px 0 0;
}

.prose ul {
  padding-left: 1.2em;
}
.prose li + li {
  margin-top: 6px;
}

@media (min-width: 900px) {
  .page {
    padding-top: 48px;
  }
}

/* ---- Load screen (same family as the A1ZW site's lighthouse loader) ---- */
.loader {
  display: none;
}
html.js .loader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--ink);
  /* CSS-only give-up if the script never runs. */
  animation: loader-giveup 0.3s 9s steps(4) forwards;
}
html.loading {
  overflow: hidden;
}
.loader-stars i {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--ink);
  animation: loader-twinkle 1.6s steps(2) infinite;
}
.loader-stars i:nth-child(1) {
  left: 12%;
  top: 18%;
}
.loader-stars i:nth-child(2) {
  left: 30%;
  top: 9%;
  animation-delay: -0.4s;
}
.loader-stars i:nth-child(3) {
  left: 71%;
  top: 14%;
  background: #4da8ff;
  animation-delay: -0.9s;
}
.loader-stars i:nth-child(4) {
  left: 86%;
  top: 31%;
  animation-delay: -1.2s;
}
.loader-stars i:nth-child(5) {
  left: 8%;
  top: 56%;
  background: #3ee0b4;
  animation-delay: -0.7s;
}
.loader-stars i:nth-child(6) {
  left: 90%;
  top: 64%;
  background: var(--accent);
  animation-delay: -0.2s;
}
.loader-scene {
  display: grid;
  justify-items: center;
  gap: 20px;
}
.loader-tower {
  width: 80px;
  height: 130px;
  shape-rendering: crispEdges;
}
.loader-lamp {
  animation: loader-lamp 0.8s steps(2) infinite;
}
.loader-gems {
  display: flex;
  gap: 18px;
}
.loader-gems b {
  width: 12px;
  height: 12px;
  rotate: 45deg;
  background: var(--c);
  opacity: 0.18;
  transition:
    opacity 0.15s steps(2),
    scale 0.2s cubic-bezier(0.3, 1.8, 0.5, 1);
}
.loader-gems b.lit {
  opacity: 1;
  scale: 1.25;
  box-shadow: 0 0 10px var(--c);
}
.loader-gems b:nth-of-type(1) {
  --c: #ffaa33;
}
.loader-gems b:nth-of-type(2) {
  --c: #ff5e57;
}
.loader-gems b:nth-of-type(3) {
  --c: #3ee0b4;
}
.loader-gems b:nth-of-type(4) {
  --c: #4da8ff;
}
.loader-say {
  margin: 0;
  min-height: 1.4em;
  font: 700 1.1rem/1.4 var(--font-display);
  color: var(--muted);
}
.loader.done {
  animation: loader-out 0.45s 0.15s steps(5) forwards;
}
@keyframes loader-twinkle {
  50% {
    opacity: 0.25;
  }
}
@keyframes loader-lamp {
  50% {
    fill: #fff3c4;
  }
}
@keyframes loader-out {
  to {
    opacity: 0;
    visibility: hidden;
  }
}
@keyframes loader-giveup {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loader-stars i,
  .loader-lamp {
    animation: none;
  }
  .loader-gems b {
    transition: none;
  }
  .loader.done {
    animation: loader-out 0.3s forwards;
  }
}

/* ---- Link manager (admin host) and the tester's multi-target page ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.admin-nav {
  display: flex;
  gap: 8px;
}
.admin-nav a {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.admin-nav a[aria-current="page"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.input {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 6px 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}
.row .field {
  flex: 1 1 140px;
}
.btn-small {
  min-height: 44px;
  min-width: 0;
  padding: 8px 16px;
  font-size: 1rem;
  text-decoration: none;
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-danger {
  background: #c0392b;
  color: #fff;
}
.link-grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
}
.link-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}
.link-head h3 {
  margin: 0;
  font-family: var(--font-display);
  overflow-wrap: anywhere;
}
.status {
  flex: none;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid var(--line);
}
.status-active {
  background: #1f6f43;
  color: #fff;
  border-color: #1f6f43;
}
.status-revoked {
  background: #7a2b25;
  color: #fff;
  border-color: #7a2b25;
}
.status-expired,
.status-used_up {
  color: var(--muted);
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px 16px;
  margin: 12px 0;
}
.facts dt {
  font-size: 0.8rem;
  color: var(--muted);
}
.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.target-pick {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px 12px 8px;
  margin-bottom: 12px;
}
.target-perms {
  padding-left: 34px;
}
.check-sub {
  min-height: 44px;
  margin: 4px 0;
  background: transparent;
}
.qr {
  display: block;
  width: 240px;
  max-width: 100%;
  height: auto;
  margin-top: 12px;
  background: #fff;
  border-radius: 8px;
}
.fps {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
}
.fps li {
  display: grid;
  grid-template-columns: 7em 1fr 3.5em;
  gap: 8px;
  align-items: center;
}
.fps-bar {
  color: var(--accent);
  overflow: hidden;
  white-space: nowrap;
}
.json {
  margin: 0;
  padding: 10px;
  max-height: 240px;
  overflow: auto;
  border-radius: 8px;
  background: var(--bg);
  font-size: 0.85rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.session h3 {
  margin-top: 0;
  font-family: var(--font-display);
}
.session h4 {
  margin: 14px 0 6px;
}
