/* =========================================================================
   account.gemstok.com — styles
   Theme = gemstok.com (gemstok.comPrivate/style.css):
     fonts  Orbitron (logo, labels, headings) + Inter (text, names) + Noto Sans Sinhala
     dark   #222222 bg · #ffffff text · #888888 dim · neon blue #00d9ff · gold #d4af37
     light  #e8e4dc bg · #faf8f4 card · #2c2a27 text · #7a7470 dim · blue #1a6bb5
   Fonts are self-hosted (no Google requests).
   ========================================================================= */

@font-face { font-family: 'Orbitron'; font-weight: 400; font-display: swap; src: url('/assets/fonts/orbitron-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Orbitron'; font-weight: 700; font-display: swap; src: url('/assets/fonts/orbitron-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Orbitron'; font-weight: 900; font-display: swap; src: url('/assets/fonts/orbitron-latin-900-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('/assets/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url('/assets/fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('/assets/fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Noto Sans Sinhala'; font-weight: 400; font-display: swap; src: url('/assets/fonts/noto-sans-sinhala-sinhala-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Noto Sans Sinhala'; font-weight: 500; font-display: swap; src: url('/assets/fonts/noto-sans-sinhala-sinhala-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Noto Sans Sinhala'; font-weight: 600; font-display: swap; src: url('/assets/fonts/noto-sans-sinhala-sinhala-600-normal.woff2') format('woff2'); }

/* ---- Dark (gemstok.com default) ---- */
:root {
  --font-main: 'Inter', 'Noto Sans Sinhala', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-heading: 'Orbitron', 'Noto Sans Sinhala', sans-serif;

  --bg: #222222;
  --text: #ffffff;
  --text-dim: #8f8f8f;
  --accent: #00d9ff;
  --accent-rgb: 0, 217, 255;
  --gold: #d4af37;
  --on-accent: #000000;
  --card: rgba(5, 5, 5, 0.85);
  --card-border: rgba(255, 255, 255, 0.08);
  --input-bg: rgba(255, 255, 255, 0.05);
  --input-border: rgba(255, 255, 255, 0.15);
  --placeholder: rgba(255, 255, 255, 0.25);
  --skeleton: rgba(255, 255, 255, 0.06);
  --shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  --logo-glow: 0 0 15px rgba(0, 217, 255, 0.6);
  --error: #ff5a5a;
  --success: #00d9ff;
  color-scheme: dark;
}

/* ---- Light (gemstok.com body.light-mode) ---- */
:root[data-theme="light"] {
  --bg: #e8e4dc;
  --text: #2c2a27;
  --text-dim: #6e6863;
  --accent: #1a6bb5;
  --accent-rgb: 26, 107, 181;
  --gold: #8a6a2a;              /* darker gold: readable on cream (≈5:1) */
  --on-accent: #ffffff;
  --card: #faf8f4;
  --card-border: rgba(0, 0, 0, 0.08);
  --input-bg: rgba(0, 0, 0, 0.03);
  --input-border: rgba(0, 0, 0, 0.12);
  --placeholder: rgba(0, 0, 0, 0.3);
  --skeleton: rgba(0, 0, 0, 0.06);
  --shadow: 0 25px 50px rgba(0, 0, 0, 0.08);
  --logo-glow: none;
  --error: #c62828;
  --success: #1a6bb5;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  font-family: var(--font-main);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ---- Layout ---- */
.shell {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 96px 16px 32px;
}
.shell-top { justify-content: flex-start; }

.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 20px 24px;
  background: var(--bg);
}
.topbar-actions { display: flex; gap: 8px; }

.logo {
  font-family: 'Orbitron', sans-serif;
  font-size: 24px; font-weight: 900; letter-spacing: 5px;
  color: var(--text); text-shadow: var(--logo-glow); text-decoration: none;
}

.card {
  width: 100%; max-width: 420px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 44px 36px 36px;
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(15px); backdrop-filter: blur(15px);
  animation: fadeIn .4s cubic-bezier(0.165, 0.84, 0.44, 1);
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- Type ---- */
.eyebrow {
  font-family: var(--font-heading); font-size: 11px; letter-spacing: 4px;
  color: var(--gold); text-transform: uppercase; margin: 0 0 14px;
}
.title {
  font-family: var(--font-heading);
  font-size: 20px; font-weight: 400; letter-spacing: 2px; line-height: 1.35;
  text-transform: uppercase; margin: 0 0 14px;
}
.title .neon { color: var(--accent); text-shadow: 0 0 15px rgba(var(--accent-rgb), 0.5); }
:root[data-theme="light"] .title .neon { text-shadow: none; }
.lead { font-size: 15px; color: var(--text-dim); margin: 0 0 26px; }
.lead strong { color: var(--text); font-weight: 500; word-break: break-all; }
.small { font-size: 13px; color: var(--text-dim); margin: 0; }
.center { text-align: center; }
.text-link { color: var(--accent); text-decoration: none; }
.text-link:hover { text-decoration: underline; }

/* Sinhala: Orbitron has no Sinhala letters, and capitals/spacing don't apply */
:root[lang="si"] .title, :root[lang="si"] .label, :root[lang="si"] .section-h,
:root[lang="si"] .btn, :root[lang="si"] .footer {
  font-family: var(--font-main); letter-spacing: 0; text-transform: none;
}
:root[lang="si"] .title { font-size: 22px; font-weight: 600; }
:root[lang="si"] .btn { font-size: 15px; font-weight: 600; }

/* ---- Fields ---- */
.field { margin-bottom: 20px; text-align: left; }
.label {
  display: block; font-family: var(--font-heading); font-size: 11px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--accent); margin-bottom: 10px;
}
.input-wrap { position: relative; }
.input {
  width: 100%; height: 52px; padding: 0 16px;
  font-family: var(--font-main); font-size: 16px; /* 16px stops iPhone zoom */
  color: var(--text); background: var(--input-bg);
  border: 1px solid var(--input-border); border-radius: 12px; outline: none; transition: .3s;
}
.input-wrap .input { padding-right: 84px; }
.input::placeholder { color: var(--placeholder); }
.input:focus { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.03); box-shadow: 0 0 15px rgba(var(--accent-rgb), 0.1); }
.input[aria-invalid="true"] { border-color: var(--error); }
.input-pin { letter-spacing: 8px; font-size: 20px; text-align: center; }

.peek {
  position: absolute; right: 6px; top: 6px; height: 40px; padding: 0 12px;
  font-family: var(--font-main); font-size: 13px;
  color: var(--text-dim); background: transparent; border: 0; border-radius: 8px; cursor: pointer;
}
.peek:hover { color: var(--accent); }

/* ---- Strength meter ---- */
.meter { display: flex; gap: 6px; margin-top: 10px; }
.meter span { flex: 1; height: 3px; border-radius: 2px; background: var(--input-border); transition: background .25s, box-shadow .25s; }
.meter[data-level="1"] span:nth-child(-n+1) { background: var(--error); }
.meter[data-level="2"] span:nth-child(-n+2) { background: var(--gold); }
.meter[data-level="3"] span:nth-child(-n+3) { background: var(--accent); }
.meter[data-level="4"] span:nth-child(-n+4) { background: var(--accent); box-shadow: 0 0 8px rgba(var(--accent-rgb), .6); }
.meter-label { margin-top: 6px; min-height: 19px; font-size: 12px; color: var(--text-dim); }

.error { color: var(--error); font-size: 14px; margin: -6px 0 18px; text-align: left; }
.error:empty { display: none; }
.note { font-size: 14px; color: var(--text-dim); margin: 12px 0 0; }

/* ---- Buttons ---- */
.btn {
  display: block; width: 100%; padding: 17px;
  font-family: var(--font-heading); font-size: 12px; letter-spacing: 3px; text-transform: uppercase;
  text-align: center; text-decoration: none;
  color: var(--accent); background: transparent;
  border: 1px solid var(--accent); border-radius: 12px; cursor: pointer;
  box-shadow: 0 0 15px rgba(var(--accent-rgb), 0.1);
  animation: pulseGlow 2.4s ease-in-out 1;   /* pulses once, then rests */
  transition: .3s;
}
.btn:hover { background: var(--accent); color: var(--on-accent); box-shadow: 0 0 30px rgba(var(--accent-rgb), 0.4); }
.btn:disabled { opacity: .5; pointer-events: none; animation: none; }
:root[data-theme="light"] .btn { box-shadow: none; animation: none; }
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.15); }
  50%      { box-shadow: 0 0 25px rgba(var(--accent-rgb), 0.5); }
}
.btn-as-link { display: block; }
.btn-quiet { margin-top: 12px; animation: none; box-shadow: none; color: var(--text); border-color: var(--input-border); }
.btn-quiet:hover { background: transparent; color: var(--accent); border-color: var(--accent); box-shadow: none; }
.btn-danger { color: var(--error); border-color: var(--error); animation: none; box-shadow: none; }
.btn-danger:hover { background: var(--error); color: #fff; box-shadow: none; }
.btn-row { display: flex; gap: 10px; margin-top: 18px; }
.btn-row .btn { margin: 0; }

.btn-social {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: 52px;
  font-family: var(--font-main); font-size: 15px; font-weight: 500;
  color: var(--text); text-decoration: none;
  background: var(--input-bg); border: 1px solid var(--input-border); border-radius: 12px; transition: .3s;
}
.btn-social:hover { border-color: var(--accent); }
.btn-social + .btn-social { margin-top: 10px; }

.link-btn {
  display: block; width: 100%; margin-top: 16px; padding: 6px; text-align: center;
  font-family: var(--font-main); font-size: 14px;
  color: var(--text-dim); text-decoration: none; background: none; border: 0; cursor: pointer;
}
.link-btn:hover { color: var(--accent); }
.link-left { text-align: left; padding-left: 0; }

.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: var(--text-dim); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--input-border); }

.ts-box { margin: 0 0 16px; min-height: 0; }
.ts-box:empty { display: none; }

/* ---- Status icon ---- */
.status-icon {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 22px;
  color: var(--accent); border: 1px solid rgba(var(--accent-rgb), .5); box-shadow: 0 0 20px rgba(var(--accent-rgb), .25);
}
.status-icon.is-error { color: var(--error); border-color: var(--error); box-shadow: none; }
.status-icon svg { width: 24px; height: 24px; }

/* ---- Views (one visible at a time) ---- */
[data-view] { display: none; }
[data-view].is-active { display: block; }

.spinner {
  width: 28px; height: 28px; margin: 4px 0 18px;
  border: 2px solid var(--input-border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Top bar buttons ---- */
.icon-btn {
  min-width: 42px; height: 42px; padding: 0 10px; border-radius: 12px;
  display: grid; place-items: center;
  font-family: var(--font-main); font-size: 14px; font-weight: 600;
  color: var(--accent); background: transparent;
  border: 1px solid var(--card-border); cursor: pointer; transition: .3s;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ---- Footer ---- */
.footer {
  margin-top: 28px; display: flex; flex-wrap: wrap; gap: 6px 20px; justify-content: center;
  font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
}
.footer a { color: var(--text-dim); text-decoration: none; }
.footer a:hover { color: var(--accent); }

/* =========================== Account page =========================== */
.dash { width: 100%; max-width: 1080px; }
.dash.is-active { display: grid; grid-template-columns: 1fr; gap: 18px; }
.col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.dash .card { max-width: none; padding: 28px; }
@media (min-width: 960px) {
  .dash.is-active { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
}

.identity { display: flex; align-items: center; gap: 16px; }
.avatar {
  width: 60px; height: 60px; flex: 0 0 60px; border-radius: 50%; display: grid; place-items: center;
  font-family: 'Orbitron', sans-serif; font-size: 17px; letter-spacing: 1px;
  color: var(--accent); border: 1px solid rgba(var(--accent-rgb), .5); box-shadow: 0 0 18px rgba(var(--accent-rgb), .25);
}
.identity-main { min-width: 0; flex: 1; }
/* People's names: Inter, normal case (works for Sinhala/Tamil names too) */
.person-name { font-family: var(--font-main); font-size: 21px; font-weight: 600; line-height: 1.25; margin: 0 0 4px; word-break: break-word; }
.gid { margin: 0; font-family: 'Orbitron', sans-serif; font-size: 12px; letter-spacing: 3px; color: var(--gold); }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.badges:empty { display: none; }
.name-form { margin-top: 18px; }
.name-form .btn-row .btn { padding: 13px; }

.section-h {
  font-family: var(--font-heading); font-size: 12px; font-weight: 400;
  letter-spacing: 3px; text-transform: uppercase; color: var(--accent); margin: 0 0 16px;
}

.rows { margin: 0; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; border-top: 1px solid var(--input-border); }
.row:first-child { border-top: 0; padding-top: 0; }
.row dt { color: var(--text-dim); font-size: 14px; flex: 0 0 auto; }
.row dd { margin: 0; text-align: right; font-size: 14px; font-weight: 500; word-break: break-word; }
.row dd .sub { display: block; font-weight: 400; font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.row dd.dim { color: var(--text-dim); font-weight: 400; }

.balance { display: flex; align-items: baseline; gap: 10px; margin: 0 0 6px; }
.balance-num { font-family: 'Orbitron', sans-serif; font-size: 34px; color: var(--text); }
.balance-unit { color: var(--text-dim); font-size: 14px; }
.tx { list-style: none; margin: 16px 0 0; padding: 0; }
.tx li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--input-border); font-size: 14px; }
.tx .tx-desc { min-width: 0; }
.tx .tx-desc span { display: block; font-size: 12px; color: var(--text-dim); }
.tx .amt { font-weight: 600; white-space: nowrap; }
.tx .amt.plus { color: var(--accent); }

.apps { list-style: none; margin: 0; padding: 0; }
.apps li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--input-border); }
.apps li:first-child { border-top: 0; padding-top: 0; }
.apps strong { display: block; font-weight: 600; }
.apps .app-sub { font-size: 13px; color: var(--text-dim); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.pill {
  flex: 0 0 auto; display: inline-block; padding: 5px 12px; border-radius: 999px;
  font-size: 12px; color: var(--text-dim); border: 1px solid var(--input-border); text-decoration: none; white-space: nowrap;
}
.pill-live { color: var(--accent); border-color: rgba(var(--accent-rgb), .5); }
a.pill-live:hover { background: var(--accent); color: var(--on-accent); }
.pill-gold { color: var(--gold); border-color: var(--gold); }

.list { margin: 6px 0 18px; padding-left: 20px; color: var(--text-dim); font-size: 14px; }
.list li { margin: 4px 0; }
.list-h { font-weight: 600; font-size: 14px; margin: 18px 0 4px; }
.banner {
  border: 1px solid rgba(var(--accent-rgb), .4); border-radius: 16px; padding: 16px 18px;
  font-size: 14px; color: var(--text); background: rgba(var(--accent-rgb), .06); margin-bottom: 18px;
}
.banner.is-error { border-color: var(--error); background: transparent; }

/* Skeleton (loading placeholders in the page's shape) */
.sk { background: var(--skeleton); border-radius: 8px; animation: skPulse 1.4s ease-in-out infinite; }
.sk-line { height: 12px; margin: 12px 0; }
.sk-circle { width: 60px; height: 60px; border-radius: 50%; }
@keyframes skPulse { 50% { opacity: .45; } }

/* Delete flow overlay */
.sheet-wrap {
  position: fixed; inset: 0; z-index: 50; display: none; align-items: flex-start; justify-content: center;
  padding: 80px 16px 24px; overflow-y: auto; background: rgba(0, 0, 0, .7);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
:root[data-theme="light"] .sheet-wrap { background: rgba(232, 228, 220, .85); }
.sheet-wrap.is-open { display: flex; }
.sheet-wrap .card { max-width: 480px; }

@media (max-width: 400px) {
  .card { padding: 36px 22px 28px; }
  .dash .card { padding: 24px 20px; }
  .title { font-size: 17px; }
  .logo { font-size: 20px; letter-spacing: 4px; }
  .topbar { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
.w30 { width: 30%; } .w40 { width: 40%; } .w60 { width: 60%; } .w80 { width: 80%; }
.btn-row .btn { letter-spacing: 1.5px; padding: 15px 10px; }
