:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f4f4f0;
  background: #111111;
  font-synthesis: none;
  --accent: #e8f986;
  --muted: #999c94;
  --header-height: calc(65px + env(safe-area-inset-top, 0px));
}

* { box-sizing: border-box; }
body { margin: 0; padding-bottom: calc(44px + env(safe-area-inset-bottom)); }
button, input { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: wait; opacity: .6; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

.workspace {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100svh;
  padding: 0 20px 36px;
  background: #111111;
}
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: 2px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 12px 17px; border: 1px solid transparent; border-radius: 10px; font-size: 13px; font-weight: 650; transition: background .2s; }
.primary { background: var(--accent); color: #202715; }
.primary:hover { background: #f2ffb3; }
.secondary { background: #20221e; color: #e4e6dd; border-color: #3a3e34; }
.secondary:hover { background: #30332b; }
.card-help { width: 100%; max-width: 430px; padding: 14px 16px max(14px, env(safe-area-inset-bottom)); }
.interaction-help { margin: 0; color: #b0b4aa; font-size: 11px; line-height: 1.6; }
.status { margin: 9px 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.privacy-note { margin: 0; color: #7f8578; font-size: 10px; line-height: 1.6; }
.motion-notice { position: fixed; z-index: 40; bottom: calc(52px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; align-items: start; gap: 8px; width: calc(100% - 24px); max-width: 406px; padding: 12px; border: 1px solid #454c34; border-radius: 10px; background: #1c2018; box-shadow: 0 8px 30px #0006; }
.motion-notice-body { flex: 1; min-width: 0; }
.motion-notice .status { margin: 0; color: #e0e4d7; }
.motion-notice .close-button { flex: 0 0 44px; margin: -8px -8px -8px 0; }
.motion-notice .button { margin-top: 10px; }

.digital-card {
  --tilt-x: 0;
  --tilt-y: 0;
  --light-x: 50%;
  --light-y: 50%;
  --hue: 0deg;
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 430px;
  padding-top: var(--header-height);
  container-type: inline-size;
  background: #111111;
  border: 1px solid #282a24;
  border-radius: 16px;
  box-shadow: 0 24px 75px #0007;
}
.card-header { position: fixed; z-index: 50; top: 0; right: 0; left: 0; margin-inline: auto; display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; width: 100%; max-width: 430px; height: var(--header-height); padding: calc(10px + env(safe-area-inset-top, 0px)) 10px 10px; border-bottom: 1px solid #282a24; background: #111111; box-shadow: 0 6px 16px #0006; }
.card-header h1 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(16px, 4.4vw, 21px); line-height: 1.2; font-weight: 650; text-align: center; letter-spacing: -.3px; }
.header-control { display: grid; place-items: center; width: 44px; height: 44px; padding: 8px; border: 0; color: #b8dce8; background: transparent; border-radius: 6px; }
.header-control svg { width: 24px; height: 24px; }
.header-control .menu-icon circle { fill: currentColor; stroke: none; }
.header-control:hover { background: #242823; }
.invalid-banner { position: fixed; z-index: 30; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 430px; min-height: 40px; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid #454c34; color: var(--accent); background: #1c2018; font-size: 11px; line-height: 16px; letter-spacing: 1px; font-weight: 650; text-align: center; }
.card-body { position: relative; overflow: hidden; }
.card-content { position: relative; padding: 4.2cqw 4.2cqw 0; }
.portrait-row { display: grid; grid-template-columns: minmax(0, 1fr) 42.5% minmax(0, 1fr); align-items: start; gap: 10px; }
.concept-mark { padding-top: 4px; }
.concept-mark span { display: block; color: var(--accent); font-weight: 800; font-size: 28px; letter-spacing: -2px; }
.concept-mark small { display: block; margin-top: 4px; color: #9b9e90; font-size: 7px; letter-spacing: 1px; }
.concept-mark > img { display: block; width: 48px; max-width: 100%; height: 60px; object-fit: contain; object-position: top left; }
.portrait { position: relative; overflow: hidden; background: #96ac9f; }
.portrait > svg { display: block; width: 100%; height: auto; }
.portrait > img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.portrait > span { position: absolute; bottom: 6px; left: 6px; padding: 3px 5px; color: #fff; background: #172b24a6; font-size: 6px; letter-spacing: .8px; }
.refresh { display: grid; justify-items: end; gap: 9px; padding-top: 5px; text-align: right; }
.refresh > span:first-child { color: #d3d6ce; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; max-width: 100%; }
.refresh time { display: grid; gap: 4px; font-size: clamp(10px, 3cqw, 13px); line-height: 1.4; font-weight: 650; }
.profile-name { margin: 12px 0 6.5cqw; font-size: clamp(23px, 6.5cqw, 28px); line-height: 1.2; font-weight: 750; text-align: center; letter-spacing: -.5px; overflow-wrap: anywhere; }
.ruled { border-top: 1px solid #b9beb34d; }
.identity-grid { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 5cqw; padding: 6cqw 0; }
dl { margin: 0; }
dt { margin-bottom: 7px; color: #d3d6ce; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
dd { margin: 0; font-weight: 700; font-size: clamp(23px, 6.8cqw, 29px); line-height: 1.2; }
.profile-fields { display: flex; flex-direction: column; gap: 24px; padding-top: 3px; }
.profile-number { font-size: clamp(19px, 5.9cqw, 25px); letter-spacing: -.5px; overflow-wrap: anywhere; }
.pattern-tile { display: flex; flex-direction: column; justify-content: center; align-self: start; background: #fff; color: #193e56; }
.pattern-tile svg { display: block; width: 100%; }
.pattern-tile > img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; }
.birthdate { padding: 7cqw 0; }
.birthdate dd { font-size: clamp(23px, 6.5cqw, 28px); }
.detail-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 0 -3.5cqw; }
.detail-tiles dl { min-width: 0; padding: 24px 16px; background: #25272beb; }
.detail-tiles dt { font-size: 16px; }
.detail-tiles dd { font-size: 20px; overflow-wrap: anywhere; }
.secondary-portrait { width: calc(20000cqw / 738); aspect-ratio: 200 / 245; margin: calc(3200cqw / 738) 0 calc(7600cqw / 738) calc(3000cqw / 738 - 4.2cqw); pointer-events: none; }
.secondary-portrait img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: .24; filter: grayscale(1) brightness(.85); }
.signature-panel { display: grid; place-items: center; width: calc(40900cqw / 738); aspect-ratio: 409 / 103; margin: 0 auto calc(12800cqw / 738); background: #fff; color: #777; }
.signature-panel span { font-size: 12px; }
.signature-panel img { display: block; width: 100%; height: 100%; object-fit: contain; }
.card-number-banners { position: relative; isolation: isolate; }
.card-number-banners::before { content: ""; position: absolute; z-index: -1; top: 0; right: 0; left: 0; height: 17.4cqw; background: #716c34; clip-path: polygon(0 0, 100% 8.7cqw, 100% 100%, 0 100%); pointer-events: none; }
.card-number-panel { display: grid; grid-template-columns: minmax(0, 1fr) 12.2cqw; align-items: start; gap: 6cqw; min-height: 44.85cqw; padding: 14cqw 4.2cqw 10cqw; color: #172015; background: #fef363; clip-path: polygon(0 8.7cqw, 100% 0, 100% 100%, 0 100%); }
.card-number-panel dt { color: inherit; }
.card-number-panel dd { font-size: clamp(24px, 6.8cqw, 30px); overflow-wrap: anywhere; }
.bottom-logo { width: 100%; height: 12.2cqw; display: grid; place-items: center; }
.bottom-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.bottom-logo span { font-size: 7cqw; font-weight: 800; letter-spacing: -1px; }
.card-footer { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 20px 0; color: #a3a89a; font-size: 8px; }
.footer-dot { width: 4px; height: 4px; background: var(--accent); border-radius: 50%; }
.hologram { position: absolute; top: 42cqw; left: -8%; width: 116%; height: 92cqw; opacity: .62; pointer-events: none; mask: url("./rosette.svg") center / contain no-repeat; -webkit-mask: url("./rosette.svg") center / contain no-repeat; }
.hologram-colour {
  position: absolute;
  inset: -12%;
  background:
    repeating-radial-gradient(ellipse at var(--light-x) var(--light-y), #0b2e43 0 9px, #164831 16px, #596421 25px, #675321 34px, #56233f 43px, #192642 54px, #0b2e43 65px),
    conic-gradient(from 45deg at var(--light-x) var(--light-y), #405923, #1e3d63, #622a51, #71732e, #405923);
  background-blend-mode: soft-light;
  filter: saturate(1.25) hue-rotate(var(--hue));
  transform: translate(calc(var(--tilt-x) * 24px), calc(var(--tilt-y) * 24px)) rotate(calc(var(--tilt-x) * 8deg));
  will-change: transform;
}

dialog { width: min(440px, calc(100% - 32px)); max-height: calc(100svh - 40px); padding: 28px; background: #191b17; border: 1px solid #454a39; border-radius: 18px; color: #f4f4f0; box-shadow: 0 30px 100px #0009; }
dialog::backdrop { background: #000a; backdrop-filter: blur(6px); }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.dialog-heading .eyebrow { margin: 0 0 10px; color: var(--accent); font-size: 9px; }
.dialog-heading h2 { margin: 0; font-size: 25px; letter-spacing: -.6px; }
.close-button { display: grid; place-items: center; width: 44px; height: 44px; margin: -9px -12px 0 0; padding: 0; border: none; color: #b4baaa; background: none; font-size: 30px; }
.dialog-description { margin: 16px 0 24px; color: #a0a792; font-size: 12px; line-height: 1.6; }
form > label:not(.checkbox-label), .label-fields label { display: block; margin: 18px 0 8px; font-size: 12px; color: #dce0d3; }
.label-fields, .signature-field { min-width: 0; margin: 24px 0 0; padding: 12px; border: 1px solid #404633; border-radius: 8px; }
.label-fields legend, .signature-field legend { padding: 0 6px; color: var(--accent); font-size: 13px; }
#signature-pad { display: block; width: 100%; height: auto; margin: 12px 0; background: #fff; border: 1px solid #404633; border-radius: 4px; touch-action: none; cursor: crosshair; }
#signature-pad[aria-disabled="true"] { cursor: not-allowed; opacity: .6; }
input[type="text"], input[type="date"], input[type="datetime-local"] { display: block; min-width: 0; width: 100%; min-height: 48px; padding: 12px; color: #f3f4eb; background: #10120e; border: 1px solid #404633; border-radius: 8px; font-size: 16px; }
.checkbox-label { display: flex; align-items: center; gap: 10px; margin-top: 22px; font-size: 12px; }
input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.field-help { margin: 10px 0 0; color: #9ca38e; font-size: 11px; line-height: 1.6; }
.image-field { margin-top: 22px; }
.image-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 12px; color: #dce0d3; }
.remove-image { padding: 6px 0 6px 8px; color: var(--accent); font-size: 11px; background: transparent; border: 0; }
input[type="file"] { width: 100%; min-width: 0; min-height: 48px; color: #a0a792; font-size: 12px; }
input[type="file"]::file-selector-button { min-height: 48px; margin-right: 10px; padding: 12px 14px; border: 1px solid #404633; border-radius: 7px; color: #e4e6dd; background: #25291f; cursor: pointer; }
.image-preview { margin-top: 12px; padding: 8px; background: #10120e; border: 1px solid #404633; border-radius: 8px; }
.image-preview img { display: block; max-width: 100%; height: 70px; object-fit: contain; }
#logo-preview { background: repeating-conic-gradient(#20241b 0% 25%, #363c2d 0% 50%) 0 0 / 16px 16px; }
.colour-controls { display: grid; grid-template-columns: minmax(0, 1fr) 54px; align-items: center; gap: 10px; margin-top: 12px; font-size: 12px; }
.colour-controls input[type="color"] { width: 54px; height: 44px; padding: 4px; border: 1px solid #404633; border-radius: 6px; background: #10120e; }
.colour-controls input[type="range"] { grid-column: 1 / -1; width: 100%; min-width: 0; height: 44px; margin: 0; accent-color: var(--accent); }
.colour-controls label[for="logo-tolerance-input"] { grid-column: 1 / -1; display: flex; justify-content: space-between; }
.colour-controls output { color: var(--accent); font-variant-numeric: tabular-nums; }
.image-status { margin: 6px 0 0; color: #ffb4a6; font-size: 11px; line-height: 1.5; }
.form-status { margin: 14px 0; color: #ffb4a6; font-size: 12px; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 24px; }
.noscript-note { padding: 20px; text-align: center; }

@media (max-width: 480px) {
  .workspace { padding: 0; }
  .digital-card { border: 0; border-radius: 0; box-shadow: none; }
  .button { padding-inline: 10px; font-size: 12px; }
}

@media (max-width: 360px) {
  dt { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .hologram-colour { will-change: auto; }
}

@media print {
  body { padding-bottom: 0; }
  .card-help, .header-control, .motion-notice, dialog { display: none; }
  .workspace { display: block; padding: 0; }
  .card-header { position: static; display: block; height: auto; margin-inline: 0; padding: 16px; box-shadow: none; }
  .card-header h1 { white-space: normal; overflow: visible; }
  .digital-card { width: 430px; padding-top: 0; box-shadow: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .invalid-banner { position: static; transform: none; width: 430px; max-width: 100%; margin-top: 12px; padding: 12px; color: #111; background: #fff; border-color: #777; }
}
