/* ── PasskeasyOS ─────────────────────────────────────────────── */
@font-face { font-family: "Inter"; src: url("/fonts/inter-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/jetbrains-mono-var.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: var(--link); }
.mono { font-family: var(--mono); }
[hidden] { display: none !important; }

/* ── tokens: modern (default) ─────────────────────────────────── */
:root {
  --ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --desk: #0b0b0d;
  --fg: #ededf0;
  --muted: rgba(237,237,240,0.62);
  --hint: rgba(237,237,240,0.38);
  --line: rgba(255,255,255,0.09);
  --accent: #ffb454;
  --accent-bg: rgba(255,180,84,0.12);
  --link: #ffb454;
  --ok: #4ade80; --bad: #f87171;
  --win-bg: rgba(19,19,23,0.94);
  --win-border: rgba(255,255,255,0.1);
  --panel: rgba(255,255,255,0.03);
  --taskbar-h: 48px;
}

/* ── tokens: XP-era homage (generic chrome, no Microsoft marks) ── */
:root[data-theme="xp"] {
  --ui: Tahoma, Verdana, "Segoe UI", "DejaVu Sans", sans-serif;
  --desk: #3a6fd0;
  --fg: #111;
  --muted: #444;
  --hint: #777;
  --line: #d4d0c8;
  --accent: #0a53d6;
  --accent-bg: #dbe8fb;
  --link: #0033cc;
  --win-bg: #ffffff;
  --win-border: #0831d9;
  --panel: #f4f3ee;
  --taskbar-h: 32px;
}

body {
  font-family: var(--ui);
  color: var(--fg);
  background: var(--desk);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
:root[data-theme="xp"] body {
  background:
    radial-gradient(120% 70% at 70% 110%, rgba(255,255,255,0.35), transparent 60%),
    linear-gradient(to bottom, #2f63c8 0%, #4c8ce0 45%, #8cc2ef 80%, #b9dcf5 100%);
}

#bg-canvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.5; }
:root[data-theme="xp"] #bg-canvas { display: none; }

/* ── boot ─────────────────────────────────────────────────────── */
.boot {
  position: fixed; inset: 0; z-index: 1000;
  background: #07070a; color: #ededf0;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  transition: opacity 0.35s;
}
.boot.run { display: flex; }
.boot.done { opacity: 0; pointer-events: none; }
.boot-logo { font-family: var(--mono); font-size: 44px; font-weight: 700; }
.boot-cursor { color: #ffb454; animation: blink 1s steps(1) infinite; }
.boot-name { font-family: var(--mono); letter-spacing: 0.3em; font-size: 12px; color: rgba(237,237,240,0.6); text-transform: uppercase; }
.boot-bar { width: 180px; height: 3px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; margin-top: 10px; }
.boot-bar i { display: block; height: 100%; width: 40%; background: #ffb454; border-radius: 2px; animation: bootbar 1s ease-in-out infinite; }
@keyframes bootbar { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@keyframes blink { 50% { opacity: 0; } }

/* ── desktop ──────────────────────────────────────────────────── */
.desktop {
  position: fixed; top: 0; left: 0; right: 0; bottom: var(--taskbar-h);
  z-index: 1;
}
.icons {
  position: absolute; top: 16px; left: 12px; bottom: 16px;
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(auto-fill, 96px);
  gap: 6px 10px; align-content: start;
}
.dicon {
  width: 84px; display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 8px 4px; border-radius: 10px;
}
.dicon-tile {
  width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center;
  background: rgba(24,24,29,0.85);
  border: 1px solid var(--line);
  color: var(--accent);
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  transition: transform 0.15s, border-color 0.15s;
}
.dicon-tile .ico { width: 26px; height: 26px; }
.dicon-label { font-size: 12px; color: var(--fg); text-align: center; line-height: 1.2; text-shadow: 0 1px 3px rgba(0,0,0,0.7); }
.dicon:hover .dicon-tile, .dicon:focus-visible .dicon-tile { transform: translateY(-2px); border-color: rgba(255,180,84,0.5); }
.dicon:focus-visible { outline: 1px dashed var(--accent); outline-offset: 2px; }

:root[data-theme="xp"] .dicon { width: 80px; border-radius: 2px; padding: 6px 2px; }
:root[data-theme="xp"] .dicon-tile {
  width: 40px; height: 40px; border-radius: 8px; border: 1px solid rgba(0,0,0,0.25);
  color: #fff;
  background: linear-gradient(160deg, hsl(var(--h, 210) 85% 68%), hsl(var(--h, 210) 80% 42%) 70%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 2px 4px rgba(0,0,0,0.35);
}
:root[data-theme="xp"] .dicon-tile .ico { width: 24px; height: 24px; filter: drop-shadow(0 1px 0 rgba(0,0,0,0.4)); }
:root[data-theme="xp"] .dicon-label { font-size: 11px; color: #fff; text-shadow: 1px 1px 1px #000; }
:root[data-theme="xp"] .dicon:hover .dicon-tile { transform: none; }
:root[data-theme="xp"] .dicon:focus-visible { outline: 1px dotted #fff; }
:root[data-theme="xp"] .dicon:focus .dicon-label { background: #316ac5; }
[data-app="about"]    { --h: 205; }
[data-app="lab"]      { --h: 140; }
[data-app="arcade"]   { --h: 18; }
[data-app="terminal"] { --h: 225; }
[data-app="github"]   { --h: 275; }
[data-app="classic"]  { --h: 190; }

/* widgets */
.widgets {
  position: absolute; top: 16px; right: 16px; width: 290px;
  display: flex; flex-direction: column; gap: 12px;
}
.widget {
  background: rgba(20,20,24,0.82);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-size: 13px;
}
.wg-title { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--hint); margin-bottom: 10px; }
.wg-state { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.wg-dim { color: var(--hint); font-size: 11.5px; margin-top: 4px; }
.wg-msg { color: var(--muted); font-size: 12.5px; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.widget { min-width: 0; }
.wg-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; padding: 7px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.wg-row:first-child { border-top: 0; padding-top: 0; }
.wg-repo { color: var(--accent); font-size: 11.5px; }
.wg-when { color: var(--hint); font-size: 11px; }
.wg-row .wg-msg { grid-column: 1 / -1; margin-top: 2px; }
.wg-row:hover .wg-msg { color: var(--fg); }
:root[data-theme="xp"] .widget {
  background: rgba(255,255,255,0.78); color: #111; border: 1px solid rgba(255,255,255,0.9);
  border-radius: 8px; box-shadow: 0 2px 8px rgba(0,40,120,0.3);
}
:root[data-theme="xp"] .wg-title { color: #1a3f8f; font-family: var(--ui); font-weight: bold; letter-spacing: 0; text-transform: none; font-size: 12px; }
:root[data-theme="xp"] .wg-repo { color: #0a53d6; }
@media (max-width: 1100px) { .widgets { display: none; } }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--hint); display: inline-block; flex-shrink: 0; }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px rgba(74,222,128,0.6); }
.dot.busy { background: #ffb454; animation: pulse 1.4s ease-in-out infinite; }
.dot.bad { background: var(--bad); }
@keyframes pulse { 50% { opacity: 0.35; } }

/* ── windows ──────────────────────────────────────────────────── */
.windows { position: absolute; inset: 0; pointer-events: none; }
.win {
  position: absolute; pointer-events: auto;
  display: flex; flex-direction: column;
  background: var(--win-bg);
  border: 1px solid var(--win-border);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55), 0 0 0 1px rgba(0,0,0,0.3);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
  opacity: 0; transform: scale(0.97) translateY(6px);
  transition: opacity 0.16s ease, transform 0.16s ease, box-shadow 0.2s;
}
.win.shown { opacity: 1; transform: none; }
.win.closing { opacity: 0; transform: scale(0.97); }
.win.max { border-radius: 0; }
.win.dragging { transition: none; user-select: none; }
.win:not(.focused) { box-shadow: 0 12px 30px rgba(0,0,0,0.4); }
.win.focused { border-color: rgba(255,180,84,0.35); }

.win-bar {
  flex-shrink: 0; height: 40px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--line);
  cursor: default; user-select: none; touch-action: none;
}
.win-icon { color: var(--accent); display: grid; }
.win-icon .ico { width: 16px; height: 16px; }
.win-title { font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win.focused .win-title { color: var(--fg); }
.win-ctl { margin-left: auto; display: flex; gap: 4px; }
.wc { width: 30px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: var(--muted); }
.wc:hover { background: rgba(255,255,255,0.08); color: var(--fg); }
.wc-close:hover { background: #e5484d; color: #fff; }
.wc i { position: relative; width: 11px; height: 11px; display: block; }
.wc-min i::before { content: ''; position: absolute; left: 0; right: 0; bottom: 2px; height: 1.5px; background: currentColor; }
.wc-max i { border: 1.5px solid currentColor; border-radius: 2px; }
.win.max .wc-max i { box-shadow: 2px -2px 0 -0.5px var(--win-bg), 2.5px -2.5px 0 0 currentColor; }
.wc-close i::before, .wc-close i::after {
  content: ''; position: absolute; left: -1px; right: -1px; top: 50%; height: 1.5px; background: currentColor;
}
.wc-close i::before { transform: rotate(45deg); }
.wc-close i::after { transform: rotate(-45deg); }

.win-body { flex: 1; min-height: 0; overflow: auto; outline: none; position: relative; }
.win-grip {
  position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; touch-action: none;
  background: linear-gradient(135deg, transparent 55%, var(--hint) 55%, var(--hint) 62%, transparent 62%, transparent 72%, var(--hint) 72%, var(--hint) 79%, transparent 79%);
  opacity: 0.6;
}
.win.max .win-grip { display: none; }

/* XP-era chrome */
:root[data-theme="xp"] .win {
  border: 0; border-radius: 8px 8px 0 0; backdrop-filter: none; -webkit-backdrop-filter: none;
  box-shadow: 0 0 0 3px #0a4ee0, 2px 6px 16px rgba(0,0,0,0.45);
  margin: 3px;
}
:root[data-theme="xp"] .win:not(.focused) { box-shadow: 0 0 0 3px #7a96df, 2px 4px 10px rgba(0,0,0,0.3); }
:root[data-theme="xp"] .win.max { border-radius: 0; margin: 0; box-shadow: none; }
:root[data-theme="xp"] .win-bar {
  height: 30px; border: 0; padding: 0 5px 0 6px; gap: 6px;
  background: linear-gradient(to bottom, #0997ff 0%, #0058ee 8%, #0056ec 40%, #0063ff 88%, #0053e6 96%, #003dd7 100%);
}
:root[data-theme="xp"] .win:not(.focused) .win-bar { background: linear-gradient(to bottom, #9db9eb, #7a96df 40%, #7b98e3); }
:root[data-theme="xp"] .win-icon { color: #fff; }
:root[data-theme="xp"] .win-title,
:root[data-theme="xp"] .win.focused .win-title {
  font-family: "Trebuchet MS", var(--ui); font-weight: bold; font-size: 13px; color: #fff;
  text-shadow: 1px 1px 0 #0f1089;
}
:root[data-theme="xp"] .wc {
  width: 22px; height: 22px; border-radius: 3px; color: #fff;
  border: 1px solid #fff;
  background: linear-gradient(145deg, #5a8ff5, #1f5fe0 60%, #1349c8);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35);
}
:root[data-theme="xp"] .wc:hover { background: linear-gradient(145deg, #79a6ff, #2e6ef0 60%, #1a55d8); }
:root[data-theme="xp"] .wc-close { background: linear-gradient(145deg, #e9885f, #d4462a 60%, #b8321a); }
:root[data-theme="xp"] .wc-close:hover { background: linear-gradient(145deg, #f2a07c, #e05a3a 60%, #c53d22); }
:root[data-theme="xp"] .wc i { width: 9px; height: 9px; }
:root[data-theme="xp"] .wc-min i::before { height: 2.5px; bottom: 0; right: 3px; }
:root[data-theme="xp"] .wc-max i { border-width: 2px; border-top-width: 3px; border-radius: 0; }
:root[data-theme="xp"] .wc-close i::before, :root[data-theme="xp"] .wc-close i::after { height: 2.5px; }
:root[data-theme="xp"] .win-body { background: var(--win-bg); color: var(--fg); font-size: 13px; }
:root[data-theme="xp"] .win-body.app-term,
:root[data-theme="xp"] .win-body.app-game { background: #0c0c0f; color: #ededf0; }
:root[data-theme="xp"] .ph-body.app-term { background: #0c0c0f; }

/* ── taskbar ──────────────────────────────────────────────────── */
.taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--taskbar-h); z-index: 50;
  display: flex; align-items: center; gap: 8px; padding: 0 8px;
  background: rgba(14,14,17,0.86);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
}
.start {
  height: 36px; padding: 0 12px; border-radius: 10px;
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-weight: 700; font-size: 15px;
}
.start:hover, .start[aria-expanded="true"] { background: rgba(255,255,255,0.07); }
.start-cursor { color: var(--accent); animation: blink 1.2s steps(1) infinite; }
.start-label { display: none; }
.tasks { flex: 1; display: flex; gap: 4px; min-width: 0; overflow: hidden; }
.task {
  height: 36px; max-width: 200px; min-width: 0; padding: 0 12px; border-radius: 9px;
  display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px;
  position: relative;
}
.task:hover { background: rgba(255,255,255,0.06); color: var(--fg); }
.task.active { background: rgba(255,255,255,0.09); color: var(--fg); }
.task::after { content: ''; position: absolute; left: 30%; right: 30%; bottom: 2px; height: 2px; border-radius: 1px; background: var(--hint); }
.task.active::after { background: var(--accent); left: 20%; right: 20%; }
.task-icon { color: var(--accent); display: grid; }
.task-icon .ico { width: 16px; height: 16px; }
.task-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tray { display: flex; align-items: center; gap: 12px; padding: 0 6px 0 10px; }
.tray-status { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; }
.tray-status:hover { background: rgba(255,255,255,0.07); }
.clock { font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }

:root[data-theme="xp"] .taskbar {
  gap: 4px; padding: 0; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none;
  background: linear-gradient(to bottom, #1f2f86 0%, #3168d5 3%, #4993e6 8%, #2a6ee4 20%, #245edb 45%, #2562df 55%, #2b71e6 80%, #1f53d3 94%, #193ebd 100%);
}
:root[data-theme="xp"] .start {
  height: 100%; border-radius: 0 12px 12px 0; padding: 0 20px 0 10px; gap: 6px;
  font-family: "Trebuchet MS", var(--ui); font-style: italic; font-size: 17px; color: #fff;
  text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
  background: linear-gradient(to bottom, #3c8f3c 0%, #5eb85e 10%, #3fa33f 30%, #379a37 70%, #2c7f2c 100%);
  box-shadow: inset -2px 0 3px rgba(0,0,0,0.25);
}
:root[data-theme="xp"] .start:hover, :root[data-theme="xp"] .start[aria-expanded="true"] { filter: brightness(1.1); background: linear-gradient(to bottom, #3c8f3c 0%, #6bc56b 10%, #47ad47 30%, #3fa33f 70%, #2c7f2c 100%); }
:root[data-theme="xp"] .start-logo { font-style: normal; font-family: var(--mono); font-size: 14px; }
:root[data-theme="xp"] .start-cursor { color: #fff; }
:root[data-theme="xp"] .start-label { display: inline; font-weight: bold; }
:root[data-theme="xp"] .task {
  height: 24px; border-radius: 3px; color: #fff; font-size: 11.5px; min-width: 120px;
  background: linear-gradient(to bottom, #3c8af4, #2d74e8 50%, #2567dc);
  border: 1px solid rgba(0,0,40,0.25); box-shadow: inset 0 1px 0 rgba(255,255,255,0.3);
}
:root[data-theme="xp"] .task:hover { filter: brightness(1.12); background: linear-gradient(to bottom, #3c8af4, #2d74e8 50%, #2567dc); }
:root[data-theme="xp"] .task.active { background: #1e52b7; box-shadow: inset 1px 1px 2px rgba(0,0,0,0.45); }
:root[data-theme="xp"] .task::after { display: none; }
:root[data-theme="xp"] .task-icon { color: #fff; }
:root[data-theme="xp"] .tray {
  height: 100%; padding: 0 12px; gap: 8px;
  background: linear-gradient(to bottom, #0c59b9 0%, #139ee9 8%, #18b5f2 12%, #139beb 40%, #1290e8 80%, #0d8dea 100%);
  border-left: 1px solid #092e93; box-shadow: inset 1px 0 0 #1ab0f5;
}
:root[data-theme="xp"] .clock { color: #fff; font-family: var(--ui); font-size: 11.5px; }
:root[data-theme="xp"] .tray-status { width: 20px; height: 20px; }

/* ── start menu ───────────────────────────────────────────────── */
.startmenu {
  position: fixed; left: 8px; bottom: calc(var(--taskbar-h) + 8px); z-index: 60;
  width: 380px;
  background: rgba(20,20,24,0.96); border: 1px solid var(--win-border); border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  overflow: hidden;
}
.sm-head { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); }
.sm-head img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; object-position: 20% 45%; filter: grayscale(1); }
.sm-head b { display: block; font-size: 15px; }
.sm-head span { font-family: var(--mono); font-size: 11.5px; color: var(--hint); }
.sm-cols { display: grid; grid-template-columns: 1.15fr 1fr; }
.sm-apps { padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.sm-app { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: 14px; text-align: left; }
.sm-app:hover, .sm-app:focus-visible { background: var(--accent-bg); outline: none; }
.sm-ico { color: var(--accent); display: grid; }
.sm-ico .ico { width: 18px; height: 18px; }
.sm-links { padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; border-left: 1px solid var(--line); background: var(--panel); }
.sm-links a { font-size: 13px; color: var(--muted); text-decoration: none; }
.sm-links a:hover { color: var(--accent); }
.sm-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-top: 1px solid var(--line); }
.sm-theme { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; font-size: 13px; color: var(--muted); }
.sm-theme .ico { width: 16px; height: 16px; }
.sm-theme:hover { background: var(--accent-bg); color: var(--fg); }
.sm-ver { font-family: var(--mono); font-size: 11px; color: var(--hint); }

:root[data-theme="xp"] .startmenu {
  left: 0; bottom: var(--taskbar-h); border: 0; border-radius: 8px 8px 0 0; background: #fff; backdrop-filter: none; -webkit-backdrop-filter: none;
  box-shadow: 0 0 0 2px #1c55d6, 4px 4px 12px rgba(0,0,0,0.5);
}
:root[data-theme="xp"] .sm-head {
  background: linear-gradient(to bottom, #1868ce, #0e60cb 20%, #0e60cb 80%, #1a4bb8); color: #fff; border-bottom: 2px solid #e48d2e;
}
:root[data-theme="xp"] .sm-head img { border: 2px solid #fff; border-radius: 4px; filter: none; }
:root[data-theme="xp"] .sm-head b { font-family: "Trebuchet MS", var(--ui); font-size: 15px; text-shadow: 1px 1px 1px rgba(0,0,0,0.5); }
:root[data-theme="xp"] .sm-head span { color: #dce8ff; font-family: var(--ui); }
:root[data-theme="xp"] .sm-app { font-size: 12px; border-radius: 0; color: #111; }
:root[data-theme="xp"] .sm-app:hover, :root[data-theme="xp"] .sm-app:focus-visible { background: #316ac5; color: #fff; }
:root[data-theme="xp"] .sm-ico { color: #fff; width: 26px; height: 26px; border-radius: 5px; place-items: center; background: linear-gradient(160deg, hsl(var(--h,210) 85% 66%), hsl(var(--h,210) 80% 42%)); }
:root[data-theme="xp"] .sm-links { background: #d3e5fa; border-left: 1px solid #95bdee; }
:root[data-theme="xp"] .sm-links a { color: #0a246a; font-size: 12px; font-weight: bold; }
:root[data-theme="xp"] .sm-links a:hover { color: #fff; background: #316ac5; }
:root[data-theme="xp"] .sm-foot { background: linear-gradient(to bottom, #1868ce, #1a4bb8); border: 0; }
:root[data-theme="xp"] .sm-theme, :root[data-theme="xp"] .sm-ver { color: #fff; font-size: 12px; font-family: var(--ui); }
:root[data-theme="xp"] .sm-theme:hover { background: rgba(255,255,255,0.15); }

/* ── tray popover + toasts ────────────────────────────────────── */
.traypop, .toast {
  position: fixed; right: 10px; z-index: 70;
  background: rgba(20,20,24,0.96); color: var(--fg); border: 1px solid var(--win-border); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.5); font-size: 13px;
}
.traypop { bottom: calc(var(--taskbar-h) + 8px); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; max-width: 320px; }
.traypop span { color: var(--muted); }
.traypop .mono { font-size: 11.5px; color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toasts { position: fixed; right: 10px; bottom: calc(var(--taskbar-h) + 10px); z-index: 70; display: flex; flex-direction: column; gap: 8px; }
.toast {
  position: static; display: flex; gap: 10px; padding: 12px 14px; width: 300px;
  opacity: 0; transform: translateY(8px); transition: opacity 0.25s, transform 0.25s;
}
.toast.in { opacity: 1; transform: none; }
.toast-ico { color: var(--accent); }
.toast-ico .ico { width: 18px; height: 18px; }
.toast b { display: block; }
.toast span { color: var(--muted); font-size: 12.5px; }
:root[data-theme="xp"] .traypop, :root[data-theme="xp"] .toast {
  background: #ffffe1; color: #000; border: 1px solid #000; border-radius: 6px; box-shadow: 2px 2px 6px rgba(0,0,0,0.35); font-size: 12px;
}
:root[data-theme="xp"] .traypop span, :root[data-theme="xp"] .toast span { color: #333; }
:root[data-theme="xp"] .toast-ico { color: #0a53d6; }

/* ── shared bits used by apps ─────────────────────────────────── */
.app-pad { padding: 22px 24px 26px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tags span { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; }
.pill {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--hint);
  display: inline-flex; align-items: center; gap: 6px;
}
.pill-live { color: #16a34a; border-color: rgba(74,222,128,0.4); background: rgba(74,222,128,0.08); }
:root:not([data-theme="xp"]) .pill-live { color: var(--ok); }
.pill-live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

/* about */
.ab-head { display: flex; gap: 18px; align-items: center; }
.ab-photo { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; object-position: 20% 45%; filter: grayscale(1); border: 1px solid var(--line); }
.ab-name { font-size: 26px; letter-spacing: -0.02em; }
.ab-role { font-size: 12px; color: var(--hint); margin-top: 4px; }
.ab-links { display: flex; gap: 16px; margin-top: 10px; font-family: var(--mono); font-size: 12.5px; }
.ab-links a { text-decoration: none; }
.ab-lede { margin-top: 18px; line-height: 1.7; color: var(--muted); }
.ab-h { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin: 22px 0 10px; font-weight: 500; }
.ab-arcs { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.ab-arcs li { line-height: 1.55; color: var(--muted); font-size: 14px; }
.ab-arcs b { color: var(--fg); }
.ab-stack div { display: grid; grid-template-columns: 90px 1fr; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.ab-stack dt { font-family: var(--mono); font-size: 11px; color: var(--hint); text-transform: uppercase; letter-spacing: 0.08em; padding-top: 2px; }
.ab-stack dd { color: var(--muted); }
.ab-foot { margin-top: 20px; font-size: 11.5px; color: var(--hint); }
:root[data-theme="xp"] .ab-photo { border-radius: 4px; filter: none; border: 1px solid #7a96df; }
:root[data-theme="xp"] .ab-name { font-family: "Trebuchet MS", var(--ui); color: #0a246a; }
:root[data-theme="xp"] .ab-h { color: #0a246a; font-family: var(--ui); text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: bold; border-bottom: 1px solid #b0c4e8; padding-bottom: 4px; }

/* lab (explorer) */
.lab-wrap { display: grid; grid-template-columns: 220px 1fr; min-height: 100%; }
.lab-side { border-right: 1px solid var(--line); padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; background: var(--panel); }
.lab-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; text-align: left; padding: 9px 10px; border-radius: 8px; }
.lab-item:hover { background: rgba(255,255,255,0.05); }
.lab-item[aria-current="true"] { background: var(--accent-bg); }
.lab-item-name { font-weight: 600; font-size: 14px; }
.lab-item-date { font-size: 11px; color: var(--hint); }
.lab-item-live { grid-column: 1; font-family: var(--mono); font-size: 10px; color: var(--ok); text-transform: uppercase; letter-spacing: 0.08em; }
.lab-pane { padding: 22px 26px 30px; overflow: auto; }
.lab-top { display: flex; align-items: center; gap: 10px; }
.lab-dates { font-size: 11.5px; color: var(--hint); }
.lab-name { font-size: 24px; letter-spacing: -0.02em; margin-top: 10px; }
.lab-desc { margin-top: 8px; color: var(--muted); line-height: 1.65; }
.lab-finding { margin-top: 16px; padding-left: 14px; border-left: 2px solid var(--accent); font-size: 17px; font-weight: 600; line-height: 1.45; }
.lab-body { margin-top: 12px; color: var(--muted); line-height: 1.7; font-size: 14px; max-width: 62ch; }
.lab-links { display: flex; gap: 18px; margin-top: 16px; font-family: var(--mono); font-size: 12.5px; }
.lab-links a { text-decoration: none; }
.lab-back { display: none; }
:root[data-theme="xp"] .lab-side { background: linear-gradient(to bottom, #7ba2e7, #6375d6); border-right: 0; }
:root[data-theme="xp"] .lab-item { color: #fff; border-radius: 3px; }
:root[data-theme="xp"] .lab-item-date, :root[data-theme="xp"] .lab-item-live { color: #dce8ff; }
:root[data-theme="xp"] .lab-item[aria-current="true"], :root[data-theme="xp"] .lab-item:hover { background: rgba(255,255,255,0.25); }
:root[data-theme="xp"] .lab-name { color: #0a246a; font-family: "Trebuchet MS", var(--ui); }
.win-body { container-type: inline-size; }
.app-lab { height: 100%; }
.win-body.app-lab .lab-wrap { height: 100%; }
.win-body.app-lab .lab-side, .win-body.app-lab .lab-pane { overflow: auto; }
@container (max-width: 560px) { .lab-wrap { grid-template-columns: 1fr; } .lab-side { border-right: 0; border-bottom: 1px solid var(--line); } }

/* arcade */
.arc-lede { color: var(--muted); line-height: 1.6; max-width: 60ch; }
.arc-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-top: 18px; }
.arc-card { display: flex; flex-direction: column; gap: 6px; text-align: left; border-radius: 12px; padding: 0 0 10px; }
.arc-art {
  aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; position: relative;
  display: flex; align-items: flex-end; padding: 12px;
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 3px, rgba(0,0,0,0.18) 3px 4px),
    radial-gradient(120% 80% at 30% 20%, hsl(var(--hue) 90% 60% / 0.9), transparent 60%),
    linear-gradient(160deg, hsl(var(--hue) 70% 30%), #0b0b10 85%);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}
.arc-marquee { font-family: var(--mono); font-weight: 800; font-size: 17px; line-height: 1.1; color: #fff; text-shadow: 0 2px 0 hsl(var(--hue) 80% 25%), 0 0 18px hsl(var(--hue) 90% 60% / 0.7); text-transform: uppercase; }
.arc-card:hover .arc-art, .arc-card:focus-visible .arc-art { transform: translateY(-3px) rotate(-0.5deg); box-shadow: 0 16px 30px rgba(0,0,0,0.45); }
.arc-meta { font-size: 11.5px; color: var(--muted); padding: 0 2px; }
.arc-tag { font-size: 10.5px; color: var(--hint); text-transform: uppercase; letter-spacing: 0.08em; padding: 0 2px; }
.arc-h { font-size: 16px; margin-top: 28px; margin-bottom: 6px; }
.dos-stage { flex: 1; position: relative; background: #000; min-height: 240px; }
.dos-note { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(237,237,240,0.6); font-size: 12px; }
.arc-dos { margin-top: 22px; padding: 14px 16px; border: 1px dashed var(--line); border-radius: 12px; }
.arc-dos-title { font-weight: 600; }
.arc-dos-note { color: var(--muted); font-size: 13px; margin-top: 4px; line-height: 1.5; }
.arc-fine { margin-top: 14px; font-size: 11px; color: var(--hint); }
.app-game { display: flex; flex-direction: column; background: #000; }
.app-game iframe { flex: 1; width: 100%; border: 0; background: #000; min-height: 240px; }
.game-bar { display: flex; align-items: center; gap: 14px; padding: 8px 12px; font-size: 11.5px; color: rgba(237,237,240,0.6); background: #0e0e12; }
.game-bar a, .game-fs { color: #ffb454; text-decoration: none; font-size: 11.5px; font-family: var(--mono); }
.game-fs { margin-left: auto; }
:root[data-theme="xp"] .arc-card:focus-visible { outline: 1px dotted #000; }

/* terminal (always dark, whatever the theme) */
.app-term { display: flex; flex-direction: column; background: #0c0c0f; color: #ededf0; font-family: var(--mono); }
.term-out { flex: 1; overflow: auto; padding: 12px 16px; }
.term-line { font-size: 13px; line-height: 1.5; white-space: pre; }
.term-row { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid rgba(255,255,255,0.08); }
.term-sym { color: #ffb454; }
.term-in { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: #ededf0; font: 13px var(--mono); caret-color: #ffb454; }
.t-muted { color: rgba(237,237,240,0.32); } .t-output { color: rgba(237,237,240,0.75); } .t-accent { color: #ffb454; }
.t-pink { color: #ffd9a0; } .t-green { color: #4ade80; } .t-yellow { color: #fbbf24; } .t-error { color: #f87171; } .t-cyan { color: #67e8f9; }

/* ── phone shell ──────────────────────────────────────────────── */
body.is-phone { overflow: auto; }
body.is-phone .desktop, body.is-phone .taskbar, body.is-phone .startmenu { display: none; }
.phone { position: relative; z-index: 2; min-height: 100vh; }
.ph-status {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 8px) 18px 8px;
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  background: rgba(11,11,13,0.8); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.ph-name { letter-spacing: 0.12em; text-transform: uppercase; font-size: 10.5px; color: var(--hint); }
.ph-home { padding: 14px 16px 40px; }
.ph-hello { display: flex; gap: 14px; align-items: center; }
.ph-photo { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; object-position: 20% 45%; filter: grayscale(1); }
.ph-title { font-size: 20px; font-weight: 650; letter-spacing: -0.02em; }
.ph-sub { font-size: 13px; color: var(--muted); line-height: 1.45; margin-top: 2px; }
.ph-widgets { display: grid; gap: 10px; margin-top: 18px; }
.ph-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 8px; margin-top: 24px; }
.ph-icon { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.ph-icon .dicon-tile { width: 60px; height: 60px; border-radius: 16px; }
.ph-icon .dicon-tile .ico { width: 28px; height: 28px; }
.ph-label { font-size: 12px; color: var(--fg); }
.ph-foot { margin-top: 30px; text-align: center; }
.ph-theme { font-family: var(--mono); font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; }
.ph-app { min-height: 100vh; background: var(--desk); }
.ph-bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 12px;
  background: rgba(14,14,17,0.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-weight: 600;
}
.ph-back { font-family: var(--mono); font-size: 13px; color: var(--accent); padding: 6px 4px; }
.ph-body { min-height: calc(100vh - 48px); }
.ph-body.app-game { height: calc(100vh - 48px); }
.ph-body.app-term { height: calc(100vh - 48px); }
.ph-body .lab-back { display: inline-block; margin: 14px 16px 0; color: var(--accent); }
.ph-body .lab-wrap { display: block; }
.ph-body.app-lab .lab-side { border-right: 0; }
.ph-body.app-lab.lab-open .lab-side { display: none; }
.ph-body.app-lab:not(.lab-open) .lab-pane, .ph-body.app-lab:not(.lab-open) .lab-back { display: none; }
.ph-body .lab-pane { padding: 16px 18px 40px; }

:root[data-theme="xp"] .ph-status { background: linear-gradient(to bottom, #2a6ee4, #1f53d3); color: #fff; }
:root[data-theme="xp"] .ph-name { color: #dce8ff; }
:root[data-theme="xp"] .ph-title, :root[data-theme="xp"] .ph-label { color: #fff; text-shadow: 1px 1px 1px #000; }
:root[data-theme="xp"] .ph-sub { color: #eef4ff; text-shadow: 1px 1px 1px rgba(0,0,0,0.6); }
:root[data-theme="xp"] .ph-theme { color: #fff; border-color: rgba(255,255,255,0.7); }
:root[data-theme="xp"] .ph-app { background: #fff; }
:root[data-theme="xp"] .ph-bar { background: linear-gradient(to bottom, #0997ff, #0058ee 12%, #0063ff 88%, #003dd7); color: #fff; border: 0; text-shadow: 1px 1px 0 #0f1089; }
:root[data-theme="xp"] .ph-back { color: #fff; }
:root[data-theme="xp"] .ph-icon .dicon-tile { width: 54px; height: 54px; border-radius: 12px; }

@media (prefers-reduced-motion: reduce) {
  .win, .toast, .boot { transition: none; }
  .boot-cursor, .start-cursor, .dot.busy { animation: none; }
}

/* ── heat grid (shared with Activity) ─────────────────────────── */
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, auto); grid-auto-columns: 20px; gap: 4px; }
.heat i { display: block; width: 20px; height: 20px; border-radius: 4px; background: rgba(127,127,127,0.14); }
.heat i.pad { background: transparent; }
.heat i.l1 { background: rgba(255,180,84,0.25); } .heat i.l2 { background: rgba(255,180,84,0.48); }
.heat i.l3 { background: rgba(255,180,84,0.75); } .heat i.l4 { background: #ffb454; }
:root[data-theme="xp"] .heat i.l1 { background: #c6dbf7; } :root[data-theme="xp"] .heat i.l2 { background: #8fb7ee; }
:root[data-theme="xp"] .heat i.l3 { background: #4a88e0; } :root[data-theme="xp"] .heat i.l4 { background: #0a53d6; }

/* ── projects ─────────────────────────────────────────────────── */
.pj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.pj-card { display: flex; flex-direction: column; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); text-decoration: none; color: inherit; transition: border-color 0.15s, transform 0.15s; }
a.pj-card:hover { border-color: rgba(255,180,84,0.5); transform: translateY(-2px); }
.pj-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pj-where { font-size: 11px; color: var(--hint); }
a.pj-card:hover .pj-where { color: var(--accent); }
.pj-name { font-size: 18px; margin-top: 12px; letter-spacing: -0.01em; }
.pj-desc { margin-top: 8px; color: var(--muted); line-height: 1.6; font-size: 13.5px; }
.pj-card .tags { margin-top: auto; padding-top: 14px; }
:root[data-theme="xp"] .pj-card { border-radius: 4px; background: #fff; border-color: #b0c4e8; }
:root[data-theme="xp"] .pj-name { color: #0a246a; font-family: "Trebuchet MS", var(--ui); }

/* ── bookmarks ────────────────────────────────────────────────── */
.bm-lede { color: var(--muted); margin-bottom: 14px; }
.bm-list { list-style: none; border-top: 1px solid var(--line); }
.bm-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; padding: 12px 6px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.bm-item:hover { background: var(--accent-bg); }
.bm-name { font-weight: 600; }
.bm-tag { font-size: 11px; color: var(--hint); }
.bm-desc { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }

/* ── activity ─────────────────────────────────────────────────── */
.app-activity { display: flex; flex-direction: column; }
.ac-tabs { display: flex; gap: 4px; padding: 10px 14px 0; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.ac-tab { padding: 8px 14px; border-radius: 8px 8px 0 0; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; }
.ac-tab[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.ac-pane { overflow: auto; }
.ac-head { display: flex; align-items: center; gap: 10px; font-size: 18px; flex-wrap: wrap; }
.ac-dim { color: var(--hint); font-size: 12px; }
.ac-stats { display: flex; gap: 28px; margin-top: 16px; flex-wrap: wrap; }
.ac-stats-col { flex-direction: column; gap: 14px; margin-top: 0; }
.ac-stat b { display: block; font-size: 24px; letter-spacing: -0.02em; line-height: 1; }
.ac-stat span { font-size: 11px; color: var(--hint); }
.ac-bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; margin-top: 22px; }
.ac-bars span { flex: 1; background: var(--accent); border-radius: 2px 2px 0 0; opacity: 0.8; }
.ac-bars span.zero { opacity: 0.18; }
.ac-cap { font-size: 11px; color: var(--hint); margin-top: 6px; }
.ac-h { font-size: 13px; margin: 24px 0 8px; font-weight: 600; }
.ac-h0 { margin-top: 4px; }
.ac-list { list-style: none; }
.ac-list li { border-top: 1px solid var(--line); }
.ac-list li > span, .ac-row { display: block; }
.ac-list li { padding: 8px 0; }
.ac-row { display: grid; grid-template-columns: 11em minmax(0, 1fr) auto; gap: 12px; align-items: baseline; text-decoration: none; color: inherit; }
a.ac-row:hover .ac-msg { color: var(--accent); }
.ac-repo { font-size: 12px; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-msg { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-heatwrap { display: flex; gap: 28px; align-items: flex-start; }
.ac-fine { margin-top: 16px; font-size: 11px; color: var(--hint); }
@container (max-width: 520px) { .ac-row { grid-template-columns: minmax(0, 1fr) auto; } .ac-row .ac-msg { grid-column: 1 / -1; grid-row: 2; } }

/* ── reader ───────────────────────────────────────────────────── */
.app-read { background: #0b0b0d; }
.app-read iframe { display: block; width: 100%; height: 100%; border: 0; }
.ph-body.app-read { height: calc(100vh - 48px); }
.lab-read { font-family: var(--mono); font-size: 12.5px; color: var(--link); }
.lab-read:hover { text-decoration: underline; }

[data-app="projects"]  { --h: 45; }
[data-app="activity"]  { --h: 170; }
[data-app="bookmarks"] { --h: 330; }
