:root {
  --bg: #07111f;
  --bg-accent: #12243b;
  --panel: rgba(8, 20, 36, 0.84);
  --panel-border: rgba(132, 176, 255, 0.18);
  --text: #ecf5ff;
  --muted: #95a8c6;
  --accent: #5eead4;
  --accent-strong: #22c55e;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.35);
  --card-bg: rgba(6, 16, 31, 0.96);
  --header-height: 72px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(circle at top left, rgba(34, 197, 94, 0.22), transparent 28%),
    radial-gradient(circle at right, rgba(94, 234, 212, 0.18), transparent 32%),
    linear-gradient(160deg, var(--bg) 0%, #030812 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 75%);
}

.app-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  backdrop-filter: blur(18px);
  background: rgba(5, 14, 28, 0.88);
  border-bottom: 1px solid rgba(132, 176, 255, 0.16);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}

.header-shell {
  width: calc(100% - 32px);
  margin: 0 auto;
  max-width: 1880px;
  min-height: var(--header-height);
  padding: 8px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-brand {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 220px;
}

.header-tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

.header-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.1;
  max-width: none;
  letter-spacing: -0.02em;
}

.info-tab,
.close-info-button {
  min-width: 88px;
}

.sheet-tab {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 0 10px 10px;
  padding: 4px 10px 6px;
  min-width: 54px;
  min-height: 24px;
  margin-top: -8px;
  font-size: 0.72rem;
  line-height: 1;
  box-shadow: 0 5px 12px rgba(34, 197, 94, 0.12);
}

.vix-tab {
  background: linear-gradient(180deg, rgba(165, 171, 181, 0.94) 0%, rgba(94, 101, 112, 0.94) 100%);
  color: #f2f6fb;
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.16);
}

.vix-tab:hover {
  background: linear-gradient(180deg, rgba(182, 188, 198, 0.96) 0%, rgba(108, 116, 128, 0.96) 100%);
}

.header-info-panel {
  border-top: 1px solid rgba(132, 176, 255, 0.12);
  background: rgba(6, 16, 31, 0.94);
}

.header-info-shell {
  width: calc(100% - 32px);
  margin: 0 auto;
  max-width: 1880px;
  padding: 16px 0 18px;
}

.header-info-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.hidden {
  display: none;
}

.header-controls {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  position: relative;
}

.header-controls > .header-control:first-of-type {
  margin-left: 18px;
}

.header-control {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

.chart-filter-control {
  min-width: 188px;
}

.chart-filter-toggle {
  min-width: 188px;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 400;
  justify-content: space-between;
  text-align: left;
  padding: 9px 14px;
  letter-spacing: 0;
  transform: none;
}

.chart-filter-toggle:hover {
  transform: none;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.06);
}

.chart-filter-toggle::after {
  content: "v";
  margin-left: 10px;
  font-size: 0.76rem;
  color: rgba(236, 245, 255, 0.78);
}

.chart-filter-toggle.is-open::after {
  content: "^";
}

.chart-filter-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 280px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(132, 176, 255, 0.18);
  background: rgba(6, 16, 31, 0.98);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.36);
  z-index: 1005;
}

.chart-filter-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.chart-filter-panel-head strong {
  margin: 0;
  font-size: 0.9rem;
}

.chart-filter-close {
  min-width: 64px;
  min-height: 32px;
  padding: 6px 10px;
  font-size: 0.8rem;
}

.chart-filter-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.chart-filter-action {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.8rem;
}

.chart-filter-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 2px;
}

.chart-filter-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.chart-filter-item input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #4ade80;
}

.chart-filter-item span {
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.2;
}

.shell {
  width: calc(100% - 32px);
  margin: 0 auto;
  max-width: 1880px;
  padding: 8px 0 20px;
}

.home-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 20px;
  padding: 20px 22px;
  margin-bottom: 10px;
}

.home-intro-copy h2,
.article-card h3,
.legal-page h2,
.legal-section h3 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.15;
}

.section-kicker {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.68rem;
}

.compact {
  max-width: none;
  margin-top: 14px;
}

.home-intro-links,
.content-grid {
  display: grid;
  gap: 12px;
}

.home-intro-links {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.info-link-card {
  display: block;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid rgba(132, 176, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.info-link-card:hover {
  transform: translateY(-1px);
  border-color: rgba(94, 234, 212, 0.3);
  background: rgba(255, 255, 255, 0.045);
}

.info-link-card strong {
  margin: 0 0 8px;
  font-size: 0.98rem;
}

.info-link-card span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.content-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
}

.article-card {
  padding: 18px 20px;
}

.article-card p,
.legal-section p,
.legal-section li,
.site-footer p,
.legal-page .lede {
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.95rem;
}

.site-footer {
  border-top: 1px solid rgba(132, 176, 255, 0.12);
  background: rgba(5, 14, 28, 0.92);
  margin-top: 18px;
}

.footer-shell {
  width: calc(100% - 32px);
  max-width: 1880px;
  margin: 0 auto;
  padding: 18px 0 22px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}

.footer-shell strong {
  margin: 0;
  font-size: 1rem;
}

.footer-shell p {
  margin: 8px 0 0;
  max-width: 520px;
}

.footer-copyright {
  margin-top: 10px;
  color: rgba(236, 245, 255, 0.62);
  font-size: 0.8rem;
  letter-spacing: 0.01em;
}

.footer-legal {
  max-width: 720px;
  color: rgba(154, 174, 204, 0.78);
  font-size: 0.78rem;
  line-height: 1.6;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  justify-content: flex-end;
}

.footer-nav a,
.top-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.footer-nav a:hover,
.top-nav a:hover {
  color: var(--text);
}

.page-main {
  width: calc(100% - 32px);
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 0 34px;
}

.page-header {
  width: calc(100% - 32px);
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  justify-content: flex-end;
}

.page-hero,
.legal-section {
  padding: 20px 22px;
  margin-bottom: 14px;
}

.legal-page {
  display: grid;
  gap: 14px;
}

.legal-list {
  margin: 12px 0 0;
  padding-left: 18px;
}

.legal-callout {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(132, 176, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
}

.market-link-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 24px;
  padding: 4px 12px 6px;
  border-radius: 0 0 10px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 0;
  background: linear-gradient(180deg, rgba(167, 176, 194, 0.95) 0%, rgba(90, 101, 121, 0.95) 100%);
  color: #f4f7fb;
  text-decoration: none;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.16);
}

.market-link-tab:hover {
  transform: translateY(1px);
  background: linear-gradient(180deg, rgba(182, 190, 206, 0.96) 0%, rgba(104, 115, 134, 0.96) 100%);
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.63rem;
  line-height: 1;
}

h1 {
  margin: 0;
  font-size: clamp(2.1rem, 5vw, 4.7rem);
  line-height: 0.94;
  max-width: 8ch;
}

h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.05;
}

.lede {
  max-width: 820px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.75;
  margin-top: 14px;
}

.panel {
  backdrop-filter: blur(14px);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  border-radius: 18px;
}

.topbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 18px 20px;
}

.topbar-inline {
  margin-bottom: 14px;
}

.info-hero {
  padding: 18px 20px;
  margin-bottom: 14px;
}

.notice {
  padding: 16px 20px;
}

.notice p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.toolbar-item,
.label {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1;
}

strong {
  display: block;
  margin-top: 8px;
  font-size: 1rem;
}

select,
button {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
}

select {
  color-scheme: dark;
  min-width: 84px;
}

select option {
  background: #0b1628;
  color: #ecf5ff;
}

select option:checked {
  background: #1f6ed4;
  color: #ffffff;
}

button {
  cursor: pointer;
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.92) 0%, rgba(34, 197, 94, 0.92) 100%);
  color: #041019;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(34, 197, 94, 0.18);
}

#language-select,
#global-interval {
  min-width: 78px;
}

#toggle-refresh,
#reset-layout,
#info-tab,
#chart-filter-toggle {
  min-height: 42px;
  padding-inline: 14px;
}

.header-action-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  min-width: 118px;
  align-self: end;
}

.header-action-stack #reset-layout,
.header-action-stack #toggle-refresh {
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 9px;
  font-size: 0.7rem;
  line-height: 1.1;
  white-space: nowrap;
}

#info-tab {
  min-height: 24px;
  padding-inline: 10px;
}

.dashboard-shell {
  margin-top: 8px;
  overflow-x: hidden;
}

.grid-stack {
  min-height: 0;
}

.grid-stack-item-content {
  border-radius: 24px;
  overflow: hidden;
  background: transparent;
}

.chart-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid rgba(132, 176, 255, 0.16);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  cursor: move;
}

.card-title {
  min-width: 0;
}

.card-title strong {
  margin: 0;
  font-size: 1rem;
}

.card-title span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-controls select {
  min-width: 170px;
  padding: 8px 10px;
  font-size: 0.92rem;
}

.chart-body {
  position: relative;
  flex: 1;
  min-height: 360px;
}

.chart-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.chart-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  overflow: hidden;
}

.index-monitor {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px 16px 14px;
  background:
    radial-gradient(circle at top right, rgba(94, 234, 212, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(8, 20, 36, 0.94) 0%, rgba(5, 13, 24, 0.98) 100%);
}

.index-monitor-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.index-monitor-price {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.index-monitor-change {
  margin-top: 8px;
  font-size: 0.94rem;
  font-weight: 700;
}

.index-monitor-change.positive {
  color: #5eead4;
}

.index-monitor-change.negative {
  color: #fb7185;
}

.index-monitor-change.neutral {
  color: var(--muted);
}

.index-monitor-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.74rem;
}

.index-monitor-chart {
  flex: 1;
  min-height: 140px;
  margin-top: 14px;
  border-radius: 16px;
  border: 1px solid rgba(132, 176, 255, 0.12);
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    rgba(255, 255, 255, 0.02);
  background-size: 100% 28px, 28px 100%, auto;
}

.index-monitor-chart svg {
  width: 100%;
  height: 100%;
}

.index-monitor-chart path {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.index-monitor.positive .index-monitor-chart path {
  stroke: #5eead4;
}

.index-monitor.negative .index-monitor-chart path {
  stroke: #fb7185;
}

.index-monitor.neutral .index-monitor-chart path,
.index-monitor-loading .index-monitor-chart path,
.index-monitor-error .index-monitor-chart path {
  stroke: #9fb0ca;
}

.index-monitor-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.index-monitor-stats div {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.index-monitor-stats span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1;
}

.index-monitor-stats strong {
  margin-top: 8px;
  font-size: 0.92rem;
  line-height: 1.2;
}

.index-monitor-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(132, 176, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  text-decoration: none;
  font-size: 0.78rem;
  white-space: nowrap;
}

.index-monitor-loading,
.index-monitor-error {
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}

.index-monitor-loading-text,
.index-monitor-error-text {
  color: var(--muted);
  font-size: 0.94rem;
}

.grid-stack > .grid-stack-item > .ui-resizable-se {
  right: 10px;
  bottom: 10px;
  width: 18px;
  height: 18px;
  border-right: 2px solid rgba(94, 234, 212, 0.7);
  border-bottom: 2px solid rgba(94, 234, 212, 0.7);
  border-radius: 0 0 10px 0;
}

@media (max-width: 1024px) {
  .home-intro,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .home-intro-links {
    grid-template-columns: 1fr 1fr;
  }

  .topbar {
    grid-template-columns: 1fr;
    display: grid;
  }

  .header-shell {
    flex-direction: column;
    align-items: stretch;
  }

  .header-controls {
    justify-content: flex-start;
  }

  .page-header,
  .footer-shell {
    flex-direction: column;
  }

}

@media (max-width: 720px) {
  .shell {
    width: calc(100% - 16px);
    padding: 20px 0 36px;
  }

  .header-shell {
    width: calc(100% - 16px);
    padding: 12px 0;
  }

  .page-main,
  .page-header,
  .footer-shell {
    width: calc(100% - 16px);
  }

  .header-info-shell {
    width: calc(100% - 16px);
  }

  .header-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }

  .header-control {
    min-width: 0;
  }

    .chart-filter-control,
    .chart-filter-toggle,
    .chart-filter-panel {
      width: 100%;
    }

    .header-action-stack {
      grid-column: 1 / -1;
      grid-template-columns: 1fr 1fr;
      min-width: 0;
      width: 100%;
    }

    .header-info-top {
      align-items: stretch;
    flex-direction: column;
  }

  .header-controls button,
  .header-controls select {
    width: 100%;
  }

  .card-header {
    flex-direction: column;
    align-items: stretch;
  }

  .card-controls select {
    width: 100%;
    min-width: 0;
  }

  .home-intro-links {
    grid-template-columns: 1fr;
  }

  .index-monitor-stats {
    grid-template-columns: 1fr;
  }
}
