/* ============================================================
   analysis.css — "Token Analysis" panel (index.html)
   Loaded after shared.css and momentum.css. The panel container reuses the
   .top100-container / .top100-* classes defined in index.html. Light-theme
   rules are at the end of this file. CSP: style-src 'self' allows this file.
   ============================================================ */

.an-head-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.an-token {
  font-size: 13.5px;
  font-weight: 700;
  color: rgba(232, 249, 255, 0.7);
  font-variant-numeric: tabular-nums;
}
.an-btn {
  appearance: none;
  height: 40px;
  padding: 0 22px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #c7f284, #9b8cff);
  color: #0d0b1e;
  font-family: inherit;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s ease;
}
.an-btn:hover { opacity: 0.9; }
.an-btn:disabled { opacity: 0.55; cursor: progress; }
.an-btn:focus-visible { outline: 2px solid rgba(199, 242, 132, 0.7); outline-offset: 2px; }

.an-input {
  width: 300px;
  max-width: 100%;
  height: 40px;
  padding: 0 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(199, 242, 132, 0.35);
  border-radius: 999px;
  color: #ffffff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  outline: none;
  box-shadow: 0 0 14px rgba(199, 242, 132, 0.06);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.an-input::placeholder { color: rgba(232, 249, 255, 0.7); font-weight: 500; }
.an-input:focus { border-color: rgba(199, 242, 132, 0.85); box-shadow: 0 0 20px rgba(199, 242, 132, 0.25); }
@media (max-width: 560px) {
  .an-head-right { width: 100%; }
  .an-input { flex: 1 1 100%; width: 100%; }
}

/* Choices when several tokens share a ticker */
.an-picks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}
.an-picks[hidden] { display: none; }
.an-pick {
  appearance: none;
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.an-pick:hover, .an-pick:focus-visible {
  background: rgba(199, 242, 132, 0.08);
  border-color: rgba(199, 242, 132, 0.4);
  outline: none;
}
.an-pick-icon { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; display: block; background: rgba(255, 255, 255, 0.06); }
.an-pick-main { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.an-pick-sym { font-weight: 700; font-size: 14px; }
.an-pick-name { font-size: 12px; color: rgba(232, 249, 255, 0.5); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-pick-meta { font-size: 11.5px; color: rgba(232, 249, 255, 0.5); white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .an-pick { grid-template-columns: auto minmax(0, 1fr); }
  .an-pick-meta { grid-column: 2; }
}

.an-hint,
.an-status {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: rgba(232, 249, 255, 0.5);
}
.an-hint:empty { display: none; }

/* ---- Grid of cards ---- */
.an-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 700px) {
  .an-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .an-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .an-card-wide { grid-column: span 2; }
  /* Token profile: third column, next to Key numbers and Security checks */
  .an-card-tall { grid-column: 3; grid-row: 3 / span 3; }
}
@media (max-width: 1099px) {
  .an-card-wide, .an-card-tall { grid-column: 1 / -1; }
}
.an-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
}
.an-card-title {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9b8cff;
}
.an-sub {
  margin: 14px 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(232, 249, 255, 0.5);
}
.an-block { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.an-na, .an-row-na {
  margin: 0;
  font-size: 13.5px;
  color: rgba(232, 249, 255, 0.4);
}
.an-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: rgba(232, 249, 255, 0.45);
}
.an-note.up { color: #7ee787; font-weight: 700; }
.an-note.down { color: #ff7b72; font-weight: 700; }
.an-disclaimer {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(232, 249, 255, 0.4);
}

/* ---- Risk gauge ---- */
.an-gauge { position: relative; max-width: 260px; width: 100%; margin: 0 auto; }
.an-gauge svg { width: 100%; display: block; }
.an-gauge-track,
.an-gauge-fill {
  fill: none;
  stroke-width: 16;
  stroke-linecap: round;
}
.an-gauge-track { stroke: rgba(255, 255, 255, 0.09); }
.an-gauge-fill.low { stroke: #7ee787; }
.an-gauge-fill.medium { stroke: #fbbf24; }
.an-gauge-fill.high { stroke: #ff7b72; }
.an-gauge-center {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}
.an-gauge-level { font-size: 20px; font-weight: 800; }
.an-gauge-level.low { color: #7ee787; }
.an-gauge-level.medium { color: #fbbf24; }
.an-gauge-level.high { color: #ff7b72; }
.an-gauge-pts { font-size: 12px; color: rgba(232, 249, 255, 0.5); }

/* ---- Holders donut ---- */
.an-donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.an-donut-box { position: relative; width: 150px; height: 150px; }
.an-donut { width: 100%; height: 100%; display: block; }
.an-donut-track,
.an-donut-fill {
  fill: none;
  stroke-width: 14;
}
.an-donut-fill { stroke-linecap: butt; }
.an-donut-track { stroke: rgba(255, 255, 255, 0.09); }
.an-donut-fill.ok { stroke: #7ee787; }
.an-donut-fill.warn { stroke: #fbbf24; }
.an-donut-fill.bad { stroke: #ff7b72; }
.an-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
}
.an-donut-value { font-size: 26px; font-weight: 800; color: #e8f9ff; }
.an-donut-label { font-size: 11.5px; color: rgba(232, 249, 255, 0.5); }

/* ---- Rows with bars ---- */
.an-rows { display: flex; flex-direction: column; gap: 9px; }
.an-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}
.an-row-label {
  font-size: 12.5px;
  font-weight: 700;
  color: rgba(232, 249, 255, 0.55);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.an-row-value {
  font-size: 12.5px;
  font-weight: 700;
  color: #e8f9ff;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.an-row-value.up { color: #7ee787; }
.an-row-value.down { color: #ff7b72; }
.an-row-na { grid-column: 2 / -1; }
#analysis-section .an-card:nth-child(5) .an-row { grid-template-columns: 84px minmax(0, 1fr) auto; }

.an-stack, .an-hbar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}
.an-stack-buy { background: #7ee787; }
.an-stack-sell { background: #ff7b72; }
.an-hbar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #c7f284, #9b8cff);
}
.an-diverge {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}
.an-diverge::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -2px;
  bottom: -2px;
  width: 1px;
  background: rgba(232, 249, 255, 0.3);
}
.an-diverge-fill {
  position: absolute;
  top: 0;
  bottom: 0;
}
.an-diverge-fill.up { left: 50%; background: #7ee787; border-radius: 0 999px 999px 0; }
.an-diverge-fill.down { right: 50%; background: #ff7b72; border-radius: 999px 0 0 999px; }

.an-legend { display: flex; gap: 14px; font-size: 12px; color: rgba(232, 249, 255, 0.55); }
.an-dot::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
}
.an-dot.buy::before { background: #7ee787; }
.an-dot.sell::before { background: #ff7b72; }

/* ---- Sparkline ---- */
.an-spark { width: 100%; height: 90px; display: block; }
.an-spark-line { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.an-spark-line.up { stroke: #7ee787; }
.an-spark-line.down { stroke: #ff7b72; }
.an-spark-area.up { fill: rgba(126, 231, 135, 0.12); }
.an-spark-area.down { fill: rgba(255, 123, 114, 0.12); }

/* ---- Key numbers ---- */
.an-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}
@media (min-width: 700px) {
  .an-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.an-stat { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.an-stat-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(232, 249, 255, 0.4);
}
.an-stat-value {
  font-size: 17px;
  font-weight: 700;
  color: #e8f9ff;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Chips and links ---- */
.an-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.an-chip {
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 9px;
  border: 1px solid;
}
.an-chip.ok { color: #7ee787; background: rgba(126, 231, 135, 0.08); border-color: rgba(126, 231, 135, 0.3); }
.an-chip.warn { color: #fbbf24; background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.3); }
.an-chip.bad { color: #ff7b72; background: rgba(255, 123, 114, 0.1); border-color: rgba(255, 123, 114, 0.35); }
.an-chip.na { color: rgba(232, 249, 255, 0.55); background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.12); }
.an-links { display: flex; flex-wrap: wrap; gap: 8px; }
.an-link {
  font-size: 13px;
  font-weight: 600;
  color: #9b8cff;
  text-decoration: none;
}
.an-link:hover, .an-link:focus-visible { color: #c7f284; text-decoration: underline; outline: none; }
.an-link-main { margin-top: 4px; }

/* ---- Token profile ---- */
.an-profile { gap: 12px; }
.an-prof-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.an-prof-icon { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex-shrink: 0; display: block; background: rgba(255, 255, 255, 0.06); }
.an-prof-fb {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #c7f284;
  background: linear-gradient(135deg, rgba(199, 242, 132, 0.18), rgba(155, 140, 255, 0.18));
  border: 1px solid rgba(199, 242, 132, 0.3);
}
.an-prof-names { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.an-prof-name { font-size: 18px; font-weight: 800; color: #e8f9ff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-prof-sym { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: rgba(232, 249, 255, 0.6); }
.an-prof-mint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}
.an-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; color: rgba(232, 249, 255, 0.7); }
.an-copy {
  appearance: none;
  padding: 3px 11px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  color: #c7f284;
  background: rgba(199, 242, 132, 0.08);
  border: 1px solid rgba(199, 242, 132, 0.35);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.an-copy:hover, .an-copy:focus-visible { background: #c7f284; color: #0d0b1e; outline: none; }
.an-prows { display: flex; flex-direction: column; gap: 8px; }
.an-prow { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: start; gap: 10px; }
.an-prow-label { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: rgba(232, 249, 255, 0.4); padding-top: 2px; }
.an-prow-value { font-size: 13.5px; font-weight: 700; color: #e8f9ff; text-transform: capitalize; overflow-wrap: anywhere; }

/* All-time range bar */
.an-range-track {
  position: relative;
  height: 8px;
  margin: 8px 6px 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 123, 114, 0.55), rgba(251, 191, 36, 0.55), rgba(126, 231, 135, 0.55));
}
.an-range-dot {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #e8f9ff;
  border: 3px solid #14102a;
  box-shadow: 0 0 0 2px rgba(155, 140, 255, 0.7);
}
.an-range-ends { display: flex; justify-content: space-between; gap: 10px; }
.an-range-end { display: flex; flex-direction: column; line-height: 1.3; }
.an-range-end.right { align-items: flex-end; text-align: right; }
.an-range-tag { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: rgba(232, 249, 255, 0.4); }
.an-range-num { font-size: 14px; font-weight: 700; color: #e8f9ff; font-variant-numeric: tabular-nums; }

/* ---- Light theme ---- */
html[data-theme="light"] .an-card { background: var(--t-card); border-color: var(--t-line); box-shadow: 0 2px 14px rgba(21, 18, 46, 0.06); }
html[data-theme="light"] .an-card-title { color: var(--t-violet); }
html[data-theme="light"] .an-token,
html[data-theme="light"] .an-row-value,
html[data-theme="light"] .an-stat-value,
html[data-theme="light"] .an-donut-value { color: var(--t-text); }
html[data-theme="light"] .an-hint,
html[data-theme="light"] .an-status,
html[data-theme="light"] .an-gauge-pts,
html[data-theme="light"] .an-donut-label,
html[data-theme="light"] .an-row-label,
html[data-theme="light"] .an-legend,
html[data-theme="light"] .an-sub { color: var(--t-muted); }
html[data-theme="light"] .an-na,
html[data-theme="light"] .an-row-na,
html[data-theme="light"] .an-note,
html[data-theme="light"] .an-disclaimer,
html[data-theme="light"] .an-stat-label { color: var(--t-faint); }
html[data-theme="light"] .an-note.up,
html[data-theme="light"] .an-row-value.up { color: var(--t-good); }
html[data-theme="light"] .an-note.down,
html[data-theme="light"] .an-row-value.down { color: var(--t-bad); }
html[data-theme="light"] .an-gauge-track,
html[data-theme="light"] .an-donut-track { stroke: rgba(21, 18, 46, 0.1); }
html[data-theme="light"] .an-stack,
html[data-theme="light"] .an-hbar,
html[data-theme="light"] .an-diverge { background: rgba(21, 18, 46, 0.08); }
html[data-theme="light"] .an-diverge::before { background: rgba(21, 18, 46, 0.35); }
html[data-theme="light"] .an-gauge-level.low { color: var(--t-good); }
html[data-theme="light"] .an-gauge-level.medium { color: var(--t-warn); }
html[data-theme="light"] .an-gauge-level.high { color: var(--t-bad); }
html[data-theme="light"] .an-chip.ok { color: var(--t-good); background: rgba(26, 127, 55, 0.08); border-color: rgba(26, 127, 55, 0.35); }
html[data-theme="light"] .an-chip.warn { color: var(--t-warn); background: rgba(154, 103, 0, 0.1); border-color: rgba(154, 103, 0, 0.35); }
html[data-theme="light"] .an-chip.bad { color: var(--t-bad); background: rgba(207, 34, 46, 0.08); border-color: rgba(207, 34, 46, 0.35); }
html[data-theme="light"] .an-chip.na { color: var(--t-muted); background: rgba(21, 18, 46, 0.05); border-color: var(--t-line); }
html[data-theme="light"] .an-link { color: var(--t-violet); }
html[data-theme="light"] .an-link:hover,
html[data-theme="light"] .an-link:focus-visible { color: var(--t-accent); }
html[data-theme="light"] .an-input { background: #ffffff; color: var(--t-text); border-color: var(--t-line); box-shadow: none; }
html[data-theme="light"] .an-input::placeholder { color: var(--t-muted); }
html[data-theme="light"] .an-input:focus { border-color: var(--t-accent); box-shadow: 0 0 0 3px rgba(91, 70, 214, 0.15); }
html[data-theme="light"] .an-pick { background: var(--t-card); border-color: var(--t-line); }
html[data-theme="light"] .an-pick:hover,
html[data-theme="light"] .an-pick:focus-visible { border-color: var(--t-accent); background: rgba(91, 70, 214, 0.06); }
html[data-theme="light"] .an-pick-name,
html[data-theme="light"] .an-pick-meta,
html[data-theme="light"] .an-prof-sym,
html[data-theme="light"] .an-mono { color: var(--t-muted); }
html[data-theme="light"] .an-prof-name,
html[data-theme="light"] .an-prow-value,
html[data-theme="light"] .an-range-num { color: var(--t-text); }
html[data-theme="light"] .an-prow-label,
html[data-theme="light"] .an-range-tag { color: var(--t-faint); }
html[data-theme="light"] .an-prof-mint { background: rgba(21, 18, 46, 0.04); border-color: var(--t-line); }
html[data-theme="light"] .an-prof-fb { color: var(--t-accent); }
html[data-theme="light"] .an-copy { color: var(--t-violet); background: rgba(91, 70, 214, 0.07); border-color: var(--t-line); }
html[data-theme="light"] .an-copy:hover,
html[data-theme="light"] .an-copy:focus-visible { background: var(--t-accent); color: #ffffff; }
html[data-theme="light"] .an-range-dot { background: var(--t-text); border-color: #ffffff; }
