:root {
  color-scheme: dark;
  --bg: #050b1a;
  --surface: #0d1b2a;
  --surface-strong: #12243a;
  --surface-soft: #091426;
  --border: #293b52;
  --border-strong: #435773;
  --text: #f5f7fb;
  --muted: #aebbd0;
  --gold: #ffd700;
  --gold-dark: #d8b700;
  --teal: #27d4d6;
  --pink: #ff79b8;
  --success: #5de39b;
  --warning: #ffc35b;
  --danger: #ff808b;
  --info: #85b9ff;
  --focus: #fff3a1;
  --shadow: 0 24px 70px rgb(0 0 0 / 35%);
  --radius: 14px;
  --radius-small: 9px;
  --content: 1120px;
  font-family: Inter, "Noto Sans CJK TC", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 8%, rgb(39 212 214 / 10%), transparent 34rem),
    radial-gradient(circle at 86% 12%, rgb(255 215 0 / 9%), transparent 28rem),
    var(--bg);
  line-height: 1.6;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgb(255 255 255 / 2%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 2%) 1px, transparent 1px);
  background-size: 42px 42px;
  content: "";
  mask-image: linear-gradient(to bottom, black, transparent 70%);
}

a {
  color: var(--teal);
  text-underline-offset: 0.2em;
}

a:hover {
  color: #83f5f6;
}

button,
input {
  font: inherit;
}

button,
.button {
  min-height: 44px;
}

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

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 20;
  padding: 10px 14px;
  border-radius: var(--radius-small);
  color: #07101e;
  background: var(--gold);
  font-weight: 800;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.reference-strip {
  padding: 6px 16px;
  border-bottom: 1px solid rgb(255 215 0 / 30%);
  color: var(--gold);
  background: #17170d;
  text-align: center;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.identity-header {
  min-height: 64px;
  border-bottom: 1px solid var(--border);
  background: rgb(5 11 26 / 88%);
}

.header-inner {
  display: flex;
  width: min(calc(100% - 32px), var(--content));
  min-height: 64px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgb(255 215 0 / 55%);
  border-radius: 11px;
  color: var(--gold);
  background: rgb(255 215 0 / 8%);
  font-size: 0.76rem;
}

.identity-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 18px;
  font-size: 0.9rem;
}

.identity-nav a {
  color: var(--muted);
  text-decoration: none;
}

.identity-nav a[aria-current="page"] {
  color: var(--gold);
}

.shell {
  width: min(calc(100% - 32px), var(--content));
  margin: 0 auto;
  padding: 48px 0 64px;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(340px, 1.08fr);
  gap: 48px;
  align-items: start;
}

.intro {
  padding: 32px 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

h2 {
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.35;
}

h3 {
  margin: 0;
  font-size: 1rem;
}

.lead {
  max-width: 38rem;
  margin: 20px 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.trust-list {
  display: grid;
  margin: 28px 0 0;
  padding: 0;
  gap: 14px;
  list-style: none;
}

.trust-list li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  color: var(--muted);
}

.trust-list strong {
  color: var(--text);
}

.trust-icon {
  color: var(--gold);
  font-weight: 900;
}

.auth-card,
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(150deg, rgb(18 36 58 / 96%), rgb(9 20 38 / 98%));
  box-shadow: var(--shadow);
}

.auth-card {
  padding: 28px;
}

.card-head {
  margin-bottom: 22px;
}

.card-head p {
  margin: 7px 0 0;
  color: var(--muted);
}

.provider-button,
.button {
  display: inline-flex;
  width: 100%;
  padding: 11px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-small);
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--text);
  background: var(--surface-strong);
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  border-color: var(--gold);
  color: #181400;
  background: var(--gold);
}

.button.secondary {
  width: auto;
}

.button[aria-disabled="true"],
button:disabled {
  border-color: var(--border);
  color: #7e8aa0;
  background: #142033;
  cursor: not-allowed;
  opacity: 0.76;
}

.provider-button::before {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 7px;
  color: #07101e;
  background: var(--text);
  content: "C";
  font-size: 0.76rem;
  font-weight: 900;
}

.divider {
  display: grid;
  margin: 20px 0;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.78rem;
}

.divider::before,
.divider::after {
  height: 1px;
  background: var(--border);
  content: "";
}

.field {
  margin-top: 16px;
}

.field label,
.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.88rem;
  font-weight: 750;
}

.field input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-small);
  color: var(--text);
  background: #071222;
}

.field input::placeholder {
  color: #78869c;
}

.field input[aria-invalid="true"] {
  border-color: var(--danger);
}

.field-help,
.fine-print {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.field-error {
  margin: 6px 0 0;
  color: var(--danger);
  font-size: 0.84rem;
  font-weight: 700;
}

.check-row {
  display: grid;
  margin: 16px 0;
  grid-template-columns: 20px 1fr;
  align-items: start;
  gap: 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.check-row input {
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  accent-color: var(--gold);
}

.form-actions {
  display: grid;
  margin-top: 22px;
  gap: 12px;
}

.auth-foot {
  margin: 20px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

.security-note,
.state-card,
.notice {
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  border-radius: var(--radius-small);
  background: rgb(9 20 38 / 86%);
}

.security-note {
  margin-top: 20px;
  padding: 14px 16px;
  color: var(--muted);
  font-size: 0.84rem;
}

.security-note strong {
  color: var(--text);
}

.state-gallery {
  display: grid;
  margin-top: 40px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.state-card {
  min-height: 142px;
  padding: 16px;
}

.state-card h2,
.state-card h3 {
  font-size: 0.92rem;
}

.state-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.state-card.error {
  border-left-color: var(--danger);
}

.state-card.forbidden {
  border-left-color: var(--pink);
}

.state-card.stale {
  border-left-color: var(--warning);
}

.state-card.loading {
  border-left-color: var(--teal);
}

.skeleton {
  height: 10px;
  margin-top: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1c2d43 25%, #334761 50%, #1c2d43 75%);
  background-size: 200% 100%;
  animation: shimmer 1.7s linear infinite;
}

.skeleton.short {
  width: 64%;
}

.request-ref,
.mono,
code {
  font-family: Consolas, "SFMono-Regular", monospace;
  font-variant-numeric: tabular-nums;
}

.request-ref {
  color: var(--info);
}

.steps {
  display: grid;
  margin: 0 0 28px;
  padding: 0;
  grid-template-columns: repeat(3, 1fr);
  list-style: none;
  counter-reset: step;
}

.steps.steps-four {
  grid-template-columns: repeat(4, 1fr);
}

.steps li {
  position: relative;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  counter-increment: step;
}

.steps li::before {
  display: grid;
  z-index: 1;
  width: 30px;
  height: 30px;
  margin: 0 auto;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface);
  content: counter(step);
  font-weight: 800;
}

.steps li::after {
  position: absolute;
  top: 15px;
  right: 50%;
  width: 100%;
  height: 1px;
  z-index: 0;
  background: var(--border);
  content: "";
}

.steps li:first-child::after {
  content: none;
}

.steps .active,
.steps .complete {
  color: var(--text);
}

.steps .active::before {
  border-color: var(--gold);
  color: #181400;
  background: var(--gold);
}

.steps .complete::before {
  border-color: var(--success);
  color: #06160e;
  background: var(--success);
  content: "✓";
}

.document-list {
  display: grid;
  margin: 18px 0;
  gap: 10px;
}

.document-row {
  display: grid;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  grid-template-columns: 20px 1fr auto;
  align-items: start;
  gap: 10px;
  background: rgb(5 11 26 / 48%);
}

.document-row input {
  width: 17px;
  height: 17px;
  margin: 4px 0 0;
  accent-color: var(--gold);
}

.document-row small {
  display: block;
  color: var(--muted);
}

.version {
  display: inline-flex;
  padding: 3px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  align-items: center;
  color: var(--info);
  background: rgb(133 185 255 / 8%);
  font-size: 0.74rem;
  white-space: nowrap;
}

.verification-list {
  display: grid;
  margin: 20px 0;
  padding: 0;
  gap: 10px;
  list-style: none;
}

.verification-item {
  display: grid;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  background: rgb(5 11 26 / 46%);
}

.verification-item .icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  color: #06160e;
  background: var(--success);
  font-size: 0.78rem;
  font-weight: 900;
}

.verification-item.pending .icon {
  color: #181400;
  background: var(--warning);
}

.verification-item.waiting .icon {
  color: var(--info);
  background: rgb(133 185 255 / 12%);
}

.status {
  font-size: 0.76rem;
  font-weight: 800;
}

.status.success {
  color: var(--success);
}

.status.warning {
  color: var(--warning);
}

.status.info {
  color: var(--info);
}

.masked-uid {
  display: inline-flex;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--gold);
  background: #071222;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

.token-demo {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 20px;
}

.qr-placeholder {
  display: grid;
  width: 132px;
  aspect-ratio: 1;
  place-items: center;
  border: 10px solid var(--text);
  color: var(--text);
  background:
    linear-gradient(45deg, transparent 42%, currentColor 43% 57%, transparent 58%),
    linear-gradient(-45deg, transparent 42%, currentColor 43% 57%, transparent 58%),
    #071222;
  box-shadow: inset 0 0 0 8px #071222;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.qr-placeholder span {
  padding: 5px 8px;
  color: #071222;
  background: var(--text);
}

.token-code {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--gold);
  background: #071222;
  overflow-wrap: anywhere;
}

.state-card.success {
  border-left-color: var(--success);
}

.result-heading {
  display: grid;
  gap: 14px;
  text-align: center;
}

.result-icon {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 0 auto;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--success);
  background: rgb(93 227 155 / 9%);
  font-size: 1.6rem;
  font-weight: 900;
}

.result-card {
  padding: 28px;
}

.result-card.ineligible .result-icon {
  color: var(--warning);
  background: rgb(255 195 91 / 9%);
}

.result-card.unavailable .result-icon {
  color: var(--info);
  background: rgb(133 185 255 / 9%);
}

.result-grid {
  display: grid;
  margin-top: 22px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.result-card.secondary-result {
  box-shadow: none;
}

.result-card.secondary-result h2 {
  font-size: 1.05rem;
}

.meta-list {
  display: grid;
  margin: 20px 0 0;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  font-size: 0.88rem;
}

.meta-list dt {
  color: var(--muted);
}

.meta-list dd {
  margin: 0;
}

.legal-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.legal-nav {
  position: sticky;
  top: 24px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgb(9 20 38 / 92%);
}

.legal-nav strong {
  display: block;
  margin-bottom: 10px;
}

.legal-nav a {
  display: block;
  padding: 8px 0;
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
}

.legal-document {
  padding: 34px;
}

.document-meta {
  display: flex;
  margin: 18px 0 28px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px 24px;
  color: var(--muted);
  font-size: 0.86rem;
}

.legal-document section {
  scroll-margin-top: 24px;
}

.legal-document section + section {
  margin-top: 34px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.legal-document li {
  margin: 8px 0;
  color: var(--muted);
}

.notice {
  margin: 18px 0;
  padding: 14px 16px;
  color: var(--muted);
}

.notice.warning {
  border-left-color: var(--warning);
}

.notice.danger {
  border-left-color: var(--danger);
}

.notice strong {
  color: var(--text);
}

.identity-footer {
  padding: 24px 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
  font-size: 0.78rem;
}

.identity-footer nav {
  display: flex;
  margin-bottom: 8px;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
}

.identity-footer a {
  color: var(--muted);
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@media (max-width: 900px) {
  .auth-layout,
  .legal-layout {
    grid-template-columns: 1fr;
  }

  .intro {
    padding: 0;
  }

  .state-gallery,
  .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .legal-nav {
    position: static;
  }
}

@media (max-width: 640px) {
  .identity-header,
  .header-inner {
    min-height: 56px;
  }

  .header-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 10px 0;
    gap: 8px;
  }

  .identity-nav {
    justify-content: flex-start;
  }

  .shell {
    padding: 30px 0 48px;
  }

  .auth-card,
  .result-card,
  .legal-document {
    padding: 20px;
  }

  .state-gallery,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .document-row {
    grid-template-columns: 20px 1fr;
  }

  .document-row .version {
    grid-column: 2;
    justify-self: start;
  }

  .verification-item {
    grid-template-columns: 28px 1fr;
  }

  .verification-item .status {
    grid-column: 2;
  }

  .meta-list {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .meta-list dd + dt {
    margin-top: 10px;
  }

  .token-demo {
    grid-template-columns: 1fr;
  }
}

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

  .skeleton {
    animation: none;
  }
}

@media print {
  :root {
    color-scheme: light;
  }

  body {
    color: #111;
    background: #fff;
  }

  body::before,
  .reference-strip,
  .identity-header,
  .legal-nav,
  .identity-footer,
  .state-gallery,
  .security-note {
    display: none;
  }

  .shell {
    width: 100%;
    padding: 0;
  }

  .legal-layout {
    display: block;
  }

  .legal-document {
    border: 0;
    color: #111;
    background: #fff;
    box-shadow: none;
  }

  .legal-document li,
  .document-meta,
  .notice {
    color: #333;
  }
}
