/* Virtual Wallet Pocket — mobile shell and reusable interaction surfaces. */
:root {
  color-scheme: dark;
  --page: #101c2c;
  --page-deep: #0b1522;
  --surface: #17273a;
  --surface-raised: #1b2e43;
  --surface-hover: #233a52;
  --ink: #f5f1e8;
  --muted: #b4becb;
  --subtle: #8295aa;
  --line: #2b4057;
  --line-soft: #22364c;
  --gold: #e2bb77;
  --gold-bright: #f4d89f;
  --gold-ink: #2b2114;
  --danger: #f6a99e;
  --success: #a6d9bd;
  --focus: #f2cc8b;
  --radius: 18px;
  --shadow: 0 18px 48px rgb(2 9 18 / 22%);
  font: 400 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}
*, *::before, *::after { box-sizing: border-box; }
html { min-width: 0; scroll-behavior: smooth; background: var(--page); }
body { margin: 0; min-width: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(ellipse 75% 620px at 85% 0%, #20364a80, transparent 80%), var(--page); }
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button, a, input, select, textarea { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled, [aria-disabled="true"] { cursor: default; opacity: .48; }
button, input, select, textarea, a { -webkit-tap-highlight-color: rgb(226 187 119 / 14%); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
button:disabled:hover { transform: none; }
input, select, textarea { color: var(--ink); background: var(--page-deep); border: 1px solid #3e546e; border-radius: 12px; min-width: 0; padding: 12px 14px; width: 100%; min-height: 48px; font-size: 16px; }
input::placeholder, textarea::placeholder { color: #8fa1b4; opacity: 1; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--gold); width: 20px; min-height: 20px; height: 20px; margin: 0; flex: none; }
input[type="range"] { accent-color: var(--gold); padding: 0; }
input[type="file"] { max-width: 100%; }
textarea { resize: vertical; min-height: 112px; }
label { display: block; }
h1, h2, h3, p { margin-top: 0; }
button svg { flex: none; }
a { color: var(--gold-bright); text-underline-offset: 3px; }
[hidden] { display: none !important; }
.svg-definitions { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.icon { display: block; width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.page-width { width: min(1184px, calc(100% - 64px)); margin-inline: auto; }
.button, .icon-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 46px; min-width: 44px; border: 1px solid transparent; border-radius: 12px;
  padding: 10px 16px; font-size: 14px; line-height: 1.4; font-weight: 600;
  color: var(--ink); background: transparent; text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.button:hover, .icon-button:hover { background: var(--surface-hover); }
.button.primary { color: var(--gold-ink); background: var(--gold); border-color: var(--gold); box-shadow: 0 3px 12px #010a1614; }
.button.primary:hover { background: var(--gold-bright); border-color: var(--gold-bright); }
.button.secondary { background: var(--surface-raised); border-color: #3b5067; }
.button.secondary:hover { background: var(--surface-hover); border-color: #63758a; }
.button.text-button { color: var(--gold-bright); padding-inline: 10px; }
.icon-button { width: 46px; height: 46px; padding: 11px; flex: none; border-radius: 12px; }
.danger-button, .button.danger { color: var(--danger); border-color: #613f43; background: #392b33; }
.danger-button:hover, .button.danger:hover { background: #56363b; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 100; padding: 12px 16px; border-radius: 8px; background: var(--gold); color: var(--gold-ink); }
.skip-link:focus { top: 12px; }

/* Header and welcome */
.app-header { border-bottom: 1px solid #34495d80; background: #0d1926a8; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-block: 22px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { display: grid; place-items: center; width: 46px; height: 48px; color: var(--gold); border: 1px solid #9d84565e; border-radius: 14px; background: linear-gradient(140deg, #3d463c99, #26374730); box-shadow: inset 0 1px 0 #f4d89f15; flex: none; }
.brand-mark .icon { width: 27px; height: 27px; stroke-width: 1.5; }
.brand-words strong { display: block; font-size: 17px; line-height: 1.4; letter-spacing: .01em; font-weight: 650; white-space: nowrap; }
.brand-words > span { display: block; margin-top: 1px; color: var(--gold); font-size: 10px; line-height: 1.5; letter-spacing: .09em; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.install-button { color: var(--muted); font-weight: 500; }
.install-button .icon { width: 20px; height: 20px; }
.help-button { color: var(--muted); }
.add-button { padding-inline: 18px; }
.welcome { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; padding-block: 49px 37px; }
.eyebrow { display: flex; align-items: center; gap: 11px; margin-bottom: 17px; color: var(--gold); font-size: 10px; font-weight: 600; line-height: 1.5; letter-spacing: .2em; }
.eyebrow-line { height: 1px; width: 29px; background: var(--gold); opacity: .65; }
.welcome h1 { font: 400 clamp(37px, 4.5vw, 54px)/1.12 Georgia, "Times New Roman", serif; letter-spacing: -.035em; margin-bottom: 18px; color: #fbf5e9; }
.mobile-break { display: none; }
.welcome-description { max-width: 570px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.7; }
.welcome-detail { display: flex; align-items: center; gap: 11px; white-space: nowrap; color: var(--subtle); font-size: 12px; padding-bottom: 5px; }
.welcome-detail .icon { width: 20px; height: 20px; color: #c5a56f; stroke-width: 1.5; }
.detail-line { width: 30px; height: 1px; background: #435368; }
.has-wallets .welcome { padding-block: 24px 22px; gap: 0; }
.has-wallets .welcome h1 { font-size: 32px; margin: 0; line-height: 1.15; }
.has-wallets .welcome .eyebrow, .has-wallets .welcome-description, .has-wallets .welcome-detail, .has-wallets .welcome .mobile-break { display: none; }

/* Search, filters and collection */
.collection-tools { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-bottom: 24px; }
.search-field { position: relative; width: min(430px, 100%); }
.search-field > .icon { position: absolute; top: 50%; left: 16px; transform: translateY(-50%); width: 20px; height: 20px; color: #95a7bb; pointer-events: none; }
.search-field input { min-height: 50px; padding-left: 46px; padding-right: 14px; background: #0e1b2bba; border-color: #32485e; border-radius: 13px; font-size: 15px; box-shadow: inset 0 1px 2px #0001; }
.search-field input:focus { border-color: var(--gold); }
.search-field input::-webkit-search-cancel-button { cursor: pointer; }
.collection-filters { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid #33475d; border-radius: 14px; background: #0d1928; }
.filter-button { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 16px; min-height: 44px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 14px; font-weight: 550; white-space: nowrap; }
.filter-button .icon { width: 17px; height: 17px; }
.filter-button:hover { color: var(--ink); background: #22374d; }
.filter-button[aria-pressed="true"], .filter-button.active { background: #2d3f50; color: var(--gold-bright); border-color: #52616b; box-shadow: 0 2px 8px #0003; }
.collection-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.collection-heading h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: .01em; }
.wallet-count { color: var(--subtle); font-size: 12px; }
.install-hint { display: flex; align-items: flex-start; gap: 12px; padding: 15px 17px; margin: 0 0 18px; border: 1px solid #76694766; border-radius: 13px; background: #b19a5e0d; }
.install-hint > .icon { width: 21px; height: 21px; margin-top: 1px; color: var(--gold); }
.install-hint p { margin: 0; color: var(--subtle); font-size: 13px; line-height: 1.6; }
.install-hint p + p { margin-top: 4px; }
.install-hint strong { color: #dfd2b9; font-size: 14px; font-weight: 550; }
.has-wallets .install-hint { align-items: center; padding: 11px 14px; margin-bottom: 16px; }
.has-wallets .install-hint p + p { display: none; }
.wallet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.wallet-grid:empty { display: none; }
.wallet-card { position: relative; min-width: 0; border: 1px solid #344b62; border-radius: var(--radius); background: var(--surface); box-shadow: 0 9px 28px #030c181a; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.wallet-card:hover { border-color: #71858d; box-shadow: var(--shadow); }
.wallet-card:focus-within { border-color: var(--gold); }
.wallet-card button.card-open, .wallet-card .card-open, .wallet-card button.wallet-open { display: block; width: 100%; height: 100%; text-align: left; border: 0; padding: 0; background: transparent; color: inherit; cursor: pointer; }
.card-open:focus-visible { outline-offset: -4px; }
.card-preview, .card-thumb, .wallet-thumb, .wallet-preview, .wallet-card__preview { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 1.6; min-width: 0; overflow: hidden; padding: 18px; background: radial-gradient(ellipse at 50% 0%, #41587070, transparent 80%), #132236; border-bottom: 1px solid #31495f; }
.card-preview img, .card-thumb img, .wallet-thumb img, .wallet-preview img, .wallet-card__preview img, img.card-image, img.wallet-card__image { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 8px; filter: drop-shadow(0 8px 12px #0004); }
.wallet-card > img, .card-open > img { display: block; width: 100%; aspect-ratio: 1.6; padding: 18px; object-fit: contain; background: #132236; border-bottom: 1px solid #31495f; }
.card-info, .card-body, .wallet-card__body, .wallet-info { padding: 17px 18px 18px; }
.card-name, .card-title, .wallet-name, .wallet-card__title { display: block; margin: 0 40px 5px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: 16px; line-height: 1.45; font-weight: 650; }
.card-meta, .card-type, .wallet-meta, .wallet-card__meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.card-type .icon, .card-meta .icon { width: 14px; height: 14px; color: #d4b17a; }
.card-favorite, .favorite-toggle, .wallet-card__favorite { position: absolute; z-index: 1; right: 8px; bottom: 13px; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 12px; background: transparent; color: #a6b5c5; cursor: pointer; padding: 10px; }
.card-favorite:hover, .favorite-toggle:hover, .wallet-card__favorite:hover { background: #2a415a; color: var(--gold); }
.card-favorite[aria-pressed="true"], .favorite-toggle[aria-pressed="true"], .wallet-card__favorite[aria-pressed="true"], .favorite-button[aria-pressed="true"], .is-favorite, .favorite-button.active { color: var(--gold); }
.card-favorite[aria-pressed="true"] .icon, .favorite-toggle[aria-pressed="true"] .icon, .wallet-card__favorite[aria-pressed="true"] .icon, .favorite-button[aria-pressed="true"] .icon, .favorite-button.active .icon { fill: #e2bb7733; }
.card-actions { display: flex; gap: 6px; justify-content: flex-end; padding: 0 12px 12px; }
.card-actions button { min-width: 44px; min-height: 44px; border: 1px solid var(--line); background: var(--surface-raised); color: var(--ink); border-radius: 10px; padding: 9px 12px; }
.card-badge, .type-badge, .badge { display: inline-flex; align-items: center; gap: 5px; border: 1px solid #46596b; border-radius: 99px; padding: 3px 8px; font-size: 12px; line-height: 1.4; color: #dbcca8; background: #283848; }
.no-results { grid-column: 1 / -1; text-align: center; padding: 56px 24px; color: var(--muted); border: 1px dashed #3f5265; border-radius: var(--radius); }
.no-results h2 { font: 400 27px/1.25 Georgia, "Times New Roman", serif; color: var(--ink); margin: 0 0 12px; }
.no-results p { font-size: 16px; line-height: 1.65; max-width: 440px; margin: 0 auto; }
.card-preview.is-locked { flex-direction: column; gap: 11px; background: radial-gradient(ellipse at 50% 30%, #5b5b4344, transparent 85%), #132236; }
.lock-mark { display: grid; place-items: center; width: 58px; height: 58px; border: 1px solid #9d8c665c; border-radius: 18px; color: var(--gold); background: #9d8c6610; }
.lock-mark svg { display: block; width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.locked-label { color: #d6c6a8; font-size: 14px; font-weight: 550; line-height: 1.4; text-align: center; }

/* Empty state illustration contains no example personal information. */
.empty-state { display: flex; flex-direction: column; align-items: center; min-height: 385px; padding: 34px 24px 31px; border: 1px solid #42556b80; border-radius: 22px; background: radial-gradient(ellipse 60% 70% at 50% 25%, #31485c4d, transparent 100%), #12213499; box-shadow: inset 0 1px 0 #ffffff05; text-align: center; }
.empty-illustration { position: relative; width: 210px; height: 126px; margin-bottom: 24px; }
.illustration-card { display: block; position: absolute; width: 145px; height: 89px; top: 20px; left: 32px; border: 1px solid #76838d99; border-radius: 13px; box-shadow: 0 10px 16px #0002; }
.back-card { transform: rotate(-13deg) translate(-8px, 0); background: linear-gradient(120deg, #3f596f, #283e54); border-color: #75899a; }
.middle-card { transform: rotate(10deg) translate(8px, -3px); background: linear-gradient(120deg, #68715d, #4a574f); border-color: #d8bb7e80; }
.front-card { transform: rotate(-2deg) translate(0, 9px); background: linear-gradient(120deg, #22374b, #172a3d); border-color: #b79e6f; box-shadow: 0 13px 24px #040a1570, inset 0 1px 0 #f4d89f12; }
.illustration-wallet { position: absolute; top: 16px; left: 17px; width: 20px; height: 20px; stroke: var(--gold); stroke-width: 1.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.illustration-chip { position: absolute; right: 17px; top: 18px; width: 20px; height: 16px; border: 1px solid #d6b47788; border-radius: 4px; background: linear-gradient(145deg, #b0976266, #d2b47822); }
.illustration-lines { position: absolute; left: 18px; bottom: 17px; width: 70px; height: 3px; border-radius: 2px; background: #d6bf9680; }
.illustration-lines::after { content: ""; display: block; position: absolute; left: 0; top: 8px; width: 45px; height: 2px; background: #d6bf9633; border-radius: 2px; }
.illustration-spark { position: absolute; display: block; width: 4px; height: 4px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 12px #f4d89f44; }
.spark-one { top: 16px; right: 7px; opacity: .7; }
.spark-two { bottom: 4px; left: 13px; opacity: .35; }
.empty-state h3 { margin-bottom: 9px; font: 400 27px/1.2 Georgia, "Times New Roman", serif; letter-spacing: -.02em; }
.empty-state > p { max-width: 460px; margin-bottom: 20px; color: var(--muted); font-size: 16px; line-height: 1.65; }
.empty-actions { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.empty-actions .button { min-height: 47px; }
.empty-state > .file-hint { margin: 17px 0 0; color: #8398ac; font-size: 12px; letter-spacing: .015em; }

/* Backup and device status */
.backup-bar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 0 25px; margin-top: 25px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.backup-copy { display: flex; align-items: center; gap: 14px; }
.backup-icon { display: grid; place-items: center; color: #bbab8c; width: 42px; height: 44px; border: 1px solid #46556066; border-radius: 12px; background: #25344966; flex: none; }
.backup-icon .icon { width: 23px; height: 23px; }
.backup-copy h2 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.backup-copy p { margin: 0; color: var(--subtle); font-size: 12px; line-height: 1.6; }
.backup-actions { display: flex; align-items: center; gap: 11px; flex: none; }
.backup-actions .button { font-size: 14px; }
.backup-actions .icon { width: 18px; height: 18px; }
.app-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 22px max(24px, env(safe-area-inset-bottom)); color: var(--subtle); font-size: 12px; }
.device-status { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.status-item { display: inline-flex; align-items: center; gap: 7px; min-height: 20px; }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: #9cc3af; display: inline-block; flex: none; }
.status-item.offline .status-dot, .status-dot.offline { background: #c6b88f; }
.status-separator { height: 10px; width: 1px; background: #425165; }
.footer-brand { white-space: nowrap; color: #8292a3; }
.footer-brand > span { padding-inline: 4px; color: var(--gold); }

/* Dialog surfaces and content inserted by app.js. */
dialog { color: var(--ink); background: var(--surface); border: 1px solid #536177; border-radius: 22px; box-shadow: 0 28px 100px #0009; }
dialog::backdrop { background: #030a14ba; backdrop-filter: blur(5px); }
.sheet-dialog { width: min(490px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 0; overflow: auto; }
.dialog-chrome { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px 0 25px; }
.dialog-kicker { color: var(--gold); font-size: 9px; letter-spacing: .14em; font-weight: 600; }
.dialog-chrome .icon-button { color: var(--muted); }
.dialog-content { padding: 8px 25px 27px; }
.dialog-content h2 { margin: 0 0 13px; font: 400 29px/1.2 Georgia, "Times New Roman", serif; letter-spacing: -.02em; }
.dialog-content h3 { margin: 24px 0 9px; color: var(--ink); font-size: 15px; font-weight: 650; }
.dialog-content p { margin: 0 0 16px; color: var(--muted); font-size: 16px; line-height: 1.7; }
.dialog-content ul, .dialog-content ol { padding-left: 22px; color: var(--muted); font-size: 16px; line-height: 1.7; }
.dialog-content li { padding-left: 3px; margin-bottom: 10px; }
.dialog-content li strong, .dialog-content p strong { color: var(--ink); font-weight: 600; }
.dialog-content label, .form-label { display: block; margin: 18px 0 7px; color: #d4dce5; font-size: 14px; font-weight: 550; }
.dialog-content label input, .dialog-content label select, .dialog-content label textarea { display: block; margin-top: 7px; }
.dialog-content .check, .dialog-content .checkbox-label, .check-label { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 400; color: var(--muted); }
.dialog-content .check input, .dialog-content .checkbox-label input, .check-label input { margin: 0; }
.dialog-actions, .form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; margin-top: 24px; flex-wrap: wrap; }
.dialog-actions button, .form-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; border-radius: 11px; padding: 10px 17px; border: 1px solid #486079; background: var(--surface-raised); color: var(--ink); font-size: 14px; font-weight: 600; }
.dialog-actions button.primary, .form-actions button.primary { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.dialog-actions button.danger, .form-actions button.danger, .dialog-actions button.danger-button { background: #59383e; border-color: #956366; color: #ffd4cd; }
.dialog-content .hint, .dialog-content .form-hint, .hint, .form-hint { color: var(--subtle); font-size: 12px; line-height: 1.6; margin-top: 8px; }
.dialog-content .error, .error-message, .form-error { display: block; color: #ffc0b6; background: #4a2d353d; border-left: 2px solid var(--danger); padding: 10px 12px; border-radius: 0 7px 7px 0; font-size: 13px; line-height: 1.6; margin-top: 12px; }
.error:empty, .error-message:empty, .form-error:empty { display: none; }
.success-message { color: var(--success); font-size: 13px; }
.notice, .callout { padding: 14px 16px; border: 1px solid #5e654f; border-radius: 12px; background: #80734818; color: #d7c8a9; font-size: 13px; line-height: 1.6; margin-block: 18px; }
.dialog-content code { color: var(--gold-bright); background: #091523; font-size: .9em; padding: 2px 5px; border-radius: 4px; overflow-wrap: anywhere; }
.import-list, .result-list { margin-block: 16px; display: grid; gap: 9px; }
.import-item, .result-item { display: flex; align-items: center; gap: 10px; border: 1px solid #38516a; border-radius: 11px; padding: 11px 13px; font-size: 13px; }
.import-item .file-name, .result-item .file-name { min-width: 0; overflow-wrap: anywhere; flex: 1; }
.progress, progress { width: 100%; height: 7px; border-radius: 99px; overflow: hidden; background: #0b1726; accent-color: var(--gold); }
.loading, [aria-busy="true"] { cursor: progress; }
.button.loading::after, button[aria-busy="true"]::after, .spinner { content: ""; display: inline-block; width: 17px; height: 17px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; flex: none; }
.skeleton { background: linear-gradient(100deg, #24384c 25%, #334a60 45%, #24384c 65%); background-size: 250% 100%; animation: shimmer 1.4s ease-in-out infinite; }
.toast, [role="status"].toast { position: fixed; z-index: 40; bottom: max(24px, calc(env(safe-area-inset-bottom) + 15px)); left: 50%; transform: translateX(-50%); width: max-content; max-width: min(540px, calc(100% - 32px)); padding: 13px 18px; border: 1px solid #6f807e; border-radius: 12px; background: #223949; color: var(--ink); box-shadow: 0 8px 35px #0005; font-size: 14px; line-height: 1.5; text-align: center; }
.toast.error, .toast.is-error { border-color: #ac766d; background: #48333b; color: #ffd7d0; }

/* Full-screen viewer. Explicit image dimensions are controlled by app.js. */
.viewer-dialog { inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: #0b1522; overflow: hidden; }
.viewer-layout { display: flex; flex-direction: column; width: 100%; height: 100%; height: 100dvh; }
.viewer-header { display: flex; align-items: center; gap: 16px; padding: max(14px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) 14px max(22px, env(safe-area-inset-left)); background: #132336; border-bottom: 1px solid #30475f; flex: none; }
.viewer-heading { min-width: 0; flex: 1; }
.viewer-heading h2 { margin: 0; color: var(--ink); font-size: 16px; line-height: 1.45; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-heading p { color: var(--subtle); font-size: 12px; margin: 3px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-header .icon-button { background: #21364b; border: 1px solid #39516a; color: var(--muted); }
.viewer-header .favorite-button[aria-pressed="true"] { color: var(--gold); }
.viewer-stage { position: relative; display: flex; flex: 1; min-width: 0; min-height: 0; align-items: flex-start; justify-content: flex-start; overflow: auto; padding: 28px; touch-action: pan-x pan-y; overscroll-behavior: contain; scrollbar-width: thin; background: radial-gradient(ellipse at 50% 35%, #263b52, #0c1828 82%); }
.viewer-stage img { display: block; margin: auto; flex: none; max-width: none; max-height: none; object-fit: contain; user-select: none; -webkit-user-drag: none; border-radius: 5px; box-shadow: 0 15px 55px #0006; background: repeating-conic-gradient(#dce0e5 0% 25%, #f5f6f7 0% 50%) 0 0 / 18px 18px; }
.viewer-stage:focus-visible { outline-offset: -5px; }
.viewer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; background: #132336; border-top: 1px solid #30475f; padding: 13px max(22px, env(safe-area-inset-right)) max(13px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left)); flex: none; }
.viewer-zoom { display: flex; align-items: center; gap: 6px; padding: 4px; background: #0d1a2a; border: 1px solid #354b63; border-radius: 14px; }
.viewer-zoom .icon-button, .viewer-zoom .fit-button { min-height: 44px; height: 44px; }
.viewer-zoom .fit-button { min-width: 77px; padding-inline: 11px; font-size: 14px; }
.viewer-zoom .fit-button .icon { width: 18px; height: 18px; }
.viewer-actions { display: flex; gap: 9px; }
.viewer-actions .button { min-height: 46px; font-size: 14px; }
.viewer-actions .icon { width: 19px; height: 19px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@media (min-width: 1500px) {
  .page-width { width: min(1280px, calc(100% - 96px)); }
  .wallet-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .page-width { width: calc(100% - 48px); }
  .topbar { gap: 16px; }
  .header-actions { gap: 5px; }
  .install-button { font-size: 14px; padding-inline: 9px; }
  .add-button { padding-inline: 13px; }
  .welcome-detail { display: none; }
  .wallet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .backup-bar { align-items: flex-start; }
  .backup-actions { flex-direction: column; align-items: stretch; gap: 4px; }
}
@media (max-width: 640px) {
  .page-width { width: calc(100% - 36px); }
  .topbar { display: grid; grid-template-columns: minmax(0, 1fr) 44px 44px; gap: 8px; padding-block: max(17px, env(safe-area-inset-top)) 12px; }
  .brand { grid-column: 1; grid-row: 1; gap: 10px; }
  .brand-mark { width: 41px; height: 43px; border-radius: 12px; }
  .brand-mark .icon { width: 24px; height: 24px; }
  .brand-words strong { font-size: 15px; }
  .brand-words > span { font-size: 9px; }
  .header-actions { display: contents; }
  .help-button { grid-column: 2; grid-row: 1; width: 44px; height: 44px; padding: 11px; }
  .add-button { grid-column: 3; grid-row: 1; width: 44px; height: 44px; padding: 10px; border-radius: 12px; }
  .add-button > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .install-button { grid-column: 1 / -1; grid-row: 2; justify-self: start; padding: 8px 9px 8px 2px; gap: 8px; min-height: 44px; border-radius: 8px; font-size: 14px; font-weight: 500; color: #c5c3b5; }
  .install-button .icon { width: 17px; height: 17px; color: var(--gold); }
  .welcome { padding-block: 29px 27px; }
  .eyebrow { font-size: 9px; margin-bottom: 14px; letter-spacing: .17em; gap: 9px; }
  .eyebrow-line { width: 21px; }
  .welcome h1 { font-size: clamp(36px, 10vw, 45px); margin-bottom: 15px; line-height: 1.08; letter-spacing: -.035em; }
  .mobile-break { display: block; }
  .welcome-description { max-width: 390px; font-size: 16px; line-height: 1.65; }
  .has-wallets .welcome { padding-block: 19px 17px; }
  .has-wallets .welcome h1 { font-size: 28px; }
  .collection-tools { flex-direction: column; align-items: stretch; gap: 13px; padding-bottom: 22px; }
  .has-wallets .collection-tools { gap: 10px; padding-bottom: 14px; }
  .search-field { width: 100%; }
  .search-field input { min-height: 50px; font-size: 16px; border-radius: 13px; }
  .collection-filters { align-self: flex-start; padding: 3px; border-radius: 12px; gap: 2px; }
  .filter-button { padding-inline: 15px; font-size: 14px; min-height: 44px; border-radius: 9px; }
  .filter-button .icon { width: 16px; height: 16px; }
  .collection-heading { margin-bottom: 14px; }
  .collection-heading h2 { font-size: 14px; }
  .wallet-count { font-size: 12px; }
  .install-hint { gap: 10px; padding: 13px; margin-bottom: 16px; border-radius: 12px; }
  .install-hint p { font-size: 13px; }
  .has-wallets .install-hint { padding: 10px 12px; margin-bottom: 14px; }
  .wallet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
  .wallet-card { border-radius: 14px; }
  .card-preview, .card-thumb, .wallet-thumb, .wallet-preview, .wallet-card__preview { padding: 11px; aspect-ratio: 1.38; }
  .wallet-card > img, .card-open > img { padding: 11px; aspect-ratio: 1.38; }
  .card-info, .card-body, .wallet-card__body, .wallet-info { padding: 13px 12px 15px; min-height: 86px; }
  .card-name, .card-title, .wallet-name, .wallet-card__title { margin-right: 0; padding-right: 0; font-size: 16px; line-height: 1.4; }
  .card-meta, .card-type, .wallet-meta, .wallet-card__meta { padding-right: 32px; font-size: 12px; min-height: 24px; margin-top: 5px; overflow-wrap: anywhere; }
  .card-favorite, .favorite-toggle, .wallet-card__favorite { right: 4px; bottom: 6px; width: 44px; height: 44px; padding: 12px; border-radius: 10px; }
  .card-favorite .icon, .favorite-toggle .icon, .wallet-card__favorite .icon { width: 19px; height: 19px; }
  .card-preview.is-locked { gap: 8px; }
  .lock-mark { width: 44px; height: 44px; border-radius: 13px; }
  .lock-mark svg { width: 23px; height: 23px; }
  .empty-state { min-height: 380px; padding: 27px 17px 25px; border-radius: 18px; }
  .empty-illustration { transform: scale(.9); margin-bottom: 11px; height: 119px; }
  .empty-state h3 { font-size: 25px; }
  .empty-state > p { max-width: 290px; font-size: 16px; line-height: 1.65; margin-bottom: 18px; }
  .desktop-break { display: none; }
  .empty-actions { flex-direction: column; gap: 5px; width: 100%; }
  .empty-actions .primary { min-width: 225px; }
  .empty-actions .text-button { min-height: 44px; font-size: 14px; }
  .empty-state > .file-hint { margin-top: 10px; font-size: 12px; }
  .backup-bar { flex-direction: column; gap: 17px; padding-block: 22px; margin-top: 25px; }
  .backup-copy { gap: 11px; }
  .backup-copy h2 { font-size: 15px; }
  .backup-copy p { max-width: 245px; font-size: 12px; }
  .backup-icon { width: 39px; height: 42px; border-radius: 11px; }
  .backup-actions { flex-direction: row; gap: 10px; align-items: center; width: 100%; flex-wrap: wrap; }
  .backup-actions .button { font-size: 14px; min-height: 45px; gap: 7px; padding-inline: 11px; }
  .backup-actions .text-button { padding-inline: 6px; }
  .app-footer { flex-direction: column; align-items: flex-start; gap: 11px; padding-top: 18px; padding-bottom: max(25px, env(safe-area-inset-bottom)); }
  .device-status { gap: 8px; font-size: 12px; line-height: 1.7; }
  .footer-brand { font-size: 12px; }
  .sheet-dialog { width: calc(100% - 22px); max-height: calc(100dvh - 28px); border-radius: 20px; }
  .dialog-chrome { padding: 11px 10px 0 21px; }
  .dialog-content { padding: 7px 21px 24px; }
  .dialog-content h2 { font-size: 27px; }
  .dialog-content p, .dialog-content ul, .dialog-content ol { font-size: 16px; }
  .dialog-actions, .form-actions { gap: 8px; }
  .dialog-actions button, .form-actions button { flex: 1; min-height: 48px; padding-inline: 12px; }
  .viewer-header { gap: 11px; padding: max(11px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 11px max(12px, env(safe-area-inset-left)); }
  .viewer-header .icon-button { width: 44px; height: 44px; min-height: 44px; padding: 10px; border-radius: 11px; }
  .viewer-heading h2 { font-size: 16px; }
  .viewer-heading p { font-size: 12px; }
  .viewer-stage { padding: 16px; }
  .viewer-toolbar { flex-direction: column; gap: 11px; padding: 11px max(14px, env(safe-area-inset-right)) max(15px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
  .viewer-zoom { gap: 8px; padding: 3px; border-radius: 13px; }
  .viewer-zoom .fit-button { min-width: 75px; }
  .viewer-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
  .viewer-actions .button { padding: 11px 8px; gap: 7px; font-size: 14px; min-height: 45px; }
  .viewer-actions .icon { width: 17px; height: 17px; }
}
@media (max-width: 420px) {
  .viewer-actions .button { flex-direction: column; gap: 4px; padding: 8px 4px; min-height: 66px; }
}
@media (max-width: 360px) {
  .page-width { width: calc(100% - 28px); }
  .brand { gap: 8px; }
  .brand-words strong { font-size: 14px; }
  .welcome h1 { font-size: 36px; }
  .wallet-grid { gap: 10px; }
  .card-info, .card-body, .wallet-card__body, .wallet-info { padding-inline: 10px; }
  .backup-actions { gap: 4px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .viewer-header { padding-block: 7px; }
  .viewer-toolbar { flex-direction: row; padding-block: 7px; gap: 12px; }
  .viewer-actions { display: flex; width: auto; }
  .viewer-actions .button { min-height: 44px; }
  .viewer-stage { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
