/* Noto Sans (SIL Open Font License, fonts/OFL.txt), from this site: only the weights
   400 to 600 and the Latin letters and signs the page uses (fonts/README.md). */
@font-face {
	font-family: 'Noto Sans';
	src: url('./fonts/NotoSans.woff2') format('woff2');
	font-weight: 400 600;
	font-style: normal;
	font-display: swap;
}

/* ===== Colours ==================================================================
   Every colour of the page and the chart is a variable. The light values are the
   defaults; the dark theme overrides them below. */

:root {
	--font-family: 'Noto Sans', sans-serif;

	/* type scale: four steps, one rem = 10px. Emphasis comes from weight and
	   colour, not from extra sizes.
	   2xs  10px  tiny chart labels, the (100) after JPY
	   xs   11px  descriptions, notes, axes, small print, changes in the currency list
	   sm   12px  secondary labels: ruler, help, status, section notes
	   md   13px  body, controls, names, rates, values
	   lg   14px  section titles */
	--fs-2xs: 1rem;
	--fs-xs: 1.1rem;
	--fs-sm: 1.2rem;
	--fs-md: 1.3rem;
	--fs-lg: 1.4rem;
	--fs-icon: 1.6rem;

	/* page: cool blue-grey, the accent is the colour of the price line */
	--ink: #1f2a33;
	--muted: #66727d;
	--page: #eef1f4;
	--surface: #ffffff;
	--sunken: #f4f6f8;
	--rule: #d9dfe5;
	--accent: #2f5d8a;
	--accent-ink: #ffffff;
	--accent-soft: #e3ecf5;
	--up: #0f8a52;
	--down: #c93a3a;
	--chart-bg: #ffffff;
	--knob: #ffffff;
	--tile: #eceff2;
	--tile-hover: #e3e7eb;
	--tile-on: #d8dee4;

	/* chart: axes and grid */
	--axis-domainc: #696969;
	--axis-textc: #696969;
	--grid-color: #ececec;
	--ref-line: #a0a0a0;

	/* chart: series */
	--c-price: #38678f;
	--c-band: #909090;
	--c-donchian: #8a6d3b;
	--fill-bba: #bfbfbf;
	--opacity-bba: 0.2;
	--c-macd: #0061cb;
	--c-signal: #ff8084;
	--c-hist-up: #708070;
	--c-hist-down: #907070;
	--c-hist-legend: #808080;
	--c-roc: #f28f3b;
	--c-rsi: #505050;
	--c-stoch-k: #7a5fc0;
	--c-stoch-d: #c9a227;
	--c-hv: #b0478f;
	--c-signal-up: #00b061;
	--c-signal-down: #e04b4b;

	/* chart: moving averages, in the order they are added */
	--c-ma-1: #e04b4b;
	--c-ma-2: #00b061;
	--c-ma-3: #ff7dcd;
	--c-ma-4: #a39354;
	--c-ma-5: #2a9d8f;
	--c-ma-6: #8e5bd0;
	--c-ma-7: #e08a1e;
	--c-ma-8: #3b8fd9;
	--c-ma-9: #b5446e;
	--c-ma-10: #6b8e23;

	/* comparison lines after the main one (in the price colour) */
	--c-cmp-1: #e07b1a;
	--c-cmp-2: #8e5bd0;
	--c-cmp-3: #2a9d8f;

	/* chart: crosshair, tags, drawings, markers */
	--c-crosshair: #b8b8b8;
	--c-tag: #5b6270;
	--c-tag-text: #ffffff;
	--c-trend: #606060;
	--c-channel: #8c8c8c; /* drawn channels: lighter than a trend line */
	--level-color: #b07a1e;
	--fib-color: #7a5fc0;
	--c-marker-fill: #00ced1;
	--c-divider: #d4d4d8;
}

@media (prefers-color-scheme: dark) {
	:root {
		--ink: #dce3e9;
		--muted: #8a97a3;
		--page: #0b1117;
		--surface: #121a22;
		--sunken: #0e151c;
		--rule: #24303b;
		--accent: #7fb0e0;
		--accent-ink: #0b1117;
		--accent-soft: #1a2a3a;
		--up: #3cc488;
		--down: #f07070;
		--chart-bg: #0e151c;
		--knob: #d5dde4;
		--tile: #17212b;
		--tile-hover: #1d2934;
		--tile-on: #283745;

		--axis-domainc: #6c727c;
		--axis-textc: #8a9099;
		--grid-color: #111a2b;
		--ref-line: #5c6370;

		--c-price: #6fa3d8;
		--c-band: #6f7b8c;
		--c-donchian: #c4a46b;
		--fill-bba: #49698a;
		--opacity-bba: 0.2;
		--c-macd: #4f95ec;
		--c-signal: #ff8f93;
		--c-hist-up: #6e9a6e;
		--c-hist-down: #a86c6c;
		--c-hist-legend: #8f959e;
		--c-roc: #f5a05a;
		--c-rsi: #c9ccd1;
		--c-stoch-k: #a58be0;
		--c-stoch-d: #d9b84a;
		--c-hv: #d982bd;
		--c-signal-up: #2fc27b;
		--c-signal-down: #f06262;

		--c-ma-1: #f06262;
		--c-ma-2: #2fc27b;
		--c-ma-3: #ff93d6;
		--c-ma-4: #c9b46a;
		--c-ma-5: #4fc1b3;
		--c-ma-6: #b08cf0;
		--c-ma-7: #f2a64a;
		--c-ma-8: #6fb1f2;
		--c-ma-9: #e0789f;
		--c-ma-10: #9cc25a;

		--c-cmp-1: #f5a050;
		--c-cmp-2: #b18be8;
		--c-cmp-3: #4fc1b3;

		--c-crosshair: #4a5160;
		--c-tag: #3a4254;
		--c-tag-text: #e8eaee;
		--c-trend: #b3b8c0;
		--c-channel: #80878f;
		--level-color: #d9b84a;
		--fib-color: #a58be0;
		--c-marker-fill: #00ced1;
		--c-divider: #262d40;
	}

	::-webkit-calendar-picker-indicator {
		filter: invert(1);
		opacity: .6;
	}
}

/* ===== Base ===================================================================== */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	font-size: 62.5%;
	-webkit-text-size-adjust: 100%;
	overflow-y: scroll;
}

body {
	margin: 0;
	font-family: var(--font-family);
	font-optical-sizing: auto;
	font-size: var(--fs-md);
	line-height: 1.45;
	color: var(--ink);
	background: var(--page);
}

a {
	color: inherit;
}

code {
	font-size: .95em;
}

/* ===== Layout ===================================================================
   Wide screens: menu (310px) beside the chart. Narrow screens: a bar on top, the
   menu opens under it over the chart. */

main {
	min-height: 100vh;
	padding: 1rem;
}

section {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	align-items: flex-start;
}

menu {
	margin: 0;
	padding: 0;
	flex: 1 1 100%;
	position: relative;
}

article {
	flex: 1 1 100%;
	min-width: 0;
	position: relative;
	background: var(--chart-bg);
	border: 1px solid var(--rule);
	border-radius: 1rem;
	padding: .4rem 0 0;
}

/* no data, or the data could not be loaded: a message in place of the chart */
article.is-empty > svg {
	display: none;
}

.chart-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: .6rem;
	min-height: clamp(24rem, 50vh, 40rem);
	padding: 2rem;
	text-align: center;
}

.chart-empty svg {
	display: block;
	width: 3.6rem;
	height: 3.6rem;
	margin-bottom: .4rem;
	fill: none;
	stroke: var(--muted);
	stroke-width: 1.5;
	stroke-linecap: round;
	stroke-linejoin: round;
	opacity: .6;
}

.chart-empty p {
	margin: 0;
	max-width: 32rem;
}

.chart-empty-title {
	font-size: var(--fs-lg);
	font-weight: 600;
	color: var(--ink);
}

.chart-empty-hint {
	font-size: var(--fs-sm);
	color: var(--muted);
}

.chart-empty-retry {
	margin-top: .8rem;
	padding: .6rem 1.6rem;
	font: inherit;
	font-size: var(--fs-md);
	font-weight: 600;
	color: var(--accent);
	background: none;
	border: 1px solid var(--rule);
	border-radius: 2rem;
	cursor: pointer;
}

.chart-empty-retry:hover {
	background: var(--accent-soft);
	border-color: var(--accent);
}

article svg {
	display: block;
	width: 100%;
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	user-select: none;
}

/* the small print at the end of the menu, after Help */
.colophon {
	margin: 1.6rem 1.2rem 1rem;
	font-size: var(--fs-xs);
	line-height: 1.6;
	color: var(--muted);
}

.colophon a {
	color: inherit;
}

@media screen and (min-width: 900px) {
	section {
		flex-wrap: nowrap;
	}

	menu {
		flex: 0 0 31rem;
		position: sticky;
		top: 1rem;
		max-height: calc(100vh - 2rem);
		overflow-x: hidden;
		overflow-y: auto;
		overscroll-behavior: contain;
	}

	article {
		flex: 1 1 auto;
	}
}

/* The menu scrolls without a visible scroll bar (no strip taken from its width).
   A soft fade at the top or bottom edge shows that there is more to scroll; the
   script sets fade-top / fade-bottom while there is. */
menu,
#cpanel {
	scrollbar-width: none;
}

menu::-webkit-scrollbar,
#cpanel::-webkit-scrollbar {
	display: none;
}

.fade-bottom {
	-webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 3rem), transparent);
	mask-image: linear-gradient(to bottom, #000 calc(100% - 3rem), transparent);
}

.fade-top {
	-webkit-mask-image: linear-gradient(to top, #000 calc(100% - 3rem), transparent);
	mask-image: linear-gradient(to top, #000 calc(100% - 3rem), transparent);
}

.fade-top.fade-bottom {
	-webkit-mask-image: linear-gradient(to bottom, transparent, #000 3rem, #000 calc(100% - 3rem), transparent);
	mask-image: linear-gradient(to bottom, transparent, #000 3rem, #000 calc(100% - 3rem), transparent);
}

/* ===== Menu bar ================================================================= */

.menu-bar {
	/* above the swipe strip on the right edge, so the menu button stays tappable */
	position: relative;
	z-index: 19;
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 1rem;
	margin-bottom: 1rem;
}

.logo {
	display: flex;
	justify-content: center;
	width: 4rem;
}

.logo svg {
	fill: var(--accent);
}

#menu {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

/* two short lines in the right corner, the lower one shorter */
.menu-toggle {
	grid-column: 3;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: flex-end;
	gap: .5rem;
	width: 3.6rem;
	height: 3.6rem;
	padding: 0 .9rem;
	box-sizing: border-box;
	border-radius: 50%;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: background-color .15s;
	position: relative;
}

/* a 44px touch target around the small icon */
.menu-toggle::after {
	content: '';
	position: absolute;
	inset: -.4rem;
}

.menu-toggle span {
	display: block;
	width: 1.8rem;
	height: 2px;
	border-radius: 2px;
	background: var(--ink);
	transition: width .2s ease;
}

.menu-toggle span + span {
	width: 1.1rem;
}

.menu-toggle:hover span + span {
	width: 1.8rem;
}

.menu-toggle:hover,
.menu-toggle:active {
	background: var(--surface);
}

#menu:focus-visible ~ .menu-bar .menu-toggle {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* ===== Menu panel: a drawer from the right on phones and tablets =================== */

.menu-backdrop,
.menu-edge,
.drawer-head {
	display: none;
}

@media screen and (max-width: 899px) {
	/* The only place of this breakpoint: the script reads --small-screen to know
	   that the menu is a drawer (main.js / controls.js, smallScreen()). */
	:root {
		--small-screen: 1;
	}

	#cpanel {
		position: fixed;
		z-index: 20;
		top: 0;
		right: 0;
		bottom: 0;
		width: min(33.3rem, calc(100vw - 4rem));
		overflow-x: hidden;
		overflow-y: auto;
		overscroll-behavior: contain;
		touch-action: pan-y;
		padding: 0 1rem calc(1rem + env(safe-area-inset-bottom));
		background: var(--page);
		border-left: 1px solid var(--rule);
		transform: translateX(100%);
		visibility: hidden;
		transition: transform .25s ease, visibility 0s .25s;
	}

	#menu:checked ~ #cpanel {
		transform: none;
		visibility: visible;
		transition: transform .25s ease;
	}

	.menu-backdrop {
		display: block;
		position: fixed;
		z-index: 19;
		inset: 0;
		/* no dimming: on iPhone a dark layer over the whole screen also tints
		   Safari's bars at the top and bottom. The layer stays, invisible, so a
		   tap beside the menu still closes it. */
		background: transparent;
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		touch-action: none;
		transition: opacity .25s ease, visibility 0s .25s;
	}

	#menu:checked ~ .menu-backdrop,
	menu.dragging .menu-backdrop {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
		transition: opacity .25s ease;
	}

	/* a strip along the right edge, 50px wide (over the price axis): swipe left from it to open the menu.
	   Starting a little inside the edge keeps clear of the browser's own
	   back / forward swipe, which starts at the very edge. */
	.menu-edge {
		display: block;
		position: fixed;
		z-index: 18;
		top: 0;
		right: 0;
		bottom: 0;
		width: 5rem;
		/* a vertical swipe here still scrolls the page (it lies over the price axis) */
		touch-action: pan-y;
	}

	#menu:checked ~ .menu-edge {
		display: none;
	}

	/* while a finger moves the drawer, it follows without animation */
	menu.dragging #cpanel {
		visibility: visible;
		transition: none;
	}

	menu.dragging .menu-backdrop {
		transition: none;
	}

	.drawer-head {
		display: flex;
		justify-content: flex-end;
		position: sticky;
		top: 0;
		z-index: 1;
		padding: 1rem 0 .6rem;
		background: var(--page);
	}

	.menu-close {
		position: relative;
		width: 3.6rem;
		height: 3.6rem;
		border-radius: 50%;
		cursor: pointer;
		-webkit-tap-highlight-color: transparent;
	}

	.menu-close:hover {
		background: var(--surface);
	}

	.menu-close span::before,
	.menu-close span::after {
		content: '';
		position: absolute;
		left: .9rem;
		top: calc(50% - 1px);
		width: 1.8rem;
		height: 2px;
		border-radius: 2px;
		background: var(--ink);
		transform: rotate(45deg);
	}

	.menu-close span::after {
		transform: rotate(-45deg);
	}

	body:has(#menu:checked) {
		overflow: hidden;
	}
}

@media (prefers-reduced-motion: reduce) {
	#cpanel,
	#menu:checked ~ #cpanel,
	.menu-backdrop {
		transition: none !important;
	}
}

@media screen and (min-width: 900px) {
	.menu-toggle {
		visibility: hidden;
	}

	/* its wider touch area stuck 4px out of the sidebar and let it scroll sideways */
	.menu-toggle::after {
		display: none;
	}
}

/* Every section is the same box; open sections show their controls. */
.section {
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: 1rem;
	margin: 0 0 1rem;
	padding: 0 1.2rem;
}

.section > summary {
	display: flex;
	align-items: baseline;
	gap: .8rem;
	list-style: none;
	cursor: pointer;
	padding: 1.1rem 0;
	font-size: var(--fs-lg);
	font-weight: 600;
}

.section > summary::-webkit-details-marker {
	display: none;
}

.section > summary::after {
	content: '';
	margin-left: auto;
	align-self: center;
	width: .7rem;
	height: .7rem;
	border-right: 2px solid var(--muted);
	border-bottom: 2px solid var(--muted);
	transform: rotate(-45deg);
	transition: transform 150ms ease-out;
}

.section[open] > summary::after {
	transform: rotate(45deg);
}

.section[open] {
	padding-bottom: 1.2rem;
}

.summary-note {
	font-size: var(--fs-sm);
	font-weight: 400;
	color: var(--muted);
}

/* ===== Controls ================================================================= */

input[type=checkbox],
input[type=radio] {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

input[type=text],
input[type=search],
input[type=date],
select {
	width: 100%;
	min-width: 0;
	height: 3.4rem;
	font: inherit;
	font-size: var(--fs-md);
	color: var(--ink);
	background: var(--sunken);
	border: 1px solid var(--rule);
	border-radius: .6rem;
	padding: 0 .8rem;
	outline: none;
}

input[type=text] {
	text-align: center;
	font-variant-numeric: tabular-nums;
}

input::placeholder {
	color: var(--muted);
	opacity: .75;
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
input:focus-visible + label {
	outline: 2px solid var(--accent);
	outline-offset: 1px;
}

.button {
	height: 3.4rem;
	font: inherit;
	font-size: var(--fs-md);
	font-weight: 600;
	color: var(--accent-ink);
	background: var(--accent);
	border: 1px solid var(--accent);
	border-radius: .6rem;
	cursor: pointer;
}

.button.quiet {
	color: var(--ink);
	background: var(--sunken);
	border-color: var(--rule);
}

.button.dashed {
	width: 100%;
	color: var(--accent);
	background: none;
	border: 1px dashed var(--rule);
	font-weight: 400;
}

.button:disabled {
	opacity: .45;
	cursor: default;
}

/* on / off: the same height and look everywhere */
.toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 3.4rem;
	padding: 0 1rem;
	border: 1px solid var(--rule);
	border-radius: .6rem;
	background: var(--sunken);
	font-size: var(--fs-md);
	cursor: pointer;
	user-select: none;
	white-space: nowrap;
}

.toggle:hover {
	border-color: var(--accent);
}

input:checked + .toggle {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--accent-ink);
}

/* Compare: with the switch on, the currency list takes several currencies; each
   chosen one shows a short line in its colour on the chart, so the list is the
   legend too. What does not apply to lines in percent is faded meanwhile. */
.compare-box {
	margin-top: .8rem;
}

.rate-list .sw {
	display: inline-block;
	width: 1.4rem;
	height: 3px;
	margin-right: .6rem;
	vertical-align: middle;
	position: relative;
	top: -1px;
	border-radius: 2px;
	background: var(--sw);
}

.rate-list label.picked {
	background: var(--accent-soft);
	background: color-mix(in srgb, var(--accent-soft) 55%, transparent);
}

.rate-list label.picked b {
	font-weight: 600;
}

/* the quote currency cannot be compared in itself */
.rate-list label.na {
	opacity: .4;
	cursor: default;
}

.compare-note {
	display: none;
	font-size: var(--fs-xs);
	font-weight: 400;
	color: var(--muted);
}

body.comparing .compare-note {
	display: inline;
}

body.comparing #overlays > summary .summary-title,
body.comparing #indicators > summary .summary-title,
body.comparing #overlays > :not(summary),
body.comparing #indicators > :not(summary),
body.comparing #tools .option-row:has(#signals, #forecasts, #logscale) {
	opacity: .45;
}

body.comparing .draw-tools {
	display: none;
}

/* Quote: the currency the chosen one is priced in (ALL, or another for a cross
   rate). The first row of the box with Compare, as a heading row with its select. */
.quote-row > label {
	min-width: 0;
}

.quote-row.option-head .desc {
	white-space: normal;
}

.quote-row select {
	width: 8.4rem;
	height: 3.2rem;
}

/* a cross rate is on: the box takes the accent, like the chosen currency above,
   so it shows that the price is no longer in lek */
.quote-row select:has(option:checked:not([value="ALL"])) {
	color: var(--accent);
	font-weight: 600;
	background-color: var(--accent-soft);
	border-color: var(--accent);
}

/* ===== Currency: one line per currency ===========================================
   Code, rate (coloured by direction), change in percent and in value. Every row
   has the same fixed columns, so the figures line up from top to bottom (no
   subgrid: Safari before iOS 16 does not know it). Same frame and hairlines as
   the option lists below. */

.rate-list {
	background: var(--sunken);
	border: 1px solid var(--rule);
	border-radius: .8rem;
	overflow: hidden;
	font-variant-numeric: tabular-nums;
}

.cols-4 { grid-template-columns: repeat(4, 1fr); }

.rate-list label {
	display: grid;
	grid-template-columns: 4.4rem minmax(0, 1fr) 5rem 6.4rem;
	align-items: baseline;
	column-gap: .8rem;
	padding: 1rem;
	cursor: pointer;
	transition: background-color .12s;
}

.rate-list label + input + label {
	border-top: 1px solid var(--rule);
}

.rate-list label:hover {
	background: var(--surface);
}

.rate-list input:checked + label {
	background: var(--accent-soft);
	box-shadow: inset 3px 0 0 var(--accent);
}

.rate-list input:focus-visible + label {
	outline: 2px solid var(--accent);
	outline-offset: -2px;
}

.rate-list b {
	font-size: var(--fs-md);
	font-weight: 500;
	white-space: nowrap;
}

.rate-list input:checked + label b {
	color: var(--accent);
	font-weight: 600;
}

.rate-list b small {
	font-weight: 400;
	color: var(--muted);
	font-size: var(--fs-2xs);
}

.rate-list .rate,
.rate-list .change,
.rate-list .delta {
	justify-self: end;
	white-space: nowrap;
}

.rate-list .rate {
	font-size: var(--fs-md);
	font-weight: 500;
	color: var(--ink);
}

.rate-list .rate.grc { color: var(--up); }
.rate-list .rate.rec { color: var(--down); }

.rate-list .change,
.rate-list .delta {
	font-size: var(--fs-xs);
	color: var(--muted);
}

/* the rate stands apart from its changes */
.rate-list .change {
	padding-left: 1rem;
}

/* phones (the menu is a drawer): the same single line, a little tighter */
@media screen and (max-width: 899px) {
	.rate-list label {
		grid-template-columns: 4rem minmax(0, 1fr) 4.8rem 6rem;
		column-gap: .6rem;
		padding: 1rem .8rem;
	}

	.rate-list .change {
		padding-left: 0;
	}
}

/* the narrowest phones (320 px): smaller figures, a shorter Compare swatch */
@media screen and (max-width: 359px) {
	.rate-list label {
		grid-template-columns: 3.8rem minmax(0, 1fr) 4.4rem 5.6rem;
		column-gap: .4rem;
		padding: 1rem .6rem;
	}

	.rate-list b,
	.rate-list .rate {
		font-size: var(--fs-sm);
	}

	.rate-list .change,
	.rate-list .delta {
		font-size: var(--fs-2xs);
	}

	.rate-list .sw {
		width: .8rem;
		margin-right: .3rem;
	}

	.quote-row select {
		width: 7rem;
	}
}

/* ===== Period: interval and range ==================================================
   One frame per group with hairlines between the cells; the chosen cell is filled. */

.cell-grid {
	display: grid;
	gap: 1px;
	background: var(--rule);
	border: 1px solid var(--rule);
	border-radius: .8rem;
	overflow: hidden;
}

.cell-grid + .cell-grid,
.cell-grid + .option-list {
	margin-top: .8rem;
}

.cell-grid label {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--sunken);
	cursor: pointer;
	font-variant-numeric: tabular-nums;
}

.cell-grid label:hover {
	background: var(--surface);
}

.cell-grid input:checked + label {
	background: var(--accent);
	color: var(--accent-ink);
	font-weight: 600;
}

.cell-grid input:focus-visible + label {
	outline: 2px solid var(--accent);
	outline-offset: -3px;
}

.segmented label {
	height: 3.6rem;
	font-size: var(--fs-md);
}

/* range: a logarithmic ruler, 1M on the left, Max on the right. The labels sit
   under their ticks; the chosen value is shown in a small accent tag on the line. */
.ruler {
	--inset: 1.6rem;
	position: relative;
	height: 6rem;
	margin: .4rem 0 .2rem;
	cursor: pointer;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
	border-radius: .6rem;
}

.ruler-line {
	position: absolute;
	left: var(--inset);
	right: var(--inset);
	top: 2.6rem;
	border-top: 1px solid var(--rule);
}

.ruler label {
	position: absolute;
	top: 2rem;
	left: calc(var(--inset) + (100% - 2 * var(--inset)) * var(--p));
	transform: translateX(-50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: .5rem;
	font-size: var(--fs-sm);
	color: var(--muted);
	white-space: nowrap;
	pointer-events: none;
	font-variant-numeric: tabular-nums;
}

.ruler label::before {
	content: '';
	width: 2px;
	height: 1.2rem;
	border-radius: 1px;
	background: var(--rule);
}

.ruler input:checked + label {
	color: transparent;
}

.ruler-mark {
	position: absolute;
	top: .3rem;
	left: calc(var(--inset) + (100% - 2 * var(--inset)) * var(--p, .4529));
	transform: translateX(-50%);
	padding: .2rem .8rem;
	border-radius: .6rem;
	background: var(--accent);
	color: var(--accent-ink);
	font-size: var(--fs-sm);
	font-weight: 600;
	white-space: nowrap;
	pointer-events: none;
	transition: left .12s;
}

.ruler input:focus-visible,
.ruler input:focus-visible + label {
	outline: none;
}

/* keyboard focus (arrow keys move along the ruler): a ring around the tag */
.ruler:has(input:focus-visible) .ruler-mark {
	box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
}

@media (max-width: 359px) {
	.ruler {
		--inset: 1.3rem;
	}

	.ruler label {
		font-size: var(--fs-xs);
	}
}

/* a custom date range is active: the ruler steps back */
.ruler.inactive {
	opacity: .4;
}

.cell-grid + .ruler {
	margin-top: 1.2rem;
}

.ruler + .option-list {
	margin-top: .6rem;
}

/* custom dates: a list with From, To and the two actions at the bottom */
.field-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 15rem);
	align-items: center;
	gap: .8rem;
	min-height: 4.6rem;
	padding: 0 .8rem 0 1.2rem;
	font-size: var(--fs-md);
	cursor: pointer;
}

.date-fields .field-row {
	border-top: 1px solid var(--rule);
}

.field-row input {
	box-sizing: border-box;
	width: 100%;
	min-width: 0;
	max-width: 100%;
	height: 3.2rem;
	background: var(--surface);
	padding: 0 .6rem;
	-webkit-appearance: none;
	appearance: none;
	text-align: left;
}

.field-row input::-webkit-date-and-time-value {
	text-align: left;
}

.field-row input::-webkit-calendar-picker-indicator {
	margin-left: auto;
}

/* the From / To rows open under the switch; closed, they take no room and
   cannot be reached with the keyboard */
.date-fields {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows .2s ease;
}

.date-fields > div {
	overflow: hidden;
	visibility: hidden;
	transition: visibility 0s .2s;
}

.date-range:has(#custom:checked) .date-fields {
	grid-template-rows: 1fr;
}

.date-range:has(#custom:checked) .date-fields > div {
	visibility: visible;
	transition-delay: 0s;
}

.option-apply {
	display: block;
	width: 100%;
	min-height: 4.4rem;
	font: inherit;
	font-size: var(--fs-md);
	font-weight: 600;
	color: var(--accent);
	background: none;
	border: 0;
	border-top: 1px solid var(--rule);
	cursor: pointer;
}

.option-apply:hover {
	background: var(--accent-soft);
}

@media (prefers-reduced-motion: reduce) {
	.date-fields,
	.date-fields > div {
		transition: none;
	}
}

/* ===== Overlays, indicators, tools: option lists ===================================
   One bordered list per group. Every row: a switch with the name on the left, the
   parameters (equal fields) on the right. Rows of a list share the same height. */

.option-list {
	border: 1px solid var(--rule);
	border-radius: .8rem;
	background: var(--sunken);
	overflow: hidden;
}

.option-list + .option-list {
	margin-top: .8rem;
}

.option-row {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	min-height: 4.8rem;
	padding-right: .8rem;
	position: relative;
}

.option-row + .option-row,
#ma-list .ma-row + .ma-row,
#ma-list .ma-palette + .ma-row,
#ma-list:not(:empty) + .option-add {
	border-top: 1px solid var(--rule);
}

/* switch: the label is the whole left part of the row */
.switch {
	display: grid;
	grid-template-columns: 3.4rem 1fr;
	grid-template-rows: auto auto;
	column-gap: 1rem;
	align-items: center;
	align-self: stretch;
	align-content: center;
	padding: .6rem 0 .6rem 1.2rem;
	cursor: pointer;
	user-select: none;
	min-width: 0;
}

.switch::before {
	content: '';
	grid-row: 1 / 3;
	width: 3.4rem;
	height: 2rem;
	border-radius: 1rem;
	background: var(--rule);
	box-shadow: inset 0 0 0 1px var(--rule);
	transition: background 150ms ease-out;
}

.switch::after {
	content: '';
	position: absolute;
	left: 1.5rem;
	top: 50%;
	width: 1.4rem;
	height: 1.4rem;
	margin-top: -.7rem;
	border-radius: 50%;
	background: var(--knob);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
	transition: transform 150ms ease-out;
}

input:checked + .switch::before {
	background: var(--accent);
	box-shadow: none;
}

input:checked + .switch::after {
	transform: translateX(1.4rem);
}

/* a switch that does not apply now (Forecasts with another Quote currency) */
input:disabled + .switch {
	opacity: .45;
	cursor: default;
}

.switch .name {
	font-size: var(--fs-md);
	font-weight: 600;
	line-height: 1.2;
}

.switch .desc {
	grid-column: 2;
	font-size: var(--fs-xs);
	color: var(--muted);
	line-height: 1.25;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.params {
	display: flex;
	gap: .5rem;
}

.params input {
	width: 4.2rem;
	height: 3.2rem;
	background: var(--surface);
}

/* a group heading inside a list (MACD): its name and periods, without a switch;
   the switches under it belong to it */
.option-head {
	padding-left: 1.2rem;
}

.option-head .name,
.option-head .desc {
	display: block;
}

.option-head .name {
	font-size: var(--fs-md);
	font-weight: 600;
	line-height: 1.2;
}

.option-head .desc {
	font-size: var(--fs-xs);
	color: var(--muted);
	line-height: 1.25;
	white-space: nowrap;
}

/* the crosshair mode (Magnet / Free) in place of the period fields; faint while
   the crosshair is off */
.mode-pick {
	display: grid;
	grid-template-columns: auto auto;
	gap: 1px;
}

.mode-pick label {
	height: 3.2rem;
	padding: 0 1rem;
	font-size: var(--fs-sm);
}

/* Save as PNG: an arrow at the end of the first legend row, above the price
   axis (the legend leaves that room), that opens the two sizes. A details
   element: a second tap closes it. Outside the svg, so not in the image.
   z-index as the swipe edge of the phone menu, later in the page, so above it. */
.save-menu {
	position: absolute;
	top: .8rem;
	right: .8rem;
	z-index: 18;
}

/* the arrow like the legend text: small, grey, no frame; a little invisible
   room around it so it is easy to tap */
.save-menu > summary {
	display: block;
	padding: .4rem;
	margin: -.4rem;
	list-style: none;
	line-height: 0;
	color: var(--muted);
	cursor: pointer;
}

/* no chart (loading for the first time, no data, a message): nothing to save */
article.is-empty .save-menu {
	display: none;
}

.save-menu > summary::-webkit-details-marker {
	display: none;
}

.save-menu > summary:hover,
.save-menu[open] > summary {
	color: var(--accent);
}

.save-menu svg {
	width: 1.3rem;
	height: 1.3rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.save-pick {
	position: absolute;
	top: 2rem;
	right: 0;
	display: grid;
	min-width: 20rem;
	padding: .6rem;
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: 1rem;
	box-shadow: 0 .6rem 2rem rgba(0, 0, 0, .12);
}

.save-pick > span {
	padding: .4rem .8rem .6rem;
	font-size: var(--fs-xs);
	color: var(--muted);
}

.save-pick button {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1.6rem;
	padding: .9rem .8rem;
	font: inherit;
	font-size: var(--fs-md);
	font-weight: 600;
	color: var(--ink);
	background: none;
	border: 0;
	border-radius: .6rem;
	cursor: pointer;
}

.save-pick small {
	font-size: var(--fs-xs);
	font-weight: 400;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}

.save-pick button:hover {
	background: var(--sunken);
}

.save-pick button:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: -2px;
}

.save-pick button:disabled {
	opacity: .55;
	cursor: default;
}

.option-row:has(#crosshair:not(:checked)) .mode-pick {
	opacity: .55;
}

/* PPO changes the MACD lines and histogram: faint while neither is on */
.option-list:has(#macd:not(:checked)):has(#macdh:not(:checked)) label[for="ppo"] {
	opacity: .55;
}

@media (prefers-reduced-motion: reduce) {
	.switch::before,
	.switch::after,
	.section > summary::after {
		transition: none;
	}
}

/* moving averages: colour, type, period, remove */
.ma-row {
	display: grid;
	grid-template-columns: 2.4rem 1fr 4.2rem 3.2rem;
	gap: .8rem;
	align-items: center;
	min-height: 4.8rem;
	padding: 0 .8rem 0 1rem;
}

/* the colour dot opens the palette; the ten colours sit in one row under it */
.ma-swatch,
.ma-colour {
	display: grid;
	place-items: center;
	padding: 0;
	background: none;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
}

.ma-swatch {
	width: 2.4rem;
	height: 2.4rem;
}

.ma-swatch::before,
.ma-colour::before {
	content: '';
	border-radius: 50%;
	background: var(--dot);
}

.ma-swatch::before {
	width: 1.2rem;
	height: 1.2rem;
}

.ma-swatch:hover::before,
.ma-swatch[aria-expanded="true"]::before {
	box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--dot);
}

.ma-palette {
	display: grid;
	grid-template-columns: repeat(10, 1fr);
	gap: .2rem;
	padding: .6rem 1rem .8rem;
	border-top: 1px dashed var(--rule);
}

.ma-colour {
	height: 2.8rem;
}

.ma-colour::before {
	width: 1.6rem;
	height: 1.6rem;
}

.ma-colour:hover::before {
	transform: scale(1.15);
}

/* the colour the average has now */
.ma-colour[aria-pressed="true"]::before {
	box-shadow: 0 0 0 2px var(--sunken), 0 0 0 4px var(--dot);
}

/* the same select everywhere (Safari draws native selects differently) */
select {
	-webkit-appearance: none;
	appearance: none;
	padding-right: 2.6rem;
	background-color: var(--surface);
	background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
	background-position: right 1.3rem center, right .9rem center;
	background-size: .4rem .4rem, .4rem .4rem;
	background-repeat: no-repeat;
	cursor: pointer;
}

.ma-row input {
	height: 3.2rem;
	background: var(--surface);
}

.ma-row select {
	height: 3.2rem;
}

.ma-remove {
	width: 3.2rem;
	height: 3.2rem;
	font: inherit;
	font-size: var(--fs-icon);
	line-height: 1;
	color: var(--muted);
	background: none;
	border: 1px solid transparent;
	border-radius: .6rem;
	cursor: pointer;
}

.ma-remove:hover {
	color: var(--down);
	border-color: var(--rule);
}

.option-add {
	display: block;
	width: 100%;
	min-height: 4.4rem;
	font: inherit;
	font-size: var(--fs-md);
	color: var(--accent);
	background: none;
	border: 0;
	cursor: pointer;
	text-align: center;
}

.option-add::before {
	content: '+';
	margin-right: .6rem;
	font-weight: 600;
}

.option-add:hover {
	background: var(--accent-soft);
}

.option-add:disabled {
	color: var(--muted);
	cursor: default;
	background: none;
}

/* ===== Tools, converter, help ===================================================== */

/* converter: amount and its currency on top, result and its currency below, the
   swap button in its own column between the two currencies, the rate and its
   date at the bottom */
.conv-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 3.6rem 8.4rem;
	grid-template-areas: "amount swap from" "result swap to";
	align-items: center;
	column-gap: .2rem;
	padding: 0 .9rem 0 1.2rem;
}

/* the line between amount and result, under the first column only */
.conv-grid::before {
	content: '';
	grid-column: 1;
	grid-row: 2;
	align-self: start;
	margin-left: -1.2rem;
	border-top: 1px solid var(--rule);
}

.conv-grid select {
	height: 3.2rem;
	margin: .7rem 0;
	font-weight: 600;
}

#q-from { grid-area: from; }
#q-to { grid-area: to; }
#q-amount { grid-area: amount; }
#q-result { grid-area: result; }

/* a long amount shows "…" when the field is left */
#q-amount {
	height: 3.2rem;
	padding: 0;
	text-overflow: ellipsis;
	border: 0;
	background: none;
	text-align: left;
	font-size: var(--fs-md);
	font-weight: 500;
}

#q-amount:focus-visible {
	outline: none;
	box-shadow: 0 2px 0 var(--accent);
	border-radius: 0;
}

/* the result on one line, "…" if it is too long; a tap copies it in full */
#q-result {
	font-size: var(--fs-md);
	font-weight: 600;
	color: var(--accent);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	cursor: pointer;
}

#q-result.copied {
	font-weight: 400;
	color: var(--muted);
}

/* close to the two currencies it swaps */
#q-swap {
	grid-area: swap;
	justify-self: end;
	display: grid;
	place-items: center;
	width: 3rem;
	height: 3rem;
	padding: 0;
	border-radius: 50%;
	border: 1px solid var(--rule);
	background: var(--surface);
	color: var(--muted);
	cursor: pointer;
}

/* the arrows as a drawing, not a character: a text arrow comes from a fallback
   font on some phones and sits off centre */
#q-swap svg {
	width: 1.6rem;
	height: 1.6rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

#q-swap:hover {
	color: var(--accent);
	border-color: var(--accent);
}

.conv-note {
	white-space: pre-line;
	line-height: 1.5;
	margin: 0;
	padding: .9rem 1.2rem;
	border-top: 1px solid var(--rule);
	font-size: var(--fs-xs);
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}

.conv-note.error {
	color: var(--down);
}

/* Help: plain text like a short manual, no frames, so it does not look like the
   controls above. A small grey heading per group, then each action in ink with
   its explanation in grey under it. */
/* one group per subject, opened with a tap (details), in a frame like the
   option lists: its name and what it covers, the text under it when open */
.help-box {
	background: var(--sunken);
	border: 1px solid var(--rule);
	border-radius: .8rem;
	overflow: hidden;
}

.help-group + .help-group {
	border-top: 1px solid var(--rule);
}

.help-group > summary {
	display: grid;
	padding: 1rem 1.2rem;
	list-style: none;
	cursor: pointer;
}

.help-group > summary::-webkit-details-marker {
	display: none;
}

.help-group .name {
	font-size: var(--fs-md);
	font-weight: 600;
	line-height: 1.2;
}

.help-group .desc {
	grid-row: 2;
	font-size: var(--fs-xs);
	color: var(--muted);
	line-height: 1.25;
}

.help-group > summary:hover {
	background: var(--surface);
}

.help-group[open] > summary .name {
	color: var(--accent);
}

/* the text of an open group, on the page colour, inset a little */
.help-group[open] {
	padding-bottom: 1.4rem;
	background: var(--surface);
}

.help-group > :not(summary) {
	margin-left: 1.2rem;
	margin-right: 1.2rem;
}

.help-list {
	margin: 0;
	display: grid;
	gap: .9rem;
}

.help-list > div {
	display: block;
}

.help-list dt {
	font-size: var(--fs-xs);
	font-weight: 600;
	color: var(--ink);
}

.help-list dd {
	margin: .1rem 0 0;
	font-size: var(--fs-xs);
	line-height: 1.5;
	color: var(--muted);
}

/* keys as plain words in ink, not as buttons; the forecast star in its own colour */
.help-list kbd,
.help-mark {
	font: inherit;
	font-weight: 600;
	color: var(--ink);
}

.help-mark {
	color: var(--c-marker-fill);
}

.help-note {
	margin: .9rem 0 0;
	font-style: italic;
	font-size: var(--fs-xs);
	color: var(--muted);
}

/* a note right under a group's name: belongs to the list that follows */
.help-group > summary + .help-note {
	margin-top: .2rem;
	margin-bottom: .8rem;
}

/* messages above the chart (data errors) */
#data-status {
	margin: .6rem 1rem;
	font-size: var(--fs-sm);
	color: var(--down);
}

#data-status:empty {
	display: none;
}

/* ===== Chart ==================================================================== */

svg text {
	font-size: var(--fs-xs);
	font-family: var(--font-family);
	pointer-events: none;
}

.domain {
	stroke: var(--axis-domainc);
}

.tick text {
	fill: var(--axis-textc);
}

.tick line {
	stroke: var(--axis-domainc);
}

.grid,
.macdgrid,
.rsrcgrid {
	cursor: default;
}

/* crosshair on: a small dot (rimmed: visible in both themes) */
svg.crosshair-on.magnet-off .grid,
svg.crosshair-on.magnet-off .macdgrid,
svg.crosshair-on.magnet-off .rsrcgrid {
	cursor: crosshair;
}

svg.crosshair-on:not(.magnet-off) .grid,
svg.crosshair-on:not(.magnet-off) .macdgrid,
svg.crosshair-on:not(.magnet-off) .rsrcgrid {
	cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9'%3E%3Ccircle cx='4.5' cy='4.5' r='2.5' fill='%2338678f' stroke='%23fff' stroke-width='1.5'/%3E%3C/svg%3E") 4 4, default;
}

/* dragging the chart or a horizontal level */
svg.panning,
svg.panning * {
	cursor: grabbing !important;
}

/* grid, reference lines, latest price */
.price-grid line {
	stroke: var(--grid-color);
	stroke-width: 1;
}

svg.grid-off .price-grid {
	display: none;
}

.ref-line {
	stroke: var(--ref-line);
}

.ref-line.roc-zero {
	stroke: var(--c-roc);
}

.last-price line {
	stroke: var(--c-price);
}

.last-price rect {
	fill: var(--c-price);
}

.last-price text {
	fill: var(--c-tag-text);
	font-weight: 600;
}

/* comparison: the 0% line and the latest change of each currency on the axis */
.compare-zero {
	stroke: var(--ref-line);
	stroke-width: .75;
	stroke-dasharray: 4 3;
}

.compare-tags text {
	fill: var(--c-tag-text);
	font-weight: 600;
}

/* Bollinger area, price line, MACD histogram */
.abbc {
	fill: var(--fill-bba);
	opacity: var(--opacity-bba);
}

.dline path.price-line {
	stroke-width: 1.75;
}

.dline path.compare-line {
	stroke-width: 1.4;
}

.macdhc {
	opacity: 0.7;
}

/* legends: names in grey, values in ink; the pair and price in bold, same size */
.legend-row text {
	font-variant-numeric: tabular-nums;
	font-size: var(--fs-xs);
}

.legend-row .lg-label {
	fill: var(--muted);
}

.legend-row .lg-value {
	fill: var(--ink);
	font-weight: 500;
}

.legend-row .lg-strong {
	fill: var(--ink);
	font-weight: 600;
}

.legend-row .lg-up {
	fill: var(--up);
	font-weight: 500;
}

.legend-row .lg-down {
	fill: var(--down);
	font-weight: 500;
}

.legend-row .lg-band {
	fill: var(--c-band);
	fill-opacity: .15;
	stroke-width: 1;
}

/* space between panels: drag to change their heights */
.panel-divider {
	cursor: row-resize;
}

/* drawing tools and markers: a pointing hand to select; a selected line is
   grabbed whole, an end handle moved */
.info-marker,
.trendlines path,
.level-hit {
	cursor: pointer;
}

.trendlines path.selected {
	cursor: grab;
}

.trend-handle {
	cursor: move;
}

.trend-handle,
.level-hit,
.panel-divider {
	touch-action: none;
}

.panel-divider-guide {
	stroke: var(--accent);
	stroke-width: 1;
	stroke-dasharray: 4 3;
}

/* crosshair and its tags on the axes */
.chart-crosshair line {
	stroke: var(--c-crosshair);
}

.axis-tag rect {
	fill: var(--c-tag);
}

.axis-tag text {
	fill: var(--c-tag-text);
}

/* Drawing on touch screens: a pencil at the top left of the price panel (its
   place is set by the chart: --draw-top, --draw-left) shows four small tools.
   Only on touch screens; a mouse has its own gestures (Help, Drawing). */
.draw-tools {
	position: absolute;
	top: var(--draw-top, 4rem);
	left: var(--draw-left, 1rem);
	z-index: 5;
	display: none;
	flex-direction: column;
	gap: 5px;
}

@media (pointer: coarse) {
	.draw-tools {
		display: flex;
	}
}

article.is-empty .draw-tools {
	display: none;
}

.draw-tools button {
	position: relative;
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	padding: 0;
	color: var(--ink);
	background: var(--surface);
	background: color-mix(in srgb, var(--surface) 85%, transparent);
	border: 1px solid var(--rule);
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

/* a larger area to tap than the button shows */
.draw-tools button::before {
	content: '';
	position: absolute;
	inset: -3px;
}

.draw-tools button svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.draw-tools button svg .fill {
	fill: currentColor;
}

.draw-tools:not(.open) button:not([data-tool="toggle"]) {
	display: none;
}

.draw-tools.open button[data-tool="toggle"] {
	color: var(--accent);
	background: var(--accent-soft);
	border-color: var(--accent);
}

.draw-tools button[aria-pressed="true"] {
	color: var(--accent-ink);
	background: var(--accent);
	border-color: var(--accent);
}

.draw-tools button:disabled {
	opacity: .35;
	cursor: default;
}

.draw-hint {
	position: absolute;
	left: 40px;
	top: var(--hint-top, 0);
	padding: 5px 9px;
	font-size: var(--fs-sm);
	line-height: 1.2;
	white-space: nowrap;
	color: var(--accent-ink);
	background: var(--accent);
	border-radius: 7px;
	pointer-events: none;
}

.draw-hint[hidden] {
	display: none;
}

/* trend lines, handles, horizontal levels, Fibonacci */
path.trend {
	stroke: var(--c-trend);
}

.channel-fill {
	fill: var(--c-channel);
	opacity: .08;
}

/* both lines of a channel (the trend line of a channel too) */
.channel-side,
path.trend.is-channel {
	fill: none;
	stroke: var(--c-channel);
}

.channel-mid {
	fill: none;
	stroke: var(--c-channel);
	stroke-width: .6;
	stroke-dasharray: 4 3;
}

.channel-hit {
	cursor: pointer;
}

.trend-handle .handle-dot {
	fill: none;
	stroke: var(--c-trend);
}

.trend-handle.is-channel .handle-dot {
	stroke: var(--c-channel);
}

.level-line {
	stroke: var(--level-color);
	stroke-width: 1;
	stroke-dasharray: 6 4;
}

.level-label {
	fill: var(--level-color);
}

.level.selected .level-line {
	stroke-width: 2;
	stroke-dasharray: none;
}

.level.selected .level-label {
	font-weight: 600;
}

.fib-line {
	stroke: var(--fib-color);
	stroke-width: 0.75;
	stroke-dasharray: 3 3;
	opacity: 0.8;
}

.fib-level:first-child .fib-line,
.fib-level:last-child .fib-line {
	stroke-dasharray: none;
}

.fib-label {
	fill: var(--fib-color);
	font-size: var(--fs-2xs) !important;
}

/* the forecast band after the last rate: the pointer goes through it to the chart
   (its cursor, crosshair and dragging stay the same over the band) */
.forecast-band {
	pointer-events: none;
}

.forecast-band .band-area {
	fill: var(--c-marker-fill);
	fill-opacity: .14;
}

.forecast-band .band-mid {
	fill: none;
	stroke: var(--c-marker-fill);
	stroke-width: 1.5;
	stroke-dasharray: 5 4;
}

/* information markers and their dialog */
.info-marker .marker-dot {
	fill: var(--c-marker-fill);
	fill-opacity: .85;
	/* a thin rim in the page colour keeps the star apart from the lines under it */
	stroke: var(--surface);
	stroke-width: 1.5;
	stroke-linejoin: round;
	paint-order: stroke;
}

.info-marker:hover .marker-dot,
.info-marker:focus-visible .marker-dot {
	fill-opacity: 1;
}

.info-tip {
	position: absolute;
	z-index: 5;
	width: max-content;
	max-width: min(28rem, calc(100% - 1.2rem));
	padding: .8rem 1rem;
	font-size: var(--fs-xs);
	line-height: 1.45;
	color: var(--ink);
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: .8rem;
	box-shadow: 0 .4rem 1.4rem rgba(15, 25, 35, .14);
	pointer-events: auto;
}

.info-tip[hidden] {
	display: none;
}

.info-tip-item + .info-tip-item {
	margin-top: .6rem;
	padding-top: .6rem;
	border-top: 1px solid var(--rule);
}

.info-tip-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0 .6rem;
}

.info-tip-date {
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}

.info-tip strong {
	font-weight: 600;
}

.info-tip-meta {
	margin-top: .2rem;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
	white-space: pre-wrap;
}

.info-tip-dir {
	font-weight: 600;
}

.info-tip-dir.up { color: var(--up); }
.info-tip-dir.down { color: var(--down); }

.info-tip-band {
	margin-top: .4rem;
	border-collapse: collapse;
	font-variant-numeric: tabular-nums;
	color: var(--muted);
}

.info-tip-band td {
	padding: .1rem .9rem 0 0;
	white-space: nowrap;
	text-align: right;
}

.info-tip-band td:first-child {
	text-align: left;
}

.info-tip-band td:last-child {
	padding-right: 0;
	color: var(--c-marker-fill);
	font-weight: 600;
}

.info-tip-band tr.tested {
	color: var(--ink);
}

.info-tip-signals {
	margin-top: .5rem;
	padding-top: .4rem;
	border-top: 1px solid var(--rule);
	color: var(--muted);
}

.info-tip-signals b {
	font-weight: 600;
	color: var(--ink);
}

.info-tip-signals ul {
	margin: .2rem 0 0;
	padding-left: 1.1rem;
}

.info-tip p {
	margin: .3rem 0 0;
	color: var(--muted);
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

/* No focus box around lines, levels, handles and markers in the chart: a selected
   line or level is shown by its own style. Keyboard use still works. */
article svg [tabindex]:focus,
article svg [tabindex]:focus-visible {
	outline: none;
}

@media screen and (max-width: 386px) {
	.tick text {
		font-size: var(--fs-2xs);
	}
}

@media print {
	menu {
		display: none;
	}

	article {
		page-break-after: always;
	}
}
