:root {
  --bg: #0F1115; --card: #171A21; --fg: #E8EAED; --muted: #8A9099;
  --green: #2ECC71; --red: #FF5C5C; --amber: #F5B942; --chip: #232733;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: calc(env(safe-area-inset-top) + 10px) calc(env(safe-area-inset-right) + 10px)
           calc(env(safe-area-inset-bottom) + 10px) calc(env(safe-area-inset-left) + 10px);
  -webkit-user-select: none; user-select: none; overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.muted { color: var(--muted); }
.card {
  background: var(--card); border-radius: 14px; padding: 16px 16px 12px;
  display: flex; flex-direction: column; height: 100%; max-width: 720px; margin: 0 auto;
}
.head { display: flex; justify-content: space-between; font-size: 14px; }
.title { font-weight: 700; color: var(--muted); }
#clock { font-variant-numeric: tabular-nums; }
.price {
  font-size: clamp(38px, 12vw, 56px); font-weight: 700; line-height: 1.1; margin-top: 4px;
  font-variant-numeric: tabular-nums; letter-spacing: -0.5px;
}
.change { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; min-height: 22px; }
.range { font-size: 13px; margin: 4px 0 10px; min-height: 16px; }
.chips { display: flex; gap: 8px; margin-bottom: 8px; }
.chips button { font-size: 13px; font-weight: 700; color: var(--muted); padding: 6px 12px; border-radius: 14px; }
.chips button.on { color: var(--fg); background: var(--chip); }
.area { position: relative; flex: 1 1 auto; min-height: 140px; }
#chart { position: absolute; inset: 0; width: 100%; height: 100%; }
.list { position: absolute; inset: 0; overflow-y: auto; font-size: 13px; font-variant-numeric: tabular-nums; -webkit-user-select: text; user-select: text; }
.list .r { display: grid; grid-template-columns: 0.7fr 1.1fr 1fr 1fr; padding: 3px 0; }
.list .r span:not(:first-child) { text-align: right; }
.list .r span:nth-child(2) { color: var(--fg); }
.list .h span { color: var(--muted) !important; }
.sources { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; font-variant-numeric: tabular-nums; }
.sources td { padding: 1px 0; color: var(--muted); white-space: nowrap; }
.sources td.dot { width: 14px; font-size: 11px; }
.sources td.name { width: 100%; overflow: hidden; text-overflow: ellipsis; max-width: 0; }
.sources td.val, .sources td.age { text-align: right; padding-left: 10px; }
.sources td.info { padding-left: 10px; font-size: 12px; }
.sources tr.active td { color: var(--fg); }
.sources tr { cursor: pointer; }
@media (max-width: 400px) { .sources td.info { max-width: 92px; overflow: hidden; text-overflow: ellipsis; } }
.status { font-size: 12px; margin-top: 10px; }
.sheet { position: fixed; inset: 0; background: #0009; display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet[hidden], .toast[hidden], .list[hidden] { display: none; }
.sheet-box {
  background: var(--chip); color: var(--fg); width: 100%; max-width: 720px; border-radius: 14px 14px 0 0;
  padding: 18px 18px calc(env(safe-area-inset-bottom) + 14px);
}
.sheet-box pre { white-space: pre-wrap; font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; margin: 0 0 14px; font-variant-numeric: tabular-nums; }
.sheet-box button { width: 100%; text-align: center; padding: 10px; border-radius: 10px; background: var(--card); font-weight: 700; }
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translateX(-50%);
  background: var(--chip); color: var(--fg); padding: 10px 16px; border-radius: 20px; font-size: 14px; z-index: 11;
}
