:root {
  --bg-0: #070809;
  --bg-1: #0d0f13;
  --card: rgba(20, 22, 27, .72);
  --card-solid: #14161b;
  --elev: rgba(30, 33, 40, .6);
  --line: rgba(230, 199, 138, .14);
  --line-strong: rgba(230, 199, 138, .34);
  --fg: #f4f1ea;
  --muted: #9c968a;
  --muted-2: #6f6a61;
  --gold-1: #f0d59b;
  --gold-2: #d8b063;
  --gold-3: #c1934a;
  --gold-grad: linear-gradient(135deg, #f4dca6 0%, #d8b063 52%, #c1934a 100%);
  --ok: #6dd7a6;
  --err: #ef6a6a;
  --radius: 20px;
  --radius-sm: 12px;
  --wrap: 1040px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--fg);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(216, 176, 99, .10), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, rgba(120, 90, 200, .08), transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  background-attachment: fixed;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* gold edge helper (mask trick) */
.edge { position: relative; }
.edge::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(150deg, rgba(240, 213, 155, .38), transparent 42%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}

/* ---------- Header ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(9, 10, 13, .68);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding-top: 13px; padding-bottom: 13px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--gold-grad); color: #241a0a;
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
  box-shadow: 0 6px 20px -6px rgba(216, 176, 99, .6);
}
.brand-txt .bhead { font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.brand-txt .sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.views { display: flex; gap: 6px; }
.view-btn {
  appearance: none; cursor: pointer;
  border: 1px solid var(--line);
  background: var(--elev); color: var(--fg);
  font-size: 13px; font-weight: 500;
  padding: 7px 16px; border-radius: 999px;
  transition: border-color .18s, background .18s, color .18s;
}
.view-btn:hover { border-color: var(--line-strong); }
.view-btn.is-active {
  background: rgba(216, 176, 99, .14); color: var(--gold-1);
  border-color: var(--line-strong); font-weight: 700;
}

.top-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Subscribe CTA — the single most prominent element */
.cta {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; cursor: pointer;
  padding: 9px 20px; border-radius: 999px;
  background: var(--gold-grad); color: #211705;
  font-size: 13.5px; font-weight: 800; letter-spacing: .3px; white-space: nowrap;
  box-shadow: 0 10px 26px -8px rgba(216, 176, 99, .75), 0 0 0 1px rgba(240, 213, 155, .3) inset;
  overflow: hidden;
  transition: transform .1s ease, box-shadow .25s ease;
  animation: ctaGlow 2.6s ease-in-out infinite;
}
.cta:hover { transform: translateY(-1px); box-shadow: 0 16px 40px -8px rgba(216, 176, 99, .95); }
.cta:active { transform: translateY(0) scale(.98); }
/* moving shine sweep */
.cta::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: skewX(-18deg); animation: ctaShine 3.4s ease-in-out infinite;
}
.cta-text { position: relative; z-index: 1; }
.cta-arrow { position: relative; z-index: 1; font-weight: 700; transition: transform .2s; }
.cta:hover .cta-arrow { transform: translateX(3px); }
.cta-ping {
  position: relative; z-index: 1; width: 7px; height: 7px; border-radius: 50%;
  background: #2a1d06; box-shadow: 0 0 0 0 rgba(42, 29, 6, .5);
  animation: ctaPing 1.8s ease-out infinite;
}
@keyframes ctaGlow {
  0%, 100% { box-shadow: 0 10px 26px -8px rgba(216, 176, 99, .7), 0 0 0 1px rgba(240, 213, 155, .3) inset; }
  50% { box-shadow: 0 12px 34px -6px rgba(216, 176, 99, 1), 0 0 0 1px rgba(240, 213, 155, .45) inset; }
}
@keyframes ctaShine { 0%, 62% { left: -60%; } 78%, 100% { left: 130%; } }
@keyframes ctaPing {
  0% { box-shadow: 0 0 0 0 rgba(42, 29, 6, .45); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(42, 29, 6, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .cta, .cta::after, .cta-ping { animation: none; }
}

/* ---------- Views ---------- */
main.wrap { padding-top: 22px; padding-bottom: 30px; }
.view { animation: rise .45s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Date tabs */
.datebar {
  display: flex; gap: 8px; overflow-x: auto;
  padding-bottom: 14px; scrollbar-width: thin;
  max-width: 780px; margin: 0 auto;
}
.datebar::-webkit-scrollbar { height: 5px; }
.datebar::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.date-tab {
  flex: 0 0 auto; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line); background: var(--elev); color: var(--fg);
  border-radius: 999px; padding: 8px 16px; font-size: 13px;
  transition: border-color .18s, color .18s, background .18s;
}
.date-tab small { color: var(--muted); margin-left: 5px; font-size: 11px; }
.date-tab:hover { border-color: var(--line-strong); }
.date-tab.is-active {
  border-color: transparent; color: #221808; font-weight: 700;
  background: var(--gold-grad);
}
.date-tab.is-active small { color: rgba(34, 24, 8, .7); }

/* Report card (frames the light email as a document) */
.report-card {
  position: relative; max-width: 760px; margin: 0 auto;
  background: var(--card);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8);
}
#report {
  width: 100%; border: 0; display: block;
  border-radius: 14px; background: #f4f6f8; min-height: 60vh;
}
.empty { text-align: center; color: var(--muted); padding: 54px 0; }

/* ---------- Analysis ---------- */
.view.is-wide { }
.analysis-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; margin-bottom: 20px; flex-wrap: wrap;
}
.ah-title {
  font-size: 22px; font-weight: 750; letter-spacing: -.3px; margin: 0;
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Segmented window control */
.seg {
  display: inline-flex; padding: 4px; gap: 3px;
  background: var(--elev); border: 1px solid var(--line); border-radius: 999px;
}
.seg button {
  appearance: none; cursor: pointer; border: none; background: transparent;
  color: var(--muted); font-size: 12.5px; font-weight: 600;
  padding: 7px 15px; border-radius: 999px; transition: color .18s, background .18s;
  white-space: nowrap;
}
.seg button:hover { color: var(--fg); }
.seg button.is-active {
  background: var(--gold-grad); color: #221808;
  box-shadow: 0 6px 16px -8px rgba(216, 176, 99, .7);
}

/* 5-market row */
.market-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
.market-card {
  position: relative;
  background: var(--card);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 16px 15px;
  display: flex; flex-direction: column; gap: 13px;
  box-shadow: 0 24px 60px -32px rgba(0, 0, 0, .75);
  animation: rise .5s cubic-bezier(.22, 1, .36, 1) both;
}
.mc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.mc-name { font-size: 15px; font-weight: 700; color: var(--fg); }

.stat { }
.stat .cap {
  font-size: 10.5px; font-weight: 600; letter-spacing: .5px;
  color: var(--muted); text-transform: uppercase; margin-bottom: 4px;
}
.stat.primary .val {
  font-size: 30px; font-weight: 800; letter-spacing: -.5px; line-height: 1;
  font-variant-numeric: tabular-nums;
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat.secondary .val {
  font-size: 20px; font-weight: 750; color: var(--fg);
  font-variant-numeric: tabular-nums; line-height: 1;
}
.stat .val.dim { color: var(--muted-2); -webkit-text-fill-color: var(--muted-2); }

/* thin progress bar */
.bar { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .06); margin-top: 8px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; }
.stat.primary .bar > i { background: var(--gold-grad); }
.stat.secondary .bar > i { background: linear-gradient(90deg, #b8a173, #8f7a4e); }

/* ---------- Footer ---------- */
.foot { text-align: center; padding: 24px 20px 40px; }
.foot-line {
  font-size: 11.5px; color: var(--muted-2); letter-spacing: .5px;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 16px;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .market-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 620px) {
  :root { --wrap: 640px; }
  .market-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .ah-title { font-size: 19px; }
  .brand-txt .bhead { font-size: 14px; }
  .stat.primary .val { font-size: 26px; }
}
@media (max-width: 380px) {
  .market-row { grid-template-columns: 1fr 1fr; }
}
