:root {
  --bg: #f4efe3;
  --bg-accent: #d3e7e3;
  --ink: #15222f;
  --muted: #596675;
  --panel: rgba(255, 252, 246, 0.88);
  --panel-strong: rgba(255, 248, 236, 0.96);
  --line: rgba(21, 34, 47, 0.12);
  --gold: #c58f10;
  --gold-soft: #f6df9b;
  --freedom: #187a8f;
  --freedom-soft: #9fe5ed;
  --shadow: 0 24px 80px rgba(24, 35, 46, 0.14);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --font-sans: "Bahnschrift", "Segoe UI Variable Text", "Yu Gothic UI", "Microsoft YaHei UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-sans);
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(24, 122, 143, 0.18), transparent 36%),
    radial-gradient(circle at top right, rgba(197, 143, 16, 0.18), transparent 30%),
    linear-gradient(180deg, #f9f4ea 0%, var(--bg) 42%, #efe6d8 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(21, 34, 47, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 34, 47, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 85%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 24px;
}

.hero-copy,
.hero-panel,
.modal,
.dxpass-card,
.json-panel {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero-copy,
.hero-panel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: var(--panel);
}

.hero-copy {
  padding: 36px;
}

.hero-copy-compact {
  padding: 20px 24px;
}

.hero-copy::after,
.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto -40px -70px auto;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(197, 143, 16, 0.32), rgba(24, 122, 143, 0.08));
  filter: blur(14px);
}

.hero-copy-compact::after,
.hero-panel-wide::after {
  display: none;
}

.eyebrow,
.section-kicker,
.modal-kicker {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero h1,
.section-header h2,
.modal h2 {
  margin: 0;
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.hero h1 {
  max-width: none;
  font-size: clamp(28px, 4vw, 42px);
}

.hero-text,
.section-note,
.modal-description,
.card-subtitle {
  color: var(--muted);
}

.hero-panel {
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(220px, 1fr) minmax(220px, 320px);
  gap: 14px;
  align-items: start;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field span {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.field input {
  width: 100%;
  border: 1px solid rgba(21, 34, 47, 0.12);
  border-radius: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.field input:focus,
.select-field:focus {
  border-color: rgba(24, 122, 143, 0.54);
  box-shadow: 0 0 0 4px rgba(24, 122, 143, 0.1);
  transform: translateY(-1px);
}

.select-field {
  width: 100%;
  border: 1px solid rgba(21, 34, 47, 0.12);
  border-radius: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.type-switch,
.copy-button {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.type-switch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(21, 34, 47, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.type-switch-track {
  position: absolute;
  top: 6px;
  left: 6px;
  width: calc(50% - 6px);
  height: calc(100% - 12px);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(236, 245, 243, 0.98));
  box-shadow:
    0 8px 18px rgba(21, 34, 47, 0.08),
    inset 0 0 0 1px rgba(21, 34, 47, 0.06);
  transition: transform 0.22s ease;
}

.type-switch[data-type="Freedom"] .type-switch-track {
  transform: translateX(100%);
}

.type-switch-option,
.copy-button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  background: transparent;
  color: var(--muted);
  position: relative;
  z-index: 1;
}

.type-switch-option.is-active {
  color: var(--ink);
}

.filter-block {
  display: grid;
  gap: 10px;
  grid-column: 1 / -1;
  min-width: 0;
}

.filter-block-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.filter-block-head strong {
  color: var(--ink);
  font-size: 12px;
}

.filter-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  border: 1px solid rgba(21, 34, 47, 0.12);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.filter-chip.is-active {
  color: var(--ink);
  border-color: rgba(21, 34, 47, 0.24);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(236, 245, 243, 0.98));
  box-shadow: inset 0 0 0 1px rgba(21, 34, 47, 0.05);
}

.filter-chip:hover,
.type-switch-option:hover,
.copy-button:hover,
.dxpass-card:hover {
  transform: translateY(-2px);
}

.meta-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  grid-column: 1 / -1;
}

.meta-strip > div {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(21, 34, 47, 0.08);
}

.meta-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.meta-strip strong {
  font-size: 24px;
  letter-spacing: -0.03em;
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 22px;
}

.section-note {
  max-width: 38ch;
  margin: 0;
  text-align: right;
  line-height: 1.6;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.dxpass-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-lg);
  text-align: left;
  background: linear-gradient(180deg, var(--panel-strong), rgba(255, 251, 242, 0.9));
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.preview-frame {
  position: relative;
  padding: 10px;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(21, 34, 47, 0.03), rgba(21, 34, 47, 0.08)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(234, 240, 236, 0.88));
  overflow: hidden;
}

.preview-frame::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 12px;
  border: 1px dashed rgba(21, 34, 47, 0.12);
}

.pass-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 256 / 352;
  border-radius: 14px;
  overflow: hidden;
  isolation: isolate;
  background: rgba(21, 34, 47, 0.04);
}

.pass-preview .layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: auto;
}

.layer-frame {
  z-index: 3;
}

.layer-character {
  z-index: 2;
}

.layer-background {
  z-index: 1;
}

.card-body {
  display: grid;
  gap: 8px;
}

.card-topline {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.type-pill,
.generation-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.type-pill[data-type="Gold"] {
  background: linear-gradient(180deg, #fbf1c8, var(--gold-soft));
  color: #6d5304;
}

.type-pill[data-type="Freedom"] {
  background: linear-gradient(180deg, #d9f8fb, var(--freedom-soft));
  color: #0f5a69;
}

.generation-tag {
  border: 1px solid rgba(21, 34, 47, 0.08);
  color: #24424a;
  background: rgba(211, 231, 227, 0.84);
}

.card-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.card-subtitle {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}

.modal-facts div {
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(21, 34, 47, 0.08);
}

.modal-facts dt {
  margin: 0 0 6px;
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.modal-facts dd {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  word-break: break-word;
}

.variant-panel {
  display: grid;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 42px 24px;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(21, 34, 47, 0.18);
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.52);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  padding: 32px 16px;
  display: grid;
  place-items: center;
  background: rgba(18, 27, 36, 0.6);
  backdrop-filter: blur(14px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  position: relative;
  width: min(1100px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 30px;
  padding: 28px;
  background: linear-gradient(180deg, rgba(255, 251, 243, 0.98), rgba(247, 241, 230, 0.98));
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  font-size: 28px;
  line-height: 1;
  background: rgba(21, 34, 47, 0.08);
  color: var(--ink);
}

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

.modal-preview {
  position: sticky;
  top: 0;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(21, 34, 47, 0.08);
}

.pass-preview-large {
  max-width: 320px;
  margin: 0 auto;
}

.modal-content {
  display: grid;
  gap: 16px;
}

.modal-description {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
}

.modal-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.json-panel {
  border-radius: 22px;
  overflow: hidden;
  background: rgba(22, 33, 44, 0.96);
  color: #f4f0e3;
}

.json-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.json-header span {
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
}

.copy-button {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: #f6f1e5;
}

.copy-button.is-copied {
  background: rgba(159, 229, 237, 0.18);
  border-color: rgba(159, 229, 237, 0.38);
}

#jsonOutput {
  margin: 0;
  padding: 18px;
  overflow: auto;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 14px;
  line-height: 1.65;
}

@media (max-width: 980px) {
  .hero-panel,
  .modal-layout {
    grid-template-columns: 1fr;
  }

  .modal-preview {
    position: static;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 16px, 100%);
    padding-top: 12px;
    padding-bottom: 28px;
  }

  .hero-copy,
  .hero-panel,
  .dxpass-card,
  .modal {
    border-radius: 22px;
  }

  .hero-copy,
  .hero-panel,
  .modal {
    padding: 18px;
  }

  .modal-facts {
    grid-template-columns: 1fr;
  }

  .meta-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .meta-strip strong {
    font-size: 20px;
  }

  .type-switch {
    width: 100%;
  }

  .filter-chip-group {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .section-header {
    align-items: start;
    flex-direction: column;
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .dxpass-card {
    padding: 12px;
  }

  .card-title {
    font-size: 16px;
  }

  .card-subtitle {
    font-size: 12px;
  }

  .modal-backdrop {
    padding: 8px;
  }

  .modal {
    max-height: calc(100vh - 16px);
    border-radius: 22px;
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  }

  .modal-close {
    top: 12px;
    right: 12px;
  }

  #jsonOutput {
    font-size: 12px;
    line-height: 1.55;
  }
}
