:root {
  color-scheme: dark;
  font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  --background: #101716;
  --surface: #17211f;
  --surface-raised: #1c2926;
  --line: #2c3b36;
  --text: #edf5ef;
  --muted: #adbdb4;
  --dim: #819589;
  --lime: #d0ed8c;
  --green: #9ee6b0;
  --amber: #f4ca83;
  --red: #f5a6a1;
  --blue: #a6c7ed;
  --radius: 16px;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 92px; }
body { min-width: 280px; margin: 0; background: var(--background); color: var(--text); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
a { color: inherit; }
p, h1, h2, h3 { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }

.visually-hidden, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link:focus { position: fixed; z-index: 5; top: 12px; left: 12px; padding: 10px; background: var(--surface); }
.wrap { width: min(1220px, calc(100% - 72px)); margin-inline: auto; }

.topbar {
  position: sticky;
  z-index: 2;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: #101716f5;
}
.topbar-inner { display: flex; align-items: center; min-height: 68px; gap: 44px; }
.brand { display: inline-flex; gap: 10px; align-items: center; color: var(--text); font-weight: 700; text-decoration: none; white-space: nowrap; }
.brand-mark { display: flex; align-items: flex-end; justify-content: center; gap: 2px; width: 27px; height: 27px; padding-bottom: 7px; border-radius: 7px; background: var(--lime); }
.brand-mark i { width: 3px; height: 6px; border-radius: 1px; background: #192516; }
.brand-mark i:nth-child(2) { height: 10px; }
.brand-mark i:nth-child(3) { height: 13px; }
.navigation { display: flex; gap: 27px; }
.navigation a { padding-block: 6px; color: var(--muted); text-decoration: none; font-size: .86rem; white-space: nowrap; }
.navigation a:hover { color: var(--lime); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.connection { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); white-space: nowrap; font-size: .78rem; }
.dot, .metric-dot { display: inline-block; flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.connection.good { color: var(--green); }
.connection.warn { color: var(--amber); }
.connection.bad { color: var(--red); }
.icon-button { display: grid; place-items: center; border: 1px solid var(--line); min-height: 36px; width: 36px; padding: 0; border-radius: 9px; background: transparent; color: var(--text); }
.icon-button:hover { background: var(--surface-raised); border-color: var(--dim); }
.refresh-icon { display: block; font-size: 21px; line-height: 1; }
.icon-button[aria-busy="true"] .refresh-icon { animation: spin 850ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

main.wrap { padding-bottom: 64px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 58px 0 34px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.45rem); line-height: 1.1; font-weight: 760; letter-spacing: -.045em; }
.hero p { max-width: 40ch; margin-top: 14px; color: var(--muted); font-size: clamp(.85rem, 1.8vw, .98rem); line-height: 1.65; }
.hero-time { display: grid; gap: 8px; justify-items: end; flex: 0 0 auto; color: var(--muted); font-size: .78rem; }
.time-zone { margin-left: 3px; font-family: var(--mono); font-size: .7rem; color: var(--dim); }
.hero-time time { color: var(--text); font-family: var(--mono); font-size: 1rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

.overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 23px; }
.metric-card { min-height: 145px; padding: 19px 23px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.metric-featured { background: linear-gradient(105deg, #212e22, #253525); border-color: #485b3b; }
.metric-card h2 { display: flex; align-items: center; gap: 8px; font-size: .83rem; font-weight: 650; color: var(--muted); }
.metric-dot { color: var(--dim); }
.metric-featured .metric-dot, .metric-featured .metric-value { color: var(--lime); }
.metric-card:nth-child(2) .metric-dot { color: var(--green); }
.metric-card:nth-child(3) .metric-dot { color: var(--blue); }
.metric-value { margin-top: 12px; font-family: var(--mono); font-size: clamp(1.8rem, 4vw, 2.52rem); line-height: 1; font-weight: 560; }
.metric-card p { margin-top: 10px; color: var(--muted); font-size: .77rem; line-height: 1.5; overflow-wrap: anywhere; }

.panel { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 19px 22px; }
.section-header h2 { font-size: 1.13rem; font-weight: 690; line-height: 1.3; }
.section-header p { margin-top: 6px; font-size: .78rem; color: var(--muted); line-height: 1.5; }
.field-label { display: block; }
.field-label input { display: block; width: min(100%, 220px); padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: #111b18; color: var(--text); font-size: .82rem; }
.field-label input::placeholder { color: var(--dim); }
.listing-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 22px 15px; }
.market-tabs { display: flex; gap: 3px; align-items: center; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #111b18; }
.market-tabs button { min-width: 55px; padding: 6px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: .82rem; white-space: nowrap; }
.market-tabs button:hover { color: var(--text); }
.market-tabs button[aria-pressed="true"] { background: #34462d; color: var(--lime); font-weight: 650; }
.select-control select { max-width: 100%; min-height: 35px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #111b18; color: var(--muted); font-size: .82rem; }

.listing-results { max-width: 100%; overflow-x: auto; }
.listing-table { width: 100%; text-align: left; border-collapse: collapse; font-size: .84rem; }
.listing-table th { font-weight: 560; color: var(--muted); background: #141e1b; }
.listing-table th, .listing-table td { border-top: 1px solid var(--line); padding: 13px 16px; vertical-align: middle; }
.listing-table th:first-child, .listing-table td:first-child { padding-left: 22px; }
.listing-table th:last-child, .listing-table td:last-child { padding-right: 22px; text-align: right; }
.listing-table tr:hover td { background: #1b2824; }
.listing-symbol { font-family: var(--mono); font-size: .9rem; font-weight: 650; overflow-wrap: anywhere; }
.subline { display: block; margin-top: 4px; color: var(--muted); font-size: .73rem; line-height: 1.35; }
.tabular { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.countdown { color: var(--lime); }
.timing-warning, .detail-body > .detail-warning { color: var(--amber); }
.window-range { line-height: 1.5; }
.window-range time { white-space: nowrap; }
.pill { display: inline-flex; gap: 5px; align-items: center; padding: 4px 8px; border-radius: 8px; color: var(--muted); background: #263933; font-size: .72rem; white-space: nowrap; }
.pill.good { background: #203d2b; color: var(--green); }
.pill.warn { background: #403725; color: var(--amber); }
.pill.bad { background: #472c2b; color: var(--red); }
.pill.blue { background: #273b49; color: var(--blue); }
.pill .dot { width: 5px; height: 5px; }
.text-button { padding: 4px 3px; border: 0; background: transparent; color: var(--lime); font-size: .82rem; white-space: nowrap; }
.text-button:hover { text-decoration: underline; }
.outline-button { display: inline-flex; gap: 5px; align-items: center; justify-content: center; min-height: 34px; padding: 6px 10px; border: 1px solid #495c39; border-radius: 8px; background: #243121; color: var(--lime); font-size: .76rem; text-decoration: none; white-space: nowrap; }
.outline-button:hover { background: #34462d; }

.empty { display: grid; justify-items: center; gap: 8px; padding: 35px 20px 37px; border-top: 1px solid var(--line); text-align: center; }
.empty h3 { font-size: .94rem; font-weight: 650; }
.empty p { max-width: 52ch; color: var(--muted); font-size: .8rem; line-height: 1.55; }
.empty-icon { display: grid; align-content: center; justify-content: center; gap: 4px; width: 42px; height: 42px; margin-bottom: 3px; border: 1px solid #3b5143; border-radius: 11px; color: var(--lime); background: #1e2b24; }
.empty-icon i { display: block; width: 16px; height: 1px; background: currentColor; }
.empty-icon i:last-child { width: 10px; }
.table-footer { display: flex; min-height: 45px; align-items: center; gap: 16px; padding: 9px 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; }
.updated-time { margin-left: auto; text-align: right; }

.secondary-panels { display: grid; grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr); align-items: start; gap: 15px; margin-top: 18px; }
.alert-list, .feed-list { margin: 0; padding: 0; list-style: none; }
.small-empty, .alert-item, .feed-item { padding: 13px 22px; border-top: 1px solid var(--line); }
.small-empty { padding-block: 20px; color: var(--muted); font-size: .82rem; }
.error-banner { margin: 0 22px 12px; padding: 9px 11px; border: 1px solid #624640; border-radius: 8px; color: var(--red); background: #342724; font-size: .79rem; line-height: 1.5; overflow-wrap: anywhere; }
.notifications-note { padding: 0 22px 12px; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.alert-item { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; }
.alert-item h3, .feed-item h3 { font-size: .84rem; font-weight: 620; overflow-wrap: anywhere; }
.alert-item p, .feed-item p { color: var(--muted); font-size: .76rem; line-height: 1.5; overflow-wrap: anywhere; }
.alert-item time { color: var(--dim); font-size: .73rem; white-space: nowrap; }
.alert-item p { grid-column: 1 / -1; }
.feed-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; }
.feed-item p { grid-column: 1 / -1; }
.feed-item .feed-error { color: var(--amber); }

.detail-dialog { width: min(550px, calc(100% - 30px)); max-height: min(760px, calc(100dvh - 40px)); margin: auto; padding: 0; border: 1px solid #455d51; border-radius: 16px; color: var(--text); background: var(--surface); }
.detail-dialog::backdrop { background: #070d0bc4; }
.dialog-header { display: flex; justify-content: space-between; align-items: start; padding: 19px 21px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { overflow-wrap: anywhere; font-size: 1.35rem; }
.detail-market { margin-bottom: 4px; color: var(--lime); font-size: .77rem; }
.detail-market:empty { display: none; }
.close-button { margin-left: 12px; font-size: 22px; }
.detail-body { padding: 17px 21px 22px; }
.detail-body > p { color: var(--muted); font-size: .84rem; line-height: 1.55; }
.detail-body dl { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 14px; margin: 15px 0; }
.detail-body dt { color: var(--muted); font-size: .76rem; }
.detail-body dd { margin: 3px 0 0; overflow-wrap: anywhere; font-size: .84rem; }
.detail-body .detail-subtitle { margin-top: 19px; font-size: .93rem; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 17px; }
.noscript { padding-block: 15px; color: var(--amber); }

@media (max-width: 820px) {
  .wrap { width: calc(100% - 36px); }
  .topbar-inner { gap: 20px; }
  .navigation { gap: 14px; }
  .secondary-panels { grid-template-columns: 1fr; }
  .hero { padding-top: 41px; }
}

@media (max-width: 570px) {
  html { scroll-padding-top: 110px; }
  .wrap { width: calc(100% - 26px); }
  .topbar-inner { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; min-height: 0; padding-block: 9px 5px; }
  .navigation { grid-row: 2; grid-column: 1 / -1; justify-content: space-between; gap: 8px; margin-top: 3px; }
  .navigation a { min-height: 30px; font-size: .8rem; }
  .topbar-actions { gap: 7px; }
  .hero { display: block; padding: 31px 0 21px; }
  .hero p { margin-top: 9px; }
  .hero-time { display: flex; justify-content: space-between; align-items: center; margin-top: 17px; }
  .hero-time time { font-size: .87rem; }
  .overview { gap: 6px; margin-bottom: 14px; }
  .metric-card { min-height: 105px; padding: 10px 7px; border-radius: 12px; }
  .metric-card h2 { gap: 4px; font-size: .68rem; white-space: nowrap; }
  .metric-dot { width: 5px; height: 5px; }
  .metric-card p { font-size: .65rem; }
  .metric-value { margin-top: 9px; }
  .section-header { gap: 8px; padding: 14px 12px; }
  .section-header h2 { font-size: 1.05rem; }
  .section-header p { font-size: .72rem; }
  .listings-panel .section-header { flex-wrap: wrap; }
  .field-label { flex: 0 1 132px; }
  .field-label input { min-width: 0; padding-inline: 9px; }
  .listing-toolbar { gap: 8px; padding: 0 12px 12px; }
  .market-tabs button { min-width: 42px; padding-inline: 6px; }
  .select-control select { padding-inline: 5px; }
  .listing-table th, .listing-table td { padding-inline: 5px; font-size: .72rem; }
  .listing-table th:first-child, .listing-table td:first-child { padding-left: 12px; }
  .listing-table th:last-child, .listing-table td:last-child { padding-right: 12px; }
  .listing-table th:nth-child(4), .listing-table td:nth-child(4) { display: none; }
  .listing-table .pill { padding-inline: 5px; font-size: .66rem; }
  .listing-symbol { font-size: .72rem; }
  .listing-table .subline { font-size: .65rem; }
  .table-footer, .alert-item, .feed-item, .small-empty, .notifications-note { padding-inline: 12px; }
  .error-banner { margin-inline: 12px; }
  .secondary-panels { margin-top: 13px; }
  .detail-body dl { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .icon-button[aria-busy="true"] .refresh-icon { animation: none; }
}
