:root {
  color-scheme: dark;
  --paper: #e6dcc6;
  --paper-soft: rgba(230, 220, 198, 0.16);
  --paper-line: rgba(230, 220, 198, 0.26);
  --ink: #0f1620;
  --ink-soft: #27303b;
  --rail: #162938;
  --rail-bright: #21465d;
  --signal: #2f8e86;
  --signal-soft: rgba(47, 142, 134, 0.18);
  --danger: #a3472f;
  --danger-soft: rgba(163, 71, 47, 0.18);
  --warning: #bf7c1f;
  --warning-soft: rgba(191, 124, 31, 0.18);
  --muted: #9aa8b7;
  --muted-soft: rgba(154, 168, 183, 0.18);
  --line: rgba(255, 255, 255, 0.1);
  --surface: rgba(12, 18, 26, 0.94);
  --surface-raised: rgba(18, 26, 37, 0.98);
  --shadow: 0 24px 56px rgba(0, 0, 0, 0.4);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(47, 142, 134, 0.16), transparent 34%),
    radial-gradient(circle at 85% 12%, rgba(191, 124, 31, 0.12), transparent 24%),
    linear-gradient(180deg, #0d141c 0%, #0a0f15 100%);
  color: var(--paper);
}

button,
a,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 3px;
}

.app-shell {
  width: min(100%, 620px);
  margin: 0 auto;
  padding: 32px 18px 56px;
}

.masthead {
  padding: 4px 6px 20px;
}

.kicker,
.eyebrow,
.rail-label,
.label,
.panel__caption,
.field__label {
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.kicker,
.eyebrow,
.label,
.panel__caption,
.field__label {
  margin: 0;
  font-size: 0.74rem;
  color: var(--muted);
}

.masthead h1,
.panel h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.masthead h1 {
  margin-top: 10px;
  font-size: clamp(2.4rem, 8vw, 4.2rem);
  line-height: 0.95;
}

.lead {
  max-width: 42ch;
  margin: 14px 0 0;
  color: #d4cbb7;
  font-size: 0.98rem;
  line-height: 1.7;
}

.pass-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.pass-card {
  position: relative;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  overflow: hidden;
}

.pass-card::after {
  content: "";
  position: absolute;
  inset: 16px auto 16px 76px;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(230, 220, 198, 0.34), transparent);
}

.pass-card__rail {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 18px 0;
  background:
    linear-gradient(180deg, rgba(33, 70, 93, 0.88), rgba(22, 41, 56, 0.96)),
    repeating-linear-gradient(180deg, rgba(230, 220, 198, 0.04) 0 9px, transparent 9px 18px);
}

.pass-card__rail::before,
.pass-card__rail::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #0a0f15;
  box-shadow: 0 0 0 1px rgba(230, 220, 198, 0.06);
}

.pass-card__rail::before {
  top: -22px;
}

.pass-card__rail::after {
  bottom: -22px;
}

.rail-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 0.72rem;
  color: rgba(230, 220, 198, 0.82);
}

.pass-card__body {
  padding: 22px 20px 24px;
}

.pair-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 14px;
}

.pair {
  min-width: 0;
}

.value {
  margin: 8px 0 0;
  color: #fbf6ec;
  font-size: 1rem;
  line-height: 1.5;
}

.value--mono {
  font-family: "Consolas", "SFMono-Regular", "Liberation Mono", monospace;
  font-size: 0.95rem;
  word-break: break-all;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
}

.badge--success {
  background: var(--signal-soft);
  color: #8ce2d8;
}

.badge--warning {
  background: var(--warning-soft);
  color: #f2bc68;
}

.badge--danger {
  background: var(--danger-soft);
  color: #ef9a82;
}

.badge--muted {
  background: var(--muted-soft);
  color: #c2cddb;
}

.status-banner {
  margin-top: 22px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}

.status-banner--info {
  background: rgba(33, 70, 93, 0.24);
  border-color: rgba(121, 169, 201, 0.24);
}

.status-banner--success {
  background: var(--signal-soft);
  border-color: rgba(140, 226, 216, 0.18);
}

.status-banner--warning {
  background: var(--warning-soft);
  border-color: rgba(242, 188, 104, 0.16);
}

.status-banner--danger {
  background: var(--danger-soft);
  border-color: rgba(239, 154, 130, 0.16);
}

.status-banner__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.status-banner__text {
  margin: 8px 0 0;
  color: #dfd5c2;
  font-size: 0.94rem;
  line-height: 1.65;
}

.panel {
  margin-top: 18px;
  padding: 20px;
}

.panel__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.panel__header--stack {
  flex-direction: column;
}

.panel h2 {
  margin-top: 8px;
  font-size: 1.5rem;
}

.panel__caption {
  max-width: 24ch;
  line-height: 1.6;
}

.resource-box {
  margin-top: 18px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.resource-link {
  display: block;
  color: #9fefe5;
  text-decoration: none;
  word-break: break-all;
  line-height: 1.8;
}

.resource-link:hover {
  text-decoration: underline;
}

.action-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}

.action-row--dual {
  margin-top: 16px;
}

.button,
.link-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.button:hover,
.link-button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.64;
  cursor: wait;
  transform: none;
}

.button--primary,
.link-button {
  background: var(--paper);
  border-color: var(--paper);
  color: var(--ink);
  font-weight: 700;
}

.button--ghost {
  background: transparent;
  border-color: var(--paper-line);
  color: var(--paper);
}

.button--danger {
  background: transparent;
  border-color: rgba(239, 154, 130, 0.34);
  color: #ef9a82;
}

.button--compact {
  min-height: 42px;
  padding: 0 18px;
}

.meta-grid,
.input-grid {
  display: grid;
  gap: 14px;
}

.meta-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 18px 0 0;
}

.meta-item {
  min-width: 0;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.meta-item dd,
.meta-item dt {
  margin: 0;
}

.meta-item dd {
  margin-top: 10px;
}

.admin-body {
  margin-top: 16px;
}

.admin-mode__title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
}

.field {
  display: grid;
  gap: 8px;
}

.input {
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid rgba(230, 220, 198, 0.14);
  border-radius: var(--radius-sm);
  background: rgba(7, 12, 17, 0.86);
  color: #f7f1e5;
}

.input::placeholder {
  color: #738191;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 20;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(15, 22, 32, 0.94);
  border: 1px solid rgba(230, 220, 198, 0.16);
  color: var(--paper);
  transform: translate(-50%, 10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast--visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.hidden {
  display: none !important;
}

@media (max-width: 640px) {
  .app-shell {
    padding: 20px 14px 40px;
  }

  .pass-card {
    grid-template-columns: 60px minmax(0, 1fr);
  }

  .pass-card::after {
    left: 60px;
  }

  .pass-card__body,
  .panel {
    padding: 18px 16px;
  }

  .pair-grid,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .panel__header {
    flex-direction: column;
  }

  .panel__caption {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
