:root {
  --gold: #ffd700;
  --gold-light: #ffe64d;
  --gold-deep: #f2bf00;
  --gold-soft: rgba(255, 215, 0, 0.14);
  --bg: #000;
  --card: rgba(255, 215, 0, 0.055);
  --card-border: rgba(255, 215, 0, 0.28);
  --text: #f7f3e6;
  --muted: rgba(247, 243, 230, 0.62);
  --danger: #ff6b6b;
  --radius-s: 12px;
  --radius-m: 18px;
  --radius-l: 25px;
  --tabbar-h: 60px;
  --topbar-h: 54px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Hiragino Kaku Gothic ProN", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: #000;
  color: var(--text);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Background aura (theme-driven) ---------- */
.aura {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255, 215, 0, 0.20), transparent 60%),
    radial-gradient(90% 60% at 50% 110%, rgba(255, 190, 0, 0.12), transparent 60%),
    #000;
  transition: background 0.6s ease;
}
body[data-theme="koiRedAura"] .aura {
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255, 60, 60, 0.28), transparent 60%),
    radial-gradient(90% 60% at 50% 110%, rgba(255, 120, 40, 0.18), transparent 60%),
    #0a0000;
}
body[data-theme="coinRainAura"] .aura {
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255, 225, 90, 0.30), transparent 62%),
    radial-gradient(90% 60% at 50% 110%, rgba(255, 200, 0, 0.20), transparent 60%),
    #050400;
}
body[data-theme="cyberVaultAura"] .aura {
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(60, 200, 255, 0.22), transparent 60%),
    radial-gradient(90% 60% at 50% 110%, rgba(255, 215, 0, 0.14), transparent 60%),
    linear-gradient(180deg, #02060a, #000);
}

.fx { position: fixed; inset: 0; z-index: 50; pointer-events: none; }

/* ---------- Phone frame ---------- */
.phone {
  position: relative; z-index: 10;
  width: 100%; max-width: 430px; height: 100dvh; max-height: 100dvh;
  display: flex; flex-direction: column;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
@media (min-width: 480px) and (min-height: 720px) {
  .phone {
    height: min(880px, 94dvh); max-height: 94dvh;
    border-radius: 34px;
    border: 1px solid rgba(255, 215, 0, 0.25);
    box-shadow: 0 0 0 8px rgba(20, 16, 4, 0.6), 0 24px 70px rgba(255, 200, 0, 0.14), 0 0 60px rgba(255, 215, 0, 0.08);
  }
}

/* ---------- Top bar ---------- */
.topbar {
  height: var(--topbar-h); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; gap: 10px;
  border-bottom: 1px solid rgba(255, 215, 0, 0.14);
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.06), transparent);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-icon { width: 26px; height: 26px; border-radius: 7px; box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
.brand-name {
  margin: 0; font-size: 16px; line-height: normal;
  font-weight: 700; letter-spacing: 0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: linear-gradient(90deg, var(--gold-light), var(--gold), var(--gold-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.noscript-seo { max-width: 640px; margin: 0 auto; padding: 28px 22px; color: #f5f5f5; font-size: 15px; line-height: 1.75; }
.noscript-seo h2 { color: var(--gold-light); font-size: 18px; margin: 22px 0 8px; }
.noscript-seo a { color: var(--gold); }
.noscript-seo ul { padding-left: 20px; margin: 8px 0; }
.merit-pill {
  display: flex; align-items: center; gap: 5px; flex: 0 0 auto;
  padding: 5px 11px; border-radius: 999px;
  background: var(--gold-soft); border: 1px solid var(--card-border);
  color: var(--gold-light); font-weight: 700; font-size: 14px;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.18) inset;
}
.pill-ico { width: 15px; height: 15px; fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linecap: round; }

/* ---------- Views ---------- */
#views { flex: 1 1 auto; position: relative; overflow: hidden; }
.view {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  display: none; animation: fade 0.28s ease;
}
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.view::-webkit-scrollbar { width: 0; }

/* ---------- Tab bar ---------- */
.tabbar {
  flex: 0 0 auto; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; align-items: stretch;
  border-top: 1px solid rgba(255, 215, 0, 0.16);
  background: linear-gradient(0deg, rgba(10, 8, 2, 0.96), rgba(0, 0, 0, 0.86));
  backdrop-filter: blur(8px);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-family: inherit; font-size: 10.5px; padding: 6px 2px; transition: color 0.2s, transform 0.1s;
}
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab.active { color: var(--gold); text-shadow: 0 0 10px rgba(255, 215, 0, 0.6); }
.tab.active svg { filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.7)); }
.tab:active { transform: scale(0.92); }

/* ---------- Generic building blocks ---------- */
.card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius-m); padding: 16px; margin-bottom: 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}
.card-title { font-size: 16px; font-weight: 700; color: var(--gold-light); margin: 0 0 4px; letter-spacing: 0.4px; }
.card-sub { font-size: 12.5px; color: var(--muted); margin: 0 0 12px; line-height: 1.5; white-space: pre-line; }
.section-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); margin: 18px 2px 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.gold { color: var(--gold-light); }
.center { text-align: center; }
.hidden { display: none !important; }

.btn {
  font-family: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
  border-radius: var(--radius-l); padding: 13px 20px; border: 1px solid transparent;
  transition: transform 0.08s ease, filter 0.2s ease, opacity 0.2s; width: 100%;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  color: #1a1400;
  background: linear-gradient(135deg, var(--gold-light), var(--gold) 45%, var(--gold-deep));
  box-shadow: 0 6px 20px rgba(255, 200, 0, 0.32);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost {
  color: var(--gold-light); background: rgba(255, 215, 0, 0.07); border-color: var(--card-border);
}
.btn-ghost:hover { background: rgba(255, 215, 0, 0.13); }
.btn-sm { padding: 8px 14px; font-size: 13px; width: auto; border-radius: 999px; }
.btn:disabled { opacity: 0.42; cursor: not-allowed; filter: grayscale(0.3); }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--gold-soft); border: 1px solid var(--card-border); color: var(--gold-light);
}

/* ---------- Countdown ---------- */
.countdown-wrap { text-align: center; padding: 10px 0 4px; }
.countdown-hint { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.countdown-grid { display: flex; justify-content: center; gap: 10px; }
.cd-cell {
  min-width: 68px; padding: 12px 6px; border-radius: var(--radius-s);
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.10), rgba(0, 0, 0, 0.3));
  border: 1px solid var(--card-border);
  box-shadow: 0 0 18px rgba(255, 200, 0, 0.10) inset;
}
.cd-num {
  font-size: 34px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff6c9, var(--gold) 60%, var(--gold-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 22px rgba(255, 210, 0, 0.35);
}
.cd-label { font-size: 10.5px; letter-spacing: 1.5px; color: var(--muted); margin-top: 6px; }

.fortune-banner {
  margin-top: 6px; padding: 14px; border-radius: var(--radius-m); text-align: center;
  background: radial-gradient(120% 120% at 50% 0%, rgba(255, 215, 0, 0.14), rgba(0, 0, 0, 0.2));
  border: 1px solid var(--card-border);
}
.fortune-banner .fb-title { color: var(--gold-light); font-weight: 700; font-size: 13px; letter-spacing: 1px; margin-bottom: 6px; }
.fortune-banner .fb-text { font-size: 15px; line-height: 1.5; }

/* ---------- Wooden fish ---------- */
.fish-stage { display: flex; flex-direction: column; align-items: center; padding: 6px 0 2px; position: relative; }
.fish-btn {
  position: relative; width: 230px; height: 230px; border-radius: 50%; border: 0; padding: 0;
  background: radial-gradient(circle at 50% 40%, rgba(255, 215, 0, 0.16), transparent 70%);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform 0.06s ease;
}
.fish-btn img { width: 190px; height: 190px; object-fit: contain; filter: drop-shadow(0 0 22px rgba(255, 200, 0, 0.45)); pointer-events: none; }
.fish-btn:active { transform: scale(0.94); }
.fish-btn::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid rgba(255, 215, 0, 0.0); pointer-events: none;
}
.fish-btn.ripple::after { animation: ripple 0.5s ease-out; }
@keyframes ripple { 0% { border-color: rgba(255, 215, 0, 0.7); transform: scale(0.9); } 100% { border-color: rgba(255, 215, 0, 0); transform: scale(1.25); } }
.float-merit {
  position: absolute; left: 50%; top: 30%; transform: translateX(-50%);
  color: var(--gold-light); font-weight: 800; font-size: 26px; pointer-events: none;
  text-shadow: 0 0 14px rgba(255, 210, 0, 0.8); animation: floatUp 0.9s ease-out forwards;
}
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 10px) scale(0.8); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -70px) scale(1.15); } }
.combo-badge { margin-top: 10px; height: 24px; }
.stat-grid { display: flex; gap: 10px; }
.stat-box { flex: 1; text-align: center; padding: 12px; border-radius: var(--radius-s); background: rgba(255, 215, 0, 0.05); border: 1px solid rgba(255, 215, 0, 0.18); }
.stat-num { font-size: 22px; font-weight: 800; color: var(--gold-light); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 3px; }
.progress { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-deep), var(--gold-light)); box-shadow: 0 0 12px rgba(255, 210, 0, 0.6); transition: width 0.25s ease; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border-radius: var(--radius-s); background: rgba(255, 215, 0, 0.045); border: 1px solid rgba(255, 215, 0, 0.16);
}
.li-thumb { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; flex: 0 0 auto; background: #111; border: 1px solid rgba(255, 215, 0, 0.2); }
.li-body { flex: 1; min-width: 0; }
.li-title { font-weight: 700; font-size: 14.5px; }
.li-sub { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.li-right { text-align: right; flex: 0 0 auto; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty .em-ico { font-size: 34px; opacity: 0.5; display: block; margin-bottom: 8px; }

/* exchange options */
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt {
  padding: 14px 10px; border-radius: var(--radius-s); text-align: center; cursor: pointer;
  background: rgba(255, 215, 0, 0.06); border: 1px solid var(--card-border); transition: transform 0.08s, background 0.2s;
}
.opt:active { transform: scale(0.96); }
.opt.disabled { opacity: 0.4; cursor: not-allowed; }
.opt .o-main { font-size: 17px; font-weight: 800; color: var(--gold-light); }
.opt .o-cost { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
input[type="text"], input[type="date"], textarea, select {
  width: 100%; font-family: inherit; font-size: 15px; color: var(--text);
  background: rgba(0, 0, 0, 0.45); border: 1px solid var(--card-border); border-radius: var(--radius-s);
  padding: 11px 12px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.12); }
textarea { resize: none; min-height: 96px; line-height: 1.5; }
select option { background: #111; color: var(--text); }
.switch { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid rgba(255, 215, 0, 0.10); }
.switch:last-child { border-bottom: 0; }
.toggle { width: 48px; height: 28px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); border: 0; position: relative; cursor: pointer; flex: 0 0 auto; transition: background 0.2s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.toggle.on { background: linear-gradient(90deg, var(--gold-deep), var(--gold-light)); }
.toggle.on::after { transform: translateX(20px); }

/* ---------- Talisman grid ---------- */
.talisman-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.talisman-card { position: relative; border-radius: var(--radius-s); overflow: hidden; border: 1px solid var(--card-border); background: #0b0b0b; cursor: pointer; }
.talisman-card img { width: 100%; aspect-ratio: 941 / 1672; object-fit: cover; display: block; }
.talisman-card .tc-lock { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.42); backdrop-filter: blur(2px); }
.talisman-card .tc-wm { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.talisman-card .tc-wm span { transform: rotate(-24deg); font-size: 26px; font-weight: 800; color: rgba(255, 255, 255, 0.30); letter-spacing: 3px; text-shadow: 0 2px 8px rgba(0,0,0,0.6); }
.tc-foot { padding: 8px 9px; }
.tc-name { font-size: 12.5px; font-weight: 700; line-height: 1.3; }
.tc-cost { font-size: 11.5px; color: var(--gold-light); margin-top: 3px; }
.tc-badge { position: absolute; top: 7px; right: 7px; }

/* ---------- Modal ---------- */
.modal-root { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 22px; background: rgba(0, 0, 0, 0.66); backdrop-filter: blur(3px); animation: fade 0.2s ease; }
.modal-root[hidden] { display: none; }
.modal {
  width: 100%; max-width: 360px; max-height: 86dvh; overflow-y: auto;
  background: linear-gradient(180deg, #14110a, #0a0803); border: 1px solid var(--card-border);
  border-radius: var(--radius-m); padding: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(255, 200, 0, 0.10);
  animation: pop 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
@keyframes pop { from { opacity: 0; transform: scale(0.9) translateY(10px); } to { opacity: 1; transform: none; } }
.modal h3 { margin: 0 0 8px; font-size: 18px; color: var(--gold-light); text-align: center; }
.modal .m-body { font-size: 14.5px; line-height: 1.6; color: var(--text); text-align: center; white-space: pre-line; margin-bottom: 16px; }
.modal .m-actions { display: flex; flex-direction: column; gap: 9px; }
.modal .m-preview { width: 100%; border-radius: var(--radius-s); margin-bottom: 14px; display: block; border: 1px solid var(--card-border); }
.download-modal { text-align: center; }
.download-modal-icon { width: 84px; height: 84px; border-radius: 20px; display: block; margin: 0 auto 14px; border: 1px solid var(--card-border); box-shadow: 0 8px 26px rgba(0, 0, 0, 0.6), 0 0 22px rgba(255, 200, 0, 0.14); }
.download-modal .m-actions a.btn { text-decoration: none; text-align: center; }
.download-modal .no-iap { margin: 14px 0 0; font-size: 11.5px; text-align: center; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 26px); transform: translate(-50%, 20px);
  z-index: 120; padding: 11px 20px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: rgba(20, 16, 6, 0.96); color: var(--gold-light); border: 1px solid var(--card-border);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6); opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
  max-width: 84%; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Promo / download ---------- */
.download-card { text-align: center; background: linear-gradient(135deg, rgba(255, 215, 0, 0.12), rgba(255, 140, 0, 0.05)); border: 1px solid var(--card-border); }
.rp-card { background: linear-gradient(160deg, rgba(255, 215, 0, 0.08), rgba(255, 255, 255, 0.02)); }
.rp-name { font-size: 15.5px; font-weight: 800; color: var(--text); margin: 6px 0 4px; line-height: 1.4; }
.rp-desc { font-size: 13px; color: var(--muted); line-height: 1.6; }
.rp-card .btn { min-height: 44px; }
.ext-ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-left: 6px; vertical-align: -2px; }
.note { font-size: 11.5px; color: var(--muted); line-height: 1.6; white-space: pre-line; }
.divider { height: 1px; background: rgba(255, 215, 0, 0.12); margin: 14px 0; }

.koi-hero { display: flex; flex-direction: column; align-items: center; }
.koi-hero img { width: 132px; height: 132px; object-fit: contain; filter: drop-shadow(0 0 20px rgba(255, 80, 80, 0.4)); }
.streak-flame { font-size: 13px; color: var(--gold-light); font-weight: 700; }
