/* Theme: change these to restyle everything, including the chart. */
:root {
	--bg: #04070a;
	--panel: #0d171c;
	--panel-hover: #192327;
	--border: #232d31;
	--border-strong: #313b40;
	--grid: #141f24;
	--text: #f6fefd;
	--muted: #949e9c;
	--dim: #657072;
	--accent: #50d2c1;
	--up: #1fa67d;
	--down: #ed7088;
	--up-volume: rgba(31, 166, 125, 0.4);
	--down-volume: rgba(237, 112, 136, 0.4);
	--depth: rgba(237, 112, 136, 0.15);
	--radius: 8px;
	--font: "Inter", system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
html, body { margin: 0; height: 100%; }
body {
	background: var(--bg);
	color: var(--text);
	font: 12px/1.4 var(--font);
	font-variant-numeric: tabular-nums;
	display: flex;
	flex-direction: column;
}
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }
[hidden] { display: none !important; }

.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); }

.nav {
	height: 56px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 0 16px;
	background: var(--panel);
	border-bottom: 1px solid var(--border);
}
.tab { padding: 6px 12px; color: var(--muted); font-size: 13px; text-decoration: none; border-radius: var(--radius); transition: color 0.15s; }
.tab.active, .tab:hover { color: var(--accent); }

.menu { position: relative; }
.right { margin-left: auto; }
.control {
	height: 32px;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 8px 0 12px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius);
	transition: background 0.15s;
}
.control:hover { background: var(--panel-hover); }
.chevron::after { content: "▾"; color: var(--muted); }
.dropdown {
	position: absolute;
	z-index: 30;
	top: calc(100% + 4px);
	min-width: 100%;
	max-height: 60vh;
	overflow-y: auto;
	padding: 4px 0;
	background: var(--panel);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius);
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}
.right .dropdown { right: 0; }
.option { display: block; width: 100%; padding: 8px 12px; text-align: left; white-space: nowrap; transition: background 0.15s; }
.option:hover { background: var(--panel-hover); }
.option.selected { color: var(--accent); }

.page { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 4px; padding: 4px; }
.panel { background: var(--panel); border-radius: var(--radius); }

.stats { flex-shrink: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 32px; padding: 8px 12px; min-height: 56px; }
.market { height: 36px; margin-left: -8px; padding: 0 8px; display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 500; border-radius: var(--radius); transition: background 0.15s; }
.market:hover, .market[aria-expanded="true"] { background: var(--panel-hover); }
.stat-list { display: flex; flex-wrap: wrap; gap: 8px 32px; }
.stat span { display: block; }
.stat span:first-child { color: var(--muted); }

.search { width: 640px; max-width: calc(100vw - 32px); padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.search-box { padding: 8px; }
.search-box input {
	width: 100%;
	height: 36px;
	padding: 0 12px;
	background: var(--bg);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius);
	outline: none;
}
.search-box input:focus { border-color: var(--dim); }
.search-results { overflow-y: auto; max-height: 55vh; padding: 4px 0; }
.search-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 90px 90px; gap: 12px; align-items: center; height: 32px; padding: 0 12px; white-space: nowrap; }
.search-row > :not(:first-child) { text-align: right; }
.search-row > :first-child { overflow: hidden; text-overflow: ellipsis; }
.search-row.head { height: 28px; color: var(--muted); border-bottom: 1px solid var(--border); }
a.search-row { color: inherit; text-decoration: none; transition: background 0.15s; }
a.search-row:hover, a.search-row.current { background: var(--panel-hover); }

.grid { flex: 1; min-height: 0; display: grid; gap: 4px; grid-template-columns: minmax(0, 1fr) 300px 260px; grid-template-rows: minmax(0, 1fr); }
@media (max-width: 1100px) {
	body { height: auto; }
	.grid { grid-template-columns: 1fr; grid-template-rows: 480px 60vh 60vh; }
}
.chart-panel { display: flex; flex-direction: column; overflow: hidden; }
.toolbar { height: 40px; flex-shrink: 0; display: flex; align-items: center; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--border); }
.toolbar button { height: 28px; min-width: 28px; padding: 0 6px; border-radius: 4px; color: var(--muted); transition: background 0.15s, color 0.15s; }
.toolbar button:hover { background: var(--panel-hover); color: var(--text); }
.toolbar button.active { color: var(--accent); }
.chart-wrap { position: relative; flex: 1; min-height: 0; }
#chart { position: absolute; inset: 0; }

.side { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.panel-title { height: 40px; flex-shrink: 0; display: flex; align-items: center; padding: 0 12px; border-bottom: 1px solid var(--border); }
.rows { flex: 1; min-height: 0; overflow-y: auto; }
.row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(48px, auto); gap: 16px; align-items: center; height: 23px; padding: 0 12px; white-space: nowrap; }
.row > :not(:first-child) { text-align: right; }
.row.head { height: 28px; flex-shrink: 0; color: var(--muted); }
.rows .row:hover { background: var(--panel-hover); }
.row > span { position: relative; z-index: 1; }
.depth { position: absolute; inset: 0 auto 0 0; background: var(--depth); pointer-events: none; }
.empty { padding: 24px 12px; text-align: center; color: var(--muted); }
