@font-face {
  font-family: "ReejiFlash";
  src: url("./fonts/reeji-flash.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

/* ── Light theme (default) ──────────────────────────── */
:root {
  --bg: #FCFCF7;
  --head: #FCFCF7;
  --neutral: #FCFCF7;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #000000;
  --btn-bg: #FCFCF7;
  --btn-text: #000000;
  --btn-hover-bg: #000000;
  --btn-hover-text: #FCFCF7;
  --cycle-correction: #f06a77;
  --cycle-bigbull: #59c86c;
  --cycle-halving: #ffff00;
  --cycle-smallbull: #8fd3a1;
  --tooltip-bg: #1f2937;
  --tooltip-text: #f3f4f6;
  --stat-bg: rgba(0,0,0,0.04);
  --future-bg: #FCFCF7;
  --bottom-label-bg: #FCFCF7;
  --title-red: #d90000;
  --muted-title: #111827;
}

/* ── Dark theme ─────────────────────────────────────── */
[data-theme="dark"] {
  --bg: #0f0f23;
  --head: #1a1a3e;
  --neutral: #1a1a3e;
  --text: #e0e0f0;
  --muted: #8888aa;
  --border: #333355;
  --btn-bg: #1a1a3e;
  --btn-text: #e0e0f0;
  --btn-hover-bg: #e0e0f0;
  --btn-hover-text: #0f0f23;
  --tooltip-bg: #2a2a4e;
  --tooltip-text: #e0e0f0;
  --stat-bg: rgba(255,255,255,0.06);
  --future-bg: #0f0f23;
  --bottom-label-bg: #1a1a3e;
  --title-red: #ff4444;
  --muted-title: #c0c0d8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "ReejiFlash", Inter, Arial, sans-serif;
  overflow: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ── Page layout ────────────────────────────────────── */

.page {
  width: fit-content;
  margin: 36px auto 18px;
  padding: 0 16px 20px;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.page.loaded {
  opacity: 1;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 16px;
}

h1 {
  margin: 0;
  font-size: 41px;
  line-height: 1;
  color: var(--title-red);
  white-space: nowrap;
}

.muted {
  color: var(--muted-title);
  font-weight: 700;
}

/* ── Legend bar ──────────────────────────────────────── */

.legend-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 16px;
  flex-wrap: wrap;
}

.legend-cycles {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.legend-gradient {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-grad-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.legend-grad-bar {
  width: 120px;
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(to right, #f5616f, #f78e98, #f8bac1, #daefe3, #b8e1c5, #96d3a7, #63be7b);
  border: 1px solid var(--border);
}

/* ── Contact bar ────────────────────────────────────── */

.contact-bar {
  display: flex;
  justify-content: center;
  margin-top: 20px;
  padding: 12px 0;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  cursor: pointer;
}

.contact-link:hover {
  background: var(--btn-hover-bg);
  color: var(--btn-hover-text);
}

/* ── Stats bar ──────────────────────────────────────── */

.stats-bar {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.stat-card {
  flex: 1;
  min-width: 160px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--stat-bg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stat-up { color: #1a8a3f; }
.stat-down { color: #d6293e; }

[data-theme="dark"] .stat-up { color: #4ade80; }
[data-theme="dark"] .stat-down { color: #fb7185; }

/* ── Tooltip ────────────────────────────────────────── */

.cell-tooltip {
  position: fixed;
  z-index: 9999;
  width: 180px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.cell-tooltip.visible {
  opacity: 1;
}

.tip-header {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.tip-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}

.tip-row span:first-child {
  color: rgba(255,255,255,0.6);
}

.tip-up { color: #4ade80; font-weight: 700; }
.tip-down { color: #fb7185; font-weight: 700; }

/* ── Table layout ───────────────────────────────────── */

.lang-cell {
  border: 0 !important;
  outline: none !important;
  background: transparent !important;
  vertical-align: middle;
  text-align: center;
  pointer-events: none;
}

.lang-cell .btn-group {
  width: 100%;
  justify-content: center;
  padding-left: 20px;
}

.lang-cell .theme-btn,
.lang-cell .x-btn,
.lang-cell .gh-btn {
  pointer-events: auto;
}

.btn-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.panel {
  display: flex;
  justify-content: center;
}

.table-wrap {
  overflow: visible;
  position: relative;
}

.cycle-table {
  border-collapse: collapse;
  table-layout: fixed;
  margin: 0 auto;
}

.cycle-table col.col-year { width: 130px; }
.cycle-table col.col-month { width: 64px; }
.cycle-table col.col-gap { width: 20px; }
.cycle-table col.col-total { width: 90px; }
.cycle-table col.col-cycle { width: 130px; }

.cycle-table th,
.cycle-table td {
  border: 1px solid var(--border);
  text-align: center;
  padding: 12px 6px;
  font-size: 14px;
  white-space: nowrap;
  position: relative;
  z-index: 1;
  transition: transform 0.15s ease, box-shadow 0.15s ease, z-index 0s, background 0.3s ease;
  outline: 1px solid var(--border);
  outline-offset: -1px;
}

/* Load animation for data rows */
.data-row {
  animation: fadeSlideIn 0.4s ease both;
  animation-delay: var(--row-delay, 0ms);
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* After leaving hover/cross-highlight, animation holds z-index:50 for 0.15s */
.cycle-table td:not(:hover),
.cycle-table th:not(.cross-highlight) {
  animation: hold-z 0.15s;
}

.data-row td:not(:hover) {
  animation: fadeSlideIn 0.4s ease both, hold-z 0.15s;
  animation-delay: var(--row-delay, 0ms), 0ms;
}

@keyframes hold-z {
  0%, 100% { z-index: 50; }
}

.cycle-table td:hover:not(.gap-col) {
  transform: scale(1.35);
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.cross-highlight {
  transform: scale(1.35);
  z-index: 90 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  outline: 1px solid var(--border);
  outline-offset: -1px;
  animation: none !important;
}

.group-highlight {
  box-shadow: 0 0 0 3px var(--border);
  filter: brightness(1.15);
}

.cycle-gap-row td,
.cycle-gap-row td:hover,
.divider-row td:hover {
  transform: none !important;
  z-index: auto !important;
  box-shadow: none !important;
  border: 0 !important;
  outline: none !important;
  pointer-events: none;
}

.cycle-table thead th {
  background: var(--head);
  font-weight: 700;
  transition: background 0.3s ease;
}

.year-cell {
  font-weight: 700;
}

/* Dark mode: override year cell gradient with darker tones */
[data-theme="dark"] .year-cell {
  filter: brightness(0.45) saturate(1.4);
}

/* 9-level gradient for price changes */
.pct-up-4 { background: #63be7b; }
.pct-up-3 { background: #96d3a7; }
.pct-up-2 { background: #a6dab6; }
.pct-up-1 { background: #b8e1c5; }
.pct-up-0 { background: #daefe3; }
.pct-down-0 { background: #f8bac1; }
.pct-down-1 { background: #f78e98; }
.pct-down-2 { background: #f67883; }
.pct-down-3 { background: #f5616f; }

/* Dark mode: mute heatmap colors */
[data-theme="dark"] .pct-up-4 { background: #2d7a42; color: #e0e0f0; }
[data-theme="dark"] .pct-up-3 { background: #3d8a55; color: #e0e0f0; }
[data-theme="dark"] .pct-up-2 { background: #4a9462; color: #e0e0f0; }
[data-theme="dark"] .pct-up-1 { background: #3d6e4e; color: #e0e0f0; }
[data-theme="dark"] .pct-up-0 { background: #2a4a36; color: #e0e0f0; }
[data-theme="dark"] .pct-down-0 { background: #5a3040; color: #e0e0f0; }
[data-theme="dark"] .pct-down-1 { background: #7a2a3a; color: #e0e0f0; }
[data-theme="dark"] .pct-down-2 { background: #8a2535; color: #e0e0f0; }
[data-theme="dark"] .pct-down-3 { background: #9a2030; color: #e0e0f0; }

.month-neutral {
  background: var(--neutral);
}

.halving-month {
  background: #ffff00;
  font-weight: 700;
}

[data-theme="dark"] .halving-month {
  background: #8a8a00;
  color: #e0e0f0;
}

.future-cell {
  background: var(--future-bg);
  color: var(--muted);
}

.gap-col {
  width: 20px;
  min-width: 20px;
  max-width: 20px;
  padding: 0 !important;
  border: 0 !important;
  outline: none !important;
  background: transparent !important;
}

.cycle-gap-row td {
  border: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  height: 20px;
  line-height: 0;
}

.divider-row td {
  border: 0;
  padding: 0;
  background: transparent;
  height: 20px;
  line-height: 0;
  outline: none;
  pointer-events: none;
}

/* Total, Cycle, Spark columns and bottom-stat rows don't need floating magnification */
.total-cell,
.cycle-cell,
.spark-cell,
.bottom-stat td {
  animation: none !important;
}
.total-cell:hover,
.cycle-cell:hover,
.spark-cell:hover,
.bottom-stat td:hover {
  transform: none !important;
  box-shadow: none !important;
  z-index: 1 !important;
}

.bottom-stat {
  font-weight: 700;
}

.bottom-stat td:first-child {
  background: var(--bottom-label-bg);
  transition: background 0.3s ease;
}

/* ── Price display ──────────────────────────────────── */

.price-box {
  padding: 0;
  display: flex;
  align-items: flex-end;
  gap: 20px;
}

.price-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.group-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1;
  white-space: nowrap;
}

.price-value {
  font-size: 46px;
  font-weight: 800;
  display: flex;
  align-items: flex-start;
  line-height: 1;
}

.month-change {
  font-size: 46px;
  font-weight: 800;
  line-height: 1;
  display: flex;
  align-items: center;
}

.month-change.up { color: #1a8a3f; }
.month-change.down { color: #d6293e; }

[data-theme="dark"] .month-change.up { color: #4ade80; }
[data-theme="dark"] .month-change.down { color: #fb7185; }

/* ── Rolling numbers ────────────────────────────────── */

.roll-col {
  display: inline-block;
  height: 1em;
  overflow: hidden;
  position: relative;
}

.roll-strip {
  display: flex;
  flex-direction: column;
  transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.roll-digit {
  display: block;
  height: 1em;
  line-height: 1;
  text-align: center;
}

.roll-static {
  display: inline-block;
  height: 1em;
  line-height: 1;
}

/* ── Cycle phase colors ─────────────────────────────── */

.cycle-correction { background: var(--cycle-correction); }
.cycle-big-bull { background: var(--cycle-bigbull); }
.cycle-halving { background: var(--cycle-halving); }
.cycle-small-bull { background: var(--cycle-smallbull); }

[data-theme="dark"] .cycle-correction { background: #993040; color: #e0e0f0; }
[data-theme="dark"] .cycle-big-bull { background: #2d6e3a; color: #e0e0f0; }
[data-theme="dark"] .cycle-halving { background: #8a8a00; color: #e0e0f0; }
[data-theme="dark"] .cycle-small-bull { background: #3d7a4e; color: #e0e0f0; }

/* ── Buttons ────────────────────────────────────────── */

.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--btn-bg);
  color: var(--btn-text);
  cursor: pointer;
  transition: background 0.25s, color 0.25s, box-shadow 0.25s, transform 0.15s;
  flex-shrink: 0;
  padding: 0;
}

.theme-btn:hover {
  background: var(--btn-hover-bg);
  color: var(--btn-hover-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

.theme-btn:active { transform: translateY(0); }

.theme-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.x-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--btn-bg);
  color: var(--btn-text);
  cursor: pointer;
  transition: background 0.25s, color 0.25s, box-shadow 0.25s, transform 0.15s;
  text-decoration: none;
  flex-shrink: 0;
}

.x-btn:hover {
  background: var(--btn-hover-bg);
  color: var(--btn-hover-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

.x-btn:active { transform: translateY(0); }

.x-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.gh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--btn-bg);
  color: var(--btn-text);
  cursor: pointer;
  transition: background 0.25s, color 0.25s, box-shadow 0.25s, transform 0.15s;
  text-decoration: none;
  flex-shrink: 0;
}

.gh-btn:hover {
  background: var(--btn-hover-bg);
  color: var(--btn-hover-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

.gh-btn:active { transform: translateY(0); }

.gh-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ── Sparkline column ──────────────────────────────── */

.cycle-table col.col-spark { width: 100px; }

.spark-cell {
  padding: 4px !important;
  background: transparent !important;
  border-color: transparent !important;
  outline: none !important;
}

.spark-cell:hover {
  transform: none !important;
  box-shadow: none !important;
  z-index: 1 !important;
}

.sparkline-svg {
  display: block;
  margin: 0 auto;
}

/* ── Toolbar ───────────────────────────────────────── */

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--btn-bg);
  color: var(--btn-text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.1s;
  white-space: nowrap;
}

.toolbar-btn:hover {
  background: var(--btn-hover-bg);
  color: var(--btn-hover-text);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.toolbar-btn:active { transform: scale(0.97); }

.toolbar-btn.active {
  background: var(--btn-hover-bg);
  color: var(--btn-hover-text);
  box-shadow: 0 0 0 2px var(--border);
}

.toolbar-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

.toolbar-btn svg { flex-shrink: 0; }

/* ── Filter slider ─────────────────────────────────── */

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.filter-val {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  min-width: 36px;
  text-align: center;
}

.filter-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}

.filter-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--btn-text);
  border: 2px solid var(--bg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  cursor: pointer;
}

.filter-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--btn-text);
  border: 2px solid var(--bg);
  cursor: pointer;
}

.filtered-out {
  opacity: 0.12 !important;
  filter: grayscale(1) !important;
}

/* ── Halving countdown ─────────────────────────────── */

.halving-countdown {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.countdown-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.countdown-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.countdown-digits {
  display: flex;
  align-items: center;
  gap: 2px;
}

.cd-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cd-num {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 24px;
  text-align: center;
}

.cd-lbl {
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}

.cd-sep {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  margin: 0 1px;
  align-self: flex-start;
  margin-top: 1px;
}

.countdown-blocks {
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
}

/* ── Detail modal ──────────────────────────────────── */

.detail-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.detail-modal.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  min-width: 320px;
  max-width: 400px;
  position: relative;
  box-shadow: 0 16px 48px rgba(0,0,0,0.3);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.modal-close:hover { color: var(--text); }

.modal-title {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modal-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.modal-stat-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.modal-up { color: #1a8a3f; }
.modal-down { color: #d6293e; }
[data-theme="dark"] .modal-up { color: #4ade80; }
[data-theme="dark"] .modal-down { color: #fb7185; }

.modal-sparkline-wrap {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Comparison panel ──────────────────────────────── */

.comparison-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100%;
  z-index: 10000;
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 20px rgba(0,0,0,0.2);
  transition: right 0.3s ease;
  overflow-y: auto;
}

.comparison-panel.visible {
  right: 0;
}

.cmp-content {
  padding: 24px;
}

.cmp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.cmp-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.cmp-sparklines {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.cmp-spark-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.cmp-year-label {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.cmp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.cmp-table th,
.cmp-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: center;
}

.cmp-table th {
  background: var(--head);
  font-weight: 700;
  font-size: 12px;
}

.cmp-table td:first-child {
  font-weight: 700;
  background: var(--stat-bg);
}

.cmp-up { color: #1a8a3f; font-weight: 700; }
.cmp-down { color: #d6293e; font-weight: 700; }
[data-theme="dark"] .cmp-up { color: #4ade80; }
[data-theme="dark"] .cmp-down { color: #fb7185; }

.cmp-total td {
  font-weight: 800 !important;
  border-top: 2px solid var(--border);
}

/* Comparison mode: year cells glow for selection */
.comparison-mode .year-cell {
  cursor: pointer;
  transition: box-shadow 0.15s ease;
}

.comparison-mode .year-cell:hover {
  box-shadow: 0 0 0 3px #3b82f6 !important;
}

.year-selected {
  box-shadow: 0 0 0 3px #3b82f6 !important;
  outline: 2px solid #3b82f6 !important;
}

/* ── ATH flash ─────────────────────────────────────── */

.ath-flash {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  z-index: 20000;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  padding: 12px 28px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(245, 158, 11, 0.4);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ath-flash.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ath-icon {
  font-size: 24px;
}

.ath-price {
  font-size: 18px;
}

/* ── Topbar layout update ──────────────────────────── */

.topbar-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ── Mobile adjustments ─────────────────────────────── */

@media (max-width: 768px) {
  h1 {
    font-size: 34px;
  }

  .price-value,
  .month-change {
    font-size: 38px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .legend-bar {
    flex-direction: column;
    gap: 8px;
  }

  .stats-bar {
    flex-direction: column;
  }

  .stat-card {
    min-width: auto;
  }

  .toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-group {
    margin-left: 0;
    flex-wrap: wrap;
  }

  .comparison-panel {
    width: 100%;
    right: -100%;
  }

  .modal-content {
    min-width: auto;
    margin: 16px;
  }

  .cycle-table col.col-spark { width: 70px; }
}
