/* Night: the same design after dark, as a colour swap and nothing else.
   The rainbow, the foil and every gradient keep exactly the same hues, saturation and transparency as by day. Only
   the neutrals swap: wherever day uses white glass at some transparency, night uses ink glass (#111015) at the very same
   transparency; the pastel sky becomes the same three hues, deep; the ink becomes light. It follows the device
   (prefers dark), and a person can pin light or dark (data-theme on <html>, set by /js/theme.js before the page paints).
   Every rule is written twice: for "the device is dark and nothing is pinned", and for "dark is pinned". */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme='light']) { --fg: #f3eefc; --dim: #a59cb6; --ink2: #cfc6de; --line: rgba(225, 210, 255, 0.14); --edge: rgba(230, 215, 255, 0.28); color-scheme: dark; background: #08070a; }
	:root:not([data-theme='light']) body { background: radial-gradient(ellipse 120% 70% at 50% -10%, #17121f 0%, #0a090d 55%), linear-gradient(172deg, #0a090d 0%, #08070a 50%, #07080c 100%) fixed; }
	:root:not([data-theme='light']) body::before { opacity: 0.04; }
	:root:not([data-theme='light']) ::selection { background: #7a3cff66; }
	:root:not([data-theme='light']) a { text-decoration-color: #f3eefc40; }
	:root:not([data-theme='light']) code { background: #1110158c; }
	:root:not([data-theme='light']) pre { background: linear-gradient(165deg, #111015c4, #1110156b); box-shadow: inset 0 1px 0 #ffffff14; }
	:root:not([data-theme='light']) :is(.card, .stat, .note, .glass, .list, .scroll:has(> .table)) { background: linear-gradient(160deg, #1110159e, #11101547); border-color: #ffffff26; box-shadow: inset 0 1px 0 #ffffff1f, inset 0 0 10px #ffffff0d, 0 24px 60px -34px #000000b3; }
	:root:not([data-theme='light']) :is(.btn, .act, .iconbtn) { background: var(--sweep) -120% 0/250% 100% no-repeat, linear-gradient(165deg, #111015d1, #1110156b); box-shadow: inset 0 1px 0 #ffffff26, inset 0 0 12px #ffffff0d, 0 10px 28px -20px #000000b3; }
	:root:not([data-theme='light']) :is(.btn.primary, .act.primary) { color: #16121c; background: linear-gradient(112deg, #fff0, #ffffffa6 45%, #fff0 60%) -150% 0/250% 100% no-repeat, var(--foil); }
	:root:not([data-theme='light']) .act.primary svg { color: #16121c; }
	:root:not([data-theme='light']) :is(input, select, textarea) { background: linear-gradient(165deg, #111015e0, #11101599); box-shadow: inset 0 1px 0 #ffffff14; color: var(--fg); }
	:root:not([data-theme='light']) select { background-image: linear-gradient(45deg, #fff0 50%, var(--fg) 50%), linear-gradient(135deg, var(--fg) 50%, #fff0 50%), linear-gradient(165deg, #111015e0, #11101599);; background-position: calc(100% - 17px) 20px, calc(100% - 12px) 20px, 0 0; background-size: 5px 5px, 5px 5px, 100% 100%; background-repeat: no-repeat; }
	:root:not([data-theme='light']) input::placeholder { color: #6f6782; }
	:root:not([data-theme='light']) :is(header.top, .abar) { background: linear-gradient(#08070acc, #08070a99); border-bottom-color: #ffffff12; }
	:root:not([data-theme='light']) .btabs { background: linear-gradient(#08070a99, #08070aeb); border-top-color: #ffffff12; }
	:root:not([data-theme='light']) .sheet { background: linear-gradient(165deg, #121117f5, #0a090df0); }
	:root:not([data-theme='light']) .scrim { background: #0000001f; }
	:root:not([data-theme='light']) :is(.chipname, .more-menu summary, .addr-row button) { background: #1110158c; color: var(--fg); }
	:root:not([data-theme='light']) .seg button { background: #11101566; }
	:root:not([data-theme='light']) .seg button.on { background: var(--foil); color: #16121c; }
	:root:not([data-theme='light']) .more-menu nav { background: #111015f2; border-color: #ffffff1f; }
	:root:not([data-theme='light']) .more-menu nav a:hover { background: #ffffff12; }
	:root:not([data-theme='light']) .lockscreen { background: #08070af2; }
	:root:not([data-theme='light']) .lamp.key { background: radial-gradient(closest-side, #ffffff0d, #ffffff05 30%, #ffffff00); }
	:root:not([data-theme='light']) .lamp.rim { background: radial-gradient(closest-side, #8fa8ff14, #8fa8ff00); }
	:root:not([data-theme='light']) .chartbox .chart.candles { background: #1110158c; border-color: #ffffff1f; }
}
:root[data-theme='dark'] { --fg: #f3eefc; --dim: #a59cb6; --ink2: #cfc6de; --line: rgba(225, 210, 255, 0.14); --edge: rgba(230, 215, 255, 0.28); color-scheme: dark; background: #08070a; }
:root[data-theme='dark'] body { background: radial-gradient(ellipse 120% 70% at 50% -10%, #17121f 0%, #0a090d 55%), linear-gradient(172deg, #0a090d 0%, #08070a 50%, #07080c 100%) fixed; }
:root[data-theme='dark'] body::before { opacity: 0.04; }
:root[data-theme='dark'] ::selection { background: #7a3cff66; }
:root[data-theme='dark'] a { text-decoration-color: #f3eefc40; }
:root[data-theme='dark'] code { background: #1110158c; }
:root[data-theme='dark'] pre { background: linear-gradient(165deg, #111015c4, #1110156b); box-shadow: inset 0 1px 0 #ffffff14; }
:root[data-theme='dark'] :is(.card, .stat, .note, .glass, .list, .scroll:has(> .table)) { background: linear-gradient(160deg, #1110159e, #11101547); border-color: #ffffff26; box-shadow: inset 0 1px 0 #ffffff1f, inset 0 0 10px #ffffff0d, 0 24px 60px -34px #000000b3; }
:root[data-theme='dark'] :is(.btn, .act, .iconbtn) { background: var(--sweep) -120% 0/250% 100% no-repeat, linear-gradient(165deg, #111015d1, #1110156b); box-shadow: inset 0 1px 0 #ffffff26, inset 0 0 12px #ffffff0d, 0 10px 28px -20px #000000b3; }
:root[data-theme='dark'] :is(.btn.primary, .act.primary) { color: #16121c; background: linear-gradient(112deg, #fff0, #ffffffa6 45%, #fff0 60%) -150% 0/250% 100% no-repeat, var(--foil); }
:root[data-theme='dark'] .act.primary svg { color: #16121c; }
:root[data-theme='dark'] :is(input, select, textarea) { background: linear-gradient(165deg, #111015e0, #11101599); box-shadow: inset 0 1px 0 #ffffff14; color: var(--fg); }
:root[data-theme='dark'] select { background-image: linear-gradient(45deg, #fff0 50%, var(--fg) 50%), linear-gradient(135deg, var(--fg) 50%, #fff0 50%), linear-gradient(165deg, #111015e0, #11101599);; background-position: calc(100% - 17px) 20px, calc(100% - 12px) 20px, 0 0; background-size: 5px 5px, 5px 5px, 100% 100%; background-repeat: no-repeat; }
:root[data-theme='dark'] input::placeholder { color: #6f6782; }
:root[data-theme='dark'] :is(header.top, .abar) { background: linear-gradient(#08070acc, #08070a99); border-bottom-color: #ffffff12; }
:root[data-theme='dark'] .btabs { background: linear-gradient(#08070a99, #08070aeb); border-top-color: #ffffff12; }
:root[data-theme='dark'] .sheet { background: linear-gradient(165deg, #121117f5, #0a090df0); }
:root[data-theme='dark'] .scrim { background: #0000001f; }
:root[data-theme='dark'] :is(.chipname, .more-menu summary, .addr-row button) { background: #1110158c; color: var(--fg); }
:root[data-theme='dark'] .seg button { background: #11101566; }
:root[data-theme='dark'] .seg button.on { background: var(--foil); color: #16121c; }
:root[data-theme='dark'] .more-menu nav { background: #111015f2; border-color: #ffffff1f; }
:root[data-theme='dark'] .more-menu nav a:hover { background: #ffffff12; }
:root[data-theme='dark'] .lockscreen { background: #08070af2; }
:root[data-theme='dark'] .lamp.key { background: radial-gradient(closest-side, #ffffff0d, #ffffff05 30%, #ffffff00); }
:root[data-theme='dark'] .lamp.rim { background: radial-gradient(closest-side, #8fa8ff14, #8fa8ff00); }
:root[data-theme='dark'] .chartbox .chart.candles { background: #1110158c; border-color: #ffffff1f; }

/* the card at night: obsidian. Solid, so nothing behind it shows through; a sheen that follows the pointer; a silver
   hairline edge; white figures and soft grey labels. Written for both ways night can be on. */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme='light']) .face {
		background:
			radial-gradient(ellipse 70% 60% at var(--gx) var(--gy), #ffffff17, #ffffff00 70%),
			linear-gradient(118deg, #ffffff00 38%, #ffffff0d 48%, #ffffff00 58%),
			linear-gradient(145deg, #1b1a21 0%, #0c0c10 42%, #050507 100%);
		border: 1px solid #ffffff2e; outline: 1px solid #00000099; outline-offset: -2px;
		box-shadow: inset 0 1px 0 #ffffff33, inset 0 -1px 0 #ffffff0d, 0 40px 80px -30px #000000f2, 0 10px 24px -12px #000000cc;
		-webkit-backdrop-filter: none; backdrop-filter: none;
	}
	:root:not([data-theme='light']) .face::before { opacity: 0.12; }
	:root:not([data-theme='light']) .glint { background: linear-gradient(105deg, #fff0 44%, #ffffff1f 50%, #fff0 56%); }
	:root:not([data-theme='light']) .stage .burst { opacity: 0.12; }
	:root:not([data-theme='light']) .slab .num { color: #ffffff; text-shadow: none; }
	:root:not([data-theme='light']) :is(.slab .who, .slab .num small, .slab-foot .hash, .slab .usd, .addr-row b, .face.back .turn) { color: #9d98a8; }
	:root:not([data-theme='light']) :is(.addr-row .code) { color: #f5f3f8; }
	:root:not([data-theme='light']) .slab-mk svg.mk .d { stroke: #ffffff; }
	:root:not([data-theme='light']) :is(.slab .addr, .addr-row button) { background-color: #ffffff14; border-color: #ffffff2e; color: #ffffff; }
	:root:not([data-theme='light']) .slab .addr { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='1.5'%3E%3Crect x='8' y='8' width='12' height='12' rx='1'/%3E%3Cpath d='M16 8V4H4v12h4'/%3E%3C/svg%3E"); }
}
:root[data-theme='dark'] .face {
	background:
		radial-gradient(ellipse 70% 60% at var(--gx) var(--gy), #ffffff17, #ffffff00 70%),
		linear-gradient(118deg, #ffffff00 38%, #ffffff0d 48%, #ffffff00 58%),
		linear-gradient(145deg, #1b1a21 0%, #0c0c10 42%, #050507 100%);
	border: 1px solid #ffffff2e; outline: 1px solid #00000099; outline-offset: -2px;
	box-shadow: inset 0 1px 0 #ffffff33, inset 0 -1px 0 #ffffff0d, 0 40px 80px -30px #000000f2, 0 10px 24px -12px #000000cc;
	-webkit-backdrop-filter: none; backdrop-filter: none;
}
:root[data-theme='dark'] .face::before { opacity: 0.12; }
:root[data-theme='dark'] .glint { background: linear-gradient(105deg, #fff0 44%, #ffffff1f 50%, #fff0 56%); }
:root[data-theme='dark'] .stage .burst { opacity: 0.12; }
:root[data-theme='dark'] .slab .num { color: #ffffff; text-shadow: none; }
:root[data-theme='dark'] :is(.slab .who, .slab .num small, .slab-foot .hash, .slab .usd, .addr-row b, .face.back .turn) { color: #9d98a8; }
:root[data-theme='dark'] :is(.addr-row .code) { color: #f5f3f8; }
:root[data-theme='dark'] .slab-mk svg.mk .d { stroke: #ffffff; }
:root[data-theme='dark'] :is(.slab .addr, .addr-row button) { background-color: #ffffff14; border-color: #ffffff2e; color: #ffffff; }
:root[data-theme='dark'] .slab .addr { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='1.5'%3E%3Crect x='8' y='8' width='12' height='12' rx='1'/%3E%3Cpath d='M16 8V4H4v12h4'/%3E%3C/svg%3E"); }

/* Night, refined (2026-11-16): brighter accents so up/down and links read at a glance; surfaces lifted off the background
   so cards and lists separate; a deeper sky with a faint violet glow; quieter lines. */
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) { --dim: #b4abc7; --ink2: #ddd5ea; --line: rgba(225, 210, 255, 0.1); --edge: rgba(230, 215, 255, 0.2); --pink: #ff7ab3; --amber: #ffc65a; --mint: #43d99b; --blue: #86a8ff; --violet: #b893ff; } :root:not([data-theme='light']) body { background: radial-gradient(ellipse 90% 55% at 50% -12%, #251a3d 0%, #120e1b 45%, #09080c 75%), radial-gradient(ellipse 60% 40% at 100% 100%, #0f1d24 0%, #09080c00 70%), #09080c fixed; } :root:not([data-theme='light']) :is(.card, .stat, .note, .glass, .list, .scroll:has(> .table), details.more) { background: linear-gradient(160deg, #1b1923f2, #131219e6); border-color: #ffffff1c; box-shadow: inset 0 1px 0 #ffffff17, 0 24px 60px -34px #000000cc; } :root:not([data-theme='light']) .li:hover { background: #ffffff08; } :root:not([data-theme='light']) .sheet { background: linear-gradient(165deg, #17151df7, #0d0c11f2); border-color: #ffffff1f; } }
:root[data-theme='dark'] { --dim: #b4abc7; --ink2: #ddd5ea; --line: rgba(225, 210, 255, 0.1); --edge: rgba(230, 215, 255, 0.2); --pink: #ff7ab3; --amber: #ffc65a; --mint: #43d99b; --blue: #86a8ff; --violet: #b893ff; }
:root[data-theme='dark'] body { background: radial-gradient(ellipse 90% 55% at 50% -12%, #251a3d 0%, #120e1b 45%, #09080c 75%), radial-gradient(ellipse 60% 40% at 100% 100%, #0f1d24 0%, #09080c00 70%), #09080c fixed; }
:root[data-theme='dark'] :is(.card, .stat, .note, .glass, .list, .scroll:has(> .table), details.more) { background: linear-gradient(160deg, #1b1923f2, #131219e6); border-color: #ffffff1c; box-shadow: inset 0 1px 0 #ffffff17, 0 24px 60px -34px #000000cc; }
:root[data-theme='dark'] .li:hover { background: #ffffff08; }
:root[data-theme='dark'] .sheet { background: linear-gradient(165deg, #17151df7, #0d0c11f2); border-color: #ffffff1f; }

/* a dropdown's open list in the dark (2026-11-16): the browser drew it white under pale text */
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) :is(option, optgroup) { background: #17151d; color: #f3eefc; } }
:root[data-theme='dark'] :is(option, optgroup) { background: #17151d; color: #f3eefc; }

/* guide and home boxes that still had the light theme's white glass in the dark (2026-11-17) */
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) :is(.toc, .callout, .steps li, .pn a, ol.three li) { background: linear-gradient(160deg, #1b1923f2, #131219e6); border-color: #ffffff1c; box-shadow: inset 0 1px 0 #ffffff14; } :root:not([data-theme='light']) .callout { border-left-color: var(--violet); } :root:not([data-theme='light']) .callout.tip { border-left-color: var(--mint); } :root:not([data-theme='light']) .callout.care { border-left-color: var(--amber); } :root:not([data-theme='light']) .callout.bad { border-left-color: var(--pink); } :root:not([data-theme='light']) .feed .li .fi { background: #ffffff12; } :root:not([data-theme='light']) .loading { background: linear-gradient(90deg, #ffffff0d, #ffffff26, #ffffff0d) 0 0/200% 100%; } }
:root[data-theme='dark'] :is(.toc, .callout, .steps li, .pn a, ol.three li) { background: linear-gradient(160deg, #1b1923f2, #131219e6); border-color: #ffffff1c; box-shadow: inset 0 1px 0 #ffffff14; }
:root[data-theme='dark'] .callout { border-left-color: var(--violet); } :root[data-theme='dark'] .callout.tip { border-left-color: var(--mint); } :root[data-theme='dark'] .callout.care { border-left-color: var(--amber); } :root[data-theme='dark'] .callout.bad { border-left-color: var(--pink); }
:root[data-theme='dark'] .feed .li .fi { background: #ffffff12; }
:root[data-theme='dark'] .loading { background: linear-gradient(90deg, #ffffff0d, #ffffff26, #ffffff0d) 0 0/200% 100%; }
