:root {
  --page-bg: #f5f5f7;
  --page-fg: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --card: #ffffff;
  --accent: #0071e3;
  --accent-soft: #e8f1fc;
  --danger: #d70015;

  --ios-bg: #f2f2f7;
  --ios-group: #ffffff;
  --ios-sheet: #f2f2f7;
  --ios-label: #000000;
  --ios-secondary: rgba(60, 60, 67, .6);
  --ios-sep: rgba(60, 60, 67, .29);
  --ios-blue: #007aff;
  --ios-red: #ff3b30;
  --ios-fill: rgba(120, 120, 128, .16);
  --ios-green: #34c759;
  --ios-material: rgba(249, 249, 249, .94);

  --spring: cubic-bezier(.2, .9, .22, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --page-bg: #101012;
    --page-fg: #f5f5f7;
    --muted: #a1a1a6;
    --line: #38383c;
    --card: #1c1c1e;
    --accent: #2997ff;
    --accent-soft: #0d2a47;
    --danger: #ff6961;

    --ios-bg: #000000;
    --ios-group: #2c2c2e;
    --ios-sheet: #1c1c1e;
    --ios-label: #ffffff;
    --ios-secondary: rgba(235, 235, 245, .6);
    --ios-sep: rgba(84, 84, 88, .65);
    --ios-blue: #0a84ff;
    --ios-red: #ff453a;
    --ios-fill: rgba(120, 120, 128, .32);
    --ios-green: #30d158;
    --ios-material: rgba(44, 44, 46, .94);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page-bg);
  color: var(--page-fg);
  font: 15px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.visually-hidden { position: fixed; width: 1px; height: 1px; left: -10px; top: -10px; opacity: 0; pointer-events: none; }

/* ---------- Page ---------- */
.page { max-width: 1060px; margin: 0 auto; padding: 28px 24px 40px; }
.top { margin-bottom: 6px; padding-top: 12px; }
.back { font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--accent); }
.top h1 { font-size: clamp(30px, 4.4vw, 42px); line-height: 1.1; letter-spacing: -.025em; margin: 8px 0 10px; }
.lede { max-width: 560px; margin: 0; color: var(--muted); }
.lede code { font-size: .92em; background: var(--card); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }

.layout { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 48px; align-items: start; }
.controls { display: flex; flex-direction: column; gap: 20px; }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 28px 20px;
  background: var(--card);
  border: 1.5px dashed var(--line);
  border-radius: 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.drop:hover, body.dragging .drop { border-color: var(--accent); background: var(--accent-soft); }
.drop:active { transform: scale(.99); }
.drop-icon { width: 34px; height: 34px; fill: none; stroke: var(--accent); stroke-width: 1.6; margin-bottom: 6px; }
.drop strong { font-size: 16px; }
.drop span { font-size: 13px; color: var(--muted); }
.drop:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.error { margin: -8px 0 0; color: var(--danger); font-size: 13px; }

.collection { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 600; }
.collection-actions { display: flex; gap: 14px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-size: 14px; font-weight: 500; }
.link-btn:hover { text-decoration: underline; }

.samples-title { display: block; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 500;
  transition: border-color .15s, transform .15s;
}
.chip:hover { border-color: var(--accent); }
.chip:active { transform: scale(.96); }
.chip:focus-visible, .link-btn:focus-visible, .lang select:focus-visible, .info summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.lang { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.lang label { font-weight: 600; }
.lang select { flex: 1; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); }

.info { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 0 16px; }
.info summary { cursor: pointer; font-weight: 600; padding: 13px 0; }
.info dl { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 8px 12px; margin: 0 0 16px; font-size: 13px; }
.info dt { color: var(--muted); }
.info dd { margin: 0; overflow-wrap: anywhere; }

.tip { margin: 0; font-size: 13px; color: var(--muted); }
.tip strong { color: var(--page-fg); }

.phone-mode-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 46px; padding: 10px 16px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--page-fg); font-weight: 600;
}
.phone-mode-btn:hover { border-color: var(--accent); color: var(--accent); }
.phone-mode-btn:focus-visible, .phone-mode-exit:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.phone-mode-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.phone-mode-exit {
  position: fixed; top: 16px; right: 16px; z-index: 100;
  padding: 9px 14px; border: 1px solid #777; border-radius: 999px;
  background: rgba(40, 40, 43, .9); color: #fff; font-size: 13px; font-weight: 600;
}

.stage { display: flex; justify-content: center; position: sticky; top: 16px; }

.foot { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.foot p { margin: 0; max-width: 640px; }

/* ---------- iPhone frame ---------- */
.device {
  zoom: var(--device-scale, 1);
  width: 414px; height: 868px;
  padding: 12px;
  border-radius: 68px;
  background: #1b1b1d;
  box-shadow: inset 0 0 0 2px #48484c, inset 0 0 0 6px #0c0c0d, 0 30px 60px -20px rgba(0, 0, 0, .35);
}
.screen {
  --safe-top: 0px;
  --safe-bottom: 22px;
  position: relative;
  width: 390px; height: 844px;
  border-radius: 56px;
  overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--ios-bg);
  color: var(--ios-label);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
.statusbar { flex: none; height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 4px 30px 0 52px; font-size: 17px; font-weight: 600; position: relative; }
.island { position: absolute; top: 11px; left: 50%; width: 125px; height: 37px; margin-left: -62.5px; background: #000; border-radius: 20px; }
.sb-icons { display: flex; align-items: center; gap: 6px; }
.sb-icons svg { height: 12px; width: auto; fill: currentColor; }
.home-bar { position: absolute; bottom: 8px; left: 50%; width: 134px; height: 5px; margin-left: -67px; border-radius: 3px; background: var(--ios-label); z-index: 60; pointer-events: none; }

/* top bar: large title in the stack, Done / ••• when a pass is open */
.w-top { flex: none; position: relative; height: 56px; display: flex; align-items: center; padding: 0 16px; }
.w-title { margin: 0; font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: .01em; transition: opacity .3s, transform .45s var(--spring); }
.w-done { position: absolute; left: 16px; top: 50%; border: 0; background: none; padding: 6px 0; color: var(--ios-blue); font-size: 17px; opacity: 0; pointer-events: none; transform: translate(12px, -50%); transition: opacity .3s, transform .45s var(--spring); }
.w-actions { margin-left: auto; display: flex; gap: 12px; position: relative; }
.w-circle { width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0; background: var(--ios-fill); color: var(--ios-blue); display: grid; place-items: center; transition: opacity .3s, transform .2s; }
.w-circle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.w-circle svg.dots { fill: currentColor; stroke: none; }
.w-circle:active { transform: scale(.9); }
#moreBtn { position: absolute; right: 0; top: 0; opacity: 0; pointer-events: none; }

.screen.is-open .w-title { opacity: 0; transform: translateX(-24px); pointer-events: none; }
.screen.is-open .w-done { opacity: 1; pointer-events: auto; transform: translate(0, -50%); }
.screen.is-open #addBtn, .screen.is-open #menuBtn { opacity: 0; pointer-events: none; }
.screen.is-open #moreBtn { opacity: 1; pointer-events: auto; }
.w-done:focus-visible, .w-circle:focus-visible, .sheet-btn:focus-visible, .w-card:focus-visible, .pill:focus-visible, .plain:focus-visible { outline: 3px solid var(--ios-blue); outline-offset: 2px; }

.w-content { position: relative; isolation: isolate; flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 0 40px; scrollbar-width: none; overscroll-behavior: contain; }
.w-content::-webkit-scrollbar { display: none; }
.w-content.locked { overflow-x: hidden; overflow-y: auto; }

.w-empty { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 40px 60px; gap: 6px; animation: fade .4s; }
.w-empty svg { width: 72px; height: 72px; margin-bottom: 8px; }
.w-empty h3 { margin: 0; font-size: 22px; font-weight: 700; }
.w-empty p { margin: 0 0 14px; color: var(--ios-secondary); font-size: 15px; }
.pill { border: 0; border-radius: 999px; background: var(--ios-blue); color: #fff; font-size: 17px; font-weight: 600; padding: 12px 26px; transition: transform .15s, opacity .15s; }
.pill:active { transform: scale(.96); opacity: .85; }
.plain { border: 0; background: none; color: var(--ios-blue); font-size: 17px; padding: 10px; }

/* ---------- The stack ---------- */
.w-stack { position: relative; margin: 0 16px; transition: height .45s var(--spring); }
.w-card {
  position: absolute; left: 0; right: 0; top: 0;
  cursor: pointer;
  outline: none;
  will-change: transform;
  transition: transform .7s cubic-bezier(.25, .7, .25, 1), opacity .35s ease;
}
.w-card.no-anim, .w-stack.no-anim .w-card { transition: none !important; }
.w-card.is-paging { transition: transform var(--swipe-duration, 660ms) cubic-bezier(.25, .7, .25, 1), opacity .35s ease; }
.w-card.dragging { transition: none; }
.w-card .pass-wrap { transition: transform .2s ease; }
.screen:not(.is-open) .w-card:active .pass-wrap { transform: scale(.985); }
.w-card.is-open { cursor: default; touch-action: none; }
.w-card.is-parked { height: 80px; overflow: hidden; }
.w-card.removing { opacity: 0; pointer-events: none; }
.w-dots { position: absolute; left: 0; right: 0; top: 0; z-index: 950; display: flex; justify-content: center; align-items: center; gap: 9px; height: 8px; pointer-events: none; opacity: 0; transition: opacity .3s, transform .55s var(--spring); }
.w-dots.show { opacity: 1; }
.w-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--ios-label); opacity: .22; transition: opacity .25s, transform .25s; }
.w-dots i.on { opacity: .8; }
.w-dots i.small { transform: scale(.6); }
.pass-wrap.refresh { animation: refresh .5s var(--spring); }
@keyframes refresh { from { opacity: .4; transform: scale(.97); } }

/* ---------- The pass ---------- */
.pass-wrap { max-width: 358px; margin: 0 auto; filter: drop-shadow(0 0 .5px rgba(0, 0, 0, .3)) drop-shadow(0 -1px 4px rgba(0, 0, 0, .09)); }
.pass {
  --bg: #fff; --fg: #000; --lbl: #000;
  position: relative;
  isolation: isolate;
  display: flex; flex-direction: column;
  min-height: 455px;
  border-radius: 13px;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

.pass.eventTicket {
  -webkit-mask: radial-gradient(circle at 50% 0, transparent 17px, #000 17.5px);
  mask: radial-gradient(circle at 50% 0, transparent 17px, #000 17.5px);
}
.pass.coupon {
  -webkit-mask: radial-gradient(circle at 50% 0, transparent 3.5px, #000 4px) 0 0 / 10px 100% repeat-x;
  mask: radial-gradient(circle at 50% 0, transparent 3.5px, #000 4px) 0 0 / 10px 100% repeat-x;
}
.p-bgimg { position: absolute; inset: -40px; z-index: -1; background-size: cover; background-position: center; filter: blur(18px) saturate(1.1); }

.p-head { display: flex; align-items: center; gap: 8px; min-height: 60px; padding: 10px 14px 0 12px; }
.coupon .p-head { padding-top: 14px; }
.p-logo { display: block; flex: none; object-fit: contain; }
.p-logotext { flex: 1 1 auto; min-width: 0; font-size: 17px; font-weight: 500; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-hfields { display: flex; gap: 14px; margin-left: auto; min-width: 0; flex: 0 1 auto; }
.p-hfields .f-value { font-size: 17px; line-height: 22px; }

.f { min-width: 0; flex: 0 1 auto; }
.f-label {
  display: block;
  font-size: 11px; line-height: 13px; font-weight: 600;
  letter-spacing: .02em; text-transform: uppercase;
  color: var(--lbl);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.f-value { display: block; margin-top: 2px; font-size: 16px; line-height: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.al-left { text-align: left; }
.al-center { text-align: center; }
.al-right { text-align: right; }

.p-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; }
.p-row.single { justify-content: flex-start; }
.p-pad { padding: 0 14px; }

.p-main { display: flex; gap: 12px; padding: 0 14px; }
.p-col { flex: 1; min-width: 0; }
.p-thumb { flex: none; margin-top: 14px; object-fit: contain; align-self: flex-start; }

.p-primary { margin-top: 12px; }
.p-primary .f-value { font-size: 27px; line-height: 33px; letter-spacing: -.01em; }

.p-bp { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding: 0 14px; margin-top: 12px; }
.p-bp .f-value { font-size: 40px; line-height: 46px; font-weight: 300; letter-spacing: -.01em; margin-top: 0; }
.p-transit { flex: none; width: 30px; height: 30px; margin-bottom: 8px; color: var(--lbl); }
.p-transit svg { width: 100%; height: 100%; fill: currentColor; }

.p-strip { position: relative; margin-top: 10px; aspect-ratio: 375 / 144; }
.eventTicket .p-strip { aspect-ratio: 375 / 98; }
.p-strip > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.p-sprimary { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: center; padding: 0 14px; }
.p-sprimary .f { display: flex; flex-direction: column-reverse; }
.p-sprimary .f-value { font-size: 46px; line-height: 52px; font-weight: 300; letter-spacing: -.015em; margin: 0; }
.eventTicket .p-sprimary .f-value { font-size: 34px; line-height: 40px; }
.p-sprimary .f-label { font-size: 12px; line-height: 15px; }
.p-strip-none { aspect-ratio: auto; padding: 8px 0; }

.p-bottom { margin-top: auto; padding: 16px 14px 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.p-footer { display: block; max-width: 100%; object-fit: contain; }
.bc { background: #fff; border-radius: 7px; padding: 9px; display: flex; flex-direction: column; align-items: center; max-width: 100%; }
.bc img { display: block; image-rendering: pixelated; }
.bc.square img { width: 138px; height: 138px; }
.bc.pdf417 img { width: 270px; height: auto; max-height: 150px; object-fit: contain; }
.bc.code128 { padding: 10px 12px 8px; }
.bc.code128 img { width: 262px; height: 66px; }
.bc-alt { margin-top: 6px; max-width: 262px; font-size: 12px; line-height: 15px; color: #000; text-align: center; overflow-wrap: anywhere; }
.bc-error { font-size: 12px; color: #8e8e93; padding: 20px 10px; }
.bc.dim { opacity: .35; }

/* Contactless event presentation, measured from the Wallet reader view.
   Container units keep the artwork and field rhythm proportional on small phones. */
.pass-wrap:has(.contactless) { container-type: inline-size; }
.contactless.pass {
  min-height: 105.6cqw;
  border-radius: 0;
  -webkit-mask: radial-gradient(circle at 50% -6.7cqw, transparent 11.15cqw, #000 11.3cqw);
  mask: radial-gradient(circle at 50% -6.7cqw, transparent 11.15cqw, #000 11.3cqw);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.contactless .p-head { height: 17.9cqw; min-height: 17.9cqw; padding: 0 4.2cqw 0 3.4cqw; gap: 2cqw; }
.contactless .p-logo { max-width: 40cqw; max-height: 13cqw; }
.contactless .p-logotext:empty { display: none; }
.contactless .p-hfields { flex-shrink: 0; max-width: 53%; }
.contactless .p-hfields .f-value { font-size: 5.6cqw; line-height: 1.12; margin-top: 0; }
.contactless .f-label { font-size: 2.8cqw; line-height: 1.2; letter-spacing: .02em; }
.contactless .f-value { font-size: 5.5cqw; line-height: 1.17; margin-top: .6cqw; text-overflow: clip; overflow-wrap: anywhere; }
.contactless .p-strip { margin-top: 0; }
.contactless .p-pad { padding: 0 4.2cqw; }
.contactless .p-row { margin-top: 3.7cqw; gap: 2cqw; }
.contactless .p-event-secondary { margin-top: 2.4cqw; }
.contactless .p-event-secondary .f { flex: 1; }
.contactless .p-event-secondary .f-value { font-size: 5.3cqw; }
.contactless .p-event-seats .f { flex: 1; }
.contactless .p-event-seats .f:nth-child(2):not(:last-child) { text-align: center; }
.contactless .p-event-extra .f { flex: 1 1 0; }
.contactless .p-event-extra .f:last-child { flex-grow: 1.13; text-align: left; }
.contactless .p-event-extra .f-value { font-size: 4.15cqw; }
.contactless .p-bottom { padding: 3cqw 2cqw 1.8cqw; }
.p-contactless { display: flex; align-items: flex-end; justify-content: space-between; width: 100%; }
.p-app-icon { border-radius: 5px; object-fit: contain; }
.p-contactless-symbol { margin-left: auto; display: block; width: 6cqw; height: 7cqw; color: var(--fg); opacity: .65; }
.p-contactless-symbol svg { display: block; width: 100%; height: 100%; }
.screen.is-reader { background: #000; color: #fff; }
.screen.is-reader .sheet, .screen.is-reader .asheet { color: var(--ios-label); }
.screen.is-reader .w-content { overflow: hidden; overscroll-behavior: none; touch-action: pinch-zoom; }
.screen.is-reader.reader-overflow .w-content { overflow-y: auto; touch-action: pan-y pinch-zoom; }
.screen.is-reader .w-card:not(.is-parked) .pass-wrap { width: var(--reader-card-width, 358px); max-width: 100%; }
.screen.is-reader .w-top { height: 6px; z-index: 2; }
.screen.is-reader .w-done, .screen.is-reader #moreBtn { opacity: 0; pointer-events: none; }
.screen.is-reader.reader-controls .w-done, .screen.is-reader.reader-controls #moreBtn,
.screen.is-reader .w-top:focus-within .w-done, .screen.is-reader .w-top:focus-within #moreBtn { opacity: 1; pointer-events: auto; }
.screen.is-reader .w-done { font-size: 13px; }
.screen.is-reader #moreBtn { width: 28px; height: 24px; }
.screen.is-reader .w-card:not(.is-parked) .pass-wrap { filter: drop-shadow(0 9px 12px rgba(0, 156, 222, .32)); }
.screen.is-reader .w-dots i { background: #dff8ff; }
.w-reader { position: absolute; top: 0; left: 0; right: 0; z-index: 901; display: flex; flex-direction: column; align-items: center; gap: 9px; color: #009dff; pointer-events: none; opacity: 1; transition: opacity .16s ease; }
.w-reader.is-restarting { opacity: 0; }
.w-reader > svg { width: 72px; height: 72px; overflow: visible; }
.w-reader > span { color: #8e8e93; font-size: 20px; font-weight: 400; line-height: 26px; }
.reader-phone { animation: reader-phone 2.8s ease-in-out infinite; }
.reader-ring { animation: reader-ring 2.8s ease-in-out infinite; }
@keyframes reader-phone { 0%, 100% { transform: translateY(32px); } 18%, 65% { transform: translateY(0); } 85% { transform: translateY(32px); } }
@keyframes reader-ring { 0%, 20%, 85%, 100% { opacity: 1; } 50% { opacity: .65; } }

/* unverified passes show this instead of a barcode */
.keepsake { display: flex; align-items: center; gap: 11px; max-width: 100%; padding: 11px 16px 11px 13px; border-radius: 12px; background: rgba(255, 255, 255, .92); color: #1c1c1e; text-align: left; }
.keepsake svg { flex: none; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.keepsake strong { display: block; font-size: 14px; line-height: 18px; font-weight: 600; }
.keepsake span { display: block; font-size: 12px; line-height: 16px; color: #6e6e73; }

/* ---------- Sheets ---------- */
.sheet-backdrop { position: absolute; inset: 0; z-index: 20; background: rgba(0, 0, 0, .4); animation: fade .3s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; top: calc(var(--safe-top) + 54px); z-index: 21;
  display: flex; flex-direction: column;
  background: var(--ios-sheet);
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -4px 30px rgba(0, 0, 0, .15);
  animation: sheet-up .42s var(--spring);
}
.sheet.out, .asheet.out { animation: sheet-down .26s ease-in forwards; }
.sheet-backdrop.out, .as-backdrop.out { animation: fade-out .26s forwards; }
@keyframes fade { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }

.sheet-bar { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 56px; padding: 0 16px; }
.sheet-bar h2 { margin: 0; font-size: 17px; font-weight: 600; }
.sheet-btn { justify-self: start; border: 0; background: none; padding: 4px 0; color: var(--ios-blue); font-size: 17px; }
.sheet-btn.strong { justify-self: end; font-weight: 600; }
.sheet-body { flex: 1; overflow-y: auto; padding: 4px 16px calc(var(--safe-bottom) + 30px); scrollbar-width: none; overscroll-behavior: contain; }
.sheet-body::-webkit-scrollbar { display: none; }

.ios-org { display: flex; align-items: center; gap: 12px; margin: 4px 4px 20px; }
.ios-org img, .ios-org .ios-org-ph { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: none; background: var(--ios-fill); }
.ios-org strong { display: block; font-size: 17px; font-weight: 600; }
.ios-org span { display: block; font-size: 13px; color: var(--ios-secondary); }

.ios-section { margin: 0 16px 7px; font-size: 13px; color: var(--ios-secondary); text-transform: uppercase; letter-spacing: .01em; }
.ios-group { background: var(--ios-group); border-radius: 10px; overflow: hidden; margin-bottom: 24px; }
.ios-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 6px 16px; font-size: 17px; }
.ios-group > * + *::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--ios-sep); }
button.ios-row { width: 100%; border: 0; background: none; text-align: left; transition: background .15s; }
button.ios-row:active { background: var(--ios-fill); }
.ios-row.link { color: var(--ios-blue); }
.ios-row.danger { color: var(--ios-red); }
.ios-row.center { justify-content: center; }
.ios-row select { border: 0; background: none; color: var(--ios-secondary); font-size: 17px; text-align: right; max-width: 60%; }
.ios-switch { position: relative; flex: none; width: 51px; height: 31px; }
.ios-switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.ios-switch span { position: absolute; inset: 0; border-radius: 16px; background: var(--ios-fill); transition: background .2s; pointer-events: none; }
.ios-switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 1px 1px rgba(0, 0, 0, .16); transition: transform .25s var(--spring); }
.ios-switch input:checked + span { background: var(--ios-green); }
.ios-switch input:checked + span::after { transform: translateX(20px); }
.ios-switch input:focus-visible + span { outline: 3px solid var(--ios-blue); outline-offset: 2px; }
.ios-caption { margin: -16px 16px 24px; font-size: 13px; line-height: 18px; color: var(--ios-secondary); }
.ios-caption.solo { margin-top: 0; }

.bf { position: relative; padding: 11px 16px 12px; }
.bf-label { font-size: 13px; color: var(--ios-secondary); margin-bottom: 2px; }
.bf-value { font-size: 17px; line-height: 22px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bf-value a { color: var(--ios-blue); text-decoration: none; }

/* editor */
.ed-row { display: grid; grid-template-columns: auto minmax(0, 1fr); }
.ed-row input, .ed-row select { min-width: 0; border: 0; background: none; text-align: right; font-size: 17px; color: var(--ios-secondary); outline: none; padding: 6px 0; }
.ed-row input:focus { color: var(--ios-label); }
.ed-color { display: flex; }
.ed-color input { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.ed-color input::-webkit-color-swatch-wrapper { padding: 0; }
.ed-color input::-webkit-color-swatch { border: .5px solid var(--ios-sep); border-radius: 50%; }
.ed-color input::-moz-color-swatch { border: .5px solid var(--ios-sep); border-radius: 50%; }
.ed-img { gap: 12px; }
.ed-thumb { width: 40px; height: 40px; flex: none; border-radius: 8px; background: var(--ios-fill) center / contain no-repeat; display: grid; place-items: center; overflow: hidden; }
.ed-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ed-img-name { flex: 1; }
.ed-btn { border: 0; background: none; padding: 4px 0; color: var(--ios-blue); font-size: 15px; cursor: pointer; }
.ed-btn.danger { color: var(--ios-red); }
.ed-field { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; padding: 8px 12px 9px 16px; transition: background .15s; }
.ed-field:focus-within { background: var(--ios-fill); }
.ed-field input, .ed-field textarea { grid-column: 1; width: 100%; border: 0; background: none; outline: none; padding: 2px 0; color: var(--ios-label); }
.ed-field .ed-label { font-size: 13px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--ios-secondary); }
.ed-field .ed-value { font-size: 17px; }
.ed-field textarea { resize: vertical; min-height: 44px; line-height: 22px; }
.ed-field input[type="datetime-local"] { min-height: 30px; }
.ed-del { grid-column: 2; grid-row: 1 / span 2; width: 24px; height: 24px; border: 0; border-radius: 50%; background: var(--ios-red); color: #fff; padding: 0; display: grid; place-items: center; transition: transform .15s; }
.ed-del:active { transform: scale(.85); }
.ed-del svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.ed-add svg { width: 22px; height: 22px; flex: none; }

/* ---------- Action sheet ---------- */
.as-backdrop { position: absolute; inset: 0; z-index: 40; background: rgba(0, 0, 0, .35); animation: fade .25s; }
.asheet { position: absolute; left: 8px; right: 8px; bottom: calc(var(--safe-bottom) + 6px); z-index: 41; animation: sheet-up .38s var(--spring); }
.as-group { background: var(--ios-material); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); border-radius: 14px; overflow: hidden; }
.as-title { padding: 14px 16px 13px; text-align: center; font-size: 13px; line-height: 18px; color: var(--ios-secondary); }
.as-title strong { display: block; font-weight: 600; }
.as-btn { display: block; position: relative; width: 100%; min-height: 57px; border: 0; background: none; color: var(--ios-blue); font-size: 20px; }
.as-group > * + .as-btn::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: .5px; background: var(--ios-sep); }
.as-btn:active { background: var(--ios-fill); }
.as-btn.destructive { color: var(--ios-red); }
.as-cancel { margin-top: 8px; font-weight: 600; background: var(--ios-group); border-radius: 14px; }
.as-btn:focus-visible { outline: 3px solid var(--ios-blue); outline-offset: -3px; }

/* ---------- Toast ---------- */
.toast {
  position: absolute; left: 50%; bottom: calc(var(--safe-bottom) + 24px); z-index: 50;
  max-width: calc(100% - 48px);
  padding: 10px 18px; border-radius: 22px;
  background: rgba(28, 28, 30, .9); color: #fff;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  font-size: 15px; font-weight: 500; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transform: translate(-50%, 16px) scale(.96);
  transition: opacity .3s, transform .45s var(--spring);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* ---------- Layout breakpoints ---------- */
@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .stage { position: static; }
}

/* Phones (and the home-screen app): the page becomes the Wallet app itself. */
@media (max-width: 600px), (display-mode: standalone) {
  body { background: var(--ios-bg); overflow: hidden; }
  .page { padding: 0; }
  .controls, .foot { display: none; }
  .layout { display: block; }
  .stage { position: static; }
  .device { zoom: 1; width: auto; height: auto; padding: 0; border-radius: 0; background: none; box-shadow: none; }
  .screen {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    position: fixed; inset: 0;
    width: auto; height: 100%;
    border-radius: 0;
    padding-top: var(--safe-top);
  }
  .statusbar, .home-bar { display: none; }
  .w-top { height: 60px; }
  .sheet { top: calc(var(--safe-top) + 12px); }
  body.phone-mode .phone-mode-exit { top: auto; right: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); }
}

/* The desktop full-screen option keeps the Wallet display at phone width. */
@media (min-width: 601px) {
  body.phone-mode { overflow: hidden; background: #111114; }
  body.phone-mode .page { max-width: none; padding: 0; }
  body.phone-mode .controls, body.phone-mode .foot { display: none; }
  body.phone-mode .layout { display: block; }
  body.phone-mode .stage { position: fixed; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center; background: #111114; }
  body.phone-mode .device { zoom: 1; width: auto; height: auto; padding: 0; border-radius: 0; background: none; box-shadow: none; }
  body.phone-mode .screen { width: min(390px, 100vw); height: min(844px, 100dvh); border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .w-reader, .w-reader.is-restarting { opacity: 1; transition: none; }
  .reader-phone, .reader-ring { animation: none; }
  .w-card, .w-title, .w-done, .w-circle, .toast, .w-stack { transition-duration: .01ms !important; }
  .sheet, .asheet, .sheet-backdrop, .as-backdrop, .w-empty { animation-duration: .01ms !important; }
}
