Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
rebrand CyberCity → City, make it theme-aware, and add a day/night scene
[._.]/ Adam Eivy966643306853
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 12177fcd53..f6d5a185cd 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -8,4 +8,8 @@## Changed+- **CyberCity is now "City"** — renamed throughout the UI (sidebar, scene title, command palette, keyboard help, billboards) since the cyberpunk look is now just one of several themes rather than the brand. The route stays `/city`.+- **City navigation is now map-style** — in orbital view, left-drag pans the camera across the city (so you can reach off-center districts without dropping into first-person), scroll zooms, right-drag (or ctrl-drag on a Mac trackpad) rotates, and arrow keys pan. Previously the only way to look away from the center was first-person mode.+- **City follows your PortOS theme** — the HUD panels (now fully opaque for readability) and the 3D scene's accent surfaces (ground grid, particles, online buildings, neon, and the CRT edge-glow) recolor to the active theme instead of being locked to dark cyan-on-black. The CRT affectations are opt-in per theme family: scanlines only on the terminal family, neon edge-glow on terminal + classic, and a cinematic vignette on all but the clean glass family. Status colors (stopped/red, warnings/amber) stay semantic.+- **City time-of-day follows your theme (day/night), with a real daytime look** — the old four-way sunrise/noon/sunset/midnight picker is now Auto/Day/Night. Auto (the default) renders a bright daytime city under light themes and a dark neon city under dark themes; you can still force Day or Night. Daytime is now a genuine bright, sunlit style rather than dusk: the night-tuned color grade, bloom, film grain, and chromatic aberration fade out in daylight; the sky opens to a luminous blue with high-key sun + sky fill; the ground sheds its neon grid and wet-street glow; and buildings shed their neon (edge strips, halos, base glow) to read as light, sunlit solids. The dark neon night look is unchanged. Existing installs pick up the coupling automatically (any previously-saved time-of-day reads as Auto).- **[issue-875] CyberCity district layout internals consolidated** — the city's districts now share one set of layout primitives for grid placement, category tallies, and log-scaled building heights, so each district no longer carries its own copy of that math. No visible change to the city.diff --git a/client/src/components/KeyboardHelp.jsx b/client/src/components/KeyboardHelp.jsxindex f38e4e0071..9368422236 100644--- a/client/src/components/KeyboardHelp.jsx+++ b/client/src/components/KeyboardHelp.jsx@@ -23,7 +23,7 @@ const SHORTCUT_SECTIONS = [],},{- title: 'CyberCity',+ title: 'City',shortcuts: [{ keys: ['W', 'A', 'S', 'D'], description: 'Move around' },{ keys: ['Tab'], description: 'Toggle mode' },diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsxindex 84fa0ccff0..ff215fda5d 100644--- a/client/src/components/Layout.jsx+++ b/client/src/components/Layout.jsx@@ -122,7 +122,7 @@ import socket from '../services/socket';const navItems = [{ to: '/', label: 'Dashboard', icon: Home, single: true },{ to: '/review', label: 'Review Hub', icon: ClipboardList, single: true },- { to: '/city', label: 'CyberCity', icon: Building2, single: true },+ { to: '/city', label: 'City', icon: Building2, single: true },{ separator: true },{ label: 'Apps', icon: Package, dynamic: 'apps', defaultTo: '/apps', children: [] },{diff --git a/client/src/components/city/Borough.jsx b/client/src/components/city/Borough.jsxindex 0314567c97..1c21198ecb 100644--- a/client/src/components/city/Borough.jsx+++ b/client/src/components/city/Borough.jsx@@ -1,5 +1,5 @@import { useMemo } from 'react';-import { getBuildingHeight, BOROUGH_PARAMS } from './cityConstants';+import { getBuildingHeight, BOROUGH_PARAMS, cityDayMix } from './cityConstants';import { hashString } from '../../utils/hashString';import Building from './Building';import AgentEntity from './AgentEntity';@@ -18,6 +18,9 @@ export default function Borough({ app, position, agentMap, onBuildingClick, play// Build pm2Status lookup mapconst pm2Status = app.pm2Status || {};+ // 0 at night, 1 in full daylight — buildings lighten and shed their neon by day.+ const dayMix = cityDayMix(settings);+// Compute ring positions for process buildingsconst processPositions = useMemo(() => {const count = processes.length;@@ -46,6 +49,7 @@ export default function Borough({ app, position, agentMap, onBuildingClick, playneonBrightness={neonBrightness}isProximity={isProximity}dimmed={dimmed}+ dayMix={dayMix}/>{/* Process buildings in ring around main building */}diff --git a/client/src/components/city/Building.jsx b/client/src/components/city/Building.jsxindex ccdb3788ba..119a1925c9 100644--- a/client/src/components/city/Building.jsx+++ b/client/src/components/city/Building.jsx@@ -2,7 +2,7 @@ import { useRef, useState, useMemo } from 'react';import { useFrame } from '@react-three/fiber';import { Text } from '@react-three/drei';import * as THREE from 'three';-import { getBuildingColor, getBuildingHeight, getAccentColor, CITY_COLORS, BUILDING_PARAMS, PIXEL_FONT_URL } from './cityConstants';+import { getBuildingColor, getBuildingHeight, getAccentColor, CITY_COLORS, BUILDING_PARAMS, PIXEL_FONT_URL, mixHex } from './cityConstants';import HolographicPanel from './HolographicPanel';import BuildingHologram from './BuildingHologram';@@ -267,7 +267,7 @@ function NeonEdgeStrip({ position, height, color, delay, dimMul = 1 }) {);}-export default function Building({ app, position, agentCount, onClick, playSfx, neonBrightness = 1.2, isProximity = false, dimmed = false }) {+export default function Building({ app, position, agentCount, onClick, playSfx, neonBrightness = 1.2, isProximity = false, dimmed = false, dayMix = 0 }) {const meshRef = useRef();const glowRef = useRef();const haloRef = useRef();@@ -281,6 +281,22 @@ export default function Building({ app, position, agentCount, onClick, playSfx,const { width, depth } = BUILDING_PARAMS;const dimMul = dimmed ? 0.25 : 1;+ // Daytime treatment: the building sheds its neon and reads as a sunlit solid. The+ // facade lerps from the dark cyber body toward a light, faintly status-tinted+ // wall; the dark window texture is dropped (it only reads at night) and the neon+ // edge softens to a plain architectural outline.+ // NOTE: dayMix is currently strictly 0 or 1 (the city renders only noon/sunset), so+ // the continuous lerps and the `daytime` hard-switches agree today. The lerps are+ // forward-looking — if an intermediate time-of-day is ever re-enabled, convert the+ // `!daytime`-gated mounts (halo/strips/glow/ground-lines) to opacity fades too so a+ // partial dayMix degrades gracefully instead of popping at 0.5.+ const daytime = dayMix > 0.5;+ // Mid-tone facade (not near-white) so strong daylight lands around a clean gray+ // rather than clipping to white; a touch of the status color keeps variety.+ const dayFacade = mixHex('#9aa0ac', edgeColor, 0.12);+ const bodyColor = mixHex(CITY_COLORS.buildingBody, dayFacade, dayMix);+ const edgeLineColor = daytime ? mixHex('#4a4f57', edgeColor, 0.15) : edgeColor;+// Name hash for seeded randomnessconst seed = useMemo(() => {let h = 0;@@ -315,7 +331,8 @@ export default function Building({ app, position, agentCount, onClick, playSfx,? Math.sin(t * 3.5 + seed) * 0.2 * nb: 0;const hoverBoost = hovered ? 0.4 * nb : 0;- meshRef.current.material.emissiveIntensity = (baseIntensity + pulse + hoverBoost) * dimMul;+ // Neon self-glow fades out in daylight — the building is lit by the sun instead.+ meshRef.current.material.emissiveIntensity = (baseIntensity + pulse + hoverBoost) * dimMul * (1 - dayMix * 0.9);if (glowRef.current) {glowRef.current.material.opacity = (0.35 + (isOnline ? Math.sin(t * 1.5) * 0.12 : 0) + (hovered ? 0.25 : 0)) * dimMul;@@ -342,21 +359,23 @@ export default function Building({ app, position, agentCount, onClick, playSfx,><boxGeometry args={[width, height, depth]} /><meshStandardMaterial- color={CITY_COLORS.buildingBody}+ color={bodyColor}emissive={edgeColor}- emissiveIntensity={0.35 * neonBrightness * dimMul}- map={windowTexture}+ emissiveIntensity={0.35 * neonBrightness * dimMul * (1 - dayMix * 0.9)}+ map={daytime ? undefined : windowTexture}+ roughness={daytime ? 0.9 : 1}+ metalness={daytime ? 0.05 : 0}transparentopacity={(app.archived ? 0.6 : 0.95) * dimMul}/></mesh>- {/* Neon wireframe edges */}+ {/* Building edges — bright neon by night, a plain architectural outline by day */}<lineSegments position={[0, height / 2, 0]} geometry={edgesGeom}><lineBasicMaterial- color={edgeColor}+ color={edgeLineColor}transparent- opacity={(app.archived ? 0.5 : 0.9) * dimMul}+ opacity={((app.archived ? 0.5 : 0.9) - dayMix * 0.55) * dimMul}/></lineSegments>@@ -380,8 +399,8 @@ export default function Building({ app, position, agentCount, onClick, playSfx,)}</mesh>- {/* Glow halo wireframe - slightly larger than building */}- {!app.archived && (+ {/* Glow halo wireframe - slightly larger than building (night only) */}+ {!app.archived && !daytime && (<lineSegments ref={haloRef} position={[0, height / 2, 0]}><edgesGeometry args={[new THREE.BoxGeometry(width + 0.15, height + 0.15, depth + 0.15)]} /><lineBasicMaterial@@ -392,8 +411,8 @@ export default function Building({ app, position, agentCount, onClick, playSfx,</lineSegments>)}- {/* Vertical neon edge strips on corners */}- {!app.archived && (+ {/* Vertical neon edge strips on corners (night only) */}+ {!app.archived && !daytime && (<><NeonEdgeStrip position={[width / 2, height / 2, depth / 2]} height={height} color={accentColor} delay={0} dimMul={dimMul} /><NeonEdgeStrip position={[-width / 2, height / 2, depth / 2]} height={height} color={accentColor} delay={1} dimMul={dimMul} />@@ -446,19 +465,21 @@ export default function Building({ app, position, agentCount, onClick, playSfx,{displayName}</Text>- {/* Base glow circle - wider and brighter */}- <mesh ref={glowRef} rotation={[-Math.PI / 2, 0, 0]} position={[0, 0.01, 0]}>- <circleGeometry args={[1.8, 32]} />- <meshBasicMaterial- color={edgeColor}- transparent- opacity={0.25 * dimMul}- side={THREE.DoubleSide}- />- </mesh>+ {/* Base glow circle - wider and brighter (night only) */}+ {!daytime && (+ <mesh ref={glowRef} rotation={[-Math.PI / 2, 0, 0]} position={[0, 0.01, 0]}>+ <circleGeometry args={[1.8, 32]} />+ <meshBasicMaterial+ color={edgeColor}+ transparent+ opacity={0.25 * dimMul}+ side={THREE.DoubleSide}+ />+ </mesh>+ )}- {/* Neon ground line accents */}- {!app.archived && (+ {/* Neon ground line accents (night only) */}+ {!app.archived && !daytime && (<><mesh rotation={[-Math.PI / 2, 0, 0]} position={[0, 0.02, depth / 2 + 0.3]}><planeGeometry args={[width + 0.5, 0.05]} />diff --git a/client/src/components/city/CityBillboards.jsx b/client/src/components/city/CityBillboards.jsxindex 95b651ed24..fa929ea1cc 100644--- a/client/src/components/city/CityBillboards.jsx+++ b/client/src/components/city/CityBillboards.jsx@@ -251,7 +251,7 @@ export default function CityBillboards({ positions, apps, cosStatus, reviewCount}const activityMessages = [- { label: 'CYBERCITY', text: 'DIGITAL INFRASTRUCTURE' },+ { label: 'CITY', text: 'DIGITAL INFRASTRUCTURE' },{ label: 'PORTOS', text: 'PERSONAL OPERATING SYSTEM' },{ label: 'INSTANCE MESH', text: `${onlinePeers}/${nodeCount} NODES LINKED` },];diff --git a/client/src/components/city/CityEffects.jsx b/client/src/components/city/CityEffects.jsxindex a24bc5e75c..fb3b8a7586 100644--- a/client/src/components/city/CityEffects.jsx+++ b/client/src/components/city/CityEffects.jsx@@ -5,6 +5,7 @@ import { RenderPass } from 'three/examples/jsm/postprocessing/RenderPass.js';import { UnrealBloomPass } from 'three/examples/jsm/postprocessing/UnrealBloomPass.js';import { ShaderPass } from 'three/examples/jsm/postprocessing/ShaderPass.js';import * as THREE from 'three';+import { cityDayMix } from './cityConstants';extend({ EffectComposer, RenderPass, UnrealBloomPass, ShaderPass });@@ -98,10 +99,14 @@ const FilmGrainShader = {`,};-// Color Grading shader -- push shadows blue, midtones cyan, highlights warm+// Color Grading shader -- at night push shadows blue, midtones cyan, highlights+// warm (cyberpunk). uDay (0=night, 1=day) fades those tints out and swaps in a+// bright, lightly-warm, more saturated daytime grade so noon reads as real daylight+// instead of dusk.const ColorGradingShader = {uniforms: {tDiffuse: { value: null },+ uDay: { value: 0 },},vertexShader: `varying vec2 vUv;@@ -112,24 +117,30 @@ const ColorGradingShader = {`,fragmentShader: `uniform sampler2D tDiffuse;+ uniform float uDay;varying vec2 vUv;void main() {vec4 color = texture2D(tDiffuse, vUv);float lum = dot(color.rgb, vec3(0.299, 0.587, 0.114));- // Shadows -> deep blue (#0d0d2b)- vec3 shadowTint = vec3(0.051, 0.051, 0.169);- // Midtones -> cyan- vec3 midTint = vec3(0.024, 0.714, 0.831);- // Highlights -> warm white- vec3 highTint = vec3(1.0, 0.95, 0.9);+ // Night tints (faded out by day)+ vec3 shadowTint = vec3(0.051, 0.051, 0.169); // deep blue+ vec3 midTint = vec3(0.024, 0.714, 0.831); // cyan+ vec3 highTint = vec3(1.0, 0.95, 0.9); // warm whitefloat shadowWeight = smoothstep(0.0, 0.3, lum) * (1.0 - smoothstep(0.0, 0.4, lum));float midWeight = smoothstep(0.2, 0.5, lum) * (1.0 - smoothstep(0.5, 0.8, lum));float highWeight = smoothstep(0.6, 1.0, lum);- color.rgb = mix(color.rgb, color.rgb * shadowTint * 3.0, shadowWeight * 0.12);- color.rgb = mix(color.rgb, color.rgb * midTint * 1.4, midWeight * 0.15);+ float night = 1.0 - uDay;+ color.rgb = mix(color.rgb, color.rgb * shadowTint * 3.0, shadowWeight * 0.12 * night);+ color.rgb = mix(color.rgb, color.rgb * midTint * 1.4, midWeight * 0.15 * night);color.rgb = mix(color.rgb, color.rgb * highTint, highWeight * 0.1);- // Slight brightness lift for dark areas- color.rgb = color.rgb * 1.1 + 0.015;+ // Brightness lift: the night grade lifts dark areas (+1.1/+0.015). Daylight is+ // already bright, so the lift backs off to neutral to avoid clipping to white.+ color.rgb = color.rgb * mix(1.1, 0.99, uDay) + mix(0.015, 0.0, uDay);+ // Daytime warmth + gentle saturation so colors feel sunlit rather than washed.+ vec3 warm = color.rgb * vec3(1.03, 1.0, 0.96);+ float gray = dot(warm, vec3(0.299, 0.587, 0.114));+ vec3 sat = mix(vec3(gray), warm, 1.08);+ color.rgb = mix(color.rgb, sat, uDay);gl_FragColor = color;}`,@@ -139,6 +150,9 @@ export default function CityEffects({ settings }) {const composerRef = useRef();const grainPassRef = useRef();const exposurePassRef = useRef();+ const bloomPassRef = useRef();+ const caPassRef = useRef();+ const cgPassRef = useRef();const { gl, scene, camera, size } = useThree();const bloomEnabled = settings?.bloomEnabled ?? true;@@ -147,6 +161,10 @@ export default function CityEffects({ settings }) {const chromaticAberration = settings?.chromaticAberration ?? true;const filmGrain = settings?.filmGrain ?? true;const colorGrading = settings?.colorGrading ?? true;+ // Daytime fades the heavy night atmospherics (bloom, grain, chromatic aberration,+ // blue grade) so noon reads as clear daylight rather than a hazy dusk.+ const dayMix = cityDayMix(settings);+ const caBase = bloomStrength >= 0.6 ? 0.005 : 0.003;useEffect(() => {const composer = new EffectComposer(gl);@@ -163,7 +181,10 @@ export default function CityEffects({ settings }) {0.4, // radius — tighter glow around emissive elements0.45 // threshold — only genuinely bright/emissive surfaces bloom);+ bloomPassRef.current = bloomPass;composer.addPass(bloomPass);+ } else {+ bloomPassRef.current = null;}// Exposure pass — always added, enabled/disabled via ref to avoid@@ -176,13 +197,19 @@ export default function CityEffects({ settings }) {if (colorGrading) {const cgPass = new ShaderPass(ColorGradingShader);+ cgPassRef.current = cgPass;composer.addPass(cgPass);+ } else {+ cgPassRef.current = null;}if (chromaticAberration) {const caPass = new ShaderPass(ChromaticAberrationShader);- caPass.uniforms.uStrength.value = bloomStrength >= 0.6 ? 0.005 : 0.003;+ caPass.uniforms.uStrength.value = caBase;+ caPassRef.current = caPass;composer.addPass(caPass);+ } else {+ caPassRef.current = null;}if (filmGrain) {@@ -208,6 +235,21 @@ export default function CityEffects({ settings }) {}if (grainPassRef.current) {grainPassRef.current.uniforms.uTime.value = clock.getElapsedTime();+ // Grain is a night-film affectation — fade it out in daylight.+ grainPassRef.current.uniforms.uIntensity.value = 0.04 * (1 - dayMix);+ }+ if (cgPassRef.current) {+ cgPassRef.current.uniforms.uDay.value = dayMix;+ }+ if (bloomPassRef.current) {+ // Bloom is a night-neon effect. In daylight the whole scene sits above the+ // bloom threshold, so any bloom blooms EVERYTHING into a white-out — fade the+ // strength to ~0 and raise the threshold so only true highlights (the sun) glow.+ bloomPassRef.current.strength = bloomStrength * (1 - dayMix);+ bloomPassRef.current.threshold = 0.45 + dayMix * 0.45;+ }+ if (caPassRef.current) {+ caPassRef.current.uniforms.uStrength.value = caBase * (1 - dayMix);}if (composerRef.current) {composerRef.current.render();diff --git a/client/src/components/city/CityGround.jsx b/client/src/components/city/CityGround.jsxindex d83fb98fe6..7f24bfe2fc 100644--- a/client/src/components/city/CityGround.jsx+++ b/client/src/components/city/CityGround.jsx@@ -2,16 +2,17 @@ import { useRef, useMemo } from 'react';import { useFrame } from '@react-three/fiber';import { Grid } from '@react-three/drei';import * as THREE from 'three';-import { CITY_COLORS, getTimeOfDayPreset } from './cityConstants';+import { CITY_COLORS, getTimeOfDayPreset, cityDayMix, mixHex } from './cityConstants';// Reflective puddle/wet-ground patches-function WetPatch({ position, size, color }) {+function WetPatch({ position, size, color, dayMix = 0 }) {const ref = useRef();useFrame(({ clock }) => {if (!ref.current) return;const t = clock.getElapsedTime();- ref.current.material.opacity = 0.1 + Math.sin(t * 0.8 + position[0] * 3) * 0.04;+ // Neon puddle reflections are a wet-night look — fade them out by day.+ ref.current.material.opacity = (0.1 + Math.sin(t * 0.8 + position[0] * 3) * 0.04) * (1 - dayMix);});return (@@ -29,13 +30,13 @@ function WetPatch({ position, size, color }) {}// Rolling fog layer with animated opacity-function RollingFog() {+function RollingFog({ dayMix = 0 }) {const ref = useRef();useFrame(({ clock }) => {if (!ref.current) return;const t = clock.getElapsedTime();- ref.current.material.opacity = 0.025 + Math.sin(t * 0.15) * 0.012;+ ref.current.material.opacity = (0.025 + Math.sin(t * 0.15) * 0.012) * (1 - dayMix);ref.current.position.z = Math.sin(t * 0.05) * 3;});@@ -60,10 +61,17 @@ export default function CityGround({ settings }) {const timeOfDay = settings?.timeOfDay ?? 'sunset';const skyTheme = settings?.skyTheme ?? 'cyberpunk';const preset = getTimeOfDayPreset(timeOfDay, skyTheme);+ const dayMix = cityDayMix(settings);const groundColorTarget = useRef(new THREE.Color(preset.groundColor ?? '#0a0a20'));groundColorTarget.current.set(preset.groundColor ?? '#0a0a20');const targetRoughness = preset.groundRoughness ?? 0.7;+ // The neon grid + additive fog are a night look — at day the grid mutes to faint+ // pavement lines and the glow fog fades out.+ const gridCellColor = mixHex('#0e7490', '#a7afb8', dayMix);+ const gridSectionColor = mixHex('#06b6d4', '#bcc4cc', dayMix);+ const groundFogOpacity = 0.045 * (1 - dayMix);+useFrame((_, delta) => {if (!groundMatRef.current) return;const lf = Math.min(1, delta * 3);@@ -109,8 +117,8 @@ export default function CityGround({ settings }) {infiniteGridcellSize={2}sectionSize={6}- cellColor="#0e7490"- sectionColor="#06b6d4"+ cellColor={gridCellColor}+ sectionColor={gridSectionColor}cellThickness={0.6}sectionThickness={1.4}fadeDistance={80}@@ -120,23 +128,25 @@ export default function CityGround({ settings }) {{/* Wet street reflective patches */}{puddles.map(p => (- <WetPatch key={p.id} position={p.position} size={p.size} color={p.color} />+ <WetPatch key={p.id} position={p.position} size={p.size} color={p.color} dayMix={dayMix} />))}- {/* Subtle ground fog layer */}- <mesh rotation={[-Math.PI / 2, 0, 0]} position={[0, 0.1, 0]}>- <planeGeometry args={[80, 80]} />- <meshBasicMaterial- color="#06b6d4"- transparent- opacity={0.045}- blending={THREE.AdditiveBlending}- side={THREE.DoubleSide}- />- </mesh>+ {/* Subtle ground fog layer (night neon haze; gone by day) */}+ {groundFogOpacity > 0.001 && (+ <mesh rotation={[-Math.PI / 2, 0, 0]} position={[0, 0.1, 0]}>+ <planeGeometry args={[80, 80]} />+ <meshBasicMaterial+ color="#06b6d4"+ transparent+ opacity={groundFogOpacity}+ blending={THREE.AdditiveBlending}+ side={THREE.DoubleSide}+ />+ </mesh>+ )}{/* Rolling fog layer at street level */}- {reflectionsEnabled && <RollingFog />}+ {reflectionsEnabled && <RollingFog dayMix={dayMix} />}</group>);}diff --git a/client/src/components/city/CityHud.jsx b/client/src/components/city/CityHud.jsxindex e444eaaecf..f872b40b10 100644--- a/client/src/components/city/CityHud.jsx+++ b/client/src/components/city/CityHud.jsx@@ -205,7 +205,10 @@ export default function CityHud({ cosStatus, cosAgents, agentMap, eventLogs, con).length;return (- <div className="absolute inset-0 pointer-events-none overflow-hidden">+ // z-20 keeps the HUD above the CityScanlines CRT overlay (z-10) so the vignette+ // + scanline-multiply + chromatic-aberration glow stay on the 3D scene and don't+ // haze the (now theme-colored) HUD panels.+ <div className="absolute inset-0 pointer-events-none overflow-hidden z-20">{/* Top-left: Clock + system status + vitals */}<div className="absolute top-3 left-3 pointer-events-auto"><div className="relative bg-black/85 backdrop-blur-sm border border-cyan-500/40 rounded-lg px-4 py-3 overflow-hidden">@@ -366,7 +369,7 @@ export default function CityHud({ cosStatus, cosAgents, agentMap, eventLogs, con{/* Top-center: CyberCity title with glitch effect */}<div className="absolute top-3 left-1/2 -translate-x-1/2 pointer-events-none"><GlitchTitle- text="CYBERCITY"+ text="CITY"className="font-pixel text-cyan-400/50 text-sm tracking-[0.4em]"/><div className="font-pixel text-[8px] text-cyan-400/20 tracking-[0.2em] text-center mt-0.5">diff --git a/client/src/components/city/CityScanlines.jsx b/client/src/components/city/CityScanlines.jsxindex 7c31b1decc..452d8d929b 100644--- a/client/src/components/city/CityScanlines.jsx+++ b/client/src/components/city/CityScanlines.jsx@@ -1,84 +1,74 @@import { useState, useEffect } from 'react';-// CSS-based CRT scanline + vignette overlay for cyberpunk atmosphere-export default function CityScanlines({ settings }) {- const [flicker, setFlicker] = useState(1);- const enabled = settings?.scanlineOverlay ?? true;+// CSS CRT overlay (scanlines + neon edge-glow + vignette) for the city scene.+// Each piece is opted in per theme via the `crt` profile (see deriveCrtProfile in+// cityConstants) — scanlines and neon glow are cyber/terminal affectations, not+// universal, so clean themes (e.g. glass) get little or nothing. Glow color comes+// from the live --port-accent var so it tracks the active theme. All layers sit+// at z-10, below the HUD (z-20), so they only treat the 3D scene, not the panels.+export default function CityScanlines({ settings, crt }) {+ const profile = crt || { scanlines: true, glow: true, vignette: true };+ // The user toggle can only switch scanlines OFF for a theme that supports them;+ // it can't force them onto a non-terminal theme (they'd be off-style there).+ const scanlines = profile.scanlines && (settings?.scanlineOverlay ?? true);- // Random subtle brightness flicker like a CRT monitor+ // Random subtle brightness flicker like a CRT monitor (only while scanlines on)+ const [flicker, setFlicker] = useState(1);useEffect(() => {- if (!enabled) return;+ if (!scanlines) return;const interval = setInterval(() => {setFlicker(0.97 + Math.random() * 0.03);}, 150);return () => clearInterval(interval);- }, [enabled]);+ }, [scanlines]);- if (!enabled) {- // Still render vignette and edge glow even when scanlines are off- return (- <>+ return (+ <>+ {scanlines && (<divclassName="absolute inset-0 pointer-events-none z-10"style={{- background: 'radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.5) 100%)',- }}- />- <div- className="absolute top-0 left-0 right-0 h-px pointer-events-none z-10"- style={{- background: 'linear-gradient(90deg, transparent, rgba(6,182,212,0.15) 30%, rgba(6,182,212,0.3) 50%, rgba(6,182,212,0.15) 70%, transparent)',+ backgroundImage: 'repeating-linear-gradient(0deg, rgba(0,0,0,0.05) 0px, rgba(0,0,0,0.05) 1px, transparent 1px, transparent 3px)',+ backgroundSize: '100% 3px',+ mixBlendMode: 'multiply',+ opacity: flicker,}}/>+ )}++ {profile.vignette && (<div- className="absolute bottom-0 left-0 right-0 h-px pointer-events-none z-10"+ className="absolute inset-0 pointer-events-none z-10"style={{- background: 'linear-gradient(90deg, transparent, rgba(139,92,246,0.15) 30%, rgba(139,92,246,0.3) 50%, rgba(139,92,246,0.15) 70%, transparent)',+ background: 'radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.5) 100%)',}}/>- </>- );- }+ )}- return (- <>- {/* Scanline overlay */}- <div- className="absolute inset-0 pointer-events-none z-10"- style={{- backgroundImage: 'repeating-linear-gradient(0deg, rgba(0,0,0,0.05) 0px, rgba(0,0,0,0.05) 1px, transparent 1px, transparent 3px)',- backgroundSize: '100% 3px',- mixBlendMode: 'multiply',- opacity: flicker,- }}- />- {/* Vignette effect - stronger */}- <div- className="absolute inset-0 pointer-events-none z-10"- style={{- background: 'radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.5) 100%)',- }}- />- {/* Chromatic aberration glow at edges */}- <div- className="absolute inset-0 pointer-events-none z-10 opacity-[0.025]"- style={{- boxShadow: 'inset 0 0 120px 30px rgba(6, 182, 212, 0.4), inset 0 0 80px 15px rgba(139, 92, 246, 0.3), inset 0 0 40px 10px rgba(236, 72, 153, 0.15)',- }}- />- {/* Edge glow lines - top and bottom neon strips */}- <div- className="absolute top-0 left-0 right-0 h-px pointer-events-none z-10"- style={{- background: 'linear-gradient(90deg, transparent, rgba(6,182,212,0.15) 30%, rgba(6,182,212,0.3) 50%, rgba(6,182,212,0.15) 70%, transparent)',- }}- />- <div- className="absolute bottom-0 left-0 right-0 h-px pointer-events-none z-10"- style={{- background: 'linear-gradient(90deg, transparent, rgba(139,92,246,0.15) 30%, rgba(139,92,246,0.3) 50%, rgba(139,92,246,0.15) 70%, transparent)',- }}- />+ {profile.glow && (+ <>+ {/* Chromatic-aberration-style edge glow, tinted to the theme accent */}+ <div+ className="absolute inset-0 pointer-events-none z-10 opacity-[0.025]"+ style={{+ boxShadow: 'inset 0 0 120px 30px rgb(var(--port-accent) / 0.4), inset 0 0 60px 12px rgb(var(--port-accent) / 0.2)',+ }}+ />+ {/* Top + bottom neon strips */}+ <div+ className="absolute top-0 left-0 right-0 h-px pointer-events-none z-10"+ style={{+ background: 'linear-gradient(90deg, transparent, rgb(var(--port-accent) / 0.15) 30%, rgb(var(--port-accent) / 0.3) 50%, rgb(var(--port-accent) / 0.15) 70%, transparent)',+ }}+ />+ <div+ className="absolute bottom-0 left-0 right-0 h-px pointer-events-none z-10"+ style={{+ background: 'linear-gradient(90deg, transparent, rgb(var(--port-accent) / 0.1) 30%, rgb(var(--port-accent) / 0.22) 50%, rgb(var(--port-accent) / 0.1) 70%, transparent)',+ }}+ />+ </>+ )}</>);}diff --git a/client/src/components/city/CityScene.jsx b/client/src/components/city/CityScene.jsxindex 6c06f0b792..14badd5663 100644--- a/client/src/components/city/CityScene.jsx+++ b/client/src/components/city/CityScene.jsx@@ -1,4 +1,5 @@import { useState, useCallback, useRef, useEffect } from 'react';+import * as THREE from 'three';import { Canvas } from '@react-three/fiber';import { OrbitControls } from '@react-three/drei';import CityGround from './CityGround';@@ -41,7 +42,7 @@ import PlayerController from './PlayerController';import CameraTransition from './CameraTransition';import CityPhotoCamera from './CityPhotoCamera';-export default function CityScene({ apps, agentMap, onBuildingClick, cosStatus, reviewCounts, instances, backupStatus, cosTasks, healthMetrics, voiceState, aiActivity, productivityData, activityCalendar, goals, character, chronotype, memoryGraph, inboxDepth, jiraTickets, photoMode, photoPresetId, onPhotoCaptureReady, settings, playSfx, keysRef, dimmedAppIds }) {+export default function CityScene({ apps, agentMap, onBuildingClick, cosStatus, reviewCounts, instances, backupStatus, cosTasks, healthMetrics, voiceState, aiActivity, productivityData, activityCalendar, goals, character, chronotype, memoryGraph, inboxDepth, jiraTickets, photoMode, photoPresetId, onPhotoCaptureReady, settings, playSfx, keysRef, dimmedAppIds, background }) {const [positions, setPositions] = useState(null);const [proximityApp, setProximityApp] = useState(null);const [transitioning, setTransitioning] = useState(false);@@ -79,7 +80,7 @@ export default function CityScene({ apps, agentMap, onBuildingClick, cosStatus,camera={{ position: [0, 25, 45], fov: 50 }}dpr={dpr}shadows={false}- style={{ background: '#030308', cursor: explorationMode ? 'crosshair' : 'auto' }}+ style={{ background: background || '#030308', cursor: explorationMode ? 'crosshair' : 'auto' }}// preserveDrawingBuffer lets photo mode read the frame back via toDataURL. It's a// WebGL context-creation attribute, so it can't be toggled at runtime without recreating// the renderer (which would flash the scene) — we accept it always-on. The cost on modern@@ -151,11 +152,22 @@ export default function CityScene({ apps, agentMap, onBuildingClick, cosStatus,)}{!explorationMode && !transitioning && !photoMode && (<OrbitControls+ // Map-style navigation: left-drag pans the camera across the city (so you can+ // reach off-center districts without first-person mode), right-drag rotates, scroll+ // zooms, arrow keys pan. On a Mac trackpad, ctrl+drag registers as a right-click so+ // it rotates. screenSpacePanning=false keeps panning in the ground plane (map feel).+ keyEvents+ enablePan+ screenSpacePanning={false}+ panSpeed={1.0}+ keyPanSpeed={24}maxPolarAngle={Math.PI / 2.2}minDistance={5}maxDistance={120}enableDampingdampingFactor={0.05}+ mouseButtons={{ LEFT: THREE.MOUSE.PAN, MIDDLE: THREE.MOUSE.DOLLY, RIGHT: THREE.MOUSE.ROTATE }}+ touches={{ ONE: THREE.TOUCH.PAN, TWO: THREE.TOUCH.DOLLY_ROTATE }}/>)}<CameraTransitiondiff --git a/client/src/components/city/CitySettingsPanel.jsx b/client/src/components/city/CitySettingsPanel.jsxindex 34974c157f..bece486a80 100644--- a/client/src/components/city/CitySettingsPanel.jsx+++ b/client/src/components/city/CitySettingsPanel.jsx@@ -286,21 +286,32 @@ export default function CitySettingsPanel() {/><div className="py-1.5"><div className="font-pixel text-[10px] text-gray-400 tracking-wide mb-2">TIME OF DAY</div>- <div className="grid grid-cols-4 gap-1.5">- {['sunrise', 'noon', 'sunset', 'midnight'].map(tod => (- <button- key={tod}- onClick={() => updateSetting('timeOfDay', tod)}- className={`font-pixel text-[9px] py-2 rounded border transition-all tracking-wide ${- settings.timeOfDay === tod- ? 'bg-cyan-500/20 border-cyan-500/50 text-cyan-400 shadow-[0_0_8px_rgba(6,182,212,0.2)]'- : 'bg-gray-800/40 border-gray-700/40 text-gray-500 hover:border-gray-600 hover:text-gray-400'- }`}- >- {tod.toUpperCase()}- </button>- ))}+ <div className="grid grid-cols-3 gap-1.5">+ {[+ { key: 'auto', label: 'AUTO' },+ { key: 'day', label: 'DAY' },+ { key: 'night', label: 'NIGHT' },+ ].map(({ key, label }) => {+ // Legacy presets (sunrise/noon/sunset/midnight) read as Auto now.+ const active = (settings.timeOfDay === 'day' || settings.timeOfDay === 'night')+ ? settings.timeOfDay === key+ : key === 'auto';+ return (+ <button+ key={key}+ onClick={() => updateSetting('timeOfDay', key)}+ className={`font-pixel text-[9px] py-2 rounded border transition-all tracking-wide ${+ active+ ? 'bg-cyan-500/20 border-cyan-500/50 text-cyan-400 shadow-[0_0_8px_rgba(6,182,212,0.2)]'+ : 'bg-gray-800/40 border-gray-700/40 text-gray-500 hover:border-gray-600 hover:text-gray-400'+ }`}+ >+ {label}+ </button>+ );+ })}</div>+ <div className="font-pixel text-[8px] text-gray-600 tracking-wide mt-1.5">AUTO FOLLOWS YOUR THEME (DAY / NIGHT)</div></div></div>diff --git a/client/src/components/city/cityConstants.js b/client/src/components/city/cityConstants.jsindex db06b40b57..4ac5a7b11c 100644--- a/client/src/components/city/cityConstants.js+++ b/client/src/components/city/cityConstants.js@@ -24,6 +24,9 @@ export const CITY_COLORS = {// Time-of-day presets (used by CitySky + CityLights)// hour: 0-24 mapped to sun arc. Sun traces east(6h) → overhead(12h) → west(18h) → below(0h)// daylightFactor: multiplier for scene ambient/point lights (bright day, dim night)+ // NOTE: the city UI now selects only day/night (→ 'noon'/'sunset' via resolveCityTimeOfDay).+ // 'sunrise' and 'midnight' are retained for legacy stored reads and possible future use,+ // but are no longer reachable from the settings picker.timeOfDay: {sunrise: {hour: 6,@@ -49,23 +52,29 @@ export const CITY_COLORS = {},noon: {hour: 12,- zenith: '#1a4488',- midSky: '#2266aa',- horizonHigh: '#4488bb',- horizonLow: '#5599cc',- sunCore: '#ffffee',- sunGlow: '#ffffcc',- sunLight: '#ffffff',- sunIntensity: 4.5,+ // Bright, airy daytime sky — luminous blue overhead fading to a near-white+ // horizon haze (stylized "clear day" look, BotW-ish).+ zenith: '#4a93e0',+ midSky: '#7fb6ec',+ horizonHigh: '#bfe0f7',+ horizonLow: '#e6f3fc',+ sunCore: '#fffef2',+ sunGlow: '#fff7d6',+ sunLight: '#fff4e0',+ // Moderate intensities — kept low enough that lit surfaces don't clip to white+ // (the post-process previously bloomed the over-bright scene into a white disc).+ sunIntensity: 1.9,sunScale: 0.7,isMoon: false,daylightFactor: 1.0,- groundColor: '#3a3a50',- groundRoughness: 0.6,- hemiSkyColor: '#7799bb',- hemiGroundColor: '#2a3040',- hemiIntensity: 1.2,- ambientColor: '#556688',+ // Mid-tone ground so daylight lands around a clean gray, not blown-out white.+ groundColor: '#8d9198',+ groundRoughness: 0.9,+ // Soft daytime sky fill (blue from above, warm bounce) — gentle, not high-key.+ hemiSkyColor: '#acc6e8',+ hemiGroundColor: '#b4b0a0',+ hemiIntensity: 0.95,+ ambientColor: '#c0cce0',ambientIntensity: 0.35,},sunset: {@@ -275,8 +284,134 @@ export const getTimeOfDayPreset = (timeOfDay, skyTheme) => {return timeOfDayPresets.sunset;};+// 0 at night (sunset preset), ramping to 1 at full day (noon). The scene's many+// night-cyberpunk surfaces (post-fx grade, building albedo/neon, ground grid/fog)+// lerp toward a bright daytime look by this factor. The ramp starts at 0.35 so the+// established night look (sunset's daylightFactor 0.2) stays fully at 0/unchanged.+export const cityDayMix = (settings) => {+ const preset = getTimeOfDayPreset(settings?.timeOfDay ?? 'sunset', settings?.skyTheme ?? 'cyberpunk');+ return smoothstepRange(0.35, 1, preset?.daylightFactor ?? 0);+};+// Get a deterministic neon accent color per app (for windows/decorations)export const getAccentColor = (app) => {const hash = hashString(app.name || app.id);return CITY_COLORS.neonAccents[hash % CITY_COLORS.neonAccents.length];};++// --- Theme integration -------------------------------------------------------+// CyberCity's "brand" surfaces (ground grid, particles, online buildings, the+// lead neon accent) default to cyan. When the user picks a PortOS theme we+// recolor those surfaces to the theme accent so the 3D scene tracks the rest of+// the UI. Status colors (stopped=red, etc.) stay semantic. Every brand surface+// is recomputed from the theme accent (not from the previous theme), so repeated+// switches don't compound; ORIGINAL_GROUND is only the fallback for a theme that+// somehow has no accent.+const ORIGINAL_GROUND = CITY_COLORS.ground;++// Shared color primitives. parseHex: "#0a7a4a" -> [10, 122, 74] (null on bad input).+// toHex: clamps/rounds each channel back to "#rrggbb".+const parseHex = (hex) => {+ const m = /^#([0-9a-f]{6})$/i.exec(hex || '');+ if (!m) return null;+ const n = parseInt(m[1], 16);+ return [(n >> 16) & 255, (n >> 8) & 255, n & 255];+};+const toHex = (r, g, b) => '#' + [r, g, b]+ .map((v) => Math.max(0, Math.min(255, Math.round(v))).toString(16).padStart(2, '0'))+ .join('');++// "10 122 74" (a --port-* rgb triplet) -> "#0a7a4a"+const tripletToHex = (triplet) => {+ if (typeof triplet !== 'string') return null;+ const parts = triplet.trim().split(/\s+/).map(Number);+ if (parts.length !== 3 || parts.some(Number.isNaN)) return null;+ return toHex(parts[0], parts[1], parts[2]);+};++const darkenHex = (hex, factor) => {+ const rgb = parseHex(hex);+ return rgb ? toHex(rgb[0] * factor, rgb[1] * factor, rgb[2] * factor) : hex;+};++// Mix a hex color t of the way toward white (t in 0..1). Used to derive a bright,+// accent-tinted daytime sky backdrop from the theme accent.+const lightenHex = (hex, t) => {+ const rgb = parseHex(hex);+ return rgb ? toHex(...rgb.map((c) => c + (255 - c) * t)) : hex;+};++// Mix two hex colors (t in 0..1, 0=a, 1=b).+export const mixHex = (a, b, t) => {+ const ca = parseHex(a);+ const cb = parseHex(b);+ return ca && cb ? toHex(...ca.map((c, i) => c + (cb[i] - c) * t)) : a;+};++// GLSL-style smoothstep with an edge remap (distinct from the plain Hermite+// smoothstep(t) in utils/easing.js — different arity, kept local on purpose).+const smoothstepRange = (a, b, x) => {+ if (a === b) return x < a ? 0 : 1;+ const t = Math.max(0, Math.min(1, (x - a) / (b - a)));+ return t * t * (3 - 2 * t);+};++// The city renders just two times of day — day and night — and follows the active+// theme's mode by default ('auto'). The user can still force 'day'/'night'. Legacy+// stored values (sunrise/noon/sunset/midnight) are treated as 'auto' so existing+// installs pick up theme coupling without a migration. Returns the daytime flag+// plus the concrete preset key the sky/lights/ground consume (noon vs sunset —+// sunset preserves the established dark-theme look users already have).+export const resolveCityTimeOfDay = (setting, themeIsDay) => {+ const daytime = setting === 'day' ? true+ : setting === 'night' ? false+ : !!themeIsDay;+ return { daytime, presetKey: daytime ? 'noon' : 'sunset' };+};++// The CRT overlay (scanlines / neon edge-glow / vignette in CityScanlines) is a+// cyber-terminal affectation, not a universal effect — so each piece is opted in+// per theme family. Scanlines are the most style-specific (terminal only); the+// neon edge glow suits the cyber-leaning families (terminal + the classic+// cyberpunk default); the cinematic vignette applies everywhere except the clean+// "glass" family. Glow color itself is themed via the live --port-accent var.+const deriveCrtProfile = (family) => ({+ scanlines: family === 'terminal',+ glow: family === 'terminal' || family === 'classic',+ vignette: family !== 'glass',+});++// Derive the city palette from a PortOS theme object (a THEMES entry). Pure.+export const deriveCityPalette = (theme) => {+ const accent = tripletToHex(theme?.colors?.['--port-accent']) || ORIGINAL_GROUND;+ const isDay = theme?.mode === 'day';+ // Night backdrop: a near-black, accent-tinted void — the neon's additive/bloom+ // materials need darkness or they blow out. Day backdrop: a bright, accent-tinted+ // sky (the daytime preset dims the neon, so a light surround is safe and reads as+ // actual daytime). The scene picks one based on the resolved time of day; the HUD+ // panels follow the light/dark theme independently (see .cybercity-themed CSS).+ const nightBackground = darkenHex(accent, 0.1);+ const dayBackground = lightenHex(accent, 0.86);+ return {+ themeId: theme?.id || 'classic-midnight',+ mode: theme?.mode || 'night',+ isDay,+ accent,+ nightBackground,+ dayBackground,+ // Default surround by theme mode — used for the loading screen before settings resolve.+ background: isDay ? dayBackground : nightBackground,+ crt: deriveCrtProfile(theme?.family),+ };+};++// Recolor the brand surfaces in-place from a derived palette. The city page calls+// this when the theme changes and remounts the scene subtree (keyed on themeId)+// so every component re-reads the singleton. Recomputes from ORIGINAL_BRAND.+export const applyCityBrandColors = (palette) => {+ const accent = palette?.accent || ORIGINAL_GROUND;+ CITY_COLORS.ground = accent;+ CITY_COLORS.particles = accent;+ CITY_COLORS.building.online = accent;+ CITY_COLORS.neonAccents[0] = accent;+};diff --git a/client/src/components/city/cityTheme.test.js b/client/src/components/city/cityTheme.test.jsnew file mode 100644index 0000000000..6f51b7b32e--- /dev/null+++ b/client/src/components/city/cityTheme.test.js@@ -0,0 +1,94 @@+import { describe, it, expect, beforeEach } from 'vitest';+import { deriveCityPalette, applyCityBrandColors, resolveCityTimeOfDay, CITY_COLORS, getBuildingColor } from './cityConstants';+import { getTheme } from '../../themes/portosThemes';++describe('deriveCityPalette', () => {+ it('derives the accent hex from a theme --port-accent triplet', () => {+ const phosphor = getTheme('black-ice-terminal-day');+ const p = deriveCityPalette(phosphor);+ expect(p.accent).toBe('#0a7a4a'); // 10 122 74+ expect(p.themeId).toBe('black-ice-terminal-day');+ expect(p.isDay).toBe(true);+ });++ it('exposes a dark night void and a bright day sky, both accent-tinted', () => {+ const phosphor = getTheme('black-ice-terminal-day'); // accent #0a7a4a+ const p = deriveCityPalette(phosphor);+ expect(p.nightBackground).toBe('#010c07'); // #0a7a4a * 0.1+ expect(p.dayBackground).toBe('#ddece6'); // #0a7a4a lightened 0.86 toward white+ // A day theme's default surround (loading screen) is the bright day sky.+ expect(p.isDay).toBe(true);+ expect(p.background).toBe('#ddece6');+ });++ it('defaults a night theme surround to the dark void', () => {+ const midnight = getTheme('classic-midnight'); // accent #3b82f6+ const p = deriveCityPalette(midnight);+ expect(p.isDay).toBe(false);+ expect(p.background).toBe('#060d19'); // nightBackground = #3b82f6 * 0.1+ expect(p.dayBackground).toBe('#e4eefe');+ });++ it('falls back to defaults for a missing/invalid theme', () => {+ const p = deriveCityPalette(undefined);+ expect(p.themeId).toBe('classic-midnight');+ expect(p.accent).toBe('#06b6d4'); // original cyan brand+ expect(p.background).toBe('#011215'); // night theme default -> #06b6d4 * 0.1+ });++ it('resolves time of day, following theme mode for auto/legacy and honoring explicit overrides', () => {+ // auto follows the theme mode+ expect(resolveCityTimeOfDay('auto', true)).toEqual({ daytime: true, presetKey: 'noon' });+ expect(resolveCityTimeOfDay('auto', false)).toEqual({ daytime: false, presetKey: 'sunset' });+ expect(resolveCityTimeOfDay(undefined, true)).toEqual({ daytime: true, presetKey: 'noon' });+ // legacy stored presets are treated as auto (follow the theme)+ expect(resolveCityTimeOfDay('sunset', true)).toEqual({ daytime: true, presetKey: 'noon' });+ expect(resolveCityTimeOfDay('midnight', true)).toEqual({ daytime: true, presetKey: 'noon' });+ // explicit overrides win regardless of theme mode+ expect(resolveCityTimeOfDay('day', false)).toEqual({ daytime: true, presetKey: 'noon' });+ expect(resolveCityTimeOfDay('night', true)).toEqual({ daytime: false, presetKey: 'sunset' });+ });++ it('opts CRT effects in per theme family', () => {+ // terminal (Phosphor) — full CRT+ expect(deriveCityPalette(getTheme('black-ice-terminal-day')).crt)+ .toEqual({ scanlines: true, glow: true, vignette: true });+ // classic — cyber glow + vignette, but no scanlines+ expect(deriveCityPalette(getTheme('classic-midnight')).crt)+ .toEqual({ scanlines: false, glow: true, vignette: true });+ // blueprint — vignette only+ expect(deriveCityPalette(getTheme('blueprint-ops')).crt)+ .toEqual({ scanlines: false, glow: false, vignette: true });+ // glass — fully clean, no CRT+ expect(deriveCityPalette(getTheme('lumen-glass')).crt)+ .toEqual({ scanlines: false, glow: false, vignette: false });+ });+});++describe('applyCityBrandColors', () => {+ // Restore the cyan baseline after each test so mutation doesn't leak across the suite.+ beforeEach(() => applyCityBrandColors(deriveCityPalette(undefined)));++ it('recolors brand surfaces to the theme accent', () => {+ applyCityBrandColors(deriveCityPalette(getTheme('black-ice-terminal-day')));+ expect(CITY_COLORS.ground).toBe('#0a7a4a');+ expect(CITY_COLORS.particles).toBe('#0a7a4a');+ expect(CITY_COLORS.building.online).toBe('#0a7a4a');+ expect(CITY_COLORS.neonAccents[0]).toBe('#0a7a4a');+ // online buildings follow the recolor through the shared helper+ expect(getBuildingColor('online')).toBe('#0a7a4a');+ });++ it('leaves status colors untouched', () => {+ applyCityBrandColors(deriveCityPalette(getTheme('black-ice-terminal-day')));+ expect(CITY_COLORS.building.stopped).toBe('#ef4444');+ expect(getBuildingColor('stopped')).toBe('#ef4444');+ });++ it('recomputes from the cyan baseline rather than compounding across switches', () => {+ applyCityBrandColors(deriveCityPalette(getTheme('black-ice-terminal-day')));+ applyCityBrandColors(deriveCityPalette(getTheme('classic-midnight')));+ // classic-midnight accent is 59 130 246 -> #3b82f6, not a blend of green+blue+ expect(CITY_COLORS.ground).toBe('#3b82f6');+ });+});diff --git a/client/src/hooks/useCitySettings.js b/client/src/hooks/useCitySettings.jsindex 12afc4aa8f..192036c9fb 100644--- a/client/src/hooks/useCitySettings.js+++ b/client/src/hooks/useCitySettings.js@@ -52,7 +52,7 @@ const DEFAULT_SETTINGS = {sfxVolume: 0.5,qualityPreset: 'high',skyTheme: 'cyberpunk',- timeOfDay: 'sunset',+ timeOfDay: 'auto', // 'auto' follows the active theme's day/night mode; 'day'/'night' force itexplorationMode: false,...QUALITY_PRESETS.high,};diff --git a/client/src/index.css b/client/src/index.cssindex 8eb4e81cb1..0738966b1a 100644--- a/client/src/index.css+++ b/client/src/index.css@@ -713,6 +713,98 @@ html[data-port-theme-mode="day"] [class~="hover:text-slate-100"]:hover {color: rgb(var(--port-text)) !important;}+/* === City (formerly CyberCity) HUD theming ===+ Class/id names keep the `cybercity` slug as a stable internal contract; the+ feature is branded "City" in the UI.+ The CyberCity overlay (clock, vitals, intel pane, agent bar, mini-map, filter+ bar, settings panel, photo overlay, holographic panels) was authored in a fixed+ cyberpunk palette: near-black panels (`bg-black/85`), cyan accent text/borders+ (`text-cyan-400`, `border-cyan-500/40`), and many very-low-opacity tokens+ (`text-cyan-500/20`, `text-gray-600`, `border-cyan-500/15`). On a light theme+ like Phosphor Paper that reads as dim teal on near-black floating over a cream+ page — low contrast and off-theme. Rather than edit every component, we remap+ those exact utility tokens to the active theme's `--port-*` vars, scoped to the+ `.cybercity-themed` page root so nothing else is affected. Status colors+ (red/amber/emerald/violet/...) are intentionally left to the global day-mode+ remap above so they keep their semantic meaning. The low-opacity variants are+ given a higher legibility floor than their original alpha.+ When adding a new HUD element, prefer these same tokens so it themes for free. */++/* Panels — near-black backgrounds follow the theme card color (dark in night+ themes, paper in day themes). Kept fully opaque so the busy 3D scene behind+ them never bleeds through and hurts text legibility. A two-tier split keeps+ nested elements distinct: the main panels take the card color, inner fills+ (agent items, list rows) take the slightly-different page bg color. */+html[data-port-theme] .cybercity-themed [class~="bg-black/95"],+html[data-port-theme] .cybercity-themed [class~="bg-black/92"],+html[data-port-theme] .cybercity-themed [class~="bg-black/90"],+html[data-port-theme] .cybercity-themed [class~="bg-black/85"],+html[data-port-theme] .cybercity-themed [class~="bg-black/80"],+html[data-port-theme] .cybercity-themed [class~="bg-black/70"] { background-color: rgb(var(--port-card)) !important; }+html[data-port-theme] .cybercity-themed [class~="bg-black/60"],+html[data-port-theme] .cybercity-themed [class~="bg-black/50"],+html[data-port-theme] .cybercity-themed [class~="bg-black/40"] { background-color: rgb(var(--port-bg)) !important; }++/* Accent text — cyan family → theme accent, tiered so emphasis survives. */+html[data-port-theme] .cybercity-themed [class~="text-cyan-400"],+html[data-port-theme] .cybercity-themed [class~="text-cyan-300"],+html[data-port-theme] .cybercity-themed [class~="text-cyan-500"] { color: rgb(var(--port-accent)) !important; }+html[data-port-theme] .cybercity-themed [class~="text-cyan-400/80"],+html[data-port-theme] .cybercity-themed [class~="text-cyan-400/70"],+html[data-port-theme] .cybercity-themed [class~="text-cyan-500/70"],+html[data-port-theme] .cybercity-themed [class~="text-cyan-500/60"] { color: rgb(var(--port-accent) / 0.82) !important; }+html[data-port-theme] .cybercity-themed [class~="text-cyan-400/60"],+html[data-port-theme] .cybercity-themed [class~="text-cyan-400/50"],+html[data-port-theme] .cybercity-themed [class~="text-cyan-500/50"],+html[data-port-theme] .cybercity-themed [class~="text-cyan-500/40"] { color: rgb(var(--port-accent) / 0.7) !important; }+html[data-port-theme] .cybercity-themed [class~="text-cyan-500/30"],+html[data-port-theme] .cybercity-themed [class~="text-cyan-500/25"],+html[data-port-theme] .cybercity-themed [class~="text-cyan-500/20"],+html[data-port-theme] .cybercity-themed [class~="text-cyan-400/20"] { color: rgb(var(--port-accent) / 0.55) !important; }+html[data-port-theme] .cybercity-themed [class~="hover:text-cyan-400"]:hover,+html[data-port-theme] .cybercity-themed [class~="hover:text-cyan-300"]:hover { color: rgb(var(--port-accent)) !important; }++/* Neutral / muted text — gray tokens follow the theme text colors so faint+ labels stay legible on both dark and paper panels (gray-600 on near-black was+ the worst offender). */+html[data-port-theme] .cybercity-themed [class~="text-gray-300"] { color: rgb(var(--port-text) / 0.92) !important; }+html[data-port-theme] .cybercity-themed [class~="text-gray-400"],+html[data-port-theme] .cybercity-themed [class~="text-gray-500"],+html[data-port-theme] .cybercity-themed [class~="text-gray-600"] { color: rgb(var(--port-text-muted)) !important; }++/* Borders — cyan accent borders → theme accent, with a visibility floor so the+ hairline panel frames don't vanish on a light background. */+html[data-port-theme] .cybercity-themed [class~="border-cyan-500/60"],+html[data-port-theme] .cybercity-themed [class~="border-cyan-500/50"],+html[data-port-theme] .cybercity-themed [class~="border-cyan-500/40"],+html[data-port-theme] .cybercity-themed [class~="border-cyan-400/70"],+html[data-port-theme] .cybercity-themed [class~="border-cyan-400/60"] { border-color: rgb(var(--port-accent) / 0.55) !important; }+html[data-port-theme] .cybercity-themed [class~="border-cyan-500/35"],+html[data-port-theme] .cybercity-themed [class~="border-cyan-500/30"],+html[data-port-theme] .cybercity-themed [class~="border-cyan-500/25"],+html[data-port-theme] .cybercity-themed [class~="border-cyan-400/50"] { border-color: rgb(var(--port-accent) / 0.42) !important; }+html[data-port-theme] .cybercity-themed [class~="border-cyan-500/20"],+html[data-port-theme] .cybercity-themed [class~="border-cyan-500/15"],+html[data-port-theme] .cybercity-themed [class~="border-cyan-500/10"] { border-color: rgb(var(--port-accent) / 0.3) !important; }++/* Accent fills — solid swatches (status dots, knobs, capture button) take the+ full accent; the alpha variants (dividers, active chips, mini-map grid, hover+ washes) scale down to match their original weight. */+html[data-port-theme] .cybercity-themed [class~="bg-cyan-400"],+html[data-port-theme] .cybercity-themed [class~="bg-cyan-500"] { background-color: rgb(var(--port-accent)) !important; }+html[data-port-theme] .cybercity-themed [class~="bg-cyan-400/60"] { background-color: rgb(var(--port-accent) / 0.6) !important; }+html[data-port-theme] .cybercity-themed [class~="bg-cyan-400/40"],+html[data-port-theme] .cybercity-themed [class~="bg-cyan-500/40"] { background-color: rgb(var(--port-accent) / 0.4) !important; }+html[data-port-theme] .cybercity-themed [class~="bg-cyan-500/25"],+html[data-port-theme] .cybercity-themed [class~="bg-cyan-500/20"] { background-color: rgb(var(--port-accent) / 0.2) !important; }+html[data-port-theme] .cybercity-themed [class~="bg-cyan-500/15"],+html[data-port-theme] .cybercity-themed [class~="bg-cyan-400/15"] { background-color: rgb(var(--port-accent) / 0.16) !important; }+html[data-port-theme] .cybercity-themed [class~="bg-cyan-500/10"] { background-color: rgb(var(--port-accent) / 0.12) !important; }+html[data-port-theme] .cybercity-themed [class~="bg-cyan-500/[0.03]"] { background-color: rgb(var(--port-accent) / 0.05) !important; }+html[data-port-theme] .cybercity-themed [class~="hover:bg-cyan-300"]:hover { background-color: rgb(var(--port-accent) / 0.9) !important; }+html[data-port-theme] .cybercity-themed [class~="hover:bg-cyan-500/10"]:hover { background-color: rgb(var(--port-accent) / 0.12) !important; }+html[data-port-theme] .cybercity-themed [class~="hover:bg-cyan-500/5"]:hover { background-color: rgb(var(--port-accent) / 0.08) !important; }+/* === Lumen Glass Day === */html[data-port-theme="lumen-glass-day"] :is(.bg-port-card, [class~="bg-port-card/50"]):is(.border, .rounded, .rounded-lg, .rounded-xl, .rounded-2xl) {border-color: rgb(var(--port-border) / 0.22) !important;diff --git a/client/src/pages/CyberCity.jsx b/client/src/pages/CyberCity.jsxindex c5d4c45726..61f1dd4492 100644--- a/client/src/pages/CyberCity.jsx+++ b/client/src/pages/CyberCity.jsx@@ -14,6 +14,8 @@ import CitySettingsPanel from '../components/city/CitySettingsPanel';import { computeFilterResult } from '../utils/cityFilter';import { DEFAULT_PRESET_ID, cyclePreset } from '../utils/cityPhotoMode';import { computeSoundscape } from '../utils/citySoundscape';+import { deriveCityPalette, applyCityBrandColors, resolveCityTimeOfDay } from '../components/city/cityConstants';+import { useThemeContext } from '../components/ThemeContext';function CyberCityInner() {const { apps, cosAgents, cosStatus, eventLogs, agentMap, reviewCounts, instances, systemHealth, notificationCounts, backupStatus, cosTasks, healthMetrics, voiceState, character, aiActivity, loading, connected } = useCityData();@@ -32,6 +34,31 @@ function CyberCityInner() {const { playSfx } = useCityAudio(settings, soundscape);const navigate = useNavigate();const location = useLocation();++ // CyberCity follows the active PortOS theme: the HUD recolors via the+ // `cybercity-themed` CSS scope (see index.css) and the 3D scene's brand colors+ // + surround are derived from the same theme here.+ const { theme: cityTheme } = useThemeContext();+ const cityPalette = useMemo(() => {+ const palette = deriveCityPalette(cityTheme);+ // Recolor the shared CITY_COLORS singleton during render — before the scene+ // children render — so the keyed remount below (key={cityPalette.themeId})+ // reads fresh brand colors on a theme switch.+ applyCityBrandColors(palette);+ return palette;+ }, [cityTheme]);++ // The city renders day or night, following the theme mode by default (see+ // resolveCityTimeOfDay). The resolved preset key is handed to the scene via a+ // settings override (CitySky/CityLights/CityGround read settings.timeOfDay), and+ // the backdrop swaps between the bright day sky and the dark night void to match.+ const cityTimeOfDay = resolveCityTimeOfDay(settings?.timeOfDay, cityPalette.isDay);+ const sceneBackground = cityTimeOfDay.daytime ? cityPalette.dayBackground : cityPalette.nightBackground;+ const sceneSettings = useMemo(+ () => ({ ...settings, timeOfDay: cityTimeOfDay.presetKey }),+ [settings, cityTimeOfDay.presetKey],+ );+const [filter, setFilter] = useState(() => {// try/catch is necessary because sessionStorage values are external state// a corrupted/older-schema entry would throw and crash the page render.@@ -228,9 +255,9 @@ function CyberCityInner() {if (loading) {return (- <div className="flex flex-col items-center justify-center h-full gap-4" style={{ background: '#030308' }}>+ <div className="flex flex-col items-center justify-center h-full gap-4 cybercity-themed" style={{ background: cityPalette.background }}><div className="font-pixel text-cyan-400 text-lg tracking-widest animate-pulse" style={{ textShadow: '0 0 12px rgba(6,182,212,0.5)' }}>- INITIALIZING CYBERCITY+ INITIALIZING CITY</div><div className="w-48 h-1 bg-gray-800 rounded-full overflow-hidden"><div className="h-full bg-cyan-500 rounded-full animate-pulse" style={{ width: '60%', boxShadow: '0 0 8px rgba(6,182,212,0.5)' }} />@@ -243,8 +270,10 @@ function CyberCityInner() {}return (- <div className="relative w-full h-full" style={{ background: '#030308', isolation: 'isolate' }}>+ <div className="relative w-full h-full cybercity-themed" style={{ background: sceneBackground, isolation: 'isolate' }}><CityScene+ key={cityPalette.themeId}+ background={sceneBackground}apps={apps}agentMap={agentMap}onBuildingClick={handleBuildingClick}@@ -267,7 +296,7 @@ function CyberCityInner() {photoMode={photoMode}photoPresetId={photoPresetId}onPhotoCaptureReady={handlePhotoCaptureReady}- settings={settings}+ settings={sceneSettings}playSfx={playSfx}keysRef={keysRef}dimmedAppIds={filterResult.dimmed}@@ -305,7 +334,7 @@ function CyberCityInner() {captureFnRef={captureFnRef}statsSnapshot={photoStats}/>- <CityScanlines settings={settings} />+ <CityScanlines settings={settings} crt={cityPalette.crt} />{showSettings && <CitySettingsPanel />}</div>);diff --git a/server/lib/navManifest.js b/server/lib/navManifest.jsindex 4c02462461..a4793b4f21 100644--- a/server/lib/navManifest.js+++ b/server/lib/navManifest.js@@ -6,8 +6,8 @@export const NAV_COMMANDS = [{ id: 'nav.dashboard', path: '/', label: 'Dashboard', section: 'Main', aliases: ['dashboard', 'home'], keywords: ['overview', 'start'] },{ id: 'nav.review-hub', path: '/review', label: 'Review Hub', section: 'Main', aliases: ['review', 'review-hub'] },- { id: 'nav.cybercity', path: '/city', label: 'CyberCity', section: 'Main', aliases: ['city', 'cybercity'], keywords: ['3d', 'visualization'] },- { id: 'nav.cybercity.settings', path: '/city/settings', label: 'CyberCity Settings', section: 'Main', aliases: ['city settings', 'cybercity settings', 'city-settings', 'cybercity-config'], keywords: ['cybercity', 'settings', '3d', 'configure'] },+ { id: 'nav.cybercity', path: '/city', label: 'City', section: 'Main', aliases: ['city', 'cybercity'], keywords: ['3d', 'visualization', 'cybercity'] },+ { id: 'nav.cybercity.settings', path: '/city/settings', label: 'City Settings', section: 'Main', aliases: ['city settings', 'cybercity settings', 'city-settings', 'cybercity-config'], keywords: ['cybercity', 'settings', '3d', 'configure'] },{ id: 'nav.apps', path: '/apps', label: 'Apps', section: 'Main', aliases: ['apps'] },{ id: 'nav.catalog', path: '/catalog', label: 'Catalog', section: 'Create', aliases: ['catalog', 'ingredients', 'cast', 'creative-catalog'], keywords: ['character', 'place', 'object', 'idea', 'scene', 'concept', 'inventory', 'reference', 'creative'] },