/* Crypto Gold Vault — black and gold (approved five-screen design) */
@font-face { font-family: 'CGV Display'; src: url(../fonts/cormorant.woff2) format('woff2'); font-weight: 300 700; font-display: swap; }
@font-face { font-family: 'CGV Sans'; src: url(../fonts/inter.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --gold: #E9B949; --gold-2: #F7D98A; --gold-3: #B9821F; --gold-dark: #6B4510;
  --ink: #0A0806; --ink-2: #14100B; --line: rgba(233, 185, 73, .3);
  --text: #F5EBD3; --muted: rgba(245, 235, 211, .64);
  --sans: 'CGV Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Hiragino Sans', 'Noto Sans JP', 'Noto Sans KR', 'Noto Sans SC', 'Noto Sans Arabic', 'Yu Gothic UI', sans-serif;
  --serif: 'CGV Display', 'Cormorant Garamond', Georgia, 'Hiragino Mincho ProN', 'Yu Mincho', 'Noto Serif JP', serif;
  --D: 340px; --vx: 50%; --vy: 42%;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--ink); }
html, body { margin: 0; height: 100%; color: var(--text); font-family: var(--sans); font-variant-numeric: lining-nums; }
body { overflow: hidden; overscroll-behavior: none; -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px; border-radius: 12px; }
h1, h2, h3, h4, p { margin: 0; }
svg { display: block; }
img { display: block; -webkit-user-drag: none; user-select: none; }

/* ---------- background: dark stone wall, warm light around the vault ---------- */
#bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: #070504; }
#bg .wall { position: absolute; inset: -2%; background: url(../art/marble.webp) center / cover no-repeat; }
#bg .halo { position: absolute; inset: 0; transition: opacity .8s ease;
  background: radial-gradient(circle calc(var(--D) * .95) at var(--vx) var(--vy), rgba(255, 196, 92, .30), rgba(190, 120, 30, .16) 48%, rgba(120, 70, 15, 0) 100%); }
#bg .vignette { position: absolute; inset: 0;
  background: radial-gradient(ellipse 85% 70% at var(--vx) var(--vy), rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, .55) 75%, rgba(0, 0, 0, .85) 100%),
              linear-gradient(rgba(0, 0, 0, .45), rgba(0, 0, 0, 0) 18%, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, .7)); }
body.open #bg .halo { opacity: 1.35; background: radial-gradient(circle calc(var(--D) * 1.05) at var(--vx) var(--vy), rgba(255, 206, 110, .42), rgba(200, 130, 35, .2) 50%, rgba(120, 70, 15, 0) 100%); }
body.welcome #bg .halo { background: radial-gradient(ellipse 70% 40% at 50% 58%, rgba(255, 190, 80, .26), rgba(160, 100, 20, .08) 60%, transparent 85%); }

/* ---------- top bar ---------- */
.top { position: fixed; z-index: 5; top: 0; left: 0; right: 0; height: calc(52px + var(--sat)); padding: var(--sat) calc(10px + var(--sar)) 0 calc(10px + var(--sal));
  display: flex; align-items: center; justify-content: space-between; }
.wordmark { font-family: var(--serif); font-weight: 500; letter-spacing: .34em; font-size: 15px; color: var(--gold-2); padding-inline-start: .34em; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--gold); flex: none; }
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn.plus { width: 40px; height: 40px; border-radius: 12px; color: #1A1104; background: linear-gradient(180deg, #FFE29A, #E2AE45 55%, #B67E1E);
  box-shadow: 0 0 14px rgba(233, 185, 73, .45), inset 0 1px 0 rgba(255, 255, 255, .5); }
.icon-btn.spacer { pointer-events: none; }
.icon-btn.x { font-size: 18px; color: var(--muted); }
[dir="rtl"] .icon-btn.back svg, [dir="rtl"] .chev { transform: scaleX(-1); }

/* ---------- main column ---------- */
#main { position: fixed; inset: 0; padding: calc(50px + var(--sat)) calc(16px + var(--sar)) calc(12px + var(--sab)) calc(16px + var(--sal));
  display: flex; flex-direction: column; align-items: center; justify-content: space-evenly; text-align: center; }
.titles { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.display { font-family: var(--serif); font-weight: 500; line-height: .98; letter-spacing: .005em;
  background: linear-gradient(180deg, #FFF3C8 0%, #F4CB62 46%, #B57E1E 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 12px rgba(233, 185, 73, .28)); }
#welcomeTitle { font-size: clamp(38px, 11.5vw, 64px); display: flex; flex-direction: column; padding: 0 .05em .06em; }
#welcomeTitle span:last-child { font-weight: 600; }
.tagline { font-family: var(--sans); font-size: clamp(17px, 4.6vw, 21px); color: var(--text); opacity: .92; }
.screen-title { font-family: var(--sans); font-weight: 500; font-size: 24px; color: var(--text); letter-spacing: .005em; }
.welcome-text { max-width: 340px; font-size: 14px; line-height: 1.45; color: var(--muted); }
.privacy-line { font-size: 12px; color: var(--muted); letter-spacing: .02em; }

body.welcome .home-only, body:not(.welcome) .welcome-only { display: none !important; }
body.open .home-layer, body.opening .home-layer { visibility: hidden; }
.below { display: grid; width: 100%; justify-items: center; align-items: center; }
.below > .layer { grid-area: 1 / 1; display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
#result[hidden] { display: flex !important; visibility: hidden; }

/* ---------- welcome treasure ---------- */
#hero { width: min(100%, 560px); height: var(--H, 240px); position: relative; flex: none; }
#hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%;
  -webkit-mask-image: radial-gradient(ellipse 47% 80% at 50% 60%, #000 58%, transparent 100%); mask-image: radial-gradient(ellipse 47% 80% at 50% 60%, #000 58%, transparent 100%);
  filter: drop-shadow(0 0 30px rgba(255, 190, 80, .25)); }

/* ---------- the vault stage ---------- */
#stageWrap { position: relative; width: var(--D); height: var(--D); flex: none; }
#stage { position: absolute; inset: 0; perspective: calc(var(--D) * 3); perspective-origin: 20% 50%; transform-origin: 50% 50%; outline: none; }
.glow { position: absolute; inset: -22%; border-radius: 50%; pointer-events: none; opacity: .55;
  background: radial-gradient(circle, rgba(255, 190, 80, .28) 0%, rgba(200, 130, 30, .1) 45%, transparent 68%); }
.frame { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none;
  filter: drop-shadow(0 calc(var(--D) * .025) calc(var(--D) * .04) rgba(0, 0, 0, .8)); }
.interior { position: absolute; left: 10.5%; top: 10.5%; width: 79%; height: 79%; border-radius: 50%; overflow: hidden; z-index: 1; background: #070503; isolation: isolate; }
.interior-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#pile { position: absolute; inset: 0; width: 100%; height: 100%; }
.interior .rays { position: absolute; inset: 0; opacity: 0; mix-blend-mode: screen; pointer-events: none;
  background:
    conic-gradient(from 160deg at 50% -12%, transparent 0deg, rgba(255, 224, 150, .2) 8deg, transparent 15deg, rgba(255, 224, 150, .14) 25deg, transparent 33deg, rgba(255, 224, 150, .18) 41deg, transparent 49deg),
    radial-gradient(ellipse 60% 40% at 50% 66%, rgba(255, 210, 120, .3), transparent 70%); }
.interior .burst { position: absolute; inset: 0; opacity: 0; mix-blend-mode: screen; pointer-events: none;
  background: radial-gradient(circle at 50% 56%, rgba(255, 250, 225, .95), rgba(255, 214, 120, .55) 30%, rgba(230, 160, 40, 0) 70%); }
.interior .dark { position: absolute; inset: 0; background: radial-gradient(circle at 50% 45%, rgba(0, 0, 0, .82), #000 75%); }
.interior::after { content: ''; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  box-shadow: inset 0 0 calc(var(--D) * .07) calc(var(--D) * .02) rgba(0, 0, 0, .92), inset calc(var(--D) * -.02) calc(var(--D) * .03) calc(var(--D) * .05) rgba(0, 0, 0, .6); }

.door { position: absolute; left: 10%; top: 10%; width: 80%; height: 80%; z-index: 3; transform-style: preserve-3d; transform-origin: -8% 50%; will-change: transform; }
.door-face, .door-back, .door-edge { position: absolute; inset: 0; border-radius: 50%; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.door-face { filter: drop-shadow(0 calc(var(--D) * .012) calc(var(--D) * .02) rgba(0, 0, 0, .7)); }
.door-face img { position: absolute; inset: 0; width: 100%; height: 100%; }
.door-face .wheel { will-change: transform; filter: drop-shadow(calc(var(--D) * .008) calc(var(--D) * .014) calc(var(--D) * .01) rgba(0, 0, 0, .65)); }
.door-back { width: 100%; height: 100%; transform: translateZ(calc(var(--D) * -.05)) rotateY(180deg); }
.door-edge { background: radial-gradient(circle, #3A2405 60%, #9C6A1C 85%, #4A2E06 100%); backface-visibility: visible; -webkit-backface-visibility: visible; }
.door-edge.e1 { transform: translateZ(calc(var(--D) * -.01)); }
.door-edge.e2 { transform: translateZ(calc(var(--D) * -.02)); }
.door-edge.e3 { transform: translateZ(calc(var(--D) * -.03)); }
.door-edge.e4 { transform: translateZ(calc(var(--D) * -.04)); background: radial-gradient(circle, #2A1A04 60%, #7A4E12 90%, #3A2405); }
body:not(.welcome):not(.open) #stage { cursor: pointer; }

/* ---------- gold total and the closed vault's three actions ---------- */
.total { display: flex; align-items: center; justify-content: center; gap: .28em; font-family: var(--sans); font-weight: 600;
  font-size: clamp(36px, 10vw, 54px); line-height: 1.1; color: var(--gold-2); font-variant-numeric: tabular-nums lining-nums;
  background: linear-gradient(180deg, #FFF4CF, #F3C95C 55%, #C98F2C); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 16px rgba(240, 190, 80, .3)); }
#total { direction: ltr; unicode-bidi: isolate; }
.total .unit { font-size: .62em; font-weight: 500; }
.bars-icon { width: 1.05em; height: .62em; flex: none; position: relative; background:
  linear-gradient(180deg, #FFF0B8, #E9B949 50%, #8A5A12) 50% 0 / 48% 46% no-repeat,
  linear-gradient(180deg, #FFE7A0, #D9A33A 50%, #7A4D10) 0 100% / 48% 46% no-repeat,
  linear-gradient(180deg, #FFE7A0, #D9A33A 50%, #7A4D10) 100% 100% / 48% 46% no-repeat; filter: none; }
.home-actions { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; width: min(400px, 100%); }
.side-btn { justify-self: center; display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 14px; color: var(--text); padding-top: 12px; min-width: 80px; }
.side-btn .tile { width: 54px; height: 54px; border-radius: 15px; display: grid; place-items: center; color: var(--gold);
  background: linear-gradient(180deg, rgba(48, 36, 18, .9), rgba(22, 16, 8, .92)); border: 1px solid rgba(233, 185, 73, .22);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 230, 160, .08); }
.side-btn .tile svg { width: 26px; height: 26px; }
.side-btn:active .tile { transform: scale(.95); }
.open-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.open-btn .ring { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; color: var(--gold-2);
  border: 2px solid var(--gold); background: radial-gradient(circle at 50% 35%, rgba(233, 185, 73, .2), rgba(20, 14, 6, .92) 70%);
  box-shadow: 0 0 0 5px rgba(233, 185, 73, .08), 0 0 32px rgba(233, 185, 73, .5), inset 0 0 18px rgba(233, 185, 73, .25); animation: pulse 2.6s ease-in-out infinite; }
.open-btn .ring svg { width: 34px; height: 34px; margin-inline-start: 4px; }
.open-btn .open-label { font-size: 17px; font-weight: 500; color: var(--text); }
.open-btn:active .ring { transform: scale(.95); }
.open-btn:disabled { opacity: .5; cursor: default; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 5px rgba(233, 185, 73, .08), 0 0 26px rgba(233, 185, 73, .4), inset 0 0 18px rgba(233, 185, 73, .25); }
                   50% { box-shadow: 0 0 0 9px rgba(233, 185, 73, .04), 0 0 44px rgba(233, 185, 73, .62), inset 0 0 22px rgba(233, 185, 73, .35); } }
.status { font-size: 12px; color: var(--muted); padding: 4px 10px; min-height: 24px; }
body.stale .status { color: #E9B97A; }

/* ---------- open vault result (approved screen 3) ---------- */
#result { gap: 6px; justify-content: center; visibility: hidden; }
#result.show { visibility: visible; }
.message { font-size: 18px; color: var(--text); max-width: 340px; line-height: 1.35; }
.message.note { font-size: 13px; color: var(--muted); }
.result-note { font-size: 12px; color: var(--muted); min-height: 1em; }
.result-note:empty { display: none; }
#result .actions { margin-top: 8px; min-height: 56px; }

/* ---------- buttons ---------- */
.actions { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.btn { min-height: 54px; min-width: min(300px, 84vw); max-width: 100%; padding: 0 28px; border-radius: 999px; font-size: 18px; font-weight: 500; letter-spacing: .01em;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; transition: transform .12s ease, box-shadow .2s ease, background .2s; text-align: center; }
.btn:active { transform: scale(.97); }
.btn.primary { color: #1A1104; background: linear-gradient(180deg, #FFE7A0, #EDBB4E 48%, #C48A22); box-shadow: 0 6px 28px rgba(233, 185, 73, .4), inset 0 1px 0 rgba(255, 255, 255, .55); font-weight: 600; }
.btn.gold-outline { color: var(--text); border: 1.5px solid var(--gold); background: linear-gradient(180deg, rgba(40, 28, 10, .85), rgba(16, 11, 5, .9));
  box-shadow: 0 0 22px rgba(233, 185, 73, .32), inset 0 0 14px rgba(233, 185, 73, .12); }
.btn.outline, .btn.ghost-btn { color: var(--text); border: 1.5px solid var(--line); background: rgba(20, 14, 6, .55); }
.btn.ghost-btn { min-height: 48px; font-size: 16px; }
.btn.danger-fill { background: linear-gradient(180deg, #F5B39A, #D8704F); color: #1A0904; box-shadow: none; }
.chev { font-size: 24px; line-height: 1; color: var(--gold-2); }
.plus-sign { font-size: 24px; line-height: 1; color: var(--gold-2); font-weight: 400; }

/* ---------- panels: asset list (screen 4) and asset editor (screen 5) ---------- */
.panel { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column;
  background: radial-gradient(ellipse 90% 55% at 50% 0%, rgba(90, 60, 18, .35), transparent 70%), linear-gradient(#0E0B07, #080605);
  padding: var(--sat) calc(16px + var(--sar)) calc(18px + var(--sab)) calc(16px + var(--sal));
  transform: translateX(104%); transition: transform .38s cubic-bezier(.2, .8, .2, 1); visibility: hidden; }
[dir="rtl"] .panel { transform: translateX(-104%); }
.panel.show { transform: none !important; visibility: visible; }
#editor { z-index: 12; }
.panel-top { min-height: 64px; padding-top: 6px; display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; align-items: center; justify-items: center; text-align: center; width: min(560px, 100%); margin: 0 auto; }
.panel-top .screen-title { overflow-wrap: anywhere; line-height: 1.15; }
.asset-list { list-style: none; margin: 10px auto 0; padding: 0; width: min(560px, 100%); overflow-y: auto; flex: 1 1 auto; display: flex; flex-direction: column; gap: 10px; -webkit-overflow-scrolling: touch; }
.asset-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 18px; width: 100%; text-align: start;
  background: linear-gradient(180deg, rgba(38, 29, 17, .92), rgba(20, 15, 9, .95)); border: 1px solid rgba(233, 185, 73, .16); box-shadow: 0 8px 20px rgba(0, 0, 0, .35); }
.asset-row:active { background: #231A10; }
.asset-row .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.asset-row .tick { font-size: 18px; font-weight: 600; color: var(--text); }
.asset-row .qty { font-size: 16px; color: var(--gold); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: start; unicode-bidi: plaintext; }
[dir="rtl"] .asset-row .qty { text-align: right; }
.asset-row .pen { width: 24px; height: 24px; color: var(--gold); flex: none; }
.badge { width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 21px; color: #fff;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c, #888) 70%, white), var(--c, #888) 55%, color-mix(in srgb, var(--c, #888) 60%, black));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .14), 0 2px 8px rgba(0, 0, 0, .5); text-shadow: 0 1px 2px rgba(0, 0, 0, .35); font-family: var(--sans); }
.empty { text-align: center; color: var(--muted); margin: 30px auto; max-width: 300px; line-height: 1.45; }
.panel-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 14px; }

.editor-body { width: min(520px, 100%); margin: 10px auto 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; user-select: text; -webkit-user-select: text; }
.coin-select { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: 18px; width: 100%; text-align: start;
  border: 1.5px solid rgba(233, 185, 73, .55); background: linear-gradient(180deg, rgba(38, 29, 17, .9), rgba(20, 15, 9, .95)); box-shadow: 0 0 16px rgba(233, 185, 73, .14); }
.coin-select > span:first-child { display: flex; align-items: center; gap: 12px; min-width: 0; }
.coin-select .nm { font-size: 18px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coin-select .nm small { font-weight: 400; color: var(--muted); font-size: 16px; }
.coin-select .chev-down svg { width: 22px; height: 22px; color: var(--gold); }
.coin-select:disabled { cursor: default; } .coin-select:disabled .chev-down { visibility: hidden; }
.cur { font-size: 13px; color: var(--muted); margin-top: -4px; padding-inline-start: 4px; min-height: 1em; }
.field { width: 100%; height: 64px; border-radius: 18px; border: 1.5px solid rgba(233, 185, 73, .3); background: rgba(10, 8, 5, .9); color: var(--text);
  font: 500 28px/1 var(--sans); padding: 0 18px; font-variant-numeric: tabular-nums; outline: none; user-select: text; -webkit-user-select: text; }
.field:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(233, 185, 73, .18); }
.field.search { height: 48px; font-size: 16px; border-radius: 14px; }
.field-label { font-size: 16px; color: var(--text); margin-bottom: -4px; padding-inline-start: 4px; margin-top: 8px; }
.preview { font-size: 15px; color: var(--gold-2); min-height: 1.2em; padding-inline-start: 4px; }
.error { font-size: 15px; color: #F0A58C; min-height: 1.2em; margin-top: -6px; padding-inline-start: 4px; }
.editor-actions { margin-top: auto; padding-top: 18px; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.editor-actions .btn { width: 100%; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(10, 8, 5, .9); border: 1px solid var(--line); }
.seg button { min-height: 40px; border-radius: 10px; font-size: 15px; color: var(--muted); padding: 0 6px; }
.seg button[aria-checked="true"] { background: linear-gradient(180deg, #F3CF72, #C99329); color: #1A1104; font-weight: 600; }
.seg.mini button { min-height: 28px; font-size: 12px; padding: 0 8px; }

/* ---------- sheets (coin picker, settings, confirm) ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .62); display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility 0s linear .25s; }
.sheet.open { opacity: 1; visibility: visible; transition: opacity .25s ease; }
.sheet-card { width: min(520px, 100%); max-height: calc(100% - var(--sat) - 20px); overflow-y: auto; background: linear-gradient(#1A140C, #0F0B07);
  border: 1px solid rgba(233, 185, 73, .24); border-bottom: 0; border-radius: 24px 24px 0 0; padding: 18px 20px calc(20px + var(--sab));
  display: flex; flex-direction: column; gap: 12px; transform: translateY(30px); transition: transform .3s cubic-bezier(.2, .8, .2, 1); user-select: text; -webkit-user-select: text; }
.sheet.open .sheet-card { transform: none; }
.sheet.center { align-items: center; padding: 20px; }
.sheet.center .sheet-card, .small-card { border-radius: 22px; border-bottom: 1px solid rgba(233, 185, 73, .24); padding-bottom: 20px; }
.small-card p { font-size: 17px; text-align: center; line-height: 1.4; }
.small-card .row { display: flex; gap: 10px; }
.small-card .row .btn { min-width: 0; flex: 1; padding: 0 14px; }
@media (min-width: 700px) and (min-height: 560px) {
  .sheet { align-items: center; }
  .sheet-card { border-radius: 24px; border-bottom: 1px solid rgba(233, 185, 73, .24); padding-bottom: 22px; }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-head h3 { font-size: 19px; font-weight: 600; }
.sheet h4 { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); margin-top: 8px; }
.small { font-size: 14px; line-height: 1.45; color: var(--text); opacity: .86; }
.muted { color: var(--muted); }
.version { font-size: 12px; }
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.lang-grid button { min-height: 40px; border-radius: 12px; border: 1px solid var(--line); background: rgba(10, 8, 5, .8); color: var(--muted); font-size: 15px; padding: 0 8px; }
.lang-grid button[aria-checked="true"] { background: linear-gradient(180deg, #F3CF72, #C99329); color: #1A1104; font-weight: 600; border-color: transparent; }
.lang-grid .auto { grid-column: 1 / -1; }
.link { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; align-self: flex-start; margin-top: 6px; }
.link.danger { color: #E99A80; }
.picker-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; max-height: 56vh; }
.picker-list button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 14px; text-align: start; }
.picker-list button:active, .picker-list button:hover { background: #1E170E; }
.picker-list .nm { flex: 1; font-size: 16px; min-width: 0; }
.picker-list .nm small { color: var(--muted); margin-inline-start: 8px; }
.picker-list .held { font-size: 13px; color: var(--gold); direction: ltr; unicode-bidi: isolate; }

::selection { background: rgba(233, 185, 73, .45); color: #fff; }

#fg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 6; pointer-events: none; }
body.loading #main { opacity: 0; }
#main { transition: opacity .4s ease; }

/* short phones: drop the explanatory line on the welcome screen */
@media (max-height: 640px) { .welcome-text { display: none; } .summary-label { font-size: 15px; } .side-btn { padding-top: 6px; } }

/* landscape phones / short windows: vault on the left, words and buttons on the right */
@media (orientation: landscape) and (max-height: 560px) {
  #main { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, auto); justify-items: center; column-gap: 28px; row-gap: 8px; }
  #main > * { grid-column: 2; }
  #main > #stageWrap, #main > #hero { grid-column: 1; grid-row: 1 / span 2; align-self: center; }
  #main > .titles { grid-row: 1; align-self: end; } body.open #main > .titles { display: none; }
  #main > .below { grid-row: 2; align-self: start; }
  body.open #main > .below { grid-row: 1 / span 2; align-self: center; }
  .below > .layer { gap: 8px; }
  #welcomeTitle { font-size: 40px; flex-direction: row; gap: .25em; }
  .titles .screen-title { font-size: 20px; }
  .total { font-size: 38px; }
  .btn { min-width: min(280px, 44vw); min-height: 46px; }
  .open-btn .ring { width: 66px; height: 66px; } .side-btn .tile { width: 46px; height: 46px; }
  .welcome-text { display: none; }
  .panel-top { min-height: 52px; padding-top: 0; }
  .editor-body { gap: 8px; margin-top: 4px; }
  .field { height: 50px; font-size: 22px; } .coin-select { padding: 8px 14px; }
  .editor-actions { flex-direction: row; padding-top: 8px; } .editor-actions .btn { min-width: 0; min-height: 46px; }
}
@media (prefers-reduced-motion: reduce) {
  .open-btn .ring { animation: none; }
  .panel, .sheet, .sheet-card, #result, #bg .halo { transition: none; }
}
#okBtn, #closeBtn { animation: fadeUp .5s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }


/* =====================================================================================================
   Luxury design system (v1.3): one set of materials for every screen — black marble, champagne gold,
   engraved serif titles, ornamented dividers, gold-bezelled controls.
   ===================================================================================================== */
:root { --gold-line: linear-gradient(90deg, rgba(233, 185, 73, 0), #E9B949 30%, #FFE7A6 50%, #E9B949 70%, rgba(233, 185, 73, 0));
  --panel-bg: linear-gradient(rgba(6, 5, 3, .78), rgba(6, 5, 3, .9)), url(../art/marble.webp) center / cover;
  --bezel: 0 0 0 1px rgba(255, 226, 150, .08) inset, 0 1px 0 rgba(255, 236, 190, .1) inset, 0 10px 30px rgba(0, 0, 0, .45); }

/* engraved gold titles */
.lux-title { font-family: var(--serif); font-weight: 600; font-size: clamp(30px, 8.6vw, 40px); line-height: 1.05; letter-spacing: .01em; padding: 0 .05em .06em;
  background: linear-gradient(180deg, #FFF3C8 0%, #F2C35A 48%, #A86F16 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .6)) drop-shadow(0 0 14px rgba(233, 185, 73, .22)); }
.lux-title.panel-title { font-size: clamp(26px, 7.4vw, 32px); }
.lux-title.small-title { font-size: clamp(24px, 6.6vw, 30px); text-align: center; }
/* ornament: line — diamond — line */
.ornament { width: min(64%, 300px); height: 10px; position: relative; margin: 2px auto 0; flex: none; }
.ornament::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--gold-line); }
.ornament::after { content: ''; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; transform: translate(-50%, -50%) rotate(45deg);
  background: linear-gradient(135deg, #FFF0C0, #C99329); box-shadow: 0 0 8px rgba(255, 210, 120, .6); }
.titles .ornament { width: min(52%, 240px); }

/* locked / unlocked */
body.locked .unlocked-only, body:not(.locked) .locked-only { display: none !important; }
body.locked .home-layer { visibility: visible; }
.auth-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.lock-hint { color: var(--muted); font-size: 14px; line-height: 1.45; max-width: 330px; }
.lock-msg { min-height: 1.2em; color: #F2A98E; font-size: 14px; max-width: 330px; }
.link.subtle { color: rgba(245, 235, 211, .55); font-size: 13px; align-self: center; margin: 0; text-decoration-color: rgba(233, 185, 73, .4); }

/* luxury button with an icon cell (lock-screen concept) */
.btn.lux { width: min(340px, 88vw); min-height: 60px; padding: 0 22px 0 14px; justify-content: flex-start; gap: 14px; color: var(--text); font-family: var(--serif); font-size: 21px; font-weight: 600;
  background: radial-gradient(ellipse 120% 160% at 50% -30%, rgba(255, 214, 130, .14), transparent 60%), linear-gradient(180deg, rgba(34, 24, 10, .94), rgba(10, 7, 4, .96));
  border: 1.5px solid transparent; background-clip: padding-box; position: relative;
  box-shadow: 0 0 0 1.5px #B8862B, 0 0 0 2.5px rgba(255, 228, 160, .18), 0 0 24px rgba(233, 185, 73, .28), inset 0 1px 0 rgba(255, 236, 190, .14); }
.btn.lux .ico { width: 40px; height: 40px; display: grid; place-items: center; color: #F2C766; flex: none; }
.btn.lux .ico svg { width: 30px; height: 30px; filter: drop-shadow(0 0 6px rgba(240, 190, 80, .45)); }
.btn.lux .sep { width: 1px; align-self: stretch; margin: 12px 0; background: linear-gradient(transparent, #C99329, transparent); }
.btn.lux .lbl { flex: 1; text-align: center; }
.btn.lux:hover { box-shadow: 0 0 0 1.5px #E2B04A, 0 0 0 2.5px rgba(255, 228, 160, .25), 0 0 34px rgba(233, 185, 73, .42), inset 0 1px 0 rgba(255, 236, 190, .2); }
.btn.primary { font-family: var(--serif); font-size: 20px; letter-spacing: .01em; }
.btn.gold-outline, .btn.outline, .btn.ghost-btn { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.btn.mini { min-height: 34px; min-width: 0; padding: 0 14px; font-size: 14px; font-family: var(--sans); font-weight: 600; color: #1A1104;
  background: linear-gradient(180deg, #F6D68A, #C99329); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45); }
.btn.mini.ghost { background: transparent; color: var(--gold-2); box-shadow: 0 0 0 1px rgba(233, 185, 73, .5); }
.btn:disabled { opacity: .55; cursor: default; }

/* ---------- combination mechanism on the door ---------- */
.door-face .door-img { z-index: 1; }
.door-face .wheel { z-index: 3; }
.combo { position: absolute; left: 28%; width: 44%; top: 4%; aspect-ratio: 2.7; z-index: 2; --wh: calc(var(--D) * .0695); }
.combo-plate { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; filter: drop-shadow(0 calc(var(--D) * .006) calc(var(--D) * .008) rgba(0, 0, 0, .65)); }
.drums { position: absolute; left: 19%; width: 62%; top: 24.4%; height: 51.2%; z-index: 1; display: flex; gap: 2.5%; padding: 0 1.5%;
  background: #120B04; box-shadow: inset 0 calc(var(--D) * .006) calc(var(--D) * .01) rgba(0, 0, 0, .9); }
.drum { position: relative; flex: 1; height: 100%; overflow: hidden;
  background: linear-gradient(180deg, #1C1206 0%, #7A6038 14%, #D9C79F 36%, #F7EED7 50%, #D9C79F 64%, #7A6038 86%, #1C1206 100%); }
.drum::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, .35), transparent 22%, transparent 78%, rgba(0, 0, 0, .35)); }
.strip { display: block; will-change: transform; }
.strip span { display: flex; align-items: center; justify-content: center; height: var(--wh); font-family: var(--serif); font-weight: 700;
  font-size: calc(var(--D) * .056); color: #2A1A06; text-shadow: 0 1px 0 rgba(255, 255, 255, .45); font-variant-numeric: lining-nums tabular-nums; }
.gem { position: absolute; left: 50%; top: -20%; width: calc(var(--D) * .026); height: calc(var(--D) * .026); transform: translate(-50%, -50%) rotate(45deg); z-index: 3; border-radius: 2px;
  background: radial-gradient(circle at 35% 35%, #FFF6D8, #E7A93A 45%, #6B3E08); box-shadow: 0 0 6px rgba(255, 190, 80, .7), 0 0 0 1px rgba(60, 35, 5, .8); transition: background .4s, box-shadow .4s; }
.gem.working { animation: gemPulse .8s ease-in-out infinite; }
.gem.open { background: radial-gradient(circle at 35% 35%, #FFFFFF, #FFF0BC 40%, #E8B24A); box-shadow: 0 0 14px 3px rgba(255, 236, 170, .95), 0 0 0 1px rgba(80, 50, 5, .8); }
.gem.denied { background: radial-gradient(circle at 35% 35%, #FFD7CC, #C2361E 50%, #4A0C04); box-shadow: 0 0 14px 3px rgba(220, 60, 30, .85), 0 0 0 1px rgba(60, 10, 5, .8); }
@keyframes gemPulse { 50% { box-shadow: 0 0 16px 4px rgba(255, 210, 120, .95), 0 0 0 1px rgba(60, 35, 5, .8); } }

/* locking bolts: out (shot) into the frame while locked, withdrawn when released; they swing with the door */
.bolts { position: absolute; inset: 0; z-index: 0; }
.bolts img { position: absolute; left: 50%; top: 50%; width: 15%; height: auto; transform-origin: 0 50%;
  transform: rotate(var(--a)) translate(calc(var(--D) * .4 * .62), -50%); transition: transform .38s cubic-bezier(.3, .7, .2, 1); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .6)); }
.bolts.shot img { transform: rotate(var(--a)) translate(calc(var(--D) * .4 * .74), -50%); }
.bolts img:nth-child(1) { --a: -90deg; } .bolts img:nth-child(2) { --a: -30deg; } .bolts img:nth-child(3) { --a: 30deg; }
.bolts img:nth-child(4) { --a: 90deg; } .bolts img:nth-child(5) { --a: 140deg; } .bolts img:nth-child(6) { --a: 220deg; }

/* ---------- panels and sheets on marble ---------- */
.panel { background: var(--panel-bg); }
.panel::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 160px; pointer-events: none;
  background: radial-gradient(ellipse 70% 100% at 50% 0%, rgba(233, 185, 73, .14), transparent 70%); }
.panel-top { position: relative; }
.panel-top .ornament { grid-column: 1 / -1; }
.sheet { background: rgba(0, 0, 0, .66); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.sheet-card { background: var(--panel-bg); border: 1px solid rgba(233, 185, 73, .5);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 0 40px rgba(233, 185, 73, .12), inset 0 1px 0 rgba(255, 236, 190, .1); }
.sheet-head h3 { font-family: var(--serif); font-size: 26px; font-weight: 600; background: linear-gradient(180deg, #FFF3C8, #F2C35A 50%, #A86F16);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.sheet h4 { display: flex; align-items: center; gap: 10px; font-family: var(--sans); letter-spacing: .14em; color: #E9B949; }
.sheet h4::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(233, 185, 73, .55), transparent); }
.small-card { text-align: center; }
.small-card p { font-family: var(--serif); font-size: 21px; line-height: 1.3; }

/* fields with a gold bezel */
.field { background: linear-gradient(180deg, #070504, #120C06); border: 1px solid rgba(233, 185, 73, .5);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .8), 0 0 0 1px rgba(0, 0, 0, .5); color: #FFF4DA; }
.field:focus { border-color: #F2C766; box-shadow: inset 0 2px 6px rgba(0, 0, 0, .8), 0 0 0 3px rgba(233, 185, 73, .2), 0 0 18px rgba(233, 185, 73, .2); }
.field-label { font-family: var(--serif); font-size: 19px; color: #F3E3BD; }
.pass-card { gap: 10px; }
.pass-wrap { position: relative; }
.field.pass { font-size: 20px; padding-inline-end: 54px; }
.eye { position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; display: grid; place-items: center; color: rgba(233, 185, 73, .7); border-radius: 50%; }
.eye svg { width: 24px; height: 24px; } .eye.on { color: #FFE7A6; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.4; }
.row-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.row-actions .btn { width: 100%; }

/* asset cards: gold hairline, medallion badges */
.asset-row { background: linear-gradient(180deg, rgba(42, 31, 16, .9), rgba(16, 11, 6, .94)); border: 1px solid rgba(233, 185, 73, .26); box-shadow: var(--bezel); }
.asset-row .tick { font-family: var(--sans); letter-spacing: .02em; }
.asset-row .qty { font-family: var(--serif); font-size: 19px; font-weight: 600; color: #F2C766; font-variant-numeric: lining-nums tabular-nums; }
.badge { box-shadow: 0 0 0 2px #C9952E, 0 0 0 3.5px #3A2508, 0 0 0 4.5px rgba(255, 226, 150, .35), 0 3px 10px rgba(0, 0, 0, .6); }
.coin-select { border: 1px solid rgba(233, 185, 73, .55); box-shadow: var(--bezel); }
.picker-list button { border: 1px solid transparent; }
.picker-list button:hover, .picker-list button:active { background: linear-gradient(180deg, rgba(42, 31, 16, .9), rgba(16, 11, 6, .94)); border-color: rgba(233, 185, 73, .3); }
.empty { font-family: var(--serif); font-size: 19px; color: rgba(245, 235, 211, .7); }
.empty::before { content: ''; display: block; width: 120px; height: 10px; margin: 0 auto 14px; background: var(--gold-line); clip-path: polygon(0 45%, 44% 45%, 50% 0, 56% 45%, 100% 45%, 100% 55%, 56% 55%, 50% 100%, 44% 55%, 0 55%); }

/* settings: security management */
.methods { display: flex; flex-direction: column; gap: 8px; }
.method { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; padding: 12px 14px; border-radius: 16px;
  border: 1px solid rgba(233, 185, 73, .22); background: linear-gradient(180deg, rgba(42, 31, 16, .7), rgba(16, 11, 6, .85)); }
.method .m-label { font-size: 14px; line-height: 1.35; }
.method .m-state { font-size: 12px; color: var(--muted); justify-self: end; } .method.on .m-state { color: #F2C766; }
.method .m-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.protect-actions { display: flex; flex-direction: column; gap: 10px; }
.protect-actions .btn { width: 100%; }
.setting-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.setting-row > span { font-size: 14px; }
.setting-row h4 { margin: 0; flex: 1; }
.setting-row .seg { flex: 1 1 220px; }
body.locked .protect-only { display: none; }

/* status, loading */
.status { font-family: var(--sans); letter-spacing: .02em; }
body.loading::after { content: ''; position: fixed; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px; border-radius: 50%;
  border: 2px solid rgba(233, 185, 73, .2); border-top-color: #F2C766; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .bolts img, .strip { transition: none !important; } .gem.working { animation: none; } body.loading::after { animation: none; } }
@media (orientation: landscape) and (max-height: 560px) { .btn.lux { min-height: 48px; font-size: 18px; } .auth-actions { gap: 8px; } .lock-hint { display: none; } }

/* destructive actions stay in the material: deep burgundy with a gold bezel */
.btn.danger-fill { color: #FFE2D2; background: radial-gradient(ellipse 120% 160% at 50% -30%, rgba(255, 170, 140, .18), transparent 60%), linear-gradient(180deg, #5E1A10, #2A0905);
  box-shadow: 0 0 0 1.5px #B8862B, 0 0 18px rgba(200, 70, 40, .3), inset 0 1px 0 rgba(255, 220, 200, .15); }
#lockNowBtn { width: 100%; }

.row-actions .btn, .protect-actions .btn, .small-card .btn { min-width: 0; }
@media (orientation: landscape) and (max-height: 560px) {
  .pass-card { gap: 6px; padding-top: 12px; padding-bottom: 12px; } .pass-card #passIntro, .pass-card .ornament { display: none; }
  .pass-card .field { height: 48px; } .row-actions { flex-direction: row; } .row-actions .btn { min-height: 44px; }
}

/* the top-left slot: the lock button when a protected vault is open for the user, otherwise an empty spacer */
#lockTopBtn:not([hidden]) + #lockTopSpacer { display: none; }

/* welcome: the founder-approved ginger keeper (art/keeper.webp: a same-size WebP encoding of
   design/approved-character/…png — not redrawn; hashes in design/REFERENCES.md).
   Framed on the head and the MIRA17 medallion so the monogram stays legible on phones; edges dissolve into the marble.
   The slight zoom uses object-view-box (no layout overflow); browsers without it show the uncropped framing. */
#hero { width: min(100%, calc(var(--H) * .9)); overflow: hidden; border-radius: 28px;
  -webkit-mask-image: radial-gradient(ellipse 60% 62% at 50% 46%, #000 62%, transparent 100%); mask-image: radial-gradient(ellipse 60% 62% at 50% 46%, #000 62%, transparent 100%); }
/* the soft edge is masked on the box (not the image), so it holds whatever object-view-box does to the picture */
#hero img { object-fit: cover; object-position: 45% 36%; object-view-box: inset(3% 5% 6% 4%); filter: none; -webkit-mask-image: none; mask-image: none; }

#offer { z-index: 11; }
.offer-body { width: min(520px, 100%); margin: 8px auto 0; flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.price-card { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 16px 18px; border-radius: 18px;
  border: 1.5px solid #B8862B; box-shadow: 0 0 22px rgba(233, 185, 73, .22); font-family: var(--serif); font-size: 20px; }
.price-card strong { color: #F2C766; font-size: 18px; text-align: end; }
/* a heavy leaf: a solid-looking machined edge 6.6 % of the vault thick (12 close slices of turned gold, lit from the
   upper left like the face; deepest first in the markup), the back plate behind it */
.door-edge:nth-child(1) { --z: 12; }
.door-edge:nth-child(2) { --z: 11; }
.door-edge:nth-child(3) { --z: 10; }
.door-edge:nth-child(4) { --z: 9; }
.door-edge:nth-child(5) { --z: 8; }
.door-edge:nth-child(6) { --z: 7; }
.door-edge:nth-child(7) { --z: 6; }
.door-edge:nth-child(8) { --z: 5; }
.door-edge:nth-child(9) { --z: 4; }
.door-edge:nth-child(10) { --z: 3; }
.door-edge:nth-child(11) { --z: 2; }
.door-edge:nth-child(12) { --z: 1; }
.door-edge { transform: translateZ(calc(var(--D) * -.0055 * var(--z))); background: radial-gradient(circle, #24170A 0 88%, transparent 88.6%),
  conic-gradient(from -20deg, #F4D488, #C08A2E 18%, #6E4612 42%, #3E2608 55%, #7A4F16 72%, #D6A548 90%, #F4D488); }
.door-back { transform: translateZ(calc(var(--D) * -.068)) rotateY(180deg); }

/* the demonstration never offers protection, passkeys or the lock button (no real credentials from a presentation) */
body.demo .protect-only, body.demo #lockTopBtn, body.demo #eraseBtn { display: none !important; }

/* the last door (design/lock-screen-concept-2026-11-04.png): the frame image reaches 4 % beyond the stage for the hinge
   pin (tools/art: frame ext 1.08), the leaf image 12.5 % beyond the leaf for its hinge straps (door ext 1.25);
   the leaf turns about the pin axis, which stands at the left edge of the stage (-12.5 % of the leaf box). */
.frame { inset: auto; left: -4%; top: -4%; width: 108%; height: 108%; }
.door { transform-origin: -12.5% 50%; }
.door-face .door-img { inset: auto; left: -12.5%; top: -12.5%; width: 125%; height: 125%; }

/* web checkout (USDC on Polygon) — minimal neutral layout only; visual styling belongs to the design owner */
.pay-box { margin: 12px 0; text-align: left; }
.pay-title { font-size: 1rem; margin: 0 0 6px; }
.pay-qr { width: 200px; max-width: 70%; margin: 8px auto; }
.pay-qr svg { display: block; width: 100%; height: auto; }
.pay-list { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 8px 0; }
.pay-list dt { opacity: .75; }
.pay-list dd { margin: 0; min-width: 0; }
.pay-mono { font-family: ui-monospace, Menlo, Consolas, monospace; overflow-wrap: anywhere; word-break: break-all; }
.pay-nets { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0; }
.pay-row { display: flex; gap: 8px; align-items: center; }
.pay-input { flex: 1; min-width: 0; font: inherit; padding: 6px 8px; }

