:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --panel: #ffffff;
  --panel-soft: #f5f6f7;
  --input-bg: #ffffff;
  --line: #e0e3e6;
  --line-strong: #cfd4d8;
  --text: #17191c;
  --soft: #343a40;
  --muted: #687078;
  --muted-2: #7a8289;
  --accent: #25292d;
  --green: #168b59;
  --orange: #b96b13;
  --red: #c5414c;
  --violet: #6855a5;
  --cyan: #176e91;
  --scale-green: #2eaa77;
  --scale-cyan: #73b5a0;
  --scale-yellow: #d1b15b;
  --scale-red: #d15a63;
  --chart-up: #15945e;
  --chart-down: #d6525d;
  --chart-ema: #d0802c;
  --chart-price: #356f91;
  --chart-crosshair: #6d747a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111315;
  --bg-soft: #15181b;
  --panel: #15181b;
  --panel-soft: #1a1d20;
  --input-bg: #0e1012;
  --line: #30353a;
  --line-strong: #454b50;
  --text: #edf0f3;
  --soft: #d2d7db;
  --muted: #a0a7ae;
  --muted-2: #adb4ba;
  --accent: #edf0f3;
  --green: #55bd8a;
  --orange: #d9994f;
  --red: #df747d;
  --violet: #aa9bd8;
  --cyan: #71abc2;
  --scale-green: #419b73;
  --scale-cyan: #659c8e;
  --scale-yellow: #aa945b;
  --scale-red: #ad6067;
  --chart-up: #66d799;
  --chart-down: #ff786d;
  --chart-ema: #e9a34c;
  --chart-price: #7cb7d1;
  --chart-crosshair: #b5bdc4;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); scroll-behavior: smooth; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.shell { width: min(1380px, calc(100% - 48px)); margin-inline: auto; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(16px);
}

.topbar-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand img { width: 48px; height: 48px; border-radius: 50%; }
.brand span { display: grid; gap: 2px; }
.brand b { font-size: 1.06rem; font-weight: 800; letter-spacing: .08em; }
.brand small { color: var(--muted); font-size: .76rem; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; }

.top-actions { display: flex; align-items: center; gap: 13px; }
.price-chip { display: grid; justify-items: end; gap: 2px; }
.price-chip span { color: var(--muted); font-size: .72rem; font-weight: 750; letter-spacing: .09em; }
.price-chip b { font-size: .95rem; font-weight: 750; }
.language { display: flex; padding: 3px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg-soft); }
.language button { min-width: 40px; height: 34px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; cursor: pointer; font-size: .78rem; font-weight: 800; }
.language button[aria-pressed="true"] { color: var(--bg); background: var(--accent); }
.theme-toggle { min-height: 42px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 13px; color: var(--text); background: var(--panel); cursor: pointer; font-size: .78rem; font-weight: 700; }
.theme-toggle:hover { border-color: var(--muted); }
.language button:focus-visible, .theme-toggle:focus-visible, a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

main { padding-block: 31px 78px; }
.data-mode { margin-bottom: 14px; border: 1px solid #d9a45f; padding: 11px 14px; color: #7e4a08; background: #fff8ee; font-size: .8rem; font-weight: 750; text-align: center; }
:root[data-theme="dark"] .data-mode { color: #f2c17f; background: #2a2117; }

.market-strip {
  display: grid;
  grid-template-columns: .9fr .9fr .9fr 1.55fr;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
}
.market-cell { min-height: 128px; padding: 21px 22px; border-right: 1px solid var(--line); }
.market-cell:last-child { border-right: 0; }
.market-cell > span, .cell-head > span { color: var(--muted); font-size: .76rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.market-cell > strong { display: block; margin-top: 14px; font-size: clamp(1.65rem, 2vw, 2.15rem); font-weight: 750; letter-spacing: -.045em; }
.market-cell > small { display: block; margin-top: 8px; color: var(--muted-2); font-size: .82rem; }
.cell-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.cell-head small { color: var(--muted-2); font-size: .73rem; }
.etf-values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin-top: 18px; }
.etf-values div { min-width: 0; }
.etf-values small { display: block; color: var(--muted-2); font-size: .73rem; }
.etf-values b { display: block; overflow: hidden; margin-top: 5px; color: var(--text); font-size: .96rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }

.section-block { margin-top: 54px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 16px; }
.section-head h1, .section-head h2 { margin: 5px 0 0; font-size: clamp(1.65rem, 2.3vw, 2.25rem); font-weight: 750; letter-spacing: -.045em; line-height: 1.08; }
.eyebrow { margin: 0; color: var(--muted); font-size: .74rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.section-note { max-width: 610px; margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.55; text-align: right; }
.section-head time { color: var(--muted); font-size: .84rem; white-space: nowrap; }

.report-panel { border-left: 3px solid var(--accent); background: var(--panel-soft); }
.report-panel p { max-width: 1180px; margin: 0; padding: 22px 26px; color: var(--soft); font-size: 1.02rem; line-height: 1.78; white-space: pre-line; }

.indicator-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line-strong); }
.indicator-card {
  display: flex;
  min-height: 204px;
  flex-direction: column;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line-strong);
  padding: 18px 17px;
  background: transparent;
}
.indicator-card:nth-child(4n) { border-right: 0; }
.indicator-top { display: flex; justify-content: space-between; gap: 10px; }
.indicator-index { color: var(--muted-2); font-size: .73rem; font-weight: 750; letter-spacing: .08em; }
.indicator-category { color: var(--muted-2); font-size: .72rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.indicator-card h3 { margin: 9px 0 0; font-size: 1rem; font-weight: 750; letter-spacing: -.02em; }
.indicator-current { display: block; margin-top: 11px; font-size: clamp(1.55rem, 1.8vw, 1.85rem); font-weight: 750; line-height: 1; letter-spacing: -.045em; }
.indicator-card > p { min-height: 40px; margin: 8px 0 0; color: var(--muted); font-size: .875rem; line-height: 1.42; }
.indicator-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: auto; padding-top: 12px; }
.indicator-facts div { min-width: 0; }
.indicator-facts span { display: block; color: var(--muted-2); font-size: .73rem; }
.indicator-facts b { display: block; overflow: hidden; margin-top: 4px; color: var(--soft); font-size: .82rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.indicator-scale { position: relative; height: 6px; margin-top: 13px; border-radius: 999px; background: linear-gradient(90deg, var(--scale-green) 0%, var(--scale-cyan) 30%, var(--scale-yellow) 66%, var(--scale-red) 100%); }
.indicator-scale i { position: absolute; top: 50%; left: var(--position, 50%); width: 13px; height: 13px; transform: translate(-50%, -50%); border: 3px solid var(--bg); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--muted-2); }

.chart-tools { display: flex; align-items: flex-end; gap: 20px; }
.chart-summary { display: grid; min-width: 105px; justify-items: end; gap: 3px; }
.chart-summary strong { font-size: 1.14rem; font-weight: 750; }
.chart-summary small { color: var(--muted); font-size: .78rem; }
.chart-ranges { display: flex; padding: 3px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg-soft); }
.chart-ranges button { min-width: 44px; height: 34px; border: 0; border-radius: 6px; padding-inline: 10px; color: var(--muted); background: transparent; cursor: pointer; font-size: .78rem; font-weight: 800; }
.chart-ranges button:hover { color: var(--text); }
.chart-ranges button[aria-pressed="true"] { color: var(--bg); background: var(--accent); }
.chart-ranges button:disabled { cursor: wait; opacity: .62; }
.chart-ranges button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.chart-frame { position: relative; min-height: 360px; overflow: hidden; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); background: linear-gradient(180deg, color-mix(in srgb, var(--panel-soft) 48%, transparent), transparent 62%); }
#price-chart { display: block; width: 100%; min-height: 340px; color: var(--muted); }
.chart-legend { position: absolute; z-index: 2; top: 12px; left: 88px; display: flex; align-items: center; gap: 16px; pointer-events: none; color: var(--muted); font-size: .73rem; font-weight: 700; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ema-key i { width: 18px; height: 2px; background: var(--chart-ema); }
.chart-live-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.chart-live-status.live i { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 16%, transparent); }
.chart-live-status.reconnecting i, .chart-live-status.connecting i { background: var(--orange); }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .94rem; }
.chart-tooltip { position: absolute; z-index: 3; display: none; min-width: 238px; pointer-events: none; border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 11px; color: var(--text); background: var(--panel); box-shadow: 0 12px 30px rgba(0, 0, 0, .14); }
.chart-tooltip.show { display: block; }
.chart-tooltip small { display: block; color: var(--muted); font-size: .72rem; }
.chart-tooltip b { display: block; margin-top: 3px; font-size: .88rem; font-weight: 750; }
.chart-tooltip span { display: block; margin-top: 5px; color: var(--muted); font-size: .68rem; word-spacing: 3px; }

footer { border-top: 1px solid var(--line); background: var(--bg-soft); }
.footer-inner { min-height: 88px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 28px; }
.footer-inner span { font-size: .82rem; font-weight: 750; }
.footer-inner p { margin: 0; color: var(--muted); font-size: .79rem; text-align: center; }
.footer-links { display: flex; align-items: center; justify-content: flex-end; gap: 18px; }
.footer-inner a { color: var(--muted); font-size: .77rem; text-decoration: none; }
.footer-inner a:hover { color: var(--text); }

.policy-main { padding-block: 42px 76px; }
.policy-header { max-width: 840px; padding-bottom: 25px; border-bottom: 1px solid var(--line-strong); }
.policy-header h1 { margin: 7px 0 11px; font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1.05; letter-spacing: -.055em; }
.policy-header p { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.65; }
.policy-content { max-width: 900px; }
.policy-content section { margin-top: 34px; }
.policy-content h2 { margin: 0 0 10px; font-size: 1.25rem; letter-spacing: -.025em; }
.policy-content p, .policy-content li { color: var(--soft); font-size: .95rem; line-height: 1.7; }
.policy-content ul { margin: 10px 0 0; padding-left: 21px; }
.policy-content a { color: var(--text); }
.policy-table-wrap { overflow-x: auto; margin-top: 14px; border: 1px solid var(--line); }
.policy-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.policy-table th, .policy-table td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.policy-table th { color: var(--muted); background: var(--bg-soft); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; }
.policy-table tr:last-child td { border-bottom: 0; }
.policy-back { display: inline-flex; margin-top: 34px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 11px 15px; color: var(--text); text-decoration: none; font-size: .86rem; font-weight: 700; }

.error-page { min-height: 100vh; display: grid; place-items: center; text-align: center; }
.error-page img { border-radius: 50%; }
.error-page h1 { margin: 20px 0 8px; font-size: clamp(3rem, 10vw, 7rem); }
.error-page p { color: var(--muted); }
.error-page a { display: inline-flex; margin-top: 18px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 12px 18px; color: var(--text); text-decoration: none; }

.loader { position: fixed; z-index: 100; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--bg); transition: opacity .25s ease, visibility .25s ease; }
.loader.done { opacity: 0; visibility: hidden; }
.loader img { width: 82px; height: 82px; border-radius: 50%; }
.loader span { color: var(--soft); font-size: .82rem; font-weight: 700; letter-spacing: .06em; }
.loader i { position: relative; overflow: hidden; width: 150px; height: 3px; border-radius: 999px; background: var(--line); }
.loader i::after { position: absolute; inset: 0; content: ""; transform: translateX(-100%); background: var(--accent); animation: loading 1.1s infinite ease-in-out; }
@keyframes loading { to { transform: translateX(100%); } }

@media (max-width: 1050px) {
  .market-strip { grid-template-columns: repeat(3, 1fr); }
  .etf-overview { grid-column: 1 / -1; border-top: 1px solid var(--line); }
  .market-cell:nth-child(3) { border-right: 0; }
  .indicator-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .indicator-card:nth-child(4n) { border-right: 1px solid var(--line); }
  .indicator-card:nth-child(even) { border-right: 0; }
}

@media (max-width: 720px) {
  .shell { width: min(100% - 24px, 1380px); }
  .topbar-inner { min-height: 66px; }
  .brand img { width: 42px; height: 42px; }
  .brand small, .price-chip { display: none; }
  .top-actions { gap: 7px; }
  .theme-toggle { min-height: 40px; padding-inline: 10px; }
  main { padding-top: 20px; }
  .market-strip { grid-template-columns: 1fr 1fr; }
  .market-cell { min-height: 121px; padding: 18px 16px; }
  .market-cell:nth-child(2) { border-right: 0; }
  .market-cell:nth-child(3) { border-top: 1px solid var(--line); border-right: 1px solid var(--line); }
  .etf-overview { grid-column: 1 / -1; }
  .section-block { margin-top: 44px; }
  .section-head { display: block; }
  .section-note, .section-head time { display: block; margin-top: 9px; text-align: left; }
  .report-panel p { padding: 20px 21px; font-size: 1rem; }
  .indicator-grid { grid-template-columns: 1fr; }
  .indicator-card, .indicator-card:nth-child(4n), .indicator-card:nth-child(even) { min-height: 188px; border-right: 0; padding: 17px 4px; }
  .chart-tools { align-items: center; justify-content: space-between; margin-top: 12px; }
  .chart-summary { min-width: 0; justify-items: start; }
  .chart-frame { min-height: 300px; }
  #price-chart { min-height: 290px; }
  .chart-legend { top: 10px; left: 72px; }
  .footer-inner { grid-template-columns: 1fr; gap: 8px; padding-block: 23px; text-align: center; }
  .footer-links { justify-content: center; margin-top: 6px; }
}

@media (max-width: 430px) {
  .theme-toggle { width: 42px; padding: 0; overflow: hidden; font-size: 0; }
  .theme-toggle::before { content: "◐"; font-size: 1rem; }
  .brand b { font-size: .98rem; }
  .market-strip { grid-template-columns: 1fr; }
  .market-cell { border-right: 0; border-bottom: 1px solid var(--line); }
  .market-cell:nth-child(3) { border-right: 0; }
  .etf-overview { grid-column: auto; border-bottom: 0; }
  .market-cell > span, .cell-head > span { font-size: .7rem; }
  .market-cell > strong { font-size: 1.55rem; }
  .etf-values { gap: 8px; }
  .etf-values b { font-size: .88rem; }
  .chart-tools { align-items: flex-start; flex-direction: column; gap: 10px; }
  .chart-ranges { width: 100%; }
  .chart-ranges button { min-width: 0; flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
