:root {
  --night: #0E1233; --violet: #6E5AA8; --gold: #E9BE6A; --gold-deep: #B98A3C; --ivory: #F3EEDF; --rose: #EBC7E3; --teal: #3FB59B;
  --stage: #0b0e2a;
  --surface: rgba(250, 246, 236, 0.94); --surface-2: rgba(29, 30, 61, 0.05); --ink: #1d1e3d; --ink-soft: rgba(29, 30, 61, 0.66);
  --line: rgba(29, 30, 61, 0.14); --accent: #94651c; --field: rgba(29, 30, 61, 0.05); --shadow: 0 24px 60px rgba(8, 10, 32, 0.38);
  --danger: #a2322a; --ok: #1f7a64; --chip-on: rgba(233, 190, 106, 0.28);
  --display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --ui: "Jost", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: rgba(15, 19, 52, 0.86); --surface-2: rgba(255, 255, 255, 0.05); --ink: #F3EEDF; --ink-soft: rgba(243, 238, 223, 0.68);
    --line: rgba(243, 238, 223, 0.14); --accent: #E9BE6A; --field: rgba(255, 255, 255, 0.06); --shadow: 0 24px 70px rgba(2, 3, 14, 0.62);
    --danger: #ff9f93; --ok: #72dcc0; --chip-on: rgba(233, 190, 106, 0.2);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --surface: rgba(15, 19, 52, 0.86); --surface-2: rgba(255, 255, 255, 0.05); --ink: #F3EEDF; --ink-soft: rgba(243, 238, 223, 0.68);
  --line: rgba(243, 238, 223, 0.14); --accent: #E9BE6A; --field: rgba(255, 255, 255, 0.06); --shadow: 0 24px 70px rgba(2, 3, 14, 0.62);
  --danger: #ff9f93; --ok: #72dcc0; --chip-on: rgba(233, 190, 106, 0.2);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; scroll-padding-top: env(safe-area-inset-top, 0px); }
body { height: 100%; margin: 0; overflow: hidden; background: var(--stage); color: var(--ivory); font-family: var(--ui); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ic { width: 20px; height: 20px; flex: none; }

#stage { position: fixed; inset: 0; }
#gl { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }

/* ---------------- loader ---------------- */
#loader { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(ellipse at 50% 40%, #1b1f4d 0%, #0b0e2a 70%); transition: opacity 0.9s ease; }
#loader.out { opacity: 0; pointer-events: none; }
.ld-logo { width: 96px; height: 96px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(233, 190, 106, 0.5), 0 0 60px rgba(233, 190, 106, 0.35); animation: breathe 3.2s ease-in-out infinite; }
.ld-text { margin: 0; font-family: var(--display); font-style: italic; font-size: 1.35rem; color: rgba(243, 238, 223, 0.86); text-align: center; padding: 0 24px; }
.ld-bar { width: 180px; height: 2px; background: rgba(243, 238, 223, 0.14); border-radius: 2px; overflow: hidden; }
.ld-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #c8913f, #f6dc9a); transition: width 0.4s ease; }
@keyframes breathe { 0%, 100% { transform: scale(1); filter: brightness(1); } 50% { transform: scale(1.04); filter: brightness(1.15); } }

/* ---------------- hero (always over the night scene) ---------------- */
#hero { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center; pointer-events: none;
  padding: 0 20px calc(env(safe-area-inset-bottom, 0px) + 7vh);
  background: radial-gradient(ellipse 80% 60% at 50% 88%, rgba(6, 8, 26, 0.78) 0%, rgba(6, 8, 26, 0.35) 55%, rgba(6, 8, 26, 0) 80%);
  opacity: 0; transition: opacity 1.1s ease; }
#hero.in { opacity: 1; }
#hero.out { opacity: 0; transition-duration: 0.8s; }
.hero-inner { max-width: 720px; text-align: center; pointer-events: auto; }
.wordmark { margin: 0; font-family: var(--display); font-weight: 500; font-size: clamp(2.5rem, 7.2vw, 5.4rem); line-height: 1; letter-spacing: 0.18em; text-transform: uppercase; padding-left: 0.18em;
  background: linear-gradient(180deg, #fbe9b8 0%, #e3b565 45%, #fff1c9 60%, #c8913f 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 18px rgba(233, 190, 106, 0.28)); }
.hero-tag { margin: 14px 0 0; font-family: var(--display); font-style: italic; font-size: clamp(1.25rem, 2.6vw, 1.8rem); color: var(--ivory); }
.hero-lead { margin: 14px auto 0; max-width: 34em; font-size: clamp(1rem, 1.6vw, 1.1rem); color: rgba(243, 238, 223, 0.9); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 26px; }
.hero-note { margin: 20px auto 0; max-width: 38em; font-size: 0.88rem; color: rgba(243, 238, 223, 0.66); }

/* ---------------- buttons ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 14px; padding: 0.72em 1.25em; font-weight: 500; letter-spacing: 0.01em; text-decoration: none; transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-lg { padding: 0.9em 1.6em; font-size: 1.02rem; }
.btn-small { padding: 0.42em 0.9em; font-size: 0.86rem; border-radius: 10px; }
.btn-primary { background: linear-gradient(180deg, #f6dc9c, #dcaa57); color: #1d1530; box-shadow: 0 8px 28px rgba(233, 190, 106, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.btn-primary:hover { box-shadow: 0 10px 34px rgba(233, 190, 106, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.btn-ghost { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-ghost.on-dark { background: rgba(243, 238, 223, 0.06); border-color: rgba(243, 238, 223, 0.35); color: var(--ivory); }
.btn-ghost.on-dark:hover { border-color: var(--gold); }
.btn.wide { width: 100%; margin-top: 8px; }
.btn-price { font-size: 0.82em; opacity: 0.72; font-weight: 500; }
.text-btn { background: none; border: 0; padding: 4px 0; color: var(--accent); display: inline-flex; align-items: center; gap: 6px; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid transparent; background: none; color: inherit; }
.glass-dark { background: rgba(10, 13, 38, 0.55); border: 1px solid rgba(243, 238, 223, 0.14); color: var(--ivory); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.glass-dark:hover { border-color: rgba(233, 190, 106, 0.5); }
.pill-btn { height: 40px; padding: 0 14px; border-radius: 12px; font-size: 0.88rem; }

/* ---------------- top bar ---------------- */
#topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 0; pointer-events: none; }
#topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 36px; height: 36px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(233, 190, 106, 0.5), 0 0 18px rgba(233, 190, 106, 0.25); }
.brand span { font-family: var(--display); font-weight: 500; font-size: 1.32rem; letter-spacing: 0.05em; color: var(--ivory); text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5); white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.wallet-btn { height: 40px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 12px; border: 1px solid rgba(233, 190, 106, 0.6);
  background: linear-gradient(180deg, rgba(246, 220, 156, 0.95), rgba(220, 170, 87, 0.95)); color: #1d1530; font-weight: 500; font-size: 0.9rem; }
.wallet-btn.on { background: rgba(10, 13, 38, 0.6); color: var(--ivory); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.wallet-btn .w-dot, .w-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 10px var(--teal); flex: none; }
.wallet-btn.demo .w-dot { background: var(--rose); box-shadow: 0 0 10px var(--rose); }
.w-bal { color: var(--gold); font-variant-numeric: tabular-nums; }
.w-addr { opacity: 0.85; }

/* ---------------- dock ---------------- */
#dockWrap { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; display: flex; justify-content: center; padding: 0 12px calc(env(safe-area-inset-bottom, 0px) + 16px); pointer-events: none;
  opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease 0.4s, transform 0.6s ease 0.4s; }
body.entered #dockWrap { opacity: 1; transform: none; }
#dock { pointer-events: auto; display: flex; gap: 4px; padding: 6px; border-radius: 18px; background: rgba(10, 13, 38, 0.62); border: 1px solid rgba(243, 238, 223, 0.13);
  backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2); box-shadow: 0 16px 40px rgba(2, 3, 14, 0.45); }
#dock button { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border: 0; border-radius: 13px; background: none; color: var(--ivory); font-size: 0.93rem; white-space: nowrap; transition: background 0.2s; }
#dock button:hover { background: rgba(243, 238, 223, 0.08); }
#dock .dock-primary { background: linear-gradient(180deg, rgba(246, 220, 156, 0.95), rgba(220, 170, 87, 0.95)); color: #1d1530; font-weight: 500; }
#dock .dock-primary:hover { background: linear-gradient(180deg, #f8e2aa, #e0b061); }

/* ---------------- minimap, hint, prompt, tooltip, joystick ---------------- */
#minimap { position: fixed; right: 18px; bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); width: 168px; height: 168px; z-index: 34; cursor: crosshair;
  border-radius: 50%; box-shadow: 0 10px 30px rgba(2, 3, 14, 0.5); opacity: 0; pointer-events: none; transition: opacity 0.6s ease 0.6s; }
body.entered #minimap { opacity: 1; pointer-events: auto; }
#hint { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 70px); left: 50%; transform: translate(-50%, -6px); z-index: 33; margin: 0; max-width: min(560px, 92vw);
  padding: 10px 16px; border-radius: 12px; background: rgba(10, 13, 38, 0.6); border: 1px solid rgba(243, 238, 223, 0.12); color: rgba(243, 238, 223, 0.92); font-size: 0.9rem; text-align: center;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); opacity: 0; pointer-events: none; transition: opacity 0.6s, transform 0.6s; }
#hint.in { opacity: 1; transform: translate(-50%, 0); }
#prompt { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 88px); transform: translateX(-50%); z-index: 36; display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 14px; border: 1px solid rgba(233, 190, 106, 0.4); background: rgba(10, 13, 38, 0.7); color: var(--ivory); font-size: 0.95rem;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 10px 30px rgba(2, 3, 14, 0.4); animation: rise 0.35s ease; }
#prompt b { font-family: var(--display); font-weight: 600; font-size: 1.12rem; }
.key { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 7px; border: 1px solid rgba(243, 238, 223, 0.35); font-size: 0.8rem; font-weight: 500; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
#tooltip { position: fixed; left: 0; top: 0; z-index: 37; pointer-events: none; display: flex; flex-direction: column; padding: 8px 12px; border-radius: 10px;
  background: rgba(10, 13, 38, 0.78); border: 1px solid rgba(233, 190, 106, 0.3); color: var(--ivory); font-size: 0.85rem; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
#tooltip b { font-family: var(--display); font-size: 1.1rem; font-weight: 600; }
#tooltip span { opacity: 0.75; }
#joy { position: fixed; z-index: 38; width: 112px; height: 112px; margin: -56px 0 0 -56px; border-radius: 50%; border: 1.5px solid rgba(243, 238, 223, 0.35); background: rgba(10, 13, 38, 0.25);
  pointer-events: none; opacity: 0; transition: opacity 0.2s; }
#joy.on { opacity: 1; }
#joy .knob { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; border-radius: 50%; background: rgba(233, 190, 106, 0.85); box-shadow: 0 0 18px rgba(233, 190, 106, 0.5); transform: translate(-50%, -50%); }
#syncBadge { position: fixed; left: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); z-index: 34; padding: 6px 12px; border-radius: 10px; background: rgba(10, 13, 38, 0.6); color: rgba(243, 238, 223, 0.85); font-size: 0.8rem; }

/* ---------------- toasts ---------------- */
#toasts { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 64px); left: 50%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: min(92vw, 460px); }
.toast { pointer-events: auto; padding: 10px 16px; border-radius: 12px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 0.92rem;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); opacity: 0; transform: translateY(-8px); transition: opacity 0.3s, transform 0.3s; }
.toast.in { opacity: 1; transform: none; }
.toast.err { border-color: var(--danger); }
.toast a { color: var(--accent); margin-left: 6px; }

/* ---------------- memorial panel ---------------- */
#panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 45; width: min(420px, 100vw); background: var(--surface); color: var(--ink); border-left: 1px solid var(--line);
  box-shadow: var(--shadow); backdrop-filter: blur(20px) saturate(1.15); -webkit-backdrop-filter: blur(20px) saturate(1.15);
  transform: translateX(104%); transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); display: flex; flex-direction: column; }
#panel.open { transform: none; }
.p-close { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); right: 12px; z-index: 2; color: var(--ink-soft); }
.p-scroll { overflow-y: auto; padding: calc(env(safe-area-inset-top, 0px) + 26px) 24px calc(env(safe-area-inset-bottom, 0px) + 28px); overscroll-behavior: contain; }
.p-head { display: flex; gap: 16px; align-items: center; padding-right: 30px; }
.p-photo { width: 84px; height: 105px; flex: none; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--surface-2);
  box-shadow: 0 0 0 3px rgba(233, 190, 106, 0.7), 0 0 0 4px rgba(90, 60, 20, 0.35); font-family: var(--display); font-size: 2rem; color: var(--accent); }
.p-photo img { width: 100%; height: 100%; object-fit: cover; }
.p-logo { width: 72px; height: 72px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(233, 190, 106, 0.6); }
.p-badges { margin: 0 0 4px; display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.74rem; border: 1px solid var(--line); color: var(--ink-soft); text-decoration: none; }
.badge.gold { border-color: rgba(233, 190, 106, 0.6); color: var(--accent); }
.p-name { margin: 0; font-family: var(--display); font-weight: 600; font-size: 1.85rem; line-height: 1.1; }
.p-dates { margin: 6px 0 0; color: var(--ink-soft); font-size: 0.92rem; }
.p-place { margin: 4px 0 0; color: var(--ink-soft); font-size: 0.9rem; display: flex; align-items: center; gap: 4px; }
.p-place .ic { width: 15px; height: 15px; }
.p-sub { margin: 6px 0 0; color: var(--ink-soft); font-family: var(--display); font-style: italic; font-size: 1.08rem; line-height: 1.35; }
.p-epitaph { margin: 18px 0 0; padding: 0 0 0 14px; border-left: 2px solid rgba(233, 190, 106, 0.7); font-family: var(--display); font-style: italic; font-size: 1.22rem; line-height: 1.35; }
.p-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 20px 0 0; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 0.88rem; color: var(--ink-soft); }
.p-stats b { color: var(--ink); font-size: 1.05rem; font-weight: 600; margin-right: 2px; font-variant-numeric: tabular-nums; }
.p-note { margin: 16px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 0.9rem; color: var(--ink-soft); }
.p-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.offer { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); text-align: left; transition: border-color 0.2s, transform 0.15s; min-height: 118px; }
.offer:hover:not(:disabled) { border-color: rgba(233, 190, 106, 0.8); }
.offer:disabled { opacity: 0.5; cursor: default; }
.o-ic { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: rgba(233, 190, 106, 0.16); color: var(--accent); }
.o-txt { display: flex; flex-direction: column; }
.o-t { font-weight: 500; font-size: 0.95rem; line-height: 1.2; }
.o-s { font-size: 0.78rem; color: var(--ink-soft); line-height: 1.25; margin-top: 2px; }
.o-price { margin-top: auto; font-size: 0.86rem; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.o-price small { font-size: 0.72rem; font-weight: 500; margin-left: 4px; opacity: 0.8; }
.p-prayer { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; padding: 14px; border-radius: 14px; border: 1px solid rgba(233, 190, 106, 0.45); background: var(--surface-2); }
.p-book { margin-top: 24px; }
.p-book h3, .modal-card h3 { margin: 0 0 10px; font-family: var(--display); font-weight: 600; font-size: 1.3rem; }
.book { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.book li { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.book p { margin: 0; font-family: var(--display); font-size: 1.12rem; line-height: 1.35; }
.book span { display: block; margin-top: 6px; font-size: 0.8rem; color: var(--ink-soft); }
.p-foot { margin-top: 20px; }
.muted { color: var(--ink-soft); }
.fine { font-size: 0.8rem; color: var(--ink-soft); margin: 4px 0 0; }

/* ---------------- forms ---------------- */
input, textarea, select { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--field); color: var(--ink); outline: none; transition: border-color 0.2s; }
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 64px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 0.86rem; color: var(--ink-soft); }
label.check { flex-direction: row; align-items: flex-start; gap: 10px; color: var(--ink); font-size: 0.88rem; }
label.check input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--gold-deep); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.86rem; color: var(--ink-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-size: 0.86rem; }
.chip.on { border-color: var(--gold-deep); background: var(--chip-on); }
.chips.sym .chip { min-width: 40px; font-size: 1rem; }
.status { min-height: 1.2em; margin: 10px 0 0; font-size: 0.9rem; color: var(--ink-soft); }
.status.err { color: var(--danger); }
.status a { color: var(--accent); }

/* ---------------- modal ---------------- */
#modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(4, 5, 18, 0.5); opacity: 0; transition: opacity 0.22s; }
#modal.in { opacity: 1; }
.modal-card { position: relative; width: min(560px, 100%); max-height: min(88vh, 900px); overflow-y: auto; overscroll-behavior: contain; padding: 26px 26px 24px; border-radius: 22px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(22px) saturate(1.2); -webkit-backdrop-filter: blur(22px) saturate(1.2);
  transform: translateY(10px) scale(0.99); transition: transform 0.25s ease; }
#modal.in .modal-card { transform: none; }
.modal-card.wide { width: min(860px, 100%); }
.modal-card h2 { margin: 0 40px 10px 0; font-family: var(--display); font-weight: 600; font-size: 1.9rem; line-height: 1.1; }
.modal-card h3 { margin-top: 22px; }
.modal-card p { margin: 10px 0 0; }
.m-close { position: absolute; top: 14px; right: 14px; color: var(--ink-soft); }
.m-head { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.m-head h2 { margin: 0; }
.m-head p { margin: 2px 0 0; font-family: var(--display); font-style: italic; font-size: 1.1rem; }
.m-logo { width: 58px; height: 58px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(233, 190, 106, 0.6); }
.steps { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 6px; }
.steps li::marker { color: var(--accent); font-weight: 600; }
.ca { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin-top: 18px; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(233, 190, 106, 0.5); background: var(--surface-2); }
.ca-l { width: 100%; font-size: 0.8rem; color: var(--ink-soft); }
.ca code { flex: 1; min-width: 0; font-family: var(--ui); font-size: 0.9rem; letter-spacing: 0.02em; word-break: break-all; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.kpis { display: flex; gap: 10px; margin-top: 16px; }
.kpis div { flex: 1; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.kpis span { display: block; font-size: 0.8rem; color: var(--ink-soft); }
.kpis b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.prices { width: 100%; border-collapse: collapse; }
.prices td { padding: 9px 0; border-bottom: 1px solid var(--line); }
.prices td:last-child { text-align: right; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.risk { margin-top: 16px !important; padding-top: 12px; border-top: 1px solid var(--line); }
.notice { padding: 10px 12px; border-radius: 10px; background: var(--chip-on); color: var(--ink); }
.w-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-top: 10px; }
.w-opt { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); text-decoration: none; color: var(--ink); font-weight: 500; }
.w-opt:hover { border-color: var(--accent); }
.w-card { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; background: var(--surface-2); }
.w-dot.big { width: 12px; height: 12px; }
.w-full { margin: 2px 0 0 !important; word-break: break-all; font-size: 0.9rem; }
.demo-box { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.pay-sum { display: flex; align-items: center; gap: 14px; margin: 6px 0 4px; padding: 14px; border-radius: 14px; background: var(--surface-2); }
.pay-sum .ic { width: 30px; height: 30px; color: var(--accent); }
.pay-sum b { display: block; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.pay-sum span { color: var(--ink-soft); }
/* network status */
.net-chip { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line); font-size: 0.8rem; color: var(--ink-soft); }
.net-chip.down { color: var(--danger); border-color: currentColor; }
.net-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--ink-soft); opacity: 0.55; }
.net-chip.ok .net-dot, .net-dot.ok { background: var(--teal); box-shadow: 0 0 8px var(--teal); opacity: 1; }
.net-chip.down .net-dot, .net-dot.down { background: var(--danger); opacity: 1; }
/* wallet: address actions and history */
.w-id { min-width: 0; }
.w-acts { display: flex; flex-wrap: wrap; gap: 2px 16px; margin: 6px 0 0 !important; font-size: 0.86rem; }
.w-acts .ic, .tx-st .ic, .pay-facts .ic { width: 14px; height: 14px; }
.w-hist h3 { margin: 22px 0 8px; font-size: 1.15rem; }
.tx-list { list-style: none; margin: 0; padding: 0; max-height: 292px; overflow-y: auto; border-top: 1px solid var(--line); }
.tx { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.tx-ic { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); color: var(--accent); }
.tx-ic .ic { width: 18px; height: 18px; }
.tx-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.tx-what { max-width: 100%; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 500; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.tx-what { cursor: pointer; }
button.tx-what:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.tx-meta { font-size: 0.8rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.tx-st { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 0.8rem; color: var(--ok); text-decoration: none; }
a.tx-st:hover { text-decoration: underline; text-underline-offset: 3px; }
.tx-st.demo { color: var(--ink-soft); }
@media (max-width: 520px) { .tx-st-l { display: none; } } /* phones: just ✓ and the link icon */
/* payment confirmation: the facts of the transaction */
.pay-facts { margin: 14px 0 0; padding: 2px 14px; border: 1px solid var(--line); border-radius: 14px; font-size: 0.88rem; }
.pay-facts div { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pay-facts div:last-child { border-bottom: 0; }
.pay-facts dt { flex: none; color: var(--ink-soft); }
.pay-facts dd { margin: 0; min-width: 0; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.pay-facts a { display: inline-flex; align-items: center; gap: 3px; color: var(--accent); text-decoration: none; white-space: nowrap; }
.pay-facts a:hover { text-decoration: underline; text-underline-offset: 3px; }
.pay-facts .net-dot { margin-right: 7px; vertical-align: 1px; }
.search { font-size: 1.05rem; padding: 12px 14px; margin-top: 4px; }
.results { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.results button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid transparent; background: none; color: var(--ink); text-align: left; }
.results button:hover { background: var(--surface-2); border-color: var(--line); }
.r-sym { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--accent); font-family: var(--display); font-size: 1.1rem; flex: none; }
.r-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.r-main b { font-family: var(--display); font-size: 1.2rem; font-weight: 600; line-height: 1.15; }
.r-main span { font-size: 0.82rem; color: var(--ink-soft); }
.r-zone { font-size: 0.78rem; color: var(--ink-soft); white-space: nowrap; }
.results .empty { padding: 12px; }
.keys { display: flex; flex-wrap: wrap; gap: 6px; }
.keys .key { border-color: var(--line); color: var(--ink); height: 30px; padding: 0 10px; }
.create { margin-top: 8px; }
.c-grid { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 22px; align-items: start; }
.c-fields { display: flex; flex-direction: column; gap: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.c-preview { position: sticky; top: 0; display: flex; flex-direction: column; gap: 8px; }
.c-preview canvas { width: 100%; height: auto; max-height: 60vh; object-fit: contain; filter: drop-shadow(0 12px 18px rgba(8, 10, 32, 0.35)); }
.photo-row { display: flex; align-items: center; gap: 12px; }
.photo-row img { width: 56px; height: 70px; object-fit: cover; border-radius: 50%; box-shadow: 0 0 0 2px rgba(233, 190, 106, 0.7); }
.file { cursor: pointer; }

/* ---------------- small screens ---------------- */
@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .brand span { font-size: 1.12rem; }
  .brand img { width: 32px; height: 32px; }
  #helpBtn { display: none; }
  .pill-btn { padding: 0 10px; }
  .wallet-btn { padding: 0 10px; font-size: 0.82rem; }
  .wallet-btn .w-addr { display: none; }
  #dockWrap { padding: 0 8px calc(env(safe-area-inset-bottom, 0px) + 10px); }
  #dock { width: 100%; justify-content: space-between; }
  #dock button { flex: 1; flex-direction: column; gap: 2px; height: 56px; padding: 6px 4px; font-size: 0.68rem; white-space: normal; line-height: 1.1; text-align: center; }
  #minimap { width: 104px; height: 104px; right: 10px; bottom: auto; top: calc(env(safe-area-inset-top, 0px) + 62px); }
  #prompt { bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); }
  #panel { top: auto; left: 0; width: 100%; max-height: 82vh; max-height: 82dvh; border-left: 0; border-top: 1px solid var(--line); border-radius: 22px 22px 0 0; transform: translateY(104%); }
  .p-scroll { padding-top: 22px; }
  .p-close { top: 10px; }
  .p-name { font-size: 1.6rem; }
  #modal { place-items: end center; padding: 0; }
  .modal-card, .modal-card.wide { width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: 22px 22px 0 0; padding: 22px 18px calc(env(safe-area-inset-bottom, 0px) + 20px); }
  .c-grid { grid-template-columns: 1fr; }
  .c-preview { position: static; order: -1; align-items: center; }
  .c-preview canvas { max-height: 200px; width: auto; max-width: 100%; }
  #hint { top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 150px); }
  .hero-note { font-size: 0.82rem; }
}
@media (max-width: 520px) { .brand span { display: none; } .wallet-btn { white-space: nowrap; } .wallet-btn .ic { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; } }
@media (min-width: 721px) {
  body.panel-open #dockWrap { padding-right: 420px; }
  body.panel-open #minimap { opacity: 0; pointer-events: none; transition-delay: 0s; }
  body.panel-open #prompt { left: calc(50% - 210px); }
}
