/* ==========================================================
   SOVEREIGN — Luxury War Room Design System v2
   Obsidian marble + royal gold + frosted glass
   ========================================================== */

:root {
  --gold: #d4af37;
  --gold-bright: #f0c75e;
  --gold-deep: #8f6b1f;
  --obsidian: #07070c;
  --panel: rgba(20, 20, 32, 0.72);
  --panel-solid: #13131e;
  --edge: rgba(212, 175, 55, 0.12);
  --edge-strong: rgba(212, 175, 55, 0.3);
  --ink: #e8e6df;
  --ink-dim: #8a8794;
  --danger: #e05252;
  --success: #3ecf8e;
  --font-display: 'Cinzel', 'Times New Roman', serif;
  --font-body: 'Manrope', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--obsidian);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------- Ambient war-room background (layers behind glass) ---------- */
.bg-arena {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 15% -5%, rgba(212,175,55,0.09), transparent 60%),
    radial-gradient(ellipse 50% 35% at 90% 10%, rgba(93, 63, 211, 0.07), transparent 60%),
    radial-gradient(ellipse 70% 50% at 50% 110%, rgba(212,175,55,0.05), transparent 55%),
    linear-gradient(160deg, #0a0a12 0%, #07070c 45%, #0b0910 100%);
}
.bg-grid {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .35;
  background-image:
    linear-gradient(rgba(212,175,55,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212,175,55,0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 30%, transparent 75%);
}

/* ---------- Typography ---------- */
.font-display { font-family: var(--font-display); }
.font-mono-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.gold-text { color: var(--gold); }
.gold-gradient-text {
  background: linear-gradient(100deg, #8f6b1f 0%, #d4af37 30%, #f6e27a 50%, #d4af37 70%, #8f6b1f 100%);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: goldShine 6s linear infinite;
}
@keyframes goldShine { to { background-position: 200% center; } }
.eyebrow {
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-dim); font-weight: 700;
}
.eyebrow i { color: var(--gold-deep); margin-right: 5px; }

/* ---------- Glass cards ---------- */
.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 16px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 34px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.04);
  transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}
@supports not (backdrop-filter: blur(14px)) { .card { background: var(--panel-solid); } }
.card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 1px; border-radius: 16px 16px 0 0;
  background: linear-gradient(90deg, transparent 5%, rgba(212,175,55,0.35) 50%, transparent 95%);
  pointer-events: none;
}
.card-hover:hover, .card.cursor-pointer:hover {
  border-color: var(--edge-strong);
  transform: translateY(-2px);
  box-shadow: 0 16px 44px rgba(0,0,0,0.55), 0 0 24px rgba(212,175,55,0.06), inset 0 1px 0 rgba(255,255,255,0.05);
}
.card-hero {
  background:
    radial-gradient(ellipse 120% 90% at 50% -30%, rgba(212,175,55,0.13), transparent 60%),
    var(--panel);
  border-color: rgba(212,175,55,0.22);
}

/* ---------- Buttons ---------- */
.btn-gold {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #e8c25a 0%, #d4af37 45%, #a8842a 100%);
  color: #14100a; font-weight: 700; letter-spacing: 0.04em;
  border-radius: 12px; padding: 0.55rem 1.1rem;
  box-shadow: 0 4px 16px rgba(212,175,55,0.28), inset 0 1px 0 rgba(255,255,255,0.35);
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
}
.btn-gold::after {
  content: ''; position: absolute; top: 0; left: -80%; width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.45), transparent);
  transform: skewX(-20deg); transition: left .45s ease;
}
.btn-gold:hover { filter: brightness(1.08); box-shadow: 0 6px 22px rgba(212,175,55,0.4), inset 0 1px 0 rgba(255,255,255,0.4); }
.btn-gold:hover::after { left: 130%; }
.btn-gold:active { transform: scale(0.97); }
.btn-gold:disabled { opacity: .55; filter: grayscale(.4); }

.btn-ghost {
  border: 1px solid rgba(212,175,55,0.22); border-radius: 12px; padding: 0.55rem 1.1rem;
  color: var(--ink-dim); background: rgba(212,175,55,0.03);
  transition: all .2s ease; font-weight: 600;
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); background: rgba(212,175,55,0.08); box-shadow: 0 0 16px rgba(212,175,55,0.1); }
.btn-ghost:active { transform: scale(0.97); }

/* ---------- Inputs ---------- */
.input-dark {
  background: rgba(7,7,12,0.7); border: 1px solid rgba(212,175,55,0.14); border-radius: 12px;
  padding: 0.6rem 0.85rem; color: var(--ink); width: 100%;
  transition: border-color .2s ease, box-shadow .2s ease; font-family: var(--font-body);
}
.input-dark:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,175,55,0.12); }
.input-dark::placeholder { color: #55525e; }
select.input-dark option { background: var(--panel-solid); }
label.field-label { display:block; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim); font-weight: 700; margin: 0 0 4px 2px; }

/* ---------- Navigation: mobile bottom bar ---------- */
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 2px 6px; color: #5d5a66; font-size: 9px; font-weight: 700; letter-spacing: .06em;
  cursor: pointer; flex: 1; transition: color .2s ease; position: relative; text-transform: uppercase;
}
.nav-item i { font-size: 17px; transition: transform .2s ease, filter .2s ease; }
.nav-item.active { color: var(--gold); }
.nav-item.active i { transform: translateY(-2px); filter: drop-shadow(0 0 8px rgba(212,175,55,0.6)); }
.nav-item.active::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 22px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.bottom-nav {
  background: rgba(10,10,16,0.85); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--edge);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- Navigation: desktop sidebar ---------- */
.sidebar {
  display: none;
  position: fixed; top: 0; left: 0; bottom: 0; width: 232px; z-index: 45;
  background: rgba(10,10,16,0.82); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid var(--edge);
  padding: 22px 14px; flex-direction: column;
}
.side-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px;
  color: #6d6a78; font-size: 13px; font-weight: 600; letter-spacing: .08em; cursor: pointer;
  transition: all .2s ease; border: 1px solid transparent; margin-bottom: 4px; text-transform: uppercase;
}
.side-item i { width: 18px; text-align: center; font-size: 15px; }
.side-item:hover { color: var(--ink); background: rgba(212,175,55,0.05); }
.side-item.active {
  color: var(--gold); background: linear-gradient(90deg, rgba(212,175,55,0.12), rgba(212,175,55,0.02));
  border-color: rgba(212,175,55,0.2);
  box-shadow: inset 2px 0 0 var(--gold);
}
@media (min-width: 1024px) {
  .sidebar { display: flex; }
  .bottom-nav { display: none; }
  .main-wrap { margin-left: 232px; max-width: 860px; }
  .mobile-header { display: none; }
}

/* ---------- Progress ---------- */
.progress-bar { height: 8px; background: rgba(255,255,255,0.05); border-radius: 6px; overflow: hidden; border: 1px solid rgba(255,255,255,0.04); }
.progress-fill {
  height: 100%; border-radius: 6px; position: relative; overflow: hidden;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold), var(--gold-bright));
  transition: width .9s cubic-bezier(.22,1,.36,1);
  box-shadow: 0 0 10px rgba(212,175,55,0.35);
}
.progress-fill::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,0.5) 50%, transparent 70%);
  background-size: 200% 100%; animation: shimmer 2.4s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Stat ring (SVG) */
.stat-ring-track { stroke: rgba(255,255,255,0.06); }
.stat-ring-fill { stroke: url(#goldRing); stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(.22,1,.36,1); filter: drop-shadow(0 0 5px rgba(212,175,55,0.45)); }

/* ---------- PIN vault ---------- */
.pin-crest {
  width: 92px; height: 92px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; margin: 0 auto;
  background: radial-gradient(circle at 35% 30%, rgba(212,175,55,0.22), rgba(212,175,55,0.05) 65%);
  border: 1px solid rgba(212,175,55,0.35);
  box-shadow: 0 0 44px rgba(212,175,55,0.22), inset 0 0 24px rgba(212,175,55,0.08);
  animation: crestPulse 3.5s ease-in-out infinite;
}
@keyframes crestPulse {
  0%, 100% { box-shadow: 0 0 34px rgba(212,175,55,0.16), inset 0 0 24px rgba(212,175,55,0.08); }
  50% { box-shadow: 0 0 58px rgba(212,175,55,0.3), inset 0 0 30px rgba(212,175,55,0.12); }
}
.pin-dot {
  width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid rgba(212,175,55,0.5);
  transition: all .18s ease;
}
.pin-dot.filled {
  background: radial-gradient(circle at 35% 30%, var(--gold-bright), var(--gold-deep));
  border-color: var(--gold); transform: scale(1.15);
  box-shadow: 0 0 10px rgba(212,175,55,0.7);
}
.pin-key {
  width: 70px; height: 70px; border-radius: 50%;
  background: rgba(20,20,32,0.65); backdrop-filter: blur(10px);
  border: 1px solid rgba(212,175,55,0.14);
  font-size: 22px; font-weight: 600; color: var(--ink); font-family: var(--font-mono);
  transition: all .12s ease;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.05);
}
.pin-key:hover { border-color: rgba(212,175,55,0.4); }
.pin-key:active {
  background: linear-gradient(135deg, #e8c25a, #a8842a); color: #14100a; transform: scale(0.94);
  box-shadow: 0 0 22px rgba(212,175,55,0.5);
}
.pin-shake { animation: pinShake .4s ease; }
@keyframes pinShake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-9px)} 40%{transform:translateX(8px)} 60%{transform:translateX(-6px)} 80%{transform:translateX(4px)} }

/* ---------- Badges ---------- */
.badge { font-size: 9px; padding: 3px 9px; border-radius: 999px; font-weight: 800; letter-spacing: .1em; border: 1px solid transparent; }
.badge-builder { background: rgba(16,185,129,0.12); color: #4ade80; border-color: rgba(16,185,129,0.3); }
.badge-trader { background: rgba(59,130,246,0.12); color: #7ab8ff; border-color: rgba(59,130,246,0.3); }
.badge-extractor { background: rgba(249,115,22,0.12); color: #fdaa5e; border-color: rgba(249,115,22,0.3); }
.badge-broadcaster { background: rgba(168,85,247,0.12); color: #cf9bff; border-color: rgba(168,85,247,0.3); }
.badge-crab { background: rgba(239,68,68,0.12); color: #ff8585; border-color: rgba(239,68,68,0.32); }
.badge-unknown { background: rgba(148,148,160,0.1); color: #9c99a8; border-color: rgba(148,148,160,0.25); }
.badge-gold { background: rgba(212,175,55,0.12); color: var(--gold-bright); border-color: rgba(212,175,55,0.35); }
.badge-danger { background: rgba(224,82,82,0.12); color: #ff9d9d; border-color: rgba(224,82,82,0.32); }
.badge-success { background: rgba(62,207,142,0.12); color: #6ee7b7; border-color: rgba(62,207,142,0.3); }

/* ---------- Chat (WhatsApp-grade) ---------- */
.chat-user {
  background: linear-gradient(135deg, rgba(212,175,55,0.2), rgba(143,107,31,0.14));
  border: 1px solid rgba(212,175,55,0.28);
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.3);
}
.chat-ai {
  background: rgba(22,22,34,0.85); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 16px 16px 16px 4px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.3);
}
.chat-meta { display:flex; align-items:center; justify-content:flex-end; gap:4px; margin-top:4px; font-size:9px; color:#6d6a78; }
.tick-sent { color:#6d6a78; } .tick-done { color:#53bdeb; }
.msg-in { animation: msgIn .3s cubic-bezier(.22,1,.36,1); }
@keyframes msgIn { from { opacity:0; transform: translateY(10px) scale(.97); } to { opacity:1; transform:none; } }
.typing-dots { display:inline-flex; gap:4px; align-items:center; }
.typing-dots span {
  width:7px; height:7px; border-radius:50%; background: var(--gold);
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2){ animation-delay:.15s } .typing-dots span:nth-child(3){ animation-delay:.3s }
@keyframes typingBounce { 0%,60%,100%{ transform:translateY(0); opacity:.4 } 30%{ transform:translateY(-5px); opacity:1 } }
.avatar-ring {
  width: 40px; height: 40px; border-radius: 50%; padding: 2px;
  background: conic-gradient(from 210deg, #8f6b1f, #f6e27a, #d4af37, #8f6b1f);
  animation: ringSpin 8s linear infinite;
}
@keyframes ringSpin { to { transform: rotate(360deg); } }
.avatar-core {
  width: 100%; height: 100%; border-radius: 50%; background: #14141f;
  display:flex; align-items:center; justify-content:center; color: var(--gold); font-size: 16px;
  animation: ringSpin 8s linear infinite reverse;
}
.online-dot { width:9px; height:9px; border-radius:50%; background:var(--success); box-shadow:0 0 8px rgba(62,207,142,0.8); animation: crestPulse 2.5s infinite; }

/* ---------- Modals ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(4,4,8,0.7);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  z-index: 50; display: flex; align-items: center; justify-content: center; padding: 1rem;
  animation: fadeIn .2s ease;
}
.modal-box {
  background: linear-gradient(170deg, #17172400, #17172400), var(--panel-solid);
  background: radial-gradient(ellipse 120% 60% at 50% -20%, rgba(212,175,55,0.08), transparent 55%), #14141f;
  border: 1px solid rgba(212,175,55,0.2); border-radius: 20px;
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto;
  box-shadow: 0 24px 70px rgba(0,0,0,0.7), 0 0 40px rgba(212,175,55,0.06);
  animation: modalIn .28s cubic-bezier(.22,1,.36,1);
}
@keyframes modalIn { from { opacity:0; transform: translateY(24px) scale(.96); } to { opacity:1; transform:none; } }

/* ---------- Toasts ---------- */
.toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 100;
  display:flex; align-items:center; gap:10px;
  padding: 11px 18px; border-radius: 14px; font-size: 13px; font-weight: 600;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  animation: toastIn .35s cubic-bezier(.22,1,.36,1);
  box-shadow: 0 12px 34px rgba(0,0,0,0.5);
  max-width: min(92vw, 420px);
}
.toast-ok { background: rgba(20,28,24,0.9); border: 1px solid rgba(212,175,55,0.35); color: var(--gold-bright); }
.toast-err { background: rgba(34,16,16,0.92); border: 1px solid rgba(224,82,82,0.4); color: #ffb3b3; }
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastIn { from { opacity:0; transform: translate(-50%,-16px) scale(.95); } to { opacity:1; transform: translate(-50%,0) scale(1); } }
@keyframes toastOut { to { opacity:0; transform: translate(-50%,-12px) scale(.96); } }

/* ---------- Skeletons ---------- */
.skel { position:relative; overflow:hidden; background: rgba(255,255,255,0.045); border-radius: 10px; }
.skel::after {
  content:''; position:absolute; inset:0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,0.07) 50%, transparent 70%);
  background-size: 200% 100%; animation: shimmer 1.6s linear infinite;
}
.skel-card { border-radius: 16px; border: 1px solid rgba(255,255,255,0.04); }

/* ---------- Misc ---------- */
.streak-fire { color: #f59a3c; filter: drop-shadow(0 0 6px rgba(245,154,60,0.5)); }
.fade-in { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.stagger > * { opacity: 0; animation: fadeIn .4s ease forwards; }
.stagger > *:nth-child(1){animation-delay:.02s} .stagger > *:nth-child(2){animation-delay:.07s}
.stagger > *:nth-child(3){animation-delay:.12s} .stagger > *:nth-child(4){animation-delay:.17s}
.stagger > *:nth-child(5){animation-delay:.22s} .stagger > *:nth-child(6){animation-delay:.27s}
.stagger > *:nth-child(7){animation-delay:.32s} .stagger > *:nth-child(8){animation-delay:.37s}

.divider-crown { display:flex; align-items:center; gap:12px; color: rgba(212,175,55,0.4); font-size: 10px; margin: 4px 0; }
.divider-crown::before, .divider-crown::after { content:''; flex:1; height:1px; background: linear-gradient(90deg, transparent, rgba(212,175,55,0.25), transparent); }

.list-row { border-bottom: 1px solid rgba(255,255,255,0.05); transition: background .15s ease; }
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: rgba(212,175,55,0.03); }

.icon-chip {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display:flex; align-items:center; justify-content:center; font-size: 13px;
  background: rgba(212,175,55,0.09); color: var(--gold); border: 1px solid rgba(212,175,55,0.18);
}

.empty-state { text-align:center; padding: 2.2rem 1.2rem; }
.empty-state i { font-size: 30px; color: rgba(212,175,55,0.28); margin-bottom: 10px; display:block; }
.empty-state p { color: var(--ink-dim); font-size: 13px; }
.empty-state .maxim { font-size: 11px; color: #4d4a58; font-style: italic; margin-top: 8px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, rgba(212,175,55,0.25), rgba(212,175,55,0.1)); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(212,175,55,0.4); }
::selection { background: rgba(212,175,55,0.3); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.15s !important; }
}

/* Boot loading screen */
#boot {
  position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
  background: var(--obsidian); transition: opacity .5s ease;
}
#boot.gone { opacity: 0; pointer-events: none; }
.boot-bar { width: 150px; height: 2px; background: rgba(212,175,55,0.12); border-radius: 2px; overflow: hidden; }
.boot-bar::after { content:''; display:block; width: 45%; height:100%; background: var(--gold); border-radius:2px; animation: bootSlide 1.1s ease-in-out infinite; }
@keyframes bootSlide { 0%{ transform: translateX(-110%);} 100%{ transform: translateX(340%);} }
