:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --ink: #1c1c1e;
  --muted: #66666c;
  --line: #d9d8d2;
  --accent: #1f2a44;
  --accent-ink: #ffffff;
  --error: #b3261e;
  --notice-bg: #fff4d6;
  --notice-ink: #5c4300;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131315;
    --surface: #1e1e21;
    --ink: #f3f3f4;
    --muted: #a3a3a9;
    --line: #38383d;
    --accent: #e8e6df;
    --accent-ink: #18181a;
    --error: #ff8a80;
    --notice-bg: #3a3010;
    --notice-ink: #f6dd93;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

[hidden] { display: none !important; }

.page { max-width: 960px; margin: 0 auto; padding: 32px 16px 64px; }
.intro h1 { margin: 0; font-size: 2rem; letter-spacing: -0.02em; }
.intro p { margin: 4px 0 24px; color: var(--muted); }

.notice {
  margin: 0 0 24px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--notice-bg);
  color: var(--notice-ink);
}

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

@media (min-width: 800px) {
  .layout { grid-template-columns: 360px minmax(0, 1fr); gap: 48px; align-items: start; }
  .preview-pane { position: sticky; top: 24px; }
}

/* Live pass preview */
.card {
  --card-bg: #1f2a44;
  --card-fg: #ffffff;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 14px;
  background: var(--card-bg);
  color: var(--card-fg);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.card-head { padding: 14px 16px; min-height: 50px; }
.card-title { font-size: 1.05rem; font-weight: 600; overflow-wrap: anywhere; }

.card-strip { position: relative; aspect-ratio: 375 / 144; overflow: hidden; }
.card[data-style="eventTicket"] .card-strip { aspect-ratio: 375 / 98; }
.card-strip img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-strip img[data-fit="contain"] { object-fit: contain; }

.card-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  opacity: 0.55;
  background: repeating-linear-gradient(135deg, rgba(127, 127, 127, 0.16) 0 10px, transparent 10px 20px);
}

.card-primary { position: absolute; left: 16px; right: 16px; bottom: 10px; }
.card-primary .value { display: block; font-size: 1.5rem; line-height: 1.15; overflow-wrap: anywhere; }

/* Wallet puts generic passes' art in a small thumbnail beside the main text. */
.card[data-style="generic"] .card-strip {
  aspect-ratio: auto;
  min-height: 98px;
  padding: 4px 112px 4px 16px;
}
.card[data-style="generic"] .card-strip img,
.card[data-style="generic"] .card-empty {
  inset: 4px 16px auto auto;
  width: 90px;
  height: 90px;
  border-radius: 4px;
}
.card[data-style="generic"] .card-primary { position: static; }

.label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card-fields {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  padding: 12px 16px;
  overflow-wrap: anywhere;
}
.card-fields > div:last-child { text-align: right; }

.card-barcode { padding: 0 16px 18px; }
.card-barcode svg {
  display: block;
  width: 112px;
  height: 112px;
  margin: 0 auto;
  padding: 8px;
  border-radius: 6px;
  background: #ffffff;
  fill: #000000;
}

.preview-note { margin: 12px 0 0; text-align: center; font-size: 0.8rem; color: var(--muted); }

/* Form */
.form { display: grid; gap: 18px; min-width: 0; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend, .field > span { display: block; margin-bottom: 6px; padding: 0; font-size: 0.86rem; font-weight: 600; }
.field { display: block; min-width: 0; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }

input:not([type="radio"]):not([type="file"]), select, textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
input[type="color"] { height: 46px; padding: 4px; cursor: pointer; }
textarea { resize: vertical; }

.drop {
  display: block;
  padding: 22px 16px;
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-align: center;
  cursor: pointer;
}
.drop:hover, .drop.dragging, .drop:focus-within { border-color: var(--ink); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop strong { display: block; overflow-wrap: anywhere; }
.drop span { color: var(--muted); font-size: 0.86rem; }

.segments {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.segments input { position: absolute; opacity: 0; }
.segments span {
  display: block;
  padding: 8px 4px;
  border-radius: 7px;
  text-align: center;
  font-size: 0.9rem;
  cursor: pointer;
}
.segments input:checked + span { background: var(--accent); color: var(--accent-ink); }
.segments input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 1px; }

.primary, .wallet {
  display: block;
  width: 100%;
  padding: 14px;
  border: 0;
  border-radius: 11px;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.primary { background: var(--accent); color: var(--accent-ink); }
.primary:disabled { opacity: 0.45; cursor: not-allowed; }
.wallet { background: #000000; color: #ffffff; border: 1px solid #55555a; }

.error { margin: 0; color: var(--error); font-size: 0.92rem; }
.result p { margin: 8px 0 0; color: var(--muted); font-size: 0.86rem; text-align: center; }
