:root {
  --bg: #06080c;
  --ink: #e8ebf1;
  --muted: #8d95a7;
  --line: rgba(255, 255, 255, .1);
  --panel: rgba(15, 18, 25, .95);
  --accent: #7aa7ff;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---- Stage ------------------------------------------------------------ */

#view {
  position: fixed;
  inset: 0;
  overflow: hidden;
  perspective-origin: 50% 50%;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, .09) 1px, transparent 1.7px),
    linear-gradient(to bottom, #0c0f16 0%, #07090d 50%, #0b0d12 100%);
  background-size: 44px 44px, 100% 100%;
  cursor: crosshair;
}

#world {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  pointer-events: none;
}

.screen {
  position: absolute;
  left: 50%;
  top: 50%;
  overflow: hidden;
  border-radius: .6em;
  background: #0d1017;
  backface-visibility: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .09), 0 2em 6em rgba(0, 0, 0, .55);
}
.screen video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }

#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 72% 78% at 50% 50%, transparent 62%, rgba(0, 0, 0, .6) 100%);
  transition: opacity .3s;
}
.no-vignette #vignette { opacity: 0; }

#lock-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 18px;
  border-radius: 10px;
  background: rgba(10, 12, 16, .85);
  border: 1px solid var(--line);
  font-size: 15px;
  display: none;
  pointer-events: none;
}
.relative:not(.locked) #lock-hint { display: block; }
.relative:not(.locked) #view { cursor: pointer; }

/* ---- HUD -------------------------------------------------------------- */

#hud {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(10, 12, 16, .66);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
#hud b { color: var(--ink); }
#status { min-width: 9.5em; text-align: right; }
#yaw { min-width: 3em; }

#minimap { position: relative; width: min(240px, 40vw); height: 14px; }
.mm-screen {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .2);
}
.mm-screen.on { background: var(--accent); }
.mm-fov {
  position: absolute;
  top: 0;
  bottom: 0;
  border: 1.5px solid #fff;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .4);
}

#hint {
  position: fixed;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 8px 16px;
  border-radius: 10px;
  background: rgba(10, 12, 16, .8);
  border: 1px solid var(--line);
  text-align: center;
  font-size: 14px;
  pointer-events: none;
  transition: opacity .6s;
}
#hint span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
#hint.gone { opacity: 0; }

#gear {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(10, 12, 16, .6);
  color: var(--muted);
  cursor: pointer;
}
#gear:hover { color: var(--ink); }

/* ---- Settings panel --------------------------------------------------- */

#panel {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: min(340px, calc(100vw - 24px));
  overflow-y: auto;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
#panel[hidden] { display: none; }
#panel header { display: flex; align-items: center; justify-content: space-between; }
#panel h1 { margin: 0; font-size: 16px; }
#panel h2 { margin: 18px 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
#panel .sub { margin: 4px 0 12px; color: var(--muted); font-size: 12px; }
#close { border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
#close:hover { color: var(--ink); }

.rows { display: grid; gap: 9px; }
.row { display: grid; grid-template-columns: 7.5em 1fr 4.2em; align-items: center; gap: 8px; }
.row > span { color: var(--muted); }
.row select { grid-column: 2 / 4; }
.row output { text-align: right; font-variant-numeric: tabular-nums; }
.row.check input { justify-self: start; }
.row input:disabled { opacity: .35; }

select, #panel button:not(#close) {
  font: inherit;
  color: var(--ink);
  background: #1b202b;
  border: 1px solid #2a3140;
  border-radius: 7px;
  padding: 5px 8px;
}
#panel button:not(#close) { cursor: pointer; }
#panel button:not(#close):hover:not(:disabled) { background: #232a38; }
#panel button:disabled { opacity: .45; cursor: default; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

.note { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.note em { color: #f3c969; font-style: normal; }

#screen-list { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
#screen-list li { color: var(--muted); }
#screen-list li > * { vertical-align: middle; }
#screen-list select { width: calc(100% - 118px); margin-right: 6px; }
#screen-list button { width: 112px; }

#panel footer { margin-top: 18px; }

/* ---- Mock apps (sizes in em, 1em = body text on the virtual screen) --- */

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #0f1218;
  color: #d9dee8;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
}
.app.light { background: #f6f7f9; color: #1d2230; }
.app.paper { background: #fbf8f1; color: #2b2a26; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, Menlo, monospace; }

.menubar {
  flex: none;
  display: flex;
  align-items: center;
  gap: .8em;
  height: 2.3em;
  padding: 0 .9em;
  font-size: .8em;
  background: #171b23;
  border-bottom: 1px solid #22272f;
  color: #a9b1c2;
}
.light .menubar { background: #e6e9ee; border-color: #d4d8e0; color: #4a5263; }
.paper .menubar { background: #efe9dc; border-color: #e0d8c6; color: #6a6252; }
.lights { display: flex; gap: .45em; width: 6em; }
.lights i { width: .8em; height: .8em; border-radius: 50%; background: #ff5f57; }
.lights i:nth-child(2) { background: #febc2e; }
.lights i:nth-child(3) { background: #28c840; }
.menubar .title { flex: 1; text-align: center; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.menubar .clock { width: 6em; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.app-body { flex: 1; min-height: 0; display: flex; overflow: hidden; }
.app-body > * { flex: 1; min-width: 0; }

/* Code editor */
.ide { display: flex; }
.ide .tree { flex: none; width: 13em; padding: .8em 0; background: #0b0e13; border-right: 1px solid #1c212b; font-size: .9em; color: #9aa3b5; }
.tree .h { padding: 0 1.1em .5em; font-size: .75em; letter-spacing: .08em; text-transform: uppercase; color: #616a7d; }
.tree .h2 { margin-top: 1.2em; }
.tree .d { padding: .15em 1.1em; }
.tree .f { padding: .15em 1.1em .15em 2.2em; }
.tree .f.on { background: #1a2030; color: #e6ebf5; }
.editor { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tabs { flex: none; display: flex; background: #0b0e13; border-bottom: 1px solid #1c212b; font-size: .85em; }
.tab { padding: .55em 1.3em; color: #7d8699; border-right: 1px solid #1c212b; }
.tab.on { background: #0f1218; color: #e6ebf5; box-shadow: inset 0 2px 0 var(--accent); }
.src { flex: 1; min-height: 0; margin: 0; padding: .8em 0; overflow: hidden; font-size: .88em; line-height: 1.6; counter-reset: ln; }
.src .ln { display: block; position: relative; padding-left: 4.4em; white-space: pre; }
.src .ln::before { counter-increment: ln; content: counter(ln); position: absolute; left: 0; width: 3em; text-align: right; color: #454d5e; }
.src .ln.cur { background: rgba(122, 167, 255, .08); }
.t-kw { color: #c792ea; }
.t-str { color: #a5d6a7; }
.t-num { color: #f78c6c; }
.t-com { color: #5f697c; font-style: italic; }
.t-fn { color: #82aaff; }
.t-type { color: #ffcb6b; }
.statusbar { flex: none; display: flex; gap: 1.6em; padding: .3em 1em; font-size: .75em; background: #1f3a66; color: #cfe0ff; }
.statusbar .grow { flex: 1; }

/* Terminal */
.term { display: flex; flex-direction: column; padding: .8em 1em; background: #090b0f; font-size: .9em; line-height: 1.5; white-space: pre; }
.term-log { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.term .ok { color: #7fd88f; }
.term .warn { color: #f3c969; }
.term .err { color: #ff7b72; }
.term .dim { color: #697186; }
.term .path { color: #79c0ff; }
.term .prompt { color: #7fd88f; }
.cursor { display: inline-block; width: .6em; height: 1.15em; vertical-align: -.2em; background: #d9dee8; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Browser */
.browser { display: flex; flex-direction: column; background: #121620; color: #d9dee8; }
.urlbar { flex: none; display: flex; align-items: center; gap: .9em; padding: .5em .9em; background: #0b0e13; border-bottom: 1px solid #1c212b; }
.urlbar .nav { color: #7d8699; letter-spacing: .5em; }
.urlbar .url { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: .3em 1.1em; border-radius: 1em; background: #171c26; border: 1px solid #262c38; color: #aab2c3; font-size: .9em; }
.page { flex: 1; min-height: 0; overflow: hidden; padding: 2.2em 0; }
.page-inner { max-width: 44em; margin: 0 auto; padding: 0 2em; }
.crumbs { font-size: .8em; color: #7d8699; }
.page h1 { margin: .25em 0 .5em; font-size: 2.1em; line-height: 1.15; letter-spacing: -.01em; color: #eef1f6; }
.page h2 { margin: 1.3em 0 .35em; font-size: 1.25em; color: #eef1f6; }
.page p { margin: .55em 0; }
.page .lede { font-size: 1.12em; color: #aab2c3; }
.fig { margin: 1.3em 0; padding: 1em; border-radius: .7em; background: #171c26; border: 1px solid #232937; }
.ring { display: block; width: 100%; height: 9em; }
.ring .orbit { fill: none; stroke: #3a4252; stroke-dasharray: 3 4; }
.ring polyline { fill: none; stroke: #5d6679; stroke-width: 6; stroke-linecap: round; }
.ring polyline.on { stroke: var(--accent); }
.ring .fov { fill: rgba(122, 167, 255, .14); }
.ring .head { fill: #e8ebf1; }
.ring text { font: 12px system-ui, sans-serif; fill: #7d8699; text-anchor: middle; }

/* Chat */
.chat { display: flex; }
.chat .side { flex: none; width: 14em; padding: 1em .6em; background: #0b0e13; border-right: 1px solid #1c212b; }
.side .item { padding: .5em .8em; margin-bottom: .2em; border-radius: .45em; color: #9aa3b5; }
.side .item.on { background: #1a2030; color: #e6ebf5; }
.chat .main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.msgs { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 1.1em; padding: 1.5em 2.5em; }
.msg { max-width: 36em; }
.msg .who { margin-bottom: .25em; font-size: .78em; color: #697186; }
.msg .bubble { padding: .7em 1em; border-radius: .8em; background: #171c26; }
.msg.me { align-self: flex-end; }
.msg.me .who { text-align: right; }
.msg.me .bubble { background: #25407a; color: #eef3ff; }
.typing { display: inline-flex; gap: .35em; }
.typing i { width: .5em; height: .5em; border-radius: 50%; background: #8d95a7; animation: bounce 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }
.composer { flex: none; margin: 0 2.5em 1.5em; padding: .8em 1em; border: 1px solid #262c38; border-radius: .8em; color: #697186; }

/* System monitor */
.mon { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: auto 1fr; gap: 1em; padding: 1.2em; }
.card { min-width: 0; padding: .9em 1em; border-radius: .6em; background: #151a23; border: 1px solid #1f2531; }
.card .k { font-size: .78em; color: #7d8699; text-transform: uppercase; letter-spacing: .06em; }
.card .v { margin: .1em 0 .4em; font-variant-numeric: tabular-nums; }
.card .v b { font-size: 1.9em; font-weight: 600; }
.card .v small { color: #7d8699; }
.card svg { display: block; width: 100%; height: 3.6em; }
.card polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.card polygon { fill: rgba(122, 167, 255, .14); }
.procs { grid-column: 1 / -1; }
.procs table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.procs th { text-align: left; font-weight: 500; font-size: .8em; color: #7d8699; padding: .3em .5em .6em; border-bottom: 1px solid #242a36; }
.procs td { padding: .45em .5em; border-bottom: 1px solid #1c212b; }

/* Task board */
.kanban { display: flex; gap: 1em; padding: 1.2em; background: #12151c; }
.col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .6em; padding: .8em; border-radius: .6em; background: #191d26; }
.col h3 { margin: 0 0 .2em; font-size: .85em; color: #a9b1c2; }
.col h3 span { color: #616a7d; font-weight: 400; margin-left: .3em; }
.kcard { padding: .65em .75em; border-radius: .45em; background: #222836; font-size: .92em; }
.lbl { display: inline-block; margin-bottom: .35em; padding: .05em .5em; border-radius: .3em; font-size: .72em; text-transform: uppercase; letter-spacing: .05em; }
.lbl.idea { background: #2c2350; color: #c4b5fd; }
.lbl.test { background: #173a3a; color: #7fe0d0; }
.lbl.bug { background: #4a1f22; color: #ffa3a3; }
.lbl.feat { background: #1d3357; color: #a9c7ff; }

/* Calendar */
.cal { display: grid; grid-template-columns: 4em repeat(5, minmax(0, 1fr)); grid-template-rows: 3.4em 1fr; background: #fff; }
.cal .dh { display: flex; align-items: baseline; gap: .4em; padding: .8em .7em 0; border-left: 1px solid #eceef2; border-bottom: 1px solid #e3e6ec; color: #4a5263; }
.cal .dh b { font-size: 1.3em; }
.cal .dh.today b { color: #fff; background: #3d6fe0; border-radius: 1em; padding: 0 .45em; }
.cal .corner { border-bottom: 1px solid #e3e6ec; }
.cal .hours { position: relative; margin-bottom: 1em; }
.cal .hours span { position: absolute; right: .6em; transform: translateY(-50%); font-size: .72em; color: #8a91a1; }
.cal .day { position: relative; margin-bottom: 1em; border-left: 1px solid #eceef2;
  background: repeating-linear-gradient(to bottom, #eceef2 0 1px, transparent 1px 12.5%); }
.ev { position: absolute; left: .3em; right: .3em; overflow: hidden; padding: .3em .55em; border-radius: .4em; font-size: .8em; line-height: 1.3; border-left: .3em solid; }
.ev b { display: block; }
.ev span { opacity: .75; }
.ev.blue { background: #e3ecff; border-color: #3d6fe0; color: #1e3a7a; }
.ev.green { background: #e1f5ea; border-color: #2f9e62; color: #1d5a3a; }
.ev.purple { background: #efe7ff; border-color: #7c4ddb; color: #45297f; }
.ev.orange { background: #fff0df; border-color: #e08a2c; color: #7a4712; }

/* Music */
.media { display: flex; align-items: center; justify-content: center; gap: 3em; padding: 2em;
  background: radial-gradient(ellipse at 30% 40%, #2a1f48, #0f1218 70%); }
.art { flex: none; height: min(20em, 70%); aspect-ratio: 1; border-radius: .8em;
  background: conic-gradient(from 200deg, #ff7ab6, #7aa7ff, #6ee7c8, #ffd36e, #ff7ab6);
  box-shadow: 0 1.5em 4em rgba(0, 0, 0, .5); animation: hue 12s linear infinite; }
@keyframes hue { to { filter: hue-rotate(360deg); } }
.np { width: 20em; max-width: 45%; }
.np small { color: #9aa3b5; text-transform: uppercase; letter-spacing: .08em; font-size: .75em; }
.np h2 { margin: .2em 0 .1em; font-size: 2.2em; }
.np p { margin: 0 0 1.4em; color: #9aa3b5; }
.bar { height: .35em; border-radius: 1em; background: #2a3040; overflow: hidden; }
.bar i { display: block; height: 100%; background: #e8ebf1; }
.times { display: flex; justify-content: space-between; margin-top: .4em; font-size: .78em; color: #9aa3b5; font-variant-numeric: tabular-nums; }
.controls { display: flex; justify-content: center; gap: 1.6em; margin-top: 1em; font-size: 1.5em; color: #c9cfdb; }

/* Notes */
.notes { display: flex; }
.notes .list { flex: none; width: 15em; padding: .8em .6em; border-right: 1px solid #e6dfcf; background: #f5f0e4; }
.notes .item { padding: .6em .8em; border-radius: .45em; margin-bottom: .2em; }
.notes .item b { display: block; font-weight: 600; font-size: .92em; }
.notes .item small { color: #8a8270; }
.notes .item.on { background: #f7d774; }
.notes .doc { flex: 1; min-width: 0; padding: 2em 3em; }
.notes .doc h1 { margin: 0 0 .6em; font-size: 1.8em; }
.notes .doc li { margin: .35em 0; }
