/* Lights out: the whole shed goes dark. Tokens flip in the night palette below; hardcoded colours get night twins further down. */
.theme-toggle { order:2;flex-shrink:0;display:grid;place-items:center;min-width:44px;min-height:44px;padding:4px 10px;border:2px solid var(--ink);border-radius:0;background:var(--yellow);box-shadow:3px 3px 0 var(--shade,var(--ink));color:var(--ink);font:16px/1 var(--marker);white-space:nowrap;cursor:pointer;transform:rotate(2deg); }
html:not([data-theme]) .theme-toggle { display:none; }
.theme-toggle-night,html[data-theme="dark"] .theme-toggle-day { display:none; }
html[data-theme="dark"] .theme-toggle-night { display:inline; }
.theme-toggle:hover { background:var(--orange);transform:none; }
.theme-toggle:focus-visible { outline:3px dashed var(--ink);outline-offset:4px; }
@media (min-width:1001px) { header .site-nav { margin-inline:auto; } }
@media (max-width:1000px) { .theme-toggle { order:0; } }
@media (max-width:480px) { .theme-toggle { min-height:40px;padding:4px 8px;font-size:14px; } }

/* Night palette, after Material/HIG dark-theme guidance: #121212 base (never pure black), elevation = lighter greys, accents become dusty tints for surfaces and desaturated pastels for text, cream off-white ink (never pure white) so outlines and copy feel warm and do not glare. Artwork is never filtered. */
html[data-theme="dark"] { color-scheme:dark;--night:#121212;--cream:#1e1e1e;--ink:#f0e7d4;--ink-2:#c4bba9;--ink-3:#a8a092;--shade:#000;--orange:#3b2822;--yellow:#383022;--blue:#2a3338;--green:#2c2c2c;--pink:#393033;--glow-orange:#f4a88c;--glow-yellow:#eedc8e;--glow-blue:#a3cfea;--glow-green:#bcd9a0;--glow-pink:#f0b3c6; }
html[data-theme="dark"] .theme-toggle { background:var(--blue); }
html[data-theme="dark"] body { background-color:var(--night);background-image:linear-gradient(90deg,transparent 97%,rgba(255,255,255,.04) 97%),linear-gradient(transparent 97%,rgba(255,255,255,.04) 97%); }
html[data-theme="dark"] .noise { mix-blend-mode:screen;opacity:.04; }
/* Black line-art smileys flip to cream at night; Puppet artwork is never filtered. */
html[data-theme="dark"] .puppet-smile { filter:invert(1) sepia(.35) brightness(.96); }

/* Night twins for hardcoded daytime colours. */
html[data-theme="dark"] { --neon-pink:#523a44;--neon-blue:#324149;--neon-green:#343434;--neon-yellow:#4a4130;--paper-hi:#2c2c2c; }
html[data-theme="dark"] :is(h1 em,h2 em,.gallery-intro h1 em,.hero-note,.shed-tool h3 span,.online,.manifesto-plaque p,.crew-card li::before) { color:var(--glow-orange); }
html[data-theme="dark"] :is(.chat-head,.rarity-table thead,.mileage-grade[data-mileage="shed"]::after) { color:var(--glow-yellow); }
html[data-theme="dark"] :is(.grass,.picker-screen,.message strong) { color:var(--glow-green); }
html[data-theme="dark"] .tile-offers-button { background:#1e1e1e;box-shadow:4px 4px 0 #000; }
html[data-theme="dark"] .tile-offers-button:hover { background:#333;box-shadow:2px 2px 0 #000; }
html[data-theme="dark"] :is(.offer-dialog :focus-visible,.tile-offers-button:focus-visible,.offer-feed :focus-visible,.offer-feed-launcher:focus-visible,.chat-shell input:focus-visible,.chat-shell button:focus-visible,.chat-shell .messages:focus-visible) { outline-color:var(--glow-yellow); }
html[data-theme="dark"] .wallet-puppet-card-has-offers { outline-color:var(--glow-pink); }
html[data-theme="dark"] :is(h1,h2,h3) { text-shadow:none; }
html[data-theme="dark"] :is(.shed-intro h2,.section-heading h2,.trollbox h2,.lore h2,.collect h2,.shed-title h2,.manifesto-poster h2,.market-board h2) { text-shadow:3px 3px 0 #000; }

html[data-theme="dark"] .marquee,html[data-theme="dark"] .marquee div.marquee-track,html[data-theme="dark"] .marquee::before { background:#2a201c!important;color:var(--glow-orange)!important;text-shadow:none; }
html[data-theme="dark"] .marquee-floor { color:var(--glow-orange); }
html[data-theme="dark"] header { background:var(--night);border-bottom-color:#000;box-shadow:0 4px #000; }
html[data-theme="dark"] header .site-nav.open { background:var(--night); }
html[data-theme="dark"] :is(.market-board,.gallery select,.gallery input,.currency-toggle button,.offer-card,.offer-sales,.offer-art-frame,.drawing-pad__paper) { background:var(--cream); }
html[data-theme="dark"] :is(.trait-filter,#gallery-hint,.wallet-puppets-results) { background:rgba(0,0,0,.25); }
html[data-theme="dark"] .gallery input::placeholder { color:var(--ink-3); }
html[data-theme="dark"] :is(select,input,textarea) { color:var(--ink); }
html[data-theme="dark"] .puppet-slab { background:repeating-linear-gradient(-55deg,var(--cream) 0 5px,var(--paper-hi) 5px 10px); }
html[data-theme="dark"] :is(.puppet-tile,.shed-tool,.lore-bubble,.chat-shell,.market-links a) { box-shadow:6px 6px 0 #000; }
html[data-theme="dark"] .gallery .puppet-tile { border-color:var(--paper-hi); }
html[data-theme="dark"] .puppet-tile:nth-child(4n) { background:var(--green); }
html[data-theme="dark"] :is(.tile-rarity summary,.wallet-card-rarity,.rarity-table thead,.wall-feed-heading,.offer-button,.shed-roof,.picker-screen,.tv-screen,.puppet-tv::before,.puppet-tv::after) { background:#181818;color:var(--ink); }
html[data-theme="dark"] .picker-screen { color:var(--glow-green); }
html[data-theme="dark"] .shed-tool--picker .picker-screen { background:var(--yellow);color:var(--ink); }
html[data-theme="dark"] .offer-button { box-shadow:3px 3px 0 #000; }
html[data-theme="dark"] .offer-button:hover { background:var(--paper-hi); }
html[data-theme="dark"] .tv-speaker { background:repeating-linear-gradient(0deg,#0a0a0a 0 2px,transparent 2px 6px); }
html[data-theme="dark"] :is(.picker-art,.puppet-tile img,.wallet-puppets-results img,.offer-item img,.offer-feed-card>img,.offer-art-frame>img) { background:#fff; }
html[data-theme="dark"] [data-rarity="common"] { --loot-color:#3a3a3a;--loot-ink:var(--ink); }
html[data-theme="dark"] [data-rarity="uncommon"] { --loot-color:#3d5645;--loot-ink:var(--ink); }
html[data-theme="dark"] [data-rarity="rare"] { --loot-color:#374f6e;--loot-ink:var(--ink); }
html[data-theme="dark"] [data-rarity="epic"] { --loot-color:#51436e;--loot-ink:var(--ink); }
html[data-theme="dark"] [data-rarity="legendary"] { --loot-color:#6e5033;--loot-ink:var(--ink); }
html[data-theme="dark"] [data-rarity="artifact"] { --loot-color:#625842;--loot-ink:var(--ink); }
html[data-theme="dark"] .rarity-table tbody tr:nth-child(odd) { background:rgba(255,229,92,.06); }
html[data-theme="dark"][data-route] .rarity-table thead th { background:#181818; }
html[data-theme="dark"] .offer-card-own { background:var(--blue); }
html[data-theme="dark"] .offer-card { box-shadow:4px 4px 0 var(--pink); }
html[data-theme="dark"] .offer-card:nth-child(even) { box-shadow:4px 4px 0 var(--green); }
html[data-theme="dark"] :is(.offer-sale-party small,.offer-sale-meta,.offer-sales-note) { color:var(--ink-2); }
html[data-theme="dark"] :is(.offer-preview-banner,.manifesto-poster__art) { box-shadow:6px 6px 0 #000; }
html[data-theme="dark"] :is(.offer-feed-launcher,.offer-feed) { box-shadow:5px 5px 0 #000; }
html[data-theme="dark"] .offer-dialog::backdrop { background:rgba(0,0,0,.8); }
html[data-theme="dark"] .drawing-pad__cursor { box-shadow:0 0 0 2px #000; }

html[data-theme="dark"] .shed-intro { background:repeating-radial-gradient(circle at 15% 23%,#1c1a16 0 10px,#2e231e 11px 12px,#1c1a16 13px 25px); }
html[data-theme="dark"] .shed { background:repeating-linear-gradient(-45deg,#161616 0 25px,#1a1a1a 25px 50px); }
html[data-theme="dark"] .lore { background:#1b1f22; }
html[data-theme="dark"] .lore-art { background:repeating-linear-gradient(30deg,transparent 0 23px,rgba(255,255,255,.04) 24px 26px); }
html[data-theme="dark"] .manifesto-poster { background:repeating-linear-gradient(45deg,#1e1b16 0 25px,#221e18 25px 50px); }
html[data-theme="dark"] .collect { background:repeating-linear-gradient(-45deg,#201817 0 20px,#251b19 20px 40px); }
html[data-theme="dark"] :is(.shed-intro,.shed,.lore,.manifesto-poster,.collect,.market-board,.gallery,.hero,.rarity-board,.wallet-puppets,.puppet-crew,.superlatives,.trollbox) { border-color:#000; }
html[data-theme="dark"] .shed-building { background:#4a302a; }
html[data-theme="dark"] .shed-door { background:#5a4232; }
html[data-theme="dark"] .shed-tool:nth-child(2) { background:var(--blue); }
html[data-theme="dark"] .shed-tool--tv { background:var(--pink); }

html[data-theme="dark"] :is(.shed-button,.trollbox-launcher,.chat-form button,.currency-toggle button[aria-pressed="true"]) { background:var(--neon-pink);color:var(--ink);box-shadow:5px 5px 0 #000; }
html[data-theme="dark"] .shed-button:hover { box-shadow:2px 2px 0 #000; }
html[data-theme="dark"] .chart-launcher { background:var(--neon-blue);border-color:#8a6a78;box-shadow:4px 4px 0 #000; }
html[data-theme="dark"] .chart-launcher:hover { background:var(--neon-pink); }
html[data-theme="dark"] .terminal-bar { background:var(--blue); }
html[data-theme="dark"] .terminal-bar>span { color:var(--glow-pink); }
html[data-theme="dark"] .market-board::before { color:var(--glow-pink); }
html[data-theme="dark"] .bid-note { border-color:#7a6e55; }
html[data-theme="dark"] .market-links a { background:var(--neon-yellow); }
html[data-theme="dark"] .market-links a:nth-child(2n) { background:var(--neon-pink); }
html[data-theme="dark"] .market-links a:hover { background:var(--yellow); }
html[data-theme="dark"] .radio-player { box-shadow:4px 4px 0 #000; }
html[data-theme="dark"] .radio-wave i { background:var(--glow-pink);box-shadow:none; }
html[data-theme="dark"] :is(.radio-progress,.playlist-progress) { border-color:#5a5a5a; }
html[data-theme="dark"] .radio-playlist-launcher { box-shadow:6px 6px 0 #000!important; }
html[data-theme="dark"] .radio-playlist .playlist-controls button { border-color:#5a5a5a!important; }
html[data-theme="dark"] .radio-playlist-popup { filter:drop-shadow(8px 8px 0 #000); }
html[data-theme="dark"] .chat-shell { background:#181818; }
html[data-theme="dark"] :is(.message p,.chat-head button,.chat-shell .guestbook-empty,.chat-shell .guestbook-connection,.chat-shell .guestbook-submit-status,.chat-disclosure,.tool-title span) { color:var(--ink); }
html[data-theme="dark"] .wall-copy { background:rgba(18,18,18,.88); }
html[data-theme="dark"] footer { background:#181818;color:var(--ink);border-top-color:#3a3a3a; }
html[data-theme="dark"] :is(footer .logo,footer>a,footer small) { color:var(--ink); }
html[data-theme="dark"] .cloud { color:#2c2c2c; }

html[data-theme="dark"] .collect-quote { box-shadow:5px 5px 0 #000; }
html[data-theme="dark"] .drawing-pad__color[style*="--ink"] { --swatch:#17251d!important; }
html[data-theme="dark"] .drawing-pad__color[style*="--orange"] { --swatch:#ff683f!important; }
html[data-theme="dark"] .drawing-pad__color[style*="--blue"] { --swatch:#81cdf6!important; }
html[data-theme="dark"] .drawing-pad__color[aria-pressed="true"]::after { background:#fff9e9;color:#17251d; }
html[data-theme="dark"] .hero-art .shed-building { background:repeating-linear-gradient(7deg,#4a302a 0 29px,#2e1f1c 30px 33px); }
html[data-theme="dark"] .hero-art .shed-door { background:#5a4232; }

html[data-theme="dark"] .picker-art { color:#17251d; }

/* Night terminal surfaces: the daytime green-black panels join the charcoal elevation scale (#1e1e1e card, #232323 raised, #2c2c2c controls/tooltips). */
html[data-theme="dark"] :is(.radio-player,.radio-playlist,.chart-plot) { background:#1e1e1e; }
html[data-theme="dark"] .radio-playlist-launcher,html[data-theme="dark"] .radio-playlist .playlist-controls button { background:#1e1e1e!important; }
html[data-theme="dark"] :is(.playlist-now-playing,.sale-chart-panel) { background:#232323; }
html[data-theme="dark"] .chart-tooltip { background:#2c2c2c; }
html[data-theme="dark"] :is(.radio-progress,.playlist-progress,.chart-ranges button) { background:#2c2c2c; }
html[data-theme="dark"] :is(.radio-playlist>b,.playlist-now-playing,.chat-head,.chart-ranges button,.sale-chart,.chart-plot,.chart-empty) { border-color:#474747; }
html[data-theme="dark"] .radio-playlist button { border-bottom-color:#343434!important;color:var(--ink-2)!important; }
html[data-theme="dark"] .message { border-color:#343434; }
html[data-theme="dark"] :is(.playlist-now-playing,.chart-ranges button) { color:var(--ink); }
html[data-theme="dark"] .radio-playlist .playlist-controls button { color:var(--ink)!important; }
html[data-theme="dark"] :is(.playlist-now-playing>div:nth-child(3),.market-stats span,.chart-head p,.chart-note,.chart-y-axis,.chart-x-axis,.message time) { color:var(--ink-2); }
html[data-theme="dark"] :is(.market-empty,.chart-empty,.market-footnote) { color:var(--ink-3); }
html[data-theme="dark"] .sale-chart { background:repeating-linear-gradient(0deg,transparent 0,transparent 46px,#343434 47px),repeating-linear-gradient(90deg,transparent 0,transparent 74px,#343434 75px); }
html[data-theme="dark"] .chart-grid-line { stroke:#343434; }
html[data-theme="dark"] .chart-dust { stroke:var(--glow-yellow); }
html[data-theme="dark"] .chart-dot { border-color:#1e1e1e; }
/* Only the unstyled base controls get the terminal look; styled ones (language, gallery, trollbox) keep their own outlines. */
:where(html[data-theme="dark"]) :is(select,input) { background:#2c2c2c;border-color:#474747; }
html[data-theme="dark"] .hero-art .shed-roof { background:repeating-linear-gradient(102deg,#343434 0 13px,#1e1e1e 14px 19px); }
html[data-theme="dark"] body { background-image:linear-gradient(90deg,transparent 97%,rgba(255,255,255,.045) 97%),linear-gradient(transparent 97%,rgba(255,255,255,.045) 97%); }

/* Night twins for the app shell: dock, pager, tabs, and the terminal shadow. */
html[data-theme="dark"] footer.dock { --dock-line:var(--ink);border-top-color:#3a3a3a; }
html[data-theme="dark"] .dock-radio-toggle { background:#2c2c2c;color:var(--glow-yellow);box-shadow:3px 3px 0 #000; }
html[data-theme="dark"] .dock-radio-toggle.playing { background:#383022;color:var(--glow-green); }
html[data-theme="dark"] .dock-radio-toggle:hover:not(:disabled) { background:#333;color:var(--glow-pink); }
html[data-theme="dark"] footer .dock-radio-now small { color:var(--glow-green); }
html[data-theme="dark"][data-route] .dock :is(.radio-playlist-launcher,.offer-feed-launcher,.trollbox-launcher) { box-shadow:3px 3px 0 #000!important; }
html[data-theme="dark"] .market-collect .collect-quote { color:var(--glow-yellow); }
html[data-theme="dark"] :is(.market-stats article,.market-sold-button,.currency-toggle) { box-shadow:5px 5px 0 #000; }
html[data-theme="dark"] .market-sold-button strong { color:var(--glow-yellow); }
html[data-theme="dark"] .market-sales h3 span { color:var(--glow-green); }

@media (prefers-reduced-motion:reduce) { .theme-toggle { transform:none; } }
