*, *::before, *::after { box-sizing: border-box; }
:root { --bg-base: #fafafa; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #18181b;
  background: #fafafa;
  min-height: 100dvh;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; }
a { color: inherit; }

/* layout */
.page {
  min-height: 100dvh;
  background: linear-gradient(135deg, #fafafa 0%, #ffffff 50%, #f4f4f5 100%);
}
.container {
  max-width: 80rem;
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}
@media (min-width: 640px) { .container { padding-left: 1.5rem; padding-right: 1.5rem; } }
@media (min-width: 1024px) { .container { padding-left: 2rem; padding-right: 2rem; } }

header.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding-top: 1.5rem;
  padding-bottom: 0.75rem;
}
.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; }
.brand-svg { width: 40px; height: 40px; }
.brand-name { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.025em; color: #18181b; }
.brand-name .muted { color: #a1a1aa; }
.source-link {
  font-size: 1rem;
  font-weight: 600;
  color: #52525b;
  text-decoration: none;
  transition: color 0.15s;
}
.source-link:hover { color: #18181b; }
.bar-start { display: flex; align-items: center; gap: 1.25rem; }
.bar-end { display: flex; align-items: center; gap: 1rem; }
.btn-nav {
  background: #18181b;
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.btn-nav:hover { background: #3f3f46; }
.save-state {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: #a1a1aa;
  transition: color 0.15s;
}
.save-state::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: currentColor;
}
.save-state:empty { display: none; }
.save-state.saving { color: #a1a1aa; }
.save-state.saved { color: #16a34a; }
.save-state.error { color: #dc2626; }
.logout-form { margin: 0; display: inline-flex; }

/* Account controls — visually distinct from nav items */
.nav-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #71717a;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: color 0.15s, text-decoration-color 0.15s;
}
.nav-link:hover {
  color: #18181b;
  text-decoration-color: currentColor;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: #3f3f46;
  padding: 0.25rem 0.625rem;
  background: #f4f4f5;
  border: 1px solid #e4e4e7;
  border-radius: 9999px;
}
a.user-chip {
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
a.user-chip:hover { border-color: #a1a1aa; color: #18181b; }
/* Ally-status tinted user chip (palette vars defined with the auth badge). */
.user-chip.status-ally,
.user-chip.status-super_ally,
.user-chip.status-ultimate_ally {
  gap: 0.3rem;
  border-color: var(--tier-border);
  background: var(--tier-bg);
}
a.user-chip.status-ally:hover,
a.user-chip.status-super_ally:hover,
a.user-chip.status-ultimate_ally:hover { border-color: var(--tier-dark); }
/* In the nav the animations play once on page load, then settle — a
   constant loop next to the page content is distracting. The shimmer ends
   at background-position 0 (the static resting value, band just off the
   right edge) so the hand-off from animated to settled is seamless. */
.user-chip .status-text { animation: chip-shimmer 2.4s ease-in-out 1; }
@keyframes chip-shimmer {
  from { background-position: 105% 0; }
  to { background-position: 0% 0; }
}
.user-chip .chip-sparkle {
  font-size: 0.625rem;
  color: var(--tier-dark, #a1a1aa);
  opacity: 0.75;
  animation: chip-twinkle 2.1s ease-in-out 1;
}
@keyframes chip-twinkle {
  0% { opacity: 0; transform: scale(0.3); }
  35% { opacity: 1; transform: scale(1.15) rotate(90deg); }
  100% { opacity: 0.75; transform: scale(1) rotate(90deg); }
}
.logout-btn {
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #71717a;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: color 0.15s, text-decoration-color 0.15s;
}
.logout-btn:hover {
  color: #dc2626;
  text-decoration-color: currentColor;
}

/* Auth */
main.auth {
  display: flex;
  justify-content: center;
  padding: 3rem 0 4rem;
}
.auth-card {
  width: 100%;
  max-width: 22rem;
  background: #ffffff;
  border: 1px solid #e4e4e7;
  border-radius: 1rem;
  padding: 2rem;
}
.auth-title { margin: 0 0 1.25rem; font-size: 1.25rem; letter-spacing: -0.025em; }
.auth-label { display: block; font-size: 0.8125rem; color: #71717a; margin-bottom: 0.375rem; }
.auth-input,
.auth-card input[type="text"],
.auth-card input[type="password"] {
  width: 100%;
  padding: 0.625rem 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid #e4e4e7;
  border-radius: 0.5rem;
  font-size: 0.875rem;
}
.auth-input:focus,
.auth-card input[type="text"]:focus,
.auth-card input[type="password"]:focus { outline: none; border-color: #a1a1aa; }
.auth-submit { width: 100%; margin-top: 0.25rem; }
/* Read-only field (e.g. account status — granted by admins, not editable). */
.auth-status {
  position: relative;
  overflow: hidden;
  margin: 0 0 1rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid #e4e4e7;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: #71717a;
  background: #fafafa;
}
/* Animated ally-status tiers: shimmering gradient text + twinkling sparkles.
   Shared by the account-page badge and the nav user chip.
   Tier colors — ally: blue, super ally: green, ultimate ally: gold. */
.status-ally {
  --tier-dark: #1d4ed8;
  --tier-bright: #7dd3fc;
  --tier-border: #bfdbfe;
  --tier-bg: #eff6ff;
}
.status-super_ally {
  --tier-dark: #15803d;
  --tier-bright: #86efac;
  --tier-border: #bbf7d0;
  --tier-bg: #f0fdf4;
}
.status-ultimate_ally {
  --tier-dark: #b45309;
  --tier-bright: #fde047;
  --tier-border: #fde68a;
  --tier-bg: linear-gradient(120deg, #fffbeb, #fef3c7, #fffbeb);
}
.status-text {
  position: relative;
  z-index: 1;
  font-weight: 600;
  background: linear-gradient(
    100deg,
    var(--tier-dark, #71717a) 0%,
    var(--tier-dark, #71717a) 38%,
    var(--tier-bright, #a1a1aa) 50%,
    var(--tier-dark, #71717a) 62%,
    var(--tier-dark, #71717a) 100%
  );
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: status-shimmer 2.4s linear infinite;
}
/* One full tile period of the 250%-wide gradient (Δ166.67%), so the loop
   wraps around seamlessly with no jump between iterations. */
@keyframes status-shimmer {
  from { background-position: 83.33% 0; }
  to { background-position: -83.34% 0; }
}
.auth-status.status-ally,
.auth-status.status-super_ally,
.auth-status.status-ultimate_ally {
  border-color: var(--tier-border);
  background: var(--tier-bg);
}
.status-sparkles { position: absolute; inset: 0; pointer-events: none; }
.status-sparkles .sparkle {
  position: absolute;
  font-size: 0.625rem;
  color: var(--tier-bright, #a1a1aa);
  opacity: 0;
  animation: status-twinkle 2.1s ease-in-out infinite;
}
.status-sparkles .sparkle:nth-child(1) { top: 12%; left: 58%; animation-delay: 0s; }
.status-sparkles .sparkle:nth-child(2) { top: 52%; left: 76%; animation-delay: 0.35s; font-size: 0.5rem; }
.status-sparkles .sparkle:nth-child(3) { top: 22%; left: 88%; animation-delay: 0.7s; }
.status-sparkles .sparkle:nth-child(4) { top: 58%; left: 46%; animation-delay: 1.05s; font-size: 0.5rem; }
.status-sparkles .sparkle:nth-child(5) { top: 8%; left: 70%; animation-delay: 1.4s; }
.status-sparkles .sparkle:nth-child(6) { top: 44%; left: 94%; animation-delay: 1.75s; font-size: 0.75rem; }
@keyframes status-twinkle {
  0%, 100% { opacity: 0; transform: scale(0.3) rotate(0deg); }
  50% { opacity: 1; transform: scale(1) rotate(90deg); }
}
@media (prefers-reduced-motion: reduce) {
  .status-text { animation: none; }
  .status-sparkles .sparkle,
  .user-chip .chip-sparkle { animation: none; opacity: 0.6; transform: none; }
}
.auth-error { color: #dc2626; font-size: 0.8125rem; margin: 0 0 1rem; }
.auth-saved { color: #16a34a; font-size: 0.8125rem; margin: 0 0 1rem; }
.auth-help { color: #a1a1aa; font-size: 0.75rem; margin: -0.5rem 0 1rem; }
.auth-alt { font-size: 0.8125rem; color: #71717a; margin: 1.25rem 0 0; text-align: center; }
.auth-help ul { margin: 0; padding-left: 1.1rem; }
.pw-rules { list-style: none; color: #a1a1aa; font-size: 0.75rem; margin: -0.5rem 0 1rem; padding-left: 0; }
.pw-rules li::before { content: "•"; display: inline-block; width: 1.1rem; }
.pw-rules li.ok { color: #16a34a; }
.pw-rules li.ok::before { content: "✓"; }
.pw-rules[hidden], .pw-rules li[hidden] { display: none; }
.email-status { font-size: 0.75rem; margin: -0.5rem 0 1rem; }
.email-status.err { color: #dc2626; }
.email-status.ok { color: #16a34a; }
.email-status[hidden] { display: none; }

main.studio {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  padding-bottom: 4rem;
}
@media (min-width: 1024px) {
  main.studio {
    grid-template-columns: 1fr 400px;
    column-gap: 2.5rem;
    row-gap: 0;
    grid-template-areas:
      "stage  editor"
      "extras editor";
  }
  .stage { grid-area: stage; }
  .editor { grid-area: editor; }
  .stage-extras { grid-area: extras; }
}

/* Visitor view (no editor rendered): place the profile info beside the blob on
   tablet and desktop so everything fits in one screen. Owners (.editing) keep
   the editor layout above. */
@media (min-width: 768px) {
  .page:not(.editing) main.studio {
    grid-template-columns: minmax(0, 1fr) 340px;
    column-gap: 2rem;
    row-gap: 0;
    grid-template-areas: "stage extras";
    align-items: center;
  }
  .page:not(.editing) .stage { grid-area: stage; }
  .page:not(.editing) .stage-extras { grid-area: extras; }
}
@media (min-width: 1024px) {
  .page:not(.editing) main.studio { grid-template-columns: minmax(0, 1fr) 400px; }
}

/* Mobile editing: pin the blob preview to the top so it stays in view while
   the controls scroll beneath it. The header pins too, keeping the auto-save
   status visible. Only owners (.editing) get this; visitors keep normal flow. */
@media (max-width: 1023px) {
  .page.editing header.bar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg-base);
  }
  .page.editing main.studio { display: block; }
  .page.editing .stage {
    position: sticky;
    top: var(--header-h, 4.5rem);
    z-index: 5;
    align-items: center;
    background: var(--bg-base);
    padding-top: 0.25rem;
    padding-bottom: 0.75rem;
    box-shadow: 0 10px 14px -10px rgba(0, 0, 0, 0.18);
  }
  .page.editing .stage-frame {
    aspect-ratio: 1 / 1;
    width: auto;
    height: min(38vh, 16rem);
    max-width: 100%;
  }
  .page.editing .anim-row { margin-top: 0.5rem; }
  .page.editing .editor { margin-top: 1.25rem; }
  .page.editing .editor-card { position: static; }
  .page.editing .tab-body { max-height: none; overflow: visible; }
  .page.editing .stage-extras { margin-top: 1.5rem; }
}

/* Stage */
.stage { display: flex; flex-direction: column; }
.stage-frame {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
  border-radius: 1.5rem;
  border: 1px solid #e4e4e7;
  background: #ffffff;
  overflow: hidden;
}
.stage-glow {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(0,0,0,0.04), transparent 60%);
  pointer-events: none;
}
.stage-shadow {
  position: absolute;
  left: 50%;
  bottom: 17%;
  transform: translateX(-50%);
  width: 42%;
  height: 3.2%;
  border-radius: 50%;
  background: rgba(0,0,0,0.12);
  pointer-events: none;
}
.stage-center {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.stage-blob {
  width: 70%;
  filter: drop-shadow(0 24px 40px rgba(0,0,0,0.08));
}
.stage-blob svg { width: 100%; height: auto; display: block; }

.nametag {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid #e4e4e7;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  display: flex; align-items: center; gap: 0.5rem;
  max-width: calc(100% - 2rem);
}
.nametag-name { font-size: 0.875rem; font-weight: 500; color: #18181b; }
.nametag-pronouns { font-size: 0.75rem; color: #71717a; }

.anim-row {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  justify-content: center;
}
.anim-chip {
  padding: 0.375rem 0.875rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: #ffffff;
  border: 1px solid #e4e4e7;
  color: #52525b;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.anim-chip:hover { border-color: #a1a1aa; color: #18181b; }
.anim-chip.selected { background: #18181b; color: #ffffff; border-color: #18181b; }

@keyframes blob-hover  { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes blob-wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
@keyframes blob-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-22px); } }
@keyframes blob-spin   { to { transform: rotate(360deg); } }
@keyframes blob-wild {
  0%   { transform: translate(0, 0) rotate(0) scale(1); }
  12%  { transform: translate(-26px, -18px) rotate(-18deg) scale(1.05); }
  24%  { transform: translate(28px, -8px) rotate(22deg) scale(0.93); }
  37%  { transform: translate(18px, 22px) rotate(-28deg) scale(1.1); }
  50%  { transform: translate(-22px, 14px) rotate(40deg) scale(0.9); }
  63%  { transform: translate(26px, -20px) rotate(-35deg) scale(1.08); }
  76%  { transform: translate(-14px, 18px) rotate(50deg) scale(0.95); }
  88%  { transform: translate(-24px, -12px) rotate(-22deg) scale(1.04); }
  100% { transform: translate(0, 0) rotate(0) scale(1); }
}
.stage-blob.anim-hover  { animation: blob-hover 3.2s ease-in-out infinite; }
.stage-blob.anim-wobble { animation: blob-wobble 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
.stage-blob.anim-bounce { animation: blob-bounce 1.1s cubic-bezier(.5,0,.5,1) infinite; }
.stage-blob.anim-spin   { animation: blob-spin 7s linear infinite; }
.stage-blob.anim-wild   { animation: blob-wild 2.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .stage-blob.anim-hover,
  .stage-blob.anim-wobble,
  .stage-blob.anim-bounce,
  .stage-blob.anim-spin,
  .stage-blob.anim-wild { animation: none; }
}

.stage-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}
.btn {
  padding: 0.625rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn-primary {
  background: #18181b;
  color: #ffffff;
}
.btn-primary:hover { background: #27272a; }
.btn-secondary {
  background: #ffffff;
  border: 1px solid #e4e4e7;
  color: #18181b;
}
.btn-secondary:hover { border-color: #a1a1aa; }
.btn[disabled] { opacity: 0.5; cursor: default; }

/* Share */
.share-row {
  margin-top: 1rem;
  max-width: 40rem;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.share-input {
  flex: 1;
  padding: 0.625rem 0.875rem;
  border-radius: 0.75rem;
  background: #ffffff;
  border: 1px solid #e4e4e7;
  font-size: 0.8125rem;
  color: #3f3f46;
  outline: none;
}
.share-input:focus { border-color: #a1a1aa; }
.share-status {
  font-size: 0.75rem;
  color: #16a34a;
  text-align: center;
  margin-top: 0.5rem;
  min-height: 1rem;
}
.share-status.error { color: #dc2626; }

.profile-card {
  margin-top: 1.5rem;
  max-width: 40rem;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding: 1.25rem;
  border-radius: 1rem;
  background: #ffffff;
  border: 1px solid #e4e4e7;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.pc-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 0.75rem;
  align-items: start;
}
.pc-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a1a1aa;
  padding-top: 0.25rem;
}
.pc-val { font-size: 0.875rem; color: #3f3f46; }
.pc-val.story { white-space: pre-wrap; line-height: 1.6; margin: 0; }
.pc-traits { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.pc-trait {
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  background: #f4f4f5;
  font-size: 0.75rem;
  color: #3f3f46;
}

/* Editor */
aside.editor { display: flex; flex-direction: column; }
.editor-card {
  position: sticky;
  top: 1.5rem;
  border-radius: 1.5rem;
  border: 1px solid #e4e4e7;
  background: #ffffff;
  overflow: hidden;
}
.tabs {
  display: flex;
  border-bottom: 1px solid #e4e4e7;
}
.tab {
  flex: 1;
  padding: 0.75rem 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: #a1a1aa;
  position: relative;
  transition: color 0.15s;
}
.tab:hover { color: #52525b; }
.tab.active { color: #18181b; }
.tab.active::after {
  content: "";
  position: absolute;
  left: 1rem; right: 1rem; bottom: -1px;
  height: 2px;
  background: #18181b;
}
.tab-body {
  padding: 1.25rem;
  max-height: 70vh;
  overflow-y: auto;
}

/* Sections (look) */
.section { display: flex; flex-direction: column; gap: 0.5rem; }
.section + .section { margin-top: 1.5rem; }
.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #71717a;
  margin: 0;
}
.color-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}
.swatch {
  aspect-ratio: 1 / 1;
  border-radius: 9999px;
  transition: transform 0.15s, box-shadow 0.15s;
  border: none;
  padding: 0;
  overflow: hidden;
}
.swatch svg { display: block; width: 100%; height: 100%; }
.swatch[hidden] { display: none; }
.swatch:hover { transform: scale(1.05); }
.swatch.selected {
  transform: scale(1.1);
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #18181b;
}
.color-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #52525b;
}
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}
.chip {
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  background: #f4f4f5;
  color: #3f3f46;
  transition: background-color 0.15s, color 0.15s;
}
.chip:hover { background: #e4e4e7; }
.chip.selected { background: #18181b; color: #ffffff; }
.chip.selected:hover { background: #18181b; }

.section-search {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  background: #fafafa;
  border: 1px solid #e4e4e7;
  font-size: 0.8125rem;
  color: #18181b;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.section-search:focus { border-color: #a1a1aa; box-shadow: 0 0 0 3px rgba(24,24,27,0.06); }
.section-search::placeholder { color: #a1a1aa; }
.see-more {
  align-self: flex-start;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #ffffff;
  background: #4f46e5;
  border: 1px solid transparent;
  padding: 0.375rem 0.875rem;
  border-radius: 9999px;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.see-more:hover { background: #4338ca; }
.chip[hidden] { display: none; }
.section-empty {
  font-size: 0.75rem;
  color: #a1a1aa;
  font-style: italic;
  padding: 0.25rem 0;
}
.blush-row {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
}
.blush-row input { width: 16px; height: 16px; accent-color: #18181b; }

/* "Missing something?" feedback. Feedback is gold — the chip gets its own
   accent and a gentle pulsing glow so it invites a click without nagging. */
.chip.missing-chip {
  align-self: flex-start;
  background: #db2777;
  border: 1px solid transparent;
  color: #ffffff;
  animation: missing-pulse 2.4s ease-in-out infinite;
  transition: background-color 0.15s, transform 0.15s;
}
.chip.missing-chip:hover {
  background: #be185d;
  transform: scale(1.05);
  animation: none;
}
@keyframes missing-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(219, 39, 119, 0.45); }
  70%  { box-shadow: 0 0 0 8px rgba(219, 39, 119, 0); }
  100% { box-shadow: 0 0 0 0 rgba(219, 39, 119, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .chip.missing-chip { animation: none; }
  .chip.missing-chip:hover { transform: none; }
}
.feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(24, 24, 27, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.feedback-modal {
  width: 100%;
  max-width: 26rem;
  background: #ffffff;
  border: 1px solid #e4e4e7;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.feedback-title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  color: #18181b;
}
.feedback-hint {
  margin: 0;
  font-size: 0.8125rem;
  color: #71717a;
  line-height: 1.5;
}
.feedback-link { color: #18181b; font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.feedback-status {
  font-size: 0.75rem;
  color: #dc2626;
  min-height: 1rem;
}
.feedback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Profile editor */
.field { display: flex; flex-direction: column; gap: 0.375rem; }
.field + .field { margin-top: 1rem; }
.field-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #71717a;
}
.field-hint { font-size: 0.75rem; color: #a1a1aa; }
.input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border-radius: 0.75rem;
  background: #ffffff;
  border: 1px solid #e4e4e7;
  font-size: 0.875rem;
  color: #18181b;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: #a1a1aa; box-shadow: 0 0 0 3px rgba(24,24,27,0.06); }
.input::placeholder { color: #a1a1aa; }
textarea.input { resize: none; line-height: 1.5; }
.char-count { font-size: 0.75rem; color: #a1a1aa; text-align: right; }

/* Export */
.export-list { display: flex; flex-direction: column; gap: 0.5rem; }
.export-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: #ffffff;
  border: 1px solid #e4e4e7;
  transition: border-color 0.15s, opacity 0.15s;
  text-align: left;
  width: 100%;
}
.export-row:hover:not([disabled]) { border-color: #a1a1aa; }
.export-row[disabled] { opacity: 0.5; cursor: default; }
.export-row .label { font-size: 0.875rem; font-weight: 500; color: #18181b; display: block; }
.export-row .hint { font-size: 0.75rem; color: #71717a; display: block; }
.export-row .tag { font-size: 0.75rem; font-weight: 500; color: #71717a; flex-shrink: 0; }

footer.foot {
  text-align: center;
  font-size: 0.75rem;
  color: #a1a1aa;
  padding-bottom: 2.5rem;
}

/* Gallery */
main.gallery { flex: 1; padding: 1rem 0 2.5rem; }
.gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.gallery-title { margin: 0; font-size: 1.5rem; letter-spacing: -0.025em; color: #18181b; }
.gallery-empty { color: #71717a; font-size: 0.9375rem; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}
.card {
  display: flex;
  flex-direction: column;
  border: 1px solid #e4e4e7;
  border-radius: 1.25rem;
  background: #ffffff;
  padding: 1rem;
}
.card-preview {
  display: block;
  border-radius: 0.875rem;
  background: radial-gradient(circle at 30% 20%, rgba(0,0,0,0.04), transparent 60%);
  padding: 0.75rem 1.25rem;
}
.card-name {
  display: block;
  margin: 0.75rem 0.25rem 0.875rem;
  font-weight: 600;
  color: #18181b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; margin-top: auto; }
.card-edit { flex: 1; text-align: center; text-decoration: none; }
.card-delete {
  font-size: 0.8125rem;
  color: #a1a1aa;
  padding: 0.5rem 0.75rem;
  border-radius: 9999px;
}
.card-delete:hover { color: #dc2626; }
.card-new {
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 16rem;
  border-style: dashed;
  background: transparent;
  cursor: pointer;
  color: #71717a;
  font: inherit;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.card-new:hover { border-color: #a1a1aa; color: #18181b; }
.card-new:disabled { opacity: 0.5; cursor: default; }
.card-new-icon { font-size: 2.25rem; line-height: 1; }
.card-new-label { font-weight: 600; font-size: 0.9375rem; }

/* Tickets */
main.tickets { padding-bottom: 4rem; }
.ticket-create { margin-bottom: 1.75rem; }
.ticket-form {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  max-width: 40rem;
  padding: 1.25rem;
  border: 1px solid #e4e4e7;
  border-radius: 1rem;
  background: #ffffff;
}
.ticket-textarea { resize: vertical; min-height: 6rem; }
.ticket-form-actions { display: flex; justify-content: flex-end; }

.ticket-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.ticket-card {
  border: 1px solid #e4e4e7;
  border-radius: 1.25rem;
  background: #ffffff;
  padding: 1.25rem 1.375rem;
}
.ticket-card-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-bottom: 0.875rem;
}
.ticket-status {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  border: 1px solid transparent;
}
.ticket-status.status-received { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.ticket-status.status-reviewed { background: #fef9c3; color: #a16207; border-color: #fde68a; }
.ticket-status.status-implemented { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.ticket-status.status-not-implemented { background: #f4f4f5; color: #52525b; border-color: #e4e4e7; }
.ticket-queue {
  font-size: 0.75rem;
  font-weight: 600;
  color: #3f3f46;
  padding: 0.25rem 0.5rem;
  background: #f4f4f5;
  border: 1px solid #e4e4e7;
  border-radius: 9999px;
}
.ticket-date { margin-left: auto; font-size: 0.75rem; color: #a1a1aa; }
.ticket-field { margin-bottom: 0.875rem; }
.ticket-field:last-child { margin-bottom: 0; }
.ticket-field-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a1a1aa;
  margin-bottom: 0.25rem;
}
.ticket-text {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: #3f3f46;
  white-space: pre-wrap;
  word-break: break-word;
}
.ticket-response {
  padding-left: 0.875rem;
  border-left: 3px solid #e4e4e7;
}
.ticket-awaiting {
  margin: 0;
  font-size: 0.8125rem;
  font-style: italic;
  color: #a1a1aa;
}
.ticket-remove-form {
  margin: 0.875rem 0 0;
  display: flex;
  justify-content: flex-end;
}
.ticket-remove-btn {
  font: inherit;
  font-size: 0.8125rem;
  padding: 0.3125rem 0.75rem;
  border: 1px solid #fecaca;
  border-radius: 0.5rem;
  background: #fff;
  color: #b91c1c;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.ticket-remove-btn:hover { background: #fef2f2; border-color: #fca5a5; }

/* ---------- Digital ID card ---------- */
main.cardpage {
  display: flex;
  justify-content: center;
  padding: 0.5rem 0 4rem;
}
.card-stage {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 0;
}
.idcard-float {
  width: min(420px, 100%);
}
.idcard {
  position: relative;
  width: 100%;
  aspect-ratio: 27 / 43;
  border-radius: 1.75rem;
  overflow: hidden;
  color: #ffffff;
  background: var(--card-grad);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow:
    0 30px 60px -18px var(--card-glow),
    0 8px 22px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
/* Tier looks for the card itself. The shimmer vars (--tier-dark/-bright) are
   re-pointed at bright values so the shared .status-text gradient stays
   legible on the card's jewel-toned background. The --holo/--shine vars make
   every effect richer and faster as the tier climbs, so each upgrade visibly
   outshines the last. */
.idcard.status-ally {
  --card-grad: linear-gradient(155deg, #0a1738 0%, #14306e 38%, #1d4ed8 72%, #38bdf8 115%);
  --card-glow: rgba(29, 78, 216, 0.55);
  --tier-dark: #bfdbfe;
  --tier-bright: #ffffff;
  --holo-opacity: 0.1;
  --holo-speed: 13s;
  --shine-speed: 7.5s;
}
.idcard.status-super_ally {
  --card-grad: linear-gradient(155deg, #03190c 0%, #0f4023 38%, #15803d 72%, #4ade80 115%);
  --card-glow: rgba(21, 128, 61, 0.55);
  --tier-dark: #bbf7d0;
  --tier-bright: #ffffff;
  --holo-opacity: 0.18;
  --holo-speed: 9s;
  --shine-speed: 5.5s;
}
.idcard.status-ultimate_ally {
  --card-grad: linear-gradient(155deg, #1d1002 0%, #6a3b0a 36%, #b45309 68%, #fcd34d 112%);
  --card-glow: rgba(217, 119, 6, 0.6);
  --tier-dark: #fde68a;
  --tier-bright: #ffffff;
  --holo-opacity: 0.28;
  --holo-speed: 6s;
  --shine-speed: 4s;
}
/* Higher tiers breathe: the card's glow swells and fades, faster at the top. */
.idcard.status-super_ally { animation: card-aura 6s ease-in-out infinite; }
.idcard.status-ultimate_ally { animation: card-aura 4s ease-in-out infinite; }
/* Both frames carry the same four shadow layers (the halo is merely
   transparent at rest) — mismatched lists would snap instead of easing. */
@keyframes card-aura {
  0%, 100% {
    box-shadow:
      0 30px 60px -18px var(--card-glow),
      0 0 38px transparent,
      0 8px 22px rgba(0, 0, 0, 0.25),
      inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }
  50% {
    box-shadow:
      0 30px 70px -14px var(--card-glow),
      0 0 38px var(--card-glow),
      0 8px 22px rgba(0, 0, 0, 0.25),
      inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }
}
/* Holographic foil: a soft rainbow weave that slowly cycles hue. */
.idcard-holo {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    115deg,
    rgba(255, 119, 225, 0.5) 0px,
    rgba(255, 227, 110, 0.5) 60px,
    rgba(110, 255, 188, 0.5) 120px,
    rgba(110, 196, 255, 0.5) 180px,
    rgba(255, 119, 225, 0.5) 240px
  );
  opacity: var(--holo-opacity, 0.16);
  mix-blend-mode: overlay;
  animation: holo-drift var(--holo-speed, 9s) linear infinite;
}
@keyframes holo-drift {
  from { filter: hue-rotate(0deg); }
  to { filter: hue-rotate(360deg); }
}
/* A glossy light band sweeping across the card. */
.idcard-shine {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 0%,
    transparent 38%,
    rgba(255, 255, 255, 0.45) 48%,
    rgba(255, 255, 255, 0.12) 53%,
    transparent 62%,
    transparent 100%
  );
  background-size: 260% 100%;
  animation: card-shine var(--shine-speed, 5.5s) ease-in-out infinite;
}
@keyframes card-shine {
  0% { background-position: 110% 0; }
  55%, 100% { background-position: -45% 0; }
}
/* Twinkles scattered over the card — higher tiers earn more of them. */
.idcard-sparks { position: absolute; inset: 0; pointer-events: none; }
.idcard-sparks span {
  position: absolute;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
  opacity: 0;
  animation: status-twinkle 2.8s ease-in-out infinite;
}
.idcard-sparks span:nth-child(1) { top: 7%;  left: 12%; animation-delay: 0s; }
.idcard-sparks span:nth-child(2) { top: 16%; left: 78%; animation-delay: 0.4s; font-size: 0.625rem; }
.idcard-sparks span:nth-child(3) { top: 40%; left: 6%;  animation-delay: 0.8s; font-size: 0.75rem; }
.idcard-sparks span:nth-child(4) { top: 33%; left: 90%; animation-delay: 1.2s; }
.idcard-sparks span:nth-child(5) { top: 60%; left: 14%; animation-delay: 1.6s; font-size: 0.625rem; }
.idcard-sparks span:nth-child(6) { top: 72%; left: 84%; animation-delay: 2.0s; }
.idcard-sparks span:nth-child(7) { top: 87%; left: 28%; animation-delay: 2.4s; font-size: 0.75rem; }
.idcard-sparks span:nth-child(8) { top: 92%; left: 64%; animation-delay: 2.8s; font-size: 1rem; }
.idcard-sparks span:nth-child(9)  { top: 50%; left: 92%; animation-delay: 0.6s; font-size: 0.625rem; }
.idcard-sparks span:nth-child(10) { top: 12%; left: 34%; animation-delay: 1.4s; font-size: 0.75rem; }
.idcard-sparks span:nth-child(11) { top: 78%; left: 7%;  animation-delay: 2.2s; }
.idcard-sparks span:nth-child(12) { top: 96%; left: 44%; animation-delay: 3.0s; font-size: 0.625rem; }
.idcard.status-ally .idcard-sparks span:nth-child(n+5) { display: none; }
.idcard.status-super_ally .idcard-sparks span:nth-child(n+9) { display: none; }
/* Ultimate only: shooting stars streak diagonally across the card. */
.idcard.status-ultimate_ally .idcard-sparks::before,
.idcard.status-ultimate_ally .idcard-sparks::after {
  content: "";
  position: absolute;
  top: -4%;
  left: 96%;
  width: 110px;
  height: 2px;
  border-radius: 9999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.85) 70%, #ffffff 100%);
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.7));
  opacity: 0;
  animation: card-comet 7s ease-in infinite;
}
.idcard.status-ultimate_ally .idcard-sparks::after {
  top: 34%;
  width: 80px;
  animation-delay: 3.5s;
}
@keyframes card-comet {
  0% { transform: translate3d(0, 0, 0) rotate(135deg); opacity: 0; }
  3% { opacity: 1; }
  13%, 100% { transform: translate3d(-340px, 340px, 0) rotate(135deg); opacity: 0; }
}

.idcard-content {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem 1.5rem 1.25rem;
}
.idcard-head { display: flex; align-items: center; justify-content: space-between; }
.idcard-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.idcard-brand .muted { color: rgba(255, 255, 255, 0.6); }
.idcard-brand-svg {
  width: 30px;
  height: 30px;
  display: inline-flex;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}
.idcard-brand-svg svg { width: 100%; height: auto; }
.idcard-type {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 0.3rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.idcard-blobs {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}
.idcard-blob {
  flex: 1;
  max-width: 13rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  padding: 1rem 0.75rem 0.75rem;
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.idcard-blob svg {
  width: 100%;
  height: auto;
  max-height: 10rem;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.25));
  animation: blob-hover 3.2s ease-in-out infinite;
}
.idcard-blob-name {
  max-width: 100%;
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Nothing picked yet: a dashed slot that sends the user to My blobs. */
.idcard-blob-empty {
  justify-content: center;
  gap: 0.625rem;
  min-height: 10rem;
  border-style: dashed;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: none;
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}
.idcard-blob-empty:hover {
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.12);
}
.idcard-blob-plus { font-size: 1.75rem; line-height: 1; opacity: 0.8; }
.idcard-blob-empty .idcard-blob-name {
  color: rgba(255, 255, 255, 0.75);
  white-space: normal;
  text-align: center;
  line-height: 1.45;
}
/* The tier banner — the card's centerpiece for the ally status. */
.idcard-tier {
  position: relative;
  overflow: hidden;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 2.5rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0 22px var(--card-glow);
}
.idcard-tier .status-text {
  font-size: 1.3125rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
/* The banner steps up with the tier: brighter ring for super, a gilded
   gradient border for ultimate. */
.idcard.status-super_ally .idcard-tier {
  border-color: rgba(255, 255, 255, 0.65);
}
.idcard.status-ultimate_ally .idcard-tier {
  border-color: transparent;
  background:
    linear-gradient(rgba(0, 0, 0, 0.26), rgba(0, 0, 0, 0.26)) padding-box,
    linear-gradient(120deg, #fde68a, #fffbeb, #f59e0b, #fde68a) border-box;
}
/* Lower tiers show fewer of the banner's six sparkles. */
.idcard.status-ally .idcard-tier .sparkle:nth-child(n+3) { display: none; }
.idcard.status-super_ally .idcard-tier .sparkle:nth-child(n+5) { display: none; }
.idcard-fields { display: flex; flex-direction: column; gap: 0.875rem; }
.idcard-label {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}
.idcard-name {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  overflow-wrap: anywhere;
}
/* No name set yet: point the user at account settings. */
.idcard-name-missing {
  display: inline-block;
  font-size: 0.9375rem;
  font-weight: 600;
  font-style: italic;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.4);
  text-underline-offset: 3px;
  transition: color 0.15s, text-decoration-color 0.15s;
}
.idcard-name-missing:hover {
  color: #ffffff;
  text-decoration-color: currentColor;
}
.idcard-number {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35), 0 0 14px rgba(255, 255, 255, 0.25);
}
.idcard-foot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.25rem;
}
.idcard-foot-info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-right: auto;
  text-align: left;
  min-width: 0;
}
.idcard-since { font-size: 0.6875rem; letter-spacing: 0.04em; color: rgba(255, 255, 255, 0.6); }
.idcard-verify-hint {
  font-size: 0.625rem;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.55);
  overflow-wrap: anywhere;
}
/* The QR code linking to this card's public /verify page. White tile so
   scanners get the contrast (and quiet zone) they need. */
.idcard-qr {
  flex-shrink: 0;
  display: inline-flex;
  width: 62px;
  height: 62px;
  padding: 4px;
  border-radius: 0.625rem;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.idcard-qr svg { display: block; width: 100%; height: 100%; }
.idcard-seal {
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  background: conic-gradient(from 0deg, #ff8ad4, #ffd86e, #8affc1, #8ac6ff, #c49aff, #ff8ad4);
  opacity: 0.85;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.6), 0 2px 8px rgba(0, 0, 0, 0.25);
  animation: seal-spin 14s linear infinite;
}
@keyframes seal-spin { to { transform: rotate(360deg); } }

/* Mobile: the card is the experience — let it fill the screen below the
   header (card.js keeps --header-h in sync as the nav wraps). */
@media (max-width: 640px) {
  .card-stage { padding: 0.25rem 0 1rem; }
  .idcard {
    aspect-ratio: auto;
    height: calc(100dvh - var(--header-h, 6.5rem) - 1.75rem);
    min-height: 30rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .idcard.status-super_ally,
  .idcard.status-ultimate_ally,
  .idcard-holo,
  .idcard-shine,
  .idcard-seal,
  .idcard-blob svg,
  .idcard.status-ultimate_ally .idcard-sparks::before,
  .idcard.status-ultimate_ally .idcard-sparks::after,
  .idcard-sparks span { animation: none; }
  .idcard-sparks span { opacity: 0.6; }
}

/* Card verification (public page behind the card's QR code) */
main.verify {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem 0 4rem;
}
.verify-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.75rem;
}
.verify-mark { width: 72px; height: 72px; }
.verify-mark circle { stroke-width: 4; }
.verify-mark path {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.verify-mark.ok { animation: verify-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.verify-mark.ok circle { fill: #dcfce7; stroke: #16a34a; }
.verify-mark.ok path {
  stroke: #16a34a;
  stroke-dasharray: 42;
  stroke-dashoffset: 42;
  animation: verify-draw 0.45s ease-out 0.3s forwards;
}
.verify-mark.bad circle { fill: #fee2e2; stroke: #dc2626; }
.verify-mark.bad path { stroke: #dc2626; }
@keyframes verify-pop {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes verify-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .verify-mark.ok { animation: none; }
  .verify-mark.ok path { animation: none; stroke-dashoffset: 0; }
}
.verify-title { margin: 0; font-size: 1.75rem; letter-spacing: -0.025em; }
.verify-title.ok { color: #16a34a; }
.verify-title.bad { color: #dc2626; }
.verify-heading { margin: 0 0 0.5rem; font-size: 1.5rem; letter-spacing: -0.025em; }
.verify-sub { margin: 0; max-width: 26rem; font-size: 0.9375rem; color: #71717a; }
.verify-form {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  max-width: 22rem;
  margin-top: 1.5rem;
}
.verify-input {
  flex: 1;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
}
.verify-again { margin: 0.25rem 0 0; font-size: 0.875rem; }
.verify-again a { font-weight: 600; }

/* Gallery: feature-on-ID-card toggle (one blob stars on the card). */
.card-star {
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  color: #71717a;
  padding: 0.5rem 0.625rem;
  border-radius: 9999px;
  border: 1px solid #e4e4e7;
  background: #ffffff;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
.card-star:hover { border-color: #f59e0b; color: #b45309; }
.card-star.on { background: #fffbeb; border-color: #fde68a; color: #b45309; }
.card-star.on:hover { border-color: #f59e0b; }

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root { --bg-base: #09090b; }
  body { color: #fafafa; background: #09090b; }
  .page { background: linear-gradient(135deg, #09090b 0%, #000000 50%, #18181b 100%); }
  .brand-name { color: #fafafa; }
  .brand-name .muted { color: #a1a1aa; }
  .source-link { color: #d4d4d8; }
  .source-link:hover { color: #fafafa; }
  .nav-link { color: #a1a1aa; }
  .nav-link:hover { color: #fafafa; }
  .user-chip { color: #e4e4e7; background: #18181b; border-color: #27272a; }
  a.user-chip:hover { border-color: #52525b; color: #fafafa; }
  .logout-btn { color: #a1a1aa; }
  .logout-btn:hover { color: #f87171; }

  .stage-frame { background: #09090b; border-color: #27272a; }
  .stage-blob { filter: drop-shadow(0 24px 40px rgba(0,0,0,0.6)); }
  .stage-glow { background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.04), transparent 60%); }
  .nametag { background: rgba(24,24,27,0.9); border-color: #27272a; }
  .nametag-name { color: #fafafa; }
  .nametag-pronouns { color: #a1a1aa; }

  .btn-primary { background: #ffffff; color: #18181b; }
  .btn-primary:hover { background: #e4e4e7; }
  .btn-nav { background: #fafafa; color: #18181b; }
  .btn-nav:hover { background: #d4d4d8; }
  .btn-secondary { background: #18181b; border-color: #27272a; color: #fafafa; }
  .btn-secondary:hover { border-color: #52525b; }

  .anim-chip { background: #18181b; border-color: #27272a; color: #a1a1aa; }
  .anim-chip:hover { border-color: #52525b; color: #fafafa; }
  .anim-chip.selected { background: #ffffff; color: #18181b; border-color: #ffffff; }

  .share-input { background: #18181b; border-color: #27272a; color: #d4d4d8; }
  .share-input:focus { border-color: #52525b; }

  .profile-card { background: #09090b; border-color: #27272a; }
  .pc-label { color: #a1a1aa; }
  .pc-val { color: #d4d4d8; }
  .pc-trait { background: #27272a; color: #e4e4e7; }

  .auth-card { background: #09090b; border-color: #27272a; }
  .auth-input,
  .auth-card input[type="text"],
  .auth-card input[type="password"] { background: #18181b; border-color: #27272a; color: #fafafa; }
  .auth-input:focus,
  .auth-card input[type="text"]:focus,
  .auth-card input[type="password"]:focus { border-color: #52525b; }
  .pw-rules li.ok, .email-status.ok, .auth-saved { color: #22c55e; }
  .auth-status { background: #18181b; border-color: #27272a; color: #a1a1aa; }
  .status-ally {
    --tier-dark: #60a5fa;
    --tier-bright: #bae6fd;
    --tier-border: #1e3a8a;
    --tier-bg: #101a2e;
  }
  .status-super_ally {
    --tier-dark: #4ade80;
    --tier-bright: #bbf7d0;
    --tier-border: #14532d;
    --tier-bg: #0d2117;
  }
  .status-ultimate_ally {
    --tier-dark: #fbbf24;
    --tier-bright: #fef08a;
    --tier-border: #78350f;
    --tier-bg: linear-gradient(120deg, #1f1607, #2b1d08, #1f1607);
  }

  .editor-card { background: #09090b; border-color: #27272a; }
  .tabs { border-color: #27272a; }
  .tab:hover { color: #d4d4d8; }
  .tab.active { color: #fafafa; }
  .tab.active::after { background: #ffffff; }

  .section-title { color: #a1a1aa; }
  .swatch.selected { box-shadow: 0 0 0 2px #09090b, 0 0 0 4px #ffffff; }
  .color-name { color: #a1a1aa; }
  .chip { background: #27272a; color: #e4e4e7; }
  .chip:hover { background: #3f3f46; }
  .chip.selected { background: #ffffff; color: #18181b; }
  .chip.selected:hover { background: #ffffff; }
  .section-search { background: #18181b; border-color: #27272a; color: #fafafa; }
  .section-search:focus { border-color: #52525b; box-shadow: 0 0 0 3px rgba(255,255,255,0.06); }
  .see-more { background: #6366f1; border-color: transparent; color: #ffffff; }
  .see-more:hover { background: #818cf8; }
  .section-empty { color: #71717a; }
  .chip.missing-chip { background: #ec4899; border-color: transparent; color: #ffffff; }
  .chip.missing-chip:hover { background: #f472b6; }
  .feedback-overlay { background: rgba(0, 0, 0, 0.6); }
  .feedback-modal { background: #09090b; border-color: #27272a; }
  .feedback-title { color: #fafafa; }
  .feedback-hint { color: #a1a1aa; }
  .feedback-link { color: #fafafa; }

  .field-label { color: #a1a1aa; }
  .input { background: #18181b; border-color: #27272a; color: #fafafa; }
  .input:focus { border-color: #52525b; box-shadow: 0 0 0 3px rgba(255,255,255,0.06); }

  .export-row { background: #18181b; border-color: #27272a; }
  .export-row:hover:not([disabled]) { border-color: #52525b; }
  .export-row .label { color: #fafafa; }
  .export-row .hint { color: #a1a1aa; }

  .gallery-title { color: #fafafa; }
  .card { background: #09090b; border-color: #27272a; }
  .card-new { background: transparent; color: #71717a; }
  .card-new:hover { border-color: #52525b; color: #fafafa; }
  .card-preview { background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.04), transparent 60%); }
  .card-name { color: #fafafa; }
  .card-delete { color: #71717a; }
  .card-delete:hover { color: #f87171; }

  .ticket-form { background: #09090b; border-color: #27272a; }
  .ticket-card { background: #09090b; border-color: #27272a; }
  .ticket-text { color: #d4d4d8; }
  .ticket-queue { color: #e4e4e7; background: #18181b; border-color: #27272a; }
  .ticket-response { border-left-color: #27272a; }
  .ticket-status.status-received { background: #172554; color: #93c5fd; border-color: #1e3a8a; }
  .ticket-status.status-reviewed { background: #422006; color: #fcd34d; border-color: #713f12; }
  .ticket-status.status-implemented { background: #052e16; color: #86efac; border-color: #14532d; }
  .ticket-status.status-not-implemented { background: #18181b; color: #a1a1aa; border-color: #27272a; }
  .ticket-remove-btn { background: #09090b; color: #f87171; border-color: #7f1d1d; }
  .ticket-remove-btn:hover { background: #1f0a0a; border-color: #991b1b; }

  /* Digital ID card — the card itself is jewel-toned in both schemes;
     only the page chrome around it needs a dark pass. */
  .idcard { border-color: rgba(255, 255, 255, 0.22); }
  .verify-heading { color: #fafafa; }
  .verify-sub { color: #a1a1aa; }
  .verify-title.ok { color: #22c55e; }
  .verify-title.bad { color: #f87171; }
  .verify-mark.ok circle { fill: #052e16; stroke: #22c55e; }
  .verify-mark.ok path { stroke: #22c55e; }
  .verify-mark.bad circle { fill: #450a0a; stroke: #f87171; }
  .verify-mark.bad path { stroke: #f87171; }
  .card-star { background: #18181b; border-color: #27272a; color: #a1a1aa; }
  .card-star:hover { border-color: #b45309; color: #fbbf24; }
  .card-star.on { background: #2b1d08; border-color: #78350f; color: #fbbf24; }
  .card-star.on:hover { border-color: #b45309; }
}
