/* ===== TOKENS ===== */
:root{
  /* brand accents (from PFP) */
  --accent: #00CFFF;      /* cyan */
  --accent-2: #FFD700;    /* pixel yellow */

  /* dark */
  --bg:#0f1115;
  --surface:#161922;
  --surface-2:#11141b;
  --text:#e8ecf1;
  --muted:#9aa6b2;
  --border:rgba(255,255,255,.08);

  /* layout */
  --topbar-h:56px;
  --ticker-h:52px;
  --radius:10px;
  --radius-pixel:0px;
  --shadow:0 0 12px rgba(0,0,0,0.35);
}

body.light{
  /* light */
  --bg:#f6f7f9;
  --surface:#ffffff;
  --surface-2:#f1f3f6;
  --text:#0f1115;
  --muted:#6b7280;
  --border:rgba(15,17,21,.08);
  --shadow:0 6px 14px rgba(0,0,0,.06);
}

/* ===== BASE ===== */
html,body{height:100%;overflow-x:hidden}
*{box-sizing:border-box}
body{
  margin:0;
  font:16px/1.5 system-ui,-apple-system,Segoe UI,Roboto,Inter,Helvetica,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
  transition:background .2s ease,color .2s ease;
}
.container{max-width:1100px;margin:0 auto;padding:12px 16px}

/* ===== HEADER & NAV ===== */
.header{position:sticky;top:0;z-index:20;background:var(--bg);
  border-bottom:2px solid var(--accent-2);}
.topbar{display:flex;align-items:center;gap:12px;min-height:var(--topbar-h)}
.brand{display:flex;align-items:center;gap:10px;font-weight:800;color:var(--text);
  text-decoration:none;letter-spacing:.2px}
.brand .name{display:inline-flex;align-items:center;gap:4px}
.brand .tm{font-size:.75em;opacity:.75}
.logo{width:28px;height:28px;border-radius:6px;box-shadow:0 0 0 2px var(--accent)}
.nav{display:flex;gap:12px;margin-left:8px}
.nav a{
  --ink:var(--muted);
  color:var(--ink); text-decoration:none;
  padding:8px 10px;border-radius:8px;border:1px solid transparent;
  transition:color .15s ease, background .15s ease, border-color .15s ease;
}
.nav a:hover{color:var(--text);background:var(--surface-2);border-color:var(--border)}
.nav a.active{
  color:var(--text);
  border-color:var(--accent);
  box-shadow:0 0 0 1px var(--accent) inset;
}

/* ===== HEADER CONTROLS ===== */
.symbol-form{
  margin-left:auto;
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
  min-height:40px;
}
.symbol-form input{
  background:var(--surface-2);
  border:1px solid var(--border);
  color:var(--text);
  padding:8px 10px;
  border-radius:8px;
  min-width:70px;   /* desktop shorter */
  width:70px;
  outline:none;
}
.symbol-form input:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}
.button{
  appearance:none;
  cursor:pointer;
  padding:8px 12px;
  border-radius:8px;
  border:1px solid transparent;
  font-weight:800;
  letter-spacing:.25px;
  background:var(--accent-2);
  color:#000;
}
.button:hover{filter:brightness(1.05)}
.button:active{transform:translateY(1px)}
.button.outline{background:transparent;color:var(--text);border-color:var(--border)}
.button.outline:hover{border-color:var(--accent);color:var(--accent)}
.button.danger{background:#ef4444;color:#fff}

/* ===== MOBILE NAV (drawer) ===== */
.hamburger{
  display:none;
  margin-left:auto;
  background:transparent;
  border:1px solid var(--border);
  color:var(--text);
  padding:6px 10px;
  border-radius:8px;
  font-size:18px;
  cursor:pointer;
}
@media (max-width:900px){
  .hamburger{display:block}
  .symbol-form{margin:0}
  .symbol-form input{
    min-width:50px;   /* mobile extra short */
    width:50px;
    flex:0 0 auto;
  }
  .symbol-form .button{flex:0 0 auto}
  .nav{
    position:fixed;inset:calc(var(--topbar-h) + 4px) 0 0 auto;width:260px;
    max-height:calc(100% - var(--topbar-h));background:var(--surface);
    border-left:2px solid var(--accent-2);padding:12px;flex-direction:column;gap:8px;
    transform:translateX(100%);transition:transform .2s ease;z-index:10000}
  .nav.open{transform:translateX(0)}
}

/* ===== SURFACES ===== */
.main{padding:24px 16px}
.section{margin:22px auto 28px;max-width:1100px}
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);padding:16px}
h1,h2,h3{margin:0 0 12px}
.note{color:var(--muted);margin-top:8px}

/* ===== TICKERS ===== */
.ticker{border-top:1px solid var(--border);border-bottom:1px solid var(--border);
  height:var(--ticker-h);display:flex;align-items:center;overflow:hidden;
  contain:layout paint style;backface-visibility:hidden;transform:translateZ(0)}
.ticker>div{width:100%;height:100%}
.ticker .tradingview-widget-container,
.ticker .tradingview-widget-container__widget{width:100%!important;height:100%!important}

/* ===== NEWS LIST (pixel look) ===== */
.card.news-card{
  background:var(--surface);
  border:4px solid var(--accent-2);
  border-radius:var(--radius-pixel);
  box-shadow:var(--shadow);
}
.news-head{display:flex;align-items:center;gap:10px;margin-bottom:8px}
.card.news-card h3{
  color:var(--accent); text-transform:uppercase; letter-spacing:1px;
  margin:0; padding-bottom:6px; border-bottom:2px solid var(--accent-2); flex:0 0 auto;
}
.news-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}
.news-list li{
  display:flex;justify-content:space-between;gap:10px;align-items:center;
  padding:8px 0;border-bottom:1px solid var(--border)
}
.news-list li a{
  color:var(--text); text-decoration:none; flex:1;
  transition:color .15s ease, text-shadow .15s ease;
}
.news-list li a:hover{color:var(--accent);text-shadow:0 0 6px color-mix(in srgb, var(--accent) 55%, transparent)}
.news-list li time{color:var(--muted);font-size:.85em;white-space:nowrap}
.updated{color:var(--accent-2);font-size:.85em}

/* ===== FOOTER & misc ===== */
.footer{border-top:1px solid var(--border);padding:16px;text-align:center;color:var(--muted)}
.x-link{font-weight:bold;color:var(--accent-2);text-decoration:none}
.x-link:hover{background:var(--accent-2);color:#000;padding:2px 6px;border-radius:4px}

/* ===== MOBILE TWEAKS ===== */
@media(max-width:640px){
  .ticker{height:44px}
  .header .ticker:nth-of-type(2){display:none}
  .news-list li time{display:none}
}

/* SPA fade (future-proof) */
#pageMain{transition:opacity .12s ease}
#pageMain.fading{opacity:0}

/* Prevent ticker flicker and layout thrash (dup safe) */
.ticker{
  border-top:1px solid var(--border);
  border-bottom:1px solid var(--border);
  height: var(--ticker-h, 52px);
  display:flex; align-items:center;
  overflow:hidden;
  contain: layout paint style;
  backface-visibility:hidden;
  transform: translateZ(0);
}
.ticker > div{ width:100%; height:100%; padding:0; margin:0; }
.ticker .tradingview-widget-container,
.ticker .tradingview-widget-container__widget{
  width:100%!important;
  height:100%!important;
}

/* Keep TV iframes from collapsing before load */
#adv-chart-wrap .tradingview-widget-container__widget{ min-height:560px; }
[data-tv="screener"] .tradingview-widget-container__widget{ min-height:520px; }
[data-tv="crypto-heatmap"] .tradingview-widget-container__widget{ min-height:460px; }

/* ===== NEWS TABS (Crypto / Markets) ===== */
#newsTabs{
  display:flex;
  gap:8px;
  margin:6px 0 10px;
  flex-wrap:wrap;
}
#newsTabs .tab{
  appearance:none;
  cursor:pointer;
  padding:6px 10px;
  border-radius:8px;
  border:1px solid var(--border);
  background:var(--surface-2);
  color:var(--text);
  font-weight:700;
  letter-spacing:.25px;
  transition:background .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
#newsTabs .tab:hover{
  border-color:var(--accent);
  color:var(--accent);
}
#newsTabs .tab.active{
  background:var(--accent-2);
  color:#000;
  border-color:var(--accent-2);
  box-shadow:0 0 0 1px var(--accent-2) inset;
}

/* Small helper to hide inactive lists */
.hidden{ display:none !important; }

/* === ChillZone video frames & grid === */
.video-frame {
  position: relative;
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 0 0 rgba(0, 207, 255, 0);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), var(--surface-2));
}
.video-frame:hover {
  box-shadow: 0 0 16px rgba(0, 207, 255, 0.15);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}
.video-frame.playing {
  border-color: var(--accent);
  box-shadow:
    0 0 10px rgba(0, 207, 255, 0.35),
    0 0 32px rgba(255, 215, 0, 0.18);
  animation: livePulse 1.8s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { box-shadow:
    0 0 10px rgba(0, 207, 255, 0.28),
    0 0 28px rgba(255, 215, 0, 0.10);
  }
  50% { box-shadow:
    0 0 16px rgba(0, 207, 255, 0.45),
    0 0 40px rgba(255, 215, 0, 0.24);
  }
}
.video-frame .live-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  color: #000;
  background: var(--accent-2);
  border-radius: 999px;
  letter-spacing: .3px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  opacity: .9;
  user-select: none;
  pointer-events: none;
}
.video-frame .live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ff2d55;
  box-shadow: 0 0 10px #ff2d55;
  animation: dotBlink 1s ease-in-out infinite;
}
@keyframes dotBlink {
  0%,100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.75); opacity: .75; }
}

/* Chill grid */
.chill-grid{
  display:grid;
  gap:16px;
  grid-template-columns: 1fr;
}
@media (min-width: 900px){
  .chill-grid{ grid-template-columns: 1fr 1fr; }
}
.video-card{ padding:12px; }
.video-card-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
}
.video-card h2{ font-size:1rem; margin:0; }
.live-badge{
  display:inline-flex; align-items:center; gap:6px;
  font-size:.75rem; font-weight:800; letter-spacing:.25px;
  color:#000; background:var(--accent-2);
  border:1px solid var(--accent-2); padding:4px 8px; border-radius:999px;
  box-shadow:0 0 0 1px var(--accent-2) inset;
}
.live-badge .dot{
  width:8px; height:8px; border-radius:50%;
  background:#f43f5e; animation: dotBlink 1.25s infinite;
}

/* Brand micro-interactions */
.brand .logo { transition: transform .4s ease; }
.brand .logo:hover { transform: rotate(12deg) scale(1.04); }
.brand.woof .logo { animation: logoShake .5s ease; }
@keyframes logoShake {
  0% { transform: translateX(0) rotate(0); }
  20% { transform: translateX(-2px) rotate(-3deg); }
  40% { transform: translateX(2px) rotate(3deg); }
  60% { transform: translateX(-1px) rotate(-2deg); }
  80% { transform: translateX(1px) rotate(2deg); }
  100% { transform: translateX(0) rotate(0); }
}
.brand .woof-bubble {
  position: absolute; top: -8px; left: 44px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 8px; font-size: 12px; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-6px);
  transition: opacity .2s ease, transform .2s ease; pointer-events: none;
}
.brand.woof .woof-bubble { opacity: 1; transform: translateY(0); }

/* Tip jar minor styles */
.tip-grid{display:flex;gap:16px;flex-wrap:wrap;align-items:center}
.tip-grid img{width:160px;height:160px;border-radius:12px;border:1px solid var(--border)}
.mono{font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;}
/* ---- Support link behaves like text on desktop, icon-only on mobile ---- */
.nav .support-link {
  display:inline-flex; align-items:center; gap:8px;
}
.nav .support-icon { font-size:16px; line-height:1 }
@media (max-width:900px){
  .nav .support-text{ display:none }   /* keep only the heart on small screens */
}

/* Footer pill CTA */
.footer .support-cta{
  display:inline-flex; align-items:center; gap:8px;
  margin-left:10px; padding:6px 10px; border-radius:999px;
  border:1px solid var(--border); background:var(--surface-2); color:var(--text);
  text-decoration:none; font-weight:700;
  animation:supportWiggle 4.5s ease-in-out infinite;
}
@keyframes supportWiggle{
  0%,92%,100%{ transform:rotate(0) }
  94%{ transform:rotate(-6deg) }
  96%{ transform:rotate(6deg) }
  98%{ transform:rotate(-3deg) }
}

/* Simple QR card layout */
.qr-grid{ display:grid; gap:16px; grid-template-columns: 1fr; }
@media(min-width:720px){ .qr-grid{ grid-template-columns: repeat(2,1fr); } }
.qr{ text-align:center; }
.qr img{ max-width:220px; width:100%; height:auto; border-radius:12px; border:1px solid var(--border); box-shadow:var(--shadow); background:var(--surface); }
.addr{ display:flex; gap:8px; margin-top:10px; }
.addr code{ flex:1; padding:8px 10px; border:1px solid var(--border); border-radius:8px; overflow:auto; background:var(--surface-2); }
.copy-btn{ white-space:nowrap }
