:root {
  color-scheme: dark;
  --page-bg: #000000;
  --surface: rgba(28, 28, 30, 0.72);
  --ink: #f5f5f7;
  --muted: #a1a1a6;
  --hairline: rgba(255, 255, 255, 0.14);
  --pass-ink: #ffffff;
  --pass-muted: rgba(255, 255, 255, 0.88);
  --pass-line: rgba(255, 255, 255, 0.24);
  --accent: #0a84ff;
  --danger: #ff453a;
  --ok: #30d158;
  --warn: #ffd60a;
  --shadow: 0 34px 86px rgba(0, 0, 0, 0.72), 0 9px 28px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page-bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(84, 92, 110, 0.18), rgba(0, 0, 0, 0) 42%),
    linear-gradient(180deg, #111114 0%, #050506 36%, #000000 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "YuGothic", "Segoe UI", sans-serif;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(26px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.ticket-panel {
  width: min(100%, 410px);
  display: grid;
  gap: 16px;
}

.page-header {
  display: grid;
  gap: 4px;
  padding: 8px 4px 2px;
}

.system-name,
.wallet-note,
.loading-view p,
.error-view p,
.pass-label {
  margin: 0;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.12;
  font-weight: 800;
}

h2 {
  font-size: clamp(18px, 5.2vw, 24px);
  line-height: 1.14;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.ticket-view {
  display: grid;
  gap: 14px;
}

.pass-preview {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1074 / 1536;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  gap: 15px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 22px;
  background: url("/assets/pass/background@3x.png") center / cover no-repeat;
  color: var(--pass-ink);
  box-shadow: var(--shadow);
}

.pass-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -54px 88px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(255, 255, 255, 0.04);
}

.pass-preview > * {
  position: relative;
  z-index: 1;
}

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

.pass-brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--pass-ink);
  font-size: 16px;
  font-weight: 700;
}

.pass-symbol {
  width: 28px;
  height: 28px;
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--pass-ink);
}

.pass-symbol svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.pass-gid {
  display: grid;
  justify-items: end;
  gap: 2px;
  color: var(--pass-muted);
  text-align: right;
  font-size: 11px;
  font-weight: 600;
}

.pass-gid strong {
  color: var(--pass-ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.pass-event {
  display: grid;
  gap: 4px;
  padding-top: 6px;
}

.pass-label,
dt {
  color: var(--pass-muted);
  font-size: 11px;
  font-weight: 600;
}

.pass-timing,
.pass-details {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
}

.pass-timing {
  grid-template-columns: 1fr 1fr 1fr;
}

.pass-details {
  grid-template-columns: 1fr 1fr 1fr;
}

.pass-timing div,
.pass-details div {
  min-width: 0;
}

.pass-timing div:nth-child(2),
.pass-details div:nth-child(2) {
  text-align: center;
}

.pass-timing div:nth-child(3),
.pass-details div:nth-child(3) {
  text-align: right;
}

dd {
  min-width: 0;
  margin: 4px 0 0;
  color: var(--pass-ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.pass-timing dd,
.pass-details dd {
  overflow: hidden;
  overflow-wrap: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-wrap {
  display: flex;
  justify-content: center;
  align-self: end;
  padding-top: 0;
}

.qr-box {
  width: min(100%, 184px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #fff;
  padding: 9px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.qr-box svg {
  width: 100%;
  height: 100%;
  display: block;
}

.wallet-actions {
  display: grid;
  gap: 8px;
  padding: 2px;
}

.wallet-button {
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: linear-gradient(180deg, #242428, #0b0b0d);
  color: #fff;
  text-decoration: none;
  font-size: 17px;
  font-weight: 800;
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.wallet-button:focus-visible {
  outline: 3px solid rgba(10, 132, 255, 0.36);
  outline-offset: 3px;
}

.wallet-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
}

.wallet-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.wallet-note {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.loading-view,
.error-view {
  min-height: 520px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  border: 1px solid var(--hairline);
  border-radius: 18px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
  box-shadow: 0 20px 52px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(22px);
}

.loader {
  width: 34px;
  height: 34px;
  border: 4px solid rgba(10, 132, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.error-title {
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
}

.is-hidden {
  display: none !important;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 390px) {
  .app-shell {
    padding: 12px 10px 18px;
  }

  h1 {
    font-size: 27px;
  }

  .pass-preview {
    gap: 13px;
    padding: 18px;
    border-radius: 21px;
  }

  .pass-timing,
  .pass-details {
    gap: 10px;
  }

  dd {
    font-size: 13px;
  }

  .qr-box {
    width: min(100%, 164px);
  }
}

@media (min-width: 760px) {
  .app-shell {
    align-items: center;
  }
}
