:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  background: #0a1016;
  color: #e8f0ef;
  --surface: #111b22;
  --surface-raised: #152129;
  --line: #273740;
  --muted: #82969d;
  --green: #6fe2aa;
  --red: #ff8e91;
  --amber: #e8bd76;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 74% -8%, rgba(33, 117, 100, 0.22), transparent 32rem),
    radial-gradient(circle at 0% 28%, rgba(24, 71, 95, 0.18), transparent 28rem),
    #0a1016;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell { width: min(100% - 64px, 1480px); margin: 0 auto; }

.site-header {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(125, 157, 162, 0.14);
}

.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 36px; height: 36px; display: flex; align-items: end; gap: 4px; transform: skewX(-11deg); }
.brand-mark span { display: block; width: 8px; border-radius: 2px 2px 0 0; background: var(--green); }
.brand-mark span:nth-child(1) { height: 16px; opacity: 0.55; }
.brand-mark span:nth-child(2) { height: 27px; opacity: 0.78; }
.brand-mark span:nth-child(3) { height: 36px; }
.brand-name { font-size: 19px; line-height: 1; font-weight: 850; letter-spacing: 0.14em; }
.brand-dot { color: var(--green); }
.brand-caption { margin-top: 5px; font-size: 9px; font-weight: 750; letter-spacing: 0.3em; color: var(--muted); }
.header-status { display: flex; align-items: center; gap: 10px; font-size: 12px; color: #a7b8bb; letter-spacing: 0.04em; }
.connection-dot { width: 8px; height: 8px; border-radius: 50%; background: #697b81; box-shadow: 0 0 0 4px rgba(105, 123, 129, 0.13); }
.connection-dot.live { background: var(--green); box-shadow: 0 0 0 4px rgba(111, 226, 170, 0.12), 0 0 16px rgba(111, 226, 170, 0.7); }
.connection-dot.loading { background: var(--amber); box-shadow: 0 0 0 4px rgba(232, 189, 118, 0.12); }

.intro { padding: 58px 0 43px; }
.eyebrow { color: var(--green); font-size: 10px; font-weight: 780; letter-spacing: 0.2em; }
.intro h1 { margin: 15px 0 12px; font-size: clamp(39px, 5vw, 72px); line-height: 1.05; letter-spacing: -0.065em; font-weight: 780; }
.intro h1 span { color: #8bbba9; }
.intro p { margin: 0; color: #a5b5b8; font-size: 14px; line-height: 1.6; }

.panel { background: linear-gradient(145deg, rgba(22, 33, 41, 0.98), rgba(15, 25, 32, 0.98)); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 16px 46px rgba(0, 0, 0, 0.11); }
.controls { padding: 24px 27px 27px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; }
.section-heading h2 { margin: 7px 0 0; font-size: 22px; letter-spacing: -0.04em; }
.section-heading.compact { margin-bottom: 22px; }
.subtle { font-size: 12px; color: var(--muted); }
.control-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: end; gap: 11px; }
.token-field { grid-column: 1 / -1; }
.symbol-field, .quote-field, .interval-field, .limit-field { grid-column: span 1; }
.primary-button { grid-column: span 2; }
.field { display: flex; flex-direction: column; min-width: 0; gap: 9px; }
.field > span { color: #a7b8bb; font-size: 11px; font-weight: 650; letter-spacing: 0.02em; }
.field em { color: #657d83; font-style: normal; font-weight: 400; }
.field input, .field select { width: 100%; height: 45px; padding: 0 13px; outline: 0; border: 1px solid #31434a; border-radius: 8px; background: #0d171d; color: #e9f2f0; font-size: 13px; }
.field input::placeholder { color: #647b80; }
.field input:focus, .field select:focus { border-color: #6acaa1; box-shadow: 0 0 0 3px rgba(111, 226, 170, 0.12); }
.field select { appearance: none; padding-right: 27px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='m3 5 4 4 4-4' fill='none' stroke='%2390a8aa' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.primary-button { height: 45px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 0; border-radius: 8px; padding: 0 16px; background: var(--green); color: #0b1c18; font-size: 12px; font-weight: 800; white-space: nowrap; }
.primary-button:hover { background: #91f1c1; }
.primary-button:focus-visible { outline: 3px solid #c6f8de; outline-offset: 3px; }
.primary-button:disabled { opacity: 0.65; cursor: progress; }
.primary-button span:last-child { font-size: 18px; font-weight: 500; }
.error-banner { margin-top: 18px; padding: 11px 13px; color: #ffc7c5; background: rgba(255, 115, 119, 0.08); border: 1px solid rgba(255, 142, 145, 0.27); border-radius: 8px; font-size: 12px; line-height: 1.5; }

.status-card { margin-top: 15px; padding: 22px 27px; }
.status-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.status-heading h2 { margin: 7px 0 0; font-size: 20px; letter-spacing: -0.04em; }
.market-heading { padding: 43px 2px 20px; display: flex; justify-content: space-between; align-items: end; gap: 18px; }
.market-heading h2 { margin: 8px 0 0; font-size: 32px; letter-spacing: -0.055em; }
.market-slash { margin: 0 9px; color: #4d706e; font-weight: 350; }
.market-update { display: flex; flex-direction: column; align-items: flex-end; gap: 9px; color: var(--muted); font-size: 11px; }
.service-pill { display: inline-flex; align-items: center; min-height: 25px; border: 1px solid #38505a; border-radius: 100px; padding: 4px 11px; color: #a5b7ba; background: rgba(100, 125, 129, 0.09); font-size: 10px; font-weight: 750; letter-spacing: 0.04em; text-transform: uppercase; }
.service-pill.operational { color: var(--green); background: rgba(111, 226, 170, 0.08); border-color: rgba(111, 226, 170, 0.3); }
.service-pill.degraded { color: var(--amber); background: rgba(232, 189, 118, 0.08); border-color: rgba(232, 189, 118, 0.3); }
.service-pill.critical { color: var(--red); background: rgba(255, 142, 145, 0.08); border-color: rgba(255, 142, 145, 0.3); }
.status-events { display: grid; gap: 0; margin: 20px 0 0; padding: 0; list-style: none; }
.status-event-row { display: flex; justify-content: space-between; align-items: baseline; gap: 18px; padding: 13px 0; border-top: 1px solid #293a41; }
.status-event-message { min-width: 0; color: #e5eeeb; font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }
.status-event-details { min-width: 0; color: #879da1; font-size: 11px; text-align: right; overflow-wrap: anywhere; }
.status-event-row.operational .status-event-message { color: var(--green); }
.status-event-row.critical .status-event-message { color: var(--red); }
.status-empty { padding-top: 18px; color: #879da1; font-size: 12px; }
.exchange-status-card { margin-top: 15px; padding: 22px 27px; }
.exchange-status-list { display: grid; gap: 0; margin: 18px 0 0; padding: 0; list-style: none; }
.exchange-status-group { border-top: 1px solid #293a41; }
.exchange-status-summary { display: grid; grid-template-columns: 12px minmax(90px, 120px) minmax(0, 200px) minmax(0, 1fr); align-items: baseline; gap: 10px; padding: 12px 0; cursor: pointer; font-size: 12px; list-style: none; }
.exchange-status-summary::-webkit-details-marker { display: none; }
.exchange-status-summary::before { content: "›"; color: #879da1; font-size: 17px; line-height: 12px; transition: transform 0.15s ease; }
.exchange-status-group details[open] > .exchange-status-summary::before { transform: rotate(90deg); }
.exchange-status-summary:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.exchange-status-count { color: #879da1; font-size: 11px; overflow-wrap: anywhere; }
.exchange-pair-list { margin: 0; padding: 0 0 3px 22px; list-style: none; }
.exchange-status-row { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; padding: 10px 0; border-top: 1px solid #293a41; font-size: 12px; }
.exchange-status-row.pair { color: #9cb1b3; }
.exchange-status-name { font-weight: 650; color: #e5eeeb; }
.exchange-status-detail { color: #879da1; text-align: right; overflow-wrap: anywhere; }
.exchange-status-detail.ok { color: var(--green); }
.exchange-status-detail.maintenance, .exchange-status-detail.stale, .exchange-status-detail.reconnecting { color: var(--amber); }

.overview-grid { display: grid; grid-template-columns: minmax(280px, 0.85fr) minmax(0, 2.15fr); gap: 15px; }
.price-card, .chart-card { min-height: 406px; padding: 22px; }
.card-topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-topline h3 { margin: 0; font-size: 15px; font-weight: 720; letter-spacing: -0.02em; }
.card-topline > span { color: #6c8588; font-size: 10px; font-weight: 800; letter-spacing: 0.14em; }
.price-line { display: flex; align-items: baseline; gap: 10px; margin-top: 32px; white-space: nowrap; }
.price-line span:first-child { font-size: clamp(30px, 3.4vw, 46px); line-height: 1.1; letter-spacing: -0.065em; font-weight: 760; overflow: hidden; text-overflow: ellipsis; }
.price-line span:last-child { font-size: 12px; color: #8da3a6; font-weight: 650; }
.change-badge { display: inline-flex; margin-top: 14px; border: 1px solid; border-radius: 5px; padding: 5px 9px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.change-badge.positive { color: var(--green); border-color: rgba(111, 226, 170, 0.29); background: rgba(111, 226, 170, 0.09); }
.change-badge.negative { color: var(--red); border-color: rgba(255, 142, 145, 0.29); background: rgba(255, 142, 145, 0.09); }
.change-badge.neutral { color: #aabbbd; border-color: #3c5057; background: #17252c; }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 10px; padding-top: 29px; margin-top: 29px; border-top: 1px solid #293a41; }
.stat-grid div { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.stat-grid span { color: #80969a; font-size: 10px; font-weight: 750; letter-spacing: 0.1em; }
.stat-grid strong { font-size: 17px; font-weight: 670; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.stat-grid strong.positive { color: var(--green); }
.stat-grid strong.negative { color: var(--red); }
.card-note { margin: 26px 0 0; color: #789195; font-size: 11px; line-height: 1.5; }

.chart-topline > div:first-child { display: flex; align-items: baseline; gap: 13px; }
.chart-topline > div:first-child span { color: #759094; font-size: 11px; }
.chart-source-field { display: flex; align-items: center; gap: 8px; color: #8fa4a7; font-size: 11px; white-space: nowrap; }
.chart-source-field select { max-width: 210px; height: 34px; padding: 0 8px; border: 1px solid #31434a; border-radius: 6px; background: #0d171d; color: #e9f2f0; }
.chart-legend { display: flex; gap: 13px; color: #8fa4a7; font-size: 10px; }
.chart-legend span { display: flex; align-items: center; gap: 5px; }
.chart-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; }
.legend-up { background: var(--green); }
.legend-down { background: var(--red); }
.chart-wrap { position: relative; height: 300px; margin-top: 20px; }
.chart-wrap canvas { display: block; width: 100%; height: 100%; outline: 0; cursor: grab; touch-action: pan-y; }
.chart-wrap canvas.dragging { cursor: grabbing; }
.chart-wrap canvas:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #7e989a; font-size: 12px; pointer-events: none; }
.chart-empty[hidden] { display: none; }
.chart-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; color: #789195; font-size: 10px; font-variant-numeric: tabular-nums; }
.chart-footer span:nth-child(2) { flex: 1; text-align: right; }
.chart-zoom-controls { display: flex; gap: 4px; }
.chart-zoom-controls button { min-width: 28px; height: 26px; border: 1px solid #355049; border-radius: 5px; color: var(--green); background: #17272a; font-size: 16px; line-height: 1; }
.chart-zoom-controls button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.latest-button { border: 1px solid #355049; border-radius: 5px; padding: 4px 8px; color: var(--green); background: #17272a; font-size: 10px; white-space: nowrap; }
.latest-button[hidden] { display: none; }

.sources-card { margin-top: 15px; padding: 25px 26px 11px; }
.sources-card .section-heading { padding-bottom: 22px; }
.count-pill { padding: 7px 10px; border: 1px solid #355049; border-radius: 100px; color: #a1c9b5; background: rgba(111, 226, 170, 0.06); font-size: 11px; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 780px; border-collapse: collapse; text-align: left; }
thead { border-top: 1px solid #263940; border-bottom: 1px solid #263940; }
th { padding: 13px 10px; color: #789093; font-size: 10px; font-weight: 750; letter-spacing: 0.11em; text-transform: uppercase; white-space: nowrap; }
td { padding: 17px 10px; border-bottom: 1px solid rgba(104, 133, 139, 0.14); font-size: 12px; color: #c5d2d1; white-space: nowrap; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(117, 174, 157, 0.035); }
.numeric { text-align: right; }
.source-name { color: #e9f0ef; font-weight: 700; text-transform: capitalize; }
.source-pair { display: block; margin-top: 5px; color: #728c90; font-size: 10px; font-weight: 450; text-transform: none; }
.empty-cell { padding: 38px 10px; text-align: center; color: #82999c; }

.site-footer { display: flex; justify-content: space-between; gap: 20px; padding: 29px 0 38px; color: #667e83; font-size: 10px; border-top: 1px solid rgba(125, 157, 162, 0.14); margin-top: 28px; }
.site-footer span:first-child { font-weight: 750; letter-spacing: 0.12em; }

@media (max-width: 900px) {
  .app-shell { width: min(100% - 38px, 720px); }
  .overview-grid { grid-template-columns: 1fr; }
  .price-card { min-height: auto; }
  .chart-card { min-height: 410px; }
  .price-line { margin-top: 22px; }
  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
  .control-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .token-field { grid-column: span 4; }
  .symbol-field, .quote-field, .interval-field, .limit-field { grid-column: span 1; }
  .primary-button { grid-column: span 4; justify-content: center; }
}

@media (max-width: 650px) {
  .app-shell { width: min(100% - 28px, 520px); }
  .site-header { min-height: 74px; }
  .header-status { font-size: 11px; }
  .intro { padding: 40px 0 34px; }
  .intro p { max-width: 330px; }
  .controls, .status-card, .exchange-status-card, .price-card, .chart-card, .sources-card { padding: 19px; }
  .section-heading.compact { align-items: start; }
  .subtle { display: none; }
  .control-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .token-field { grid-column: 1 / -1; }
  .symbol-field, .quote-field, .interval-field, .limit-field { grid-column: span 1; }
  .primary-button { grid-column: span 2; }
  .market-heading { padding-top: 36px; }
  .market-heading h2 { font-size: 26px; }
  .market-update { font-size: 10px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-topline { align-items: start; }
  .chart-topline > div:first-child { flex-direction: column; gap: 4px; }
  .chart-source-field select { max-width: 150px; }
  .chart-wrap { height: 265px; }
  .chart-footer { flex-direction: column; }
  .chart-footer span:nth-child(2) { text-align: left; }
  .status-event-row { flex-direction: column; align-items: stretch; gap: 4px; }
  .status-event-details { text-align: left; }
  .exchange-status-summary { grid-template-columns: 12px minmax(0, 1fr) minmax(0, 1fr); }
  .exchange-status-summary .exchange-status-detail { grid-column: 2 / -1; text-align: left; }
  .exchange-status-row.pair { flex-direction: column; align-items: stretch; gap: 3px; }
  .exchange-status-row.pair .exchange-status-detail { text-align: left; }
  .site-footer { flex-direction: column; gap: 5px; }
}

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