/* =====================================================
   $SEXCOIN — SAVE THE WORLD
   Redesign: "Dark & Refined" — neutral anthracite,
   orange (#FF9147) as the only accent, subtle glow.
   ===================================================== */

:root {
  --bg: #0d0d0f;
  --bg2: #161618;
  --surface: #161618;
  --glass: rgba(255, 255, 255, 0.035);
  --glass-strong: rgba(255, 255, 255, 0.06);
  --stroke: rgba(255, 255, 255, 0.08);
  --stroke-strong: rgba(255, 255, 255, 0.12);
  --orange: #ff9147;
  --orange-ink: #0e0e10;
  --orange-soft: rgba(255, 145, 71, 0.12);
  --orange-line: rgba(255, 145, 71, 0.4);
  --text: #f4f3f0;
  --muted: #9c9a93;
  --faint: #76746d;
  --green: #34d399;
  --red: #f0683f;
}

html { scroll-behavior: smooth; }
html, body, button, a, #game-click-area, #world-map-svg { touch-action: manipulation; }
body.no-scroll { overflow: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  letter-spacing: -0.005em;
}

/* ambient glow — subtle, orange only */
.bg-ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(620px 420px at 12% -6%, rgba(255, 145, 71, 0.10), transparent 60%),
    radial-gradient(720px 520px at 88% 4%, rgba(255, 145, 71, 0.06), transparent 62%),
    radial-gradient(900px 600px at 50% 116%, rgba(255, 145, 71, 0.05), transparent 60%),
    var(--bg);
}
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 28%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 28%, transparent 72%);
}

/* typography helpers */
.font-display { font-family: 'Satoshi', 'Inter', system-ui, sans-serif; letter-spacing: -0.02em; }
/* "grad-text" kept as a class name for compatibility — now a clean solid orange accent */
.grad-text { color: var(--orange); }

/* glass cards — flat, thin, neutral */
.glass {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: 18px;
}
.glass-strong {
  background: var(--glass-strong);
  border: 1px solid var(--stroke);
  border-radius: 18px;
}
@media (min-width: 768px) {
  .glass, .glass-strong { backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
}
.card-hover { transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease; }
.card-hover:hover {
  transform: translateY(-3px);
  border-color: var(--orange-line);
  box-shadow: 0 16px 44px -20px rgba(255, 145, 71, 0.4);
}

/* buttons */
.btn-primary {
  background: var(--orange);
  color: var(--orange-ink);
  font-weight: 700;
  border-radius: 12px;
  box-shadow: 0 8px 26px -10px rgba(255, 145, 71, 0.6);
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 36px -10px rgba(255, 145, 71, 0.75); filter: brightness(1.05); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  font-weight: 600;
  color: var(--text);
  transition: all .18s ease;
}
.btn-ghost:hover { border-color: var(--orange-line); color: #fff; background: var(--orange-soft); }

/* nav */
.nav-pill { transition: all .18s ease; border-radius: 10px; }
.nav-pill:hover { background: var(--orange-soft); color: #fff; }
nav::-webkit-scrollbar { display: none; }

/* scroll reveal */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.3,1); }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* live indicator */
.live-dot { width: 8px; height: 8px; border-radius: 99px; background: var(--green); animation: livePulse 1.6s infinite; }
@keyframes livePulse { 0%,100% { box-shadow: 0 0 0 0 rgba(52,211,153,.5);} 50% { box-shadow: 0 0 0 6px rgba(52,211,153,0);} }

/* ===== DOOMSDAY ===== */
.doomsday-digits { font-variant-numeric: tabular-nums; letter-spacing: .01em; font-family: 'JetBrains Mono', 'Satoshi', monospace; }
.doom-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
  border-radius: 14px;
}
.doom-glow { text-shadow: 0 0 24px rgba(255, 145, 71, 0.45); }
.doomsday-flicker { animation: doomflicker 5s infinite; }
@keyframes doomflicker { 0%,94%,100%{opacity:1} 96%{opacity:.82} 98%{opacity:1} 99%{opacity:.9} }

/* ===== MAP ===== */
#world-map-svg { width: 100%; height: auto; display: block; }
#world-map-svg path { stroke: #0b0b0e; stroke-width: 0.5; cursor: pointer; transition: filter .15s ease; }
#world-map-svg path:hover { filter: brightness(1.35); stroke: #fff; stroke-width: 1; }
#world-map-svg path.rescued { animation: rescued-pulse 1.2s ease; }
@keyframes rescued-pulse { 0% { filter: brightness(2.2); } 100% { filter: brightness(1); } }

.map-tooltip {
  position: fixed; pointer-events: none; z-index: 9000;
  background: rgba(14,14,16,0.96); border: 1px solid var(--orange-line); border-radius: 10px;
  padding: 6px 12px; font-weight: 600; font-size: .85rem; color: #fff;
  box-shadow: 0 8px 30px rgba(0,0,0,.5); display: none; white-space: nowrap;
}
.map-view-btn { transition: all .18s ease; }
.map-view-btn.active {
  background: var(--orange);
  color: var(--orange-ink); border-color: transparent;
  box-shadow: 0 8px 26px -10px rgba(255,145,71,.6);
}

.rescue-row { transition: all .15s ease; }
.rescue-row:hover { border-color: var(--orange-line); transform: translateX(3px); }
.rescue-row.is-rescued { background: rgba(52, 211, 153, 0.10) !important; border-color: rgba(52,211,153,.4) !important; }

/* ===== GAME ===== */
#game-3d canvas { display: block; }
#game-click-btn:active { transform: scale(.93); }
.float-baby { position: absolute; font-weight: 900; pointer-events: none; animation: floatUp 1s ease-out forwards; z-index: 50; }
@keyframes floatUp { 0%{opacity:1; transform:translateY(0) scale(1)} 100%{opacity:0; transform:translateY(-80px) scale(1.6)} }
.upgrade-btn { transition: all .15s ease; }
.upgrade-btn:hover:not(:disabled) { border-color: var(--orange-line); background: var(--orange-soft); }
.upgrade-btn:disabled { opacity: .38; cursor: not-allowed; }
#game-mission-bar { transition: width .3s ease; }
.mission-complete-banner { animation: bannerPop .5s ease; }
@keyframes bannerPop { 0%{transform:scale(.3);opacity:0} 70%{transform:scale(1.05)} 100%{transform:scale(1);opacity:1} }

.game-fullscreen {
  position: fixed !important; inset: 0 !important; z-index: 9000 !important;
  height: 100dvh !important; border-radius: 0 !important; margin: 0 !important;
}

/* ===== TWEETS ===== */
.tweet-card { transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
.tweet-card:hover { transform: translateY(-3px); border-color: var(--orange-line); box-shadow: 0 16px 44px -22px rgba(255,145,71,.4); }
.tweet-card.is-extra { display: none; }
.tweets-expanded .tweet-card.is-extra { display: block; }
.tweet-avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  object-fit: cover;
  flex: 0 0 auto;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.16);
}

/* ===== LIVE DEX CHART ===== */
.dex-chart-shell {
  scroll-margin-top: 96px;
  background: rgba(9, 9, 11, 0.52);
  border: 1px solid rgba(255, 145, 71, 0.22);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.dex-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--stroke);
}
.dex-chart-frame-wrap {
  position: relative;
  min-height: 420px;
  background: #08080a;
}
.dex-chart-frame-wrap iframe {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 520px;
  border: 0;
  background: transparent;
}
.dex-chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ===== OVERLAYS ===== */
.lightbox-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.9); z-index:9999; align-items:center; justify-content:center; cursor:zoom-out; }
.lightbox-overlay.active { display:flex; }
.lightbox-overlay img { max-width:90vw; max-height:90vh; border-radius:14px; }

.dialog-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.72); z-index:9998; align-items:center; justify-content:center; padding:1rem; }
.dialog-overlay.active { display:flex; }
@media (min-width:768px){ .dialog-overlay.active { backdrop-filter: blur(6px); } }

/* ===== PFP ===== */
#pfp-canvas { max-width:100%; border-radius:16px; }
#pfp-drop-zone.dragover { background: var(--orange-soft); border-color: var(--orange); }
.pfp-style-btn.active { outline: 2px solid var(--orange); outline-offset: 2px; }

/* icon sizing helper */
.ic { width: 1em; height: 1em; flex-shrink: 0; vertical-align: -0.125em; }

/* ===== MOBILE ===== */
@media (max-width: 767px) {
  main { padding: 14px !important; }
  #world-map-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #world-map-svg { min-width: 720px; }
  #game-click-area { height: 360px !important; }
  .doomsday-digits { font-size: 1.55rem !important; }
  .dex-chart-head { align-items: flex-start; padding: 14px; }
  .dex-chart-frame-wrap { min-height: 360px; }
  .dex-chart-frame-wrap iframe { height: 390px; }
}
