:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  color: #17252a;
  background: #f5f6f2;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
main {
  max-width: 760px;
  padding: 32px 20px max(32px, env(safe-area-inset-bottom));
  margin: auto;
}
header {
  margin-bottom: 24px;
}
.wordmark {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  font-weight: 800;
  color: #155c64;
}
h1 {
  font-size: 2rem;
  margin: 12px 0;
}
header p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #48575a;
}
#status {
  font-weight: 600;
}
.wallet-language label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  font-weight: 600;
}
.wallet-language select {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #91aaa5;
  border-radius: 12px;
  font: inherit;
  color: #173f42;
  background: white;
}
.wallet-language p {
  max-width: 60ch;
  margin-block: 8px 16px;
  font-size: 0.82rem;
}
#cards {
  display: grid;
  gap: 20px;
}
article {
  padding: 24px;
  border: 1px solid #cdd7d3;
  border-radius: 20px;
  background: white;
  text-align: center;
}
article h2 {
  font-size: 1.3rem;
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}
article p {
  margin: 4px 0;
  font-size: 0.9rem;
  color: #48575a;
}
.code {
  display: block;
  width: min(100%, 420px);
  height: auto;
  margin: 20px auto 10px;
}
.profile-link {
  display: block;
  overflow-wrap: anywhere;
  font-size: 0.75rem;
  color: #155c64;
}
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}
nav a,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid #155c64;
  font: inherit;
  font-size: 0.875rem;
}
nav a {
  background: #155c64;
  color: white;
  text-decoration: none;
}
button {
  background: white;
  color: #155c64;
  cursor: pointer;
}
a:focus-visible,
button:focus-visible,
select:focus-visible {
  outline: 3px solid #3975c0;
  outline-offset: 3px;
}
button[hidden] {
  display: none;
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }
}
@media (min-width: 600px) {
  main {
    padding-block: 48px;
  }
  article {
    padding: 32px;
  }
}
#cards {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 10px;
  margin-bottom: 24px;
}
.card-choice {
  gap: 12px;
  padding: 14px;
  justify-content: flex-start;
  text-align: start;
  border-color: #cdd7d3;
  border-radius: 16px;
  box-shadow: 0 4px 12px #173e3606;
}
.card-choice[aria-pressed="true"] {
  border: 2px solid #155c64;
  background: #e8f2ee;
  padding: 13px;
}
.card-choice img {
  flex: 0 0 48px;
  border-radius: 8px;
  background: white;
}
.card-choice span {
  min-width: 0;
}
.card-choice strong,
.card-choice small {
  display: block;
  overflow-wrap: anywhere;
}
.card-choice small {
  margin-top: 4px;
  font-size: 0.75rem;
  color: #48575a;
}
#presentation article {
  max-width: 360px;
  min-height: 460px;
  margin: auto;
  padding: 32px 24px;
  border-radius: 28px;
  border-top: 8px solid #155c64;
  box-shadow: 0 12px 36px #173e3614;
}
#presentation h2 {
  margin-top: 26px;
  font-size: 1.65rem;
}
.card-brand {
  color: #155c64;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  font-weight: 800;
}
#presentation .code {
  width: min(100%, 240px);
  margin-block: 28px 20px;
}
.preview-note {
  max-width: 360px;
  margin: 14px auto 0;
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: center;
  color: #48575a;
}

/* Profile and QR share the same small, device-local published identity. */
[hidden] {
  display: none !important;
}
header p,
.preview-note {
  font-size: 0.95rem;
  line-height: 1.65;
}
.card-choice small {
  font-size: 0.85rem;
  line-height: 1.5;
}
.view-switch {
  display: flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid #cad8d1;
  border-radius: 99px;
  background: #e7ede8;
  max-width: 360px;
  margin: 0 auto 16px;
}
.view-switch button {
  flex: 1;
  min-height: 46px;
  border: 0;
  border-radius: 99px;
  background: transparent;
  font-weight: 700;
}
.view-switch button[aria-pressed="true"] {
  background: #173e3d;
  color: white;
  box-shadow: 0 3px 12px #153d3420;
}
#presentation .saved-card {
  --card-a: #253c3c;
  --card-b: #142727;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 460px;
  border: 1px solid #a6c2b0;
  background: linear-gradient(140deg, var(--card-a), var(--card-b));
  color: #fff;
  box-shadow:
    0 0 0 3px #5eaa9020,
    0 16px 40px #173e3616;
  overflow: hidden;
}
#presentation .saved-card[data-appearance="bold"] {
  --card-a: #218a81;
  --card-b: #103e43;
}
#presentation .saved-card[data-appearance="emerald"] {
  --card-a: #267453;
  --card-b: #102d27;
}
#presentation .saved-card[data-appearance="orchid"] {
  --card-a: #8e568d;
  --card-b: #392044;
}
#presentation .saved-card[data-appearance="amber"] {
  --card-a: #927223;
  --card-b: #2e281a;
}
#presentation .saved-card[data-appearance="sapphire"] {
  --card-a: #305a94;
  --card-b: #172b4a;
}
#presentation .saved-card[data-appearance="minimal"] {
  --card-a: #f6f5ef;
  --card-b: #e8ede4;
  color: #253c3c;
}
#presentation .saved-card[data-font="serif"] {
  font-family: Georgia, serif;
}
#presentation .saved-card[data-font="mono"] {
  font-family: ui-monospace, monospace;
}
#presentation .saved-card h2 {
  font-size: 1.8rem;
  line-height: 1.25;
  margin: 20px 0 12px;
}
#presentation .saved-card p {
  font-size: 1rem;
  line-height: 1.65;
  color: inherit;
  opacity: 0.9;
}
.saved-card .card-brand {
  color: inherit;
  opacity: 0.8;
}
.saved-identity {
  width: 100%;
  padding-block: 20px;
}
.saved-avatar {
  width: 98px;
  height: 98px;
  display: grid;
  place-items: center;
  margin: auto;
  border-radius: 28px;
  border: 1px solid #ffffff70;
  background: linear-gradient(140deg, #ffffff30, #ffffff0a);
  font-size: 2rem;
  box-shadow: 0 8px 24px #00000013;
}
#presentation .saved-card .code {
  background: #fff;
  border-radius: 16px;
  padding: 8px;
  margin-block: 0 20px;
}
#presentation .saved-card .profile-link {
  padding: 12px 18px;
  min-height: 46px;
  width: 100%;
  border: 1px solid #ffffff60;
  border-radius: 12px;
  background: #ffffff14;
  color: inherit;
  font:
    600 0.9rem system-ui,
    sans-serif;
  text-decoration: none;
}
#presentation .saved-card[data-appearance="minimal"] .profile-link {
  border-color: #9eada4;
}
.saved-card-qr .saved-identity {
  padding-block: 0;
}
nav {
  justify-content: center;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    background: #142321;
    color: #e6efea;
  }
  header p,
  .preview-note,
  .card-choice small {
    color: #bccdc4;
  }
  .wordmark {
    color: #9fd9c4;
  }
  .card-choice {
    background: #203c35;
    color: #e6efea;
  }
  .card-choice[aria-pressed="true"] {
    background: #2a5044;
    border-color: #9fd9c4;
  }
  .view-switch {
    background: #203c35;
    border-color: #57766b;
  }
  .view-switch button {
    color: #e6efea;
  }
  .view-switch button[aria-pressed="true"] {
    background: #a9d5c6;
    color: #173e3d;
  }
}

#choose-heading {
  font-size: 1.1rem;
  margin: 28px 0 14px;
}

/* Device setup stays ahead of refresh/removal controls, without covering the cards. */
.wallet-install,
.wallet-help {
  margin-block: 0 20px;
  padding: 20px;
  border: 1px solid #bed2c9;
  border-radius: 20px;
  background: #e7f0eb;
  color: #173f42;
}
.wallet-install h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}
.wallet-install p,
.wallet-help li,
.wallet-install dd {
  line-height: 1.6;
}
.wallet-install p {
  margin-block: 8px 16px;
}
#install {
  background: #173f42;
  color: white;
  font-weight: 700;
}
#install-status:empty {
  display: none;
}
.wallet-install dt {
  font-weight: 700;
  margin-block-start: 14px;
}
.wallet-install dd {
  margin: 4px 0;
}
.wallet-help summary {
  cursor: pointer;
  min-height: 32px;
  font-weight: 700;
}
.wallet-help li {
  padding-inline-start: 4px;
  margin-block: 12px;
}
.wallet-help ol {
  padding-inline-start: 24px;
}
summary:focus-visible {
  outline: 3px solid #3975c0;
  outline-offset: 3px;
}
@media (prefers-color-scheme: dark) {
  .wallet-install,
  .wallet-help {
    background: #203c35;
    color: #e6efea;
    border-color: #57766b;
  }
  #install {
    background: #a9d5c6;
    color: #173e3d;
  }
}

/* Saved profile shape is approved metadata, never inferred from image pixels. */
img.saved-avatar[data-profile-photo-shape] {
  border-radius: 0;
  object-fit: contain;
  background: transparent;
}
img.saved-avatar[data-profile-photo-shape="circle"] {
  border-radius: 50%;
}
img.saved-avatar[data-profile-photo-shape="legacy"] {
  border: 0;
  box-shadow: none;
}
