/* ============================================================
   AristeaOS — tokens
   ============================================================ */
:root {
  --bg: #111318;
  --bg-2: #181a21;
  --win: rgba(22, 24, 30, .84);
  --win-body: #15171d;
  --bar: rgba(30, 33, 41, .6);
  --line: #262a33;
  --line-2: #343945;
  --ink: #ecebe6;
  --ink-2: #aeafb6;
  --ink-3: #737682;
  --hot: #ff6a3d;
  --cool: #5eead4;
  --violet: #a78bfa;
  --glass: rgba(12, 13, 17, .62);
  --taskbar: rgba(16, 16, 19, .94);
  --menu: rgba(31, 31, 33, .94);
  --accent: #3b8eea;
  --shadow: 0 30px 80px -20px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .06);
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, ui-monospace, "SF Mono", Menlo, monospace;
  --tb: 48px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f2ed;
  --bg-2: #eeebe4;
  --win: rgba(251, 250, 247, .86);
  --win-body: #fbfaf7;
  --bar: rgba(240, 237, 230, .7);
  --line: #e3dfd5;
  --line-2: #d3cec2;
  --ink: #17181c;
  --ink-2: #4b4d56;
  --ink-3: #85878f;
  --hot: #e2461b;
  --cool: #0e9f8b;
  --violet: #6d4fd8;
  --glass: rgba(250, 249, 246, .72);
  --taskbar: rgba(238, 238, 240, .94);
  --menu: rgba(238, 238, 240, .96);
  --accent: #0067c0;
  --shadow: 0 30px 70px -24px rgba(20, 16, 8, .45), 0 0 0 1px rgba(0, 0, 0, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f2ed;
    --bg-2: #eeebe4;
    --win: rgba(251, 250, 247, .86);
    --win-body: #fbfaf7;
    --bar: rgba(240, 237, 230, .7);
    --line: #e3dfd5;
    --line-2: #d3cec2;
    --ink: #17181c;
    --ink-2: #4b4d56;
    --ink-3: #85878f;
    --hot: #e2461b;
    --cool: #0e9f8b;
    --violet: #6d4fd8;
    --glass: rgba(250, 249, 246, .72);
    --taskbar: rgba(238, 238, 240, .94);
    --menu: rgba(238, 238, 240, .96);
    --accent: #0067c0;
    --shadow: 0 30px 70px -24px rgba(20, 16, 8, .45), 0 0 0 1px rgba(0, 0, 0, .08);
    color-scheme: light;
  }
}

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: #07080a;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
svg { display: block; }
::selection { background: var(--hot); color: #fff; }
:focus-visible { outline: 2px solid var(--cool); outline-offset: 2px; border-radius: 6px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mono { font-size: .8rem; }
.dim { color: var(--ink-3); }
.hl { color: var(--hot); }
body.is-dragging, body.is-resizing { user-select: none; -webkit-user-select: none; }
body.is-dragging iframe, body.is-resizing iframe { pointer-events: none; }
body.is-resizing { cursor: nwse-resize; }

/* ============================================================
   Boot
   ============================================================ */
.boot {
  position: fixed; inset: 0; z-index: 1000; background: #050608; color: #cfd0d4;
  display: grid; place-items: center; cursor: pointer; transition: opacity .5s, visibility .5s;
}
.boot.out { opacity: 0; visibility: hidden; }
.boot-inner { width: min(520px, 90vw); }
.boot-logo, .start-btn .logo { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.boot-logo { width: 44px; height: 44px; margin-bottom: 26px; gap: 4px; }
.boot-logo i, .start-btn .logo i { border-radius: 2px; }
.boot-logo i:nth-child(1), .start-btn .logo i:nth-child(1) { background: #ff9a3c; }
.boot-logo i:nth-child(2), .start-btn .logo i:nth-child(2) { background: #d23f2a; }
.boot-logo i:nth-child(3), .start-btn .logo i:nth-child(3) { background: #0e9f8b; }
.boot-logo i:nth-child(4), .start-btn .logo i:nth-child(4) { background: #5eead4; }
.boot-log { min-height: 150px; font-family: var(--mono); font-size: .8rem; line-height: 1.85; }
.boot-log b { color: #fff; font-weight: 500; }
.boot-log .ok { color: #5eead4; }
.boot-log .dim { color: #6b6e78; }
.boot-bar { height: 3px; border-radius: 3px; background: #1a1c22; overflow: hidden; margin-top: 18px; }
.boot-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #5eead4, #ff6a3d); transition: width .2s; }
.boot-skip { color: #555862; margin-top: 16px; font-size: .7rem; }
body.shutting-down .desktop, body.shutting-down .taskbar { transition: opacity .45s, filter .45s; opacity: 0; filter: blur(6px); }

/* ============================================================
   Desktop
   ============================================================ */
.desktop { position: fixed; inset: 0 0 var(--tb) 0; overflow: hidden; }
#wall, #galaxy, #drive { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }
#wall { cursor: crosshair; }
#galaxy { background: #030305; }
body[data-wall="heat"] #wall, body[data-wall="galaxy"] #galaxy, body[data-wall="drive"] #drive { display: block; }
#drive { background: #16191e; }
/* The scrim, widget and crosshair belong to the interactive heat map only. */
body:not([data-wall="heat"]) .wall-scrim, body:not([data-wall="heat"]) .widget { display: none; }
.rubber { position: absolute; display: none; pointer-events: none; z-index: 1; border: 1px solid rgba(96,165,250,.85); background: rgba(96,165,250,.16); }
.wall-scrim {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(0,0,0,0) 45%, rgba(0,0,0,.35) 100%),
    linear-gradient(90deg, rgba(0,0,0,.3), rgba(0,0,0,0) 26%, rgba(0,0,0,0) 74%, rgba(0,0,0,.2)),
    repeating-linear-gradient(0deg, rgba(255,255,255,.028) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.028) 0 1px, transparent 1px 24px);
  cursor: crosshair;
}
body[data-wall="heat"] .icons { cursor: crosshair; }
/* NeuroDrive: darken behind the icon column and the edges so labels stay readable over the buildings. */
body[data-wall="drive"] .wall-scrim {
  display: block; cursor: default;
  background:
    linear-gradient(90deg, rgba(8,9,12,.62), rgba(8,9,12,.3) 190px, rgba(8,9,12,0) 320px),
    radial-gradient(ellipse at 55% 45%, rgba(0,0,0,0) 50%, rgba(0,0,0,.4) 100%);
}
.icons {
  position: absolute; top: 14px; left: 10px; bottom: 14px;
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(auto-fill, 98px); grid-auto-columns: 92px; gap: 4px 6px;
  align-content: start;
}
.d-icon {
  width: 92px; height: 96px; border-radius: 0; padding: 8px 4px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  color: #fff; text-align: center; cursor: default;
  border: 1px solid transparent; transition: background .08s, border-color .08s;
}
.d-icon .ico { color: #fff; filter: drop-shadow(0 2px 4px rgba(0,0,0,.7)); }
/* Windows-style: faint blue on hover, stronger blue square when selected */
.d-icon:hover { background: rgba(120,180,255,.14); border-color: rgba(120,180,255,.22); }
.d-icon.sel, .d-icon.sel:hover { background: rgba(70,150,255,.32); border-color: rgba(130,190,255,.7); }
.d-icon { -webkit-tap-highlight-color: transparent; }
.d-icon:focus-visible { outline: 1px dotted rgba(255,255,255,.7); outline-offset: -3px; }
.d-icon span { font-size: .76rem; line-height: 1.2; font-weight: 500; text-shadow: 0 1px 3px rgba(0,0,0,.95), 0 0 12px rgba(0,0,0,.6); max-width: 100%; overflow-wrap: anywhere; }

/* NeuroDrive panel: "Learn about this picture" plus Autopilot / Drive yourself. NeuroDrive wallpaper only. */
.drive-panel {
  position: absolute; top: 16px; right: 16px; width: 262px; display: none; flex-direction: column; gap: 8px; padding: 8px;
  background: rgba(10, 11, 14, .6); color: #fff;
  border: 1px solid rgba(255,255,255,.1); border-radius: 10px;
  backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
}
body[data-wall="drive"] .drive-panel { display: flex; }
.wa-learn { display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 6px; text-align: left; color: #fff; }
.wa-learn:hover { background: rgba(255,255,255,.07); }
.wa-learn span { display: flex; flex-direction: column; }
.wa-learn b { font-size: .8rem; font-weight: 500; }
.wa-learn small { font-size: .7rem; color: #aeb0b8; }
.wa-learn svg { flex: none; color: #7ab0ff; }
.wa-mode { display: grid; grid-template-columns: 1fr 1fr; background: rgba(255,255,255,.06); border-radius: 7px; padding: 3px; }
.wa-mode button { padding: 6px 4px; border-radius: 5px; font-size: .76rem; color: #bdbcc2; }
.wa-mode button[aria-checked="true"] { background: #4f8ff7; color: #fff; }
.wa-hud { display: flex; flex-direction: column; gap: 6px; padding: 0 4px 2px; font-size: .74rem; color: #bdbcc2; }
.wa-hud[hidden] { display: none; }
.wa-row { display: flex; justify-content: space-between; align-items: baseline; }
.wa-row b { font-size: 1.15rem; color: #fff; font-weight: 500; font-variant-numeric: tabular-nums; }
.wa-row [data-state].crashed { color: #ff4d6a; }
.wa-row [data-state].ai { color: #7ab0ff; }
.wa-keys { margin: 0; line-height: 1.5; }
.wa-keys kbd { font: inherit; color: #fff; border: 0; padding: 0; background: none; box-shadow: none; }
.wa-actions { display: flex; gap: 6px; }
.wa-actions button { flex: 1; padding: 5px 6px; border-radius: 6px; border: 1px solid rgba(255,255,255,.14); color: #d7d6d1; font-size: .74rem; }
.wa-actions button:hover { background: rgba(255,255,255,.07); }
.wa-actions [data-drive-ap][aria-pressed="true"] { border-color: #4f8ff7; color: #7ab0ff; }
/* Touch pedals: steering on the left, brake and gas on the right. */
.drive-pad { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; justify-content: space-between; pointer-events: none; }
.drive-pad[hidden] { display: none; }
.pad-group { display: flex; gap: 8px; pointer-events: auto; }
.drive-pad button {
  width: 64px; height: 64px; border-radius: 14px; font-size: .9rem; font-weight: 600; color: #fff;
  background: rgba(10, 11, 14, .6); border: 1px solid rgba(255,255,255,.16);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.drive-pad button.on { background: rgba(79,143,247,.55); border-color: #7ab0ff; }
.drive-pad .gas { height: 64px; background: rgba(79,143,247,.3); }

/* widget */
.widget {
  position: absolute; top: 16px; right: 16px; width: 272px; padding: 14px;
  background: rgba(10, 11, 14, .62); color: #d7d6d1;
  border: 1px solid rgba(255,255,255,.1); border-radius: 16px;
  backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 20px 50px -20px rgba(0,0,0,.6);
}
.w-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; color: #fff; }
.w-info { width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); font-size: .7rem; color: #bbb; }
.w-info:hover { border-color: var(--cool); color: var(--cool); }
.w-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-bottom: 12px; }
.w-grid div { display: flex; flex-direction: column; }
.w-grid .k { font-size: .72rem; color: #8b8d95; }
.w-grid .v { font-size: 1rem; color: #fff; font-variant-numeric: tabular-nums; }
.w-grid .v.cool { color: #5eead4; }
.legend { display: flex; align-items: center; gap: 8px; font-size: .62rem; color: #8b8d95; margin-bottom: 8px; }
.legend i { flex: 1; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #0e5a55, #12303a 22%, #17121d 42%, #6b1a3a 60%, #d23f2a 78%, #ff9a3c 90%, #ffe39a); }
.w-hint { margin: 0 0 12px; font-size: .68rem; color: #8b8d95; }
.w-actions { display: flex; gap: 8px; }
.chip { border: 1px solid rgba(94,234,212,.45); background: rgba(94,234,212,.12); color: #5eead4; border-radius: 8px; padding: 6px 12px; font-size: .78rem; transition: background .2s; }
.chip:hover { background: rgba(94,234,212,.22); }
.chip:disabled { opacity: .5; cursor: progress; }
.chip.ghost { border-color: rgba(255,255,255,.18); background: transparent; color: #bdbcc2; }

/* ============================================================
   Windows
   ============================================================ */
.windows { position: absolute; inset: 0; pointer-events: none; }
.snap-ghost {
  position: absolute; border-radius: 14px; pointer-events: none; opacity: 0;
  background: rgba(94,234,212,.1); border: 1.5px solid rgba(94,234,212,.55);
  backdrop-filter: blur(6px); transition: opacity .15s, left .15s, top .15s, width .15s, height .15s; z-index: 9999;
}
.snap-ghost.on { opacity: 1; }
.win {
  position: absolute; pointer-events: auto;
  display: flex; flex-direction: column; min-width: 280px; min-height: 200px;
  background: var(--win); border-radius: 8px; overflow: hidden;
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(1.5); -webkit-backdrop-filter: blur(26px) saturate(1.5);
  transition: opacity .18s ease, transform .22s cubic-bezier(.2,.9,.3,1.1), left .22s cubic-bezier(.2,.8,.2,1), top .22s cubic-bezier(.2,.8,.2,1), width .22s cubic-bezier(.2,.8,.2,1), height .22s cubic-bezier(.2,.8,.2,1);
}
.win.dragging, body.is-resizing .win { transition: opacity .18s, transform .22s; }
.win.opening { opacity: 0; transform: scale(.94) translateY(12px); }
.win.closing { opacity: 0; transform: scale(.95); pointer-events: none; }
.win.minimized { opacity: 0; transform: translateY(60px) scale(.85); pointer-events: none; visibility: hidden; transition: opacity .2s, transform .25s, visibility 0s .25s; }
.win.max, .win.snapped { border-radius: 0; }
.win:not(.focused) { box-shadow: 0 16px 40px -20px rgba(0,0,0,.55), 0 0 0 1px rgba(127,127,127,.12); }
.win:not(.focused) .win-bar { opacity: .75; }

.win-bar {
  height: 40px; flex: none; display: flex; align-items: center; gap: 9px; padding: 0 6px 0 12px;
  background: var(--bar); border-bottom: 1px solid var(--line); cursor: default; touch-action: none; user-select: none;
}
.win-title { flex: 1; font-size: .82rem; font-weight: 500; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win.focused .win-title { color: var(--ink); }
.win-ctrl { display: flex; gap: 2px; }
.wc { width: 34px; height: 28px; border-radius: 7px; display: grid; place-items: center; color: var(--ink-2); transition: background .15s, color .15s; }
.wc:hover { background: rgba(127,127,127,.18); color: var(--ink); }
.wc.close:hover { background: #e5484d; color: #fff; }
.win-body { flex: 1; min-height: 0; overflow: auto; background: var(--win-body); position: relative; }
.win-grip { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; touch-action: none; z-index: 3; }
.win-grip::after { content: ""; position: absolute; right: 4px; bottom: 4px; width: 7px; height: 7px; border-right: 2px solid var(--line-2); border-bottom: 2px solid var(--line-2); border-radius: 0 0 3px 0; }
.win.snapped .win-grip { display: none; }

.win-body::-webkit-scrollbar { width: 10px; height: 10px; }
.win-body::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid var(--win-body); }
.win-body::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   Taskbar
   ============================================================ */
.taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--tb); z-index: 900;
  display: flex; align-items: center; gap: 0; padding: 0;
  background: var(--taskbar); border-top: 1px solid rgba(127,127,127,.16);
  backdrop-filter: blur(24px) saturate(1.6); -webkit-backdrop-filter: blur(24px) saturate(1.6);
}
.start-btn, .search-btn { width: 48px; height: 100%; display: grid; place-items: center; flex: none; color: var(--ink); transition: background .12s; }
.start-btn:hover, .search-btn:hover, .start-btn[aria-expanded="true"] { background: rgba(127,127,127,.2); }
.start-btn .logo { width: 20px; height: 20px; }
.tasks { flex: 1; min-width: 0; margin-left: 4px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; height: 100%; align-items: center; }
.tasks::-webkit-scrollbar { display: none; }
.task {
  position: relative; height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 12px 0 9px; border-radius: 4px;
  font-size: .8rem; color: var(--ink-2); max-width: 190px; flex: none; transition: background .15s;
}
.task span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task:hover { background: rgba(127,127,127,.15); }
.task.active { background: rgba(127,127,127,.2); color: var(--ink); }
.task::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 6px; height: 3px; border-radius: 3px; transform: translateX(-50%); background: var(--ink-3); transition: width .2s, background .2s; }
.task.active::after { width: 18px; background: var(--cool); }
.task.minimized { opacity: .7; }
.tray { display: flex; align-items: center; gap: 2px; height: 100%; flex: none; }
.tray-btn { width: 36px; height: 38px; border-radius: 9px; display: grid; place-items: center; color: var(--ink-2); }
.tray-btn:hover { background: rgba(127,127,127,.15); color: var(--ink); }
.clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; padding: 0 10px; font-size: .72rem; color: var(--ink); }
.clock span + span { color: var(--ink-3); font-size: .66rem; }
.show-desktop { width: 8px; height: 100%; border-left: 1px solid rgba(127,127,127,.25); }
.show-desktop:hover { background: rgba(127,127,127,.2); }

/* ============================================================
   Start menu
   ============================================================ */
.start {
  position: fixed; left: 0; bottom: var(--tb); z-index: 950;
  width: min(340px, 100vw); height: min(540px, calc(100vh - var(--tb)));
  display: flex; background: var(--menu); color: var(--ink);
  border-top: 1px solid rgba(127,127,127,.2); border-right: 1px solid rgba(127,127,127,.2);
  box-shadow: 0 0 40px rgba(0,0,0,.45);
  backdrop-filter: blur(30px) saturate(1.4); -webkit-backdrop-filter: blur(30px) saturate(1.4);
  animation: start-up .2s cubic-bezier(.1,.9,.2,1);
}
@keyframes start-up { from { transform: translateY(28px); opacity: 0; } }
/* Icon rail: overlays the list when expanded, like Windows 10 */
.start-rail {
  position: absolute; left: 0; top: 0; bottom: 0; z-index: 2; width: 48px;
  display: flex; flex-direction: column; padding: 4px 0; overflow: hidden;
  background: var(--menu); transition: width .18s ease, box-shadow .18s ease;
}
.start.expanded .start-rail { width: 240px; box-shadow: 10px 0 30px rgba(0,0,0,.45); backdrop-filter: blur(30px); }
.rail-btn { position: relative; display: flex; align-items: center; gap: 16px; width: 100%; height: 44px; padding: 0 15px; color: var(--ink); white-space: nowrap; flex: none; }
.rail-btn:hover { background: rgba(127,127,127,.2); }
.rail-btn.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; background: var(--accent); }
.rail-btn svg { flex: none; }
.rail-btn span { font-size: .86rem; opacity: 0; transition: opacity .12s; }
.start.expanded .rail-btn span { opacity: 1; }
.rail-gap { flex: 1; }
.rail-avatar { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex: none; margin: 0 -1px; }
.start-main { flex: 1; min-width: 0; margin-left: 48px; display: flex; flex-direction: column; }
.start-search { margin: 8px 8px 4px; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; background: rgba(127,127,127,.13); border-bottom: 2px solid transparent; color: var(--ink-2); flex: none; }
.start-search:focus-within { border-bottom-color: var(--accent); background: rgba(127,127,127,.2); }
.start-search input { flex: 1; border: 0; background: transparent; color: var(--ink); font: .9rem var(--sans); outline: none; min-width: 0; }
.start-search input::placeholder { color: var(--ink-3); }
kbd { font-family: var(--mono); font-size: .66rem; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line-2); color: var(--ink-3); white-space: nowrap; }
.start-results { list-style: none; margin: 0; padding: 4px 0; overflow: auto; }
.start-results li { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; cursor: pointer; color: var(--ink); font-size: .88rem; }
.start-results li small { margin-left: auto; color: var(--ink-3); font-size: .74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.start-results li[aria-selected="true"], .start-results li:hover { background: rgba(127,127,127,.2); }
.start-results .act-ico { width: 22px; text-align: center; color: var(--accent); font-weight: 700; }
.start-results .empty { cursor: default; color: var(--ink-3); }
.start-list { flex: 1; overflow: auto; padding: 2px 0 8px; }
.start.searching .start-list { display: none; }
.sl-item { display: flex; align-items: center; gap: 12px; width: 100%; height: 40px; padding: 0 12px; color: var(--ink); font-size: .88rem; text-align: left; }
.sl-item:hover { background: rgba(127,127,127,.2); }
.sl-item.sub { padding-left: 30px; }
.sl-folder .chev { margin-left: auto; color: var(--ink-2); transition: transform .2s; }
.sl-folder[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.sl-folder[aria-expanded="false"] + .sl-sub { display: none; }

/* context menu */
.ctx {
  position: fixed; z-index: 960; min-width: 220px; padding: 6px; border-radius: 12px;
  background: var(--win); box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(1.5); -webkit-backdrop-filter: blur(24px) saturate(1.5);
  animation: fadein .12s;
}
@keyframes fadein { from { opacity: 0; transform: scale(.97); } }
.ctx button { display: block; width: 100%; text-align: left; padding: 8px 12px; border-radius: 8px; font-size: .84rem; color: var(--ink-2); }
.ctx button:hover { background: rgba(127,127,127,.16); color: var(--ink); }
.ctx hr { border: 0; border-top: 1px solid var(--line); margin: 5px 6px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tb) + 18px); transform: translate(-50%, 16px); opacity: 0; z-index: 990;
  background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 999px; pointer-events: none;
  transition: opacity .25s, transform .25s; white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================
   App primitives
   ============================================================ */
.btn-sm {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border-radius: 9px;
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink); font-size: .82rem; font-weight: 500;
  transition: border-color .15s, background .15s, transform .15s; white-space: nowrap;
}
.btn-sm:hover { border-color: var(--ink-3); }
.btn-sm:active { transform: translateY(1px); }
.btn-sm.primary { background: var(--hot); border-color: var(--hot); color: #160803; }
.btn-sm.primary:hover { filter: brightness(1.08); }
.linkish { color: var(--cool); text-decoration: underline; text-underline-offset: 2px; }
code { font-family: var(--mono); font-size: .9em; background: var(--bg-2); border: 1px solid var(--line); padding: 0 5px; border-radius: 5px; }

.has-tabs { display: flex; flex-direction: column; }
.tabs { position: sticky; top: 0; z-index: 2; display: flex; gap: 2px; padding: 8px 12px 0; background: var(--win-body); border-bottom: 1px solid var(--line); flex: none; overflow-x: auto; scrollbar-width: none; }
.tabs [role=tab] { position: relative; padding: 8px 12px 10px; font-size: .82rem; color: var(--ink-3); border-radius: 8px 8px 0 0; white-space: nowrap; }
.tabs [role=tab]:hover { color: var(--ink); }
.tabs [role=tab][aria-selected="true"] { color: var(--ink); }
.tabs [role=tab][aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--hot); }
.tab-panels { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tab-panel { padding: 22px 26px 30px; animation: fadein .2s; }
.tab-panel.flush { padding: 0; flex: 1; display: flex; flex-direction: column; min-height: 360px; }

.case p { color: var(--ink-2); margin: 0 0 14px; }
.case b { color: var(--ink); font-weight: 600; }
.case-meta { color: var(--ink-3); margin: 0 0 6px; }
.case-q { font-weight: 600; font-size: 1.3rem; line-height: 1.25; margin: 0 0 12px; }
.case h4, .doc h3, .settings h4 { color: var(--ink); font-size: .92rem; font-weight: 600; margin: 22px 0 8px; }
.facts { border-collapse: collapse; margin: 14px 0 4px; font-size: .9rem; }
.facts td { padding: 5px 16px 5px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: top; }
.facts tr:last-child td { border-bottom: 0; }
.facts td.n { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.facts td.cool { color: var(--cool); }
.bul { margin: 0; padding-left: 18px; color: var(--ink-2); }
.bul li { margin-bottom: 6px; }
.bul li::marker { color: var(--hot); }
.built { font-size: .85rem; color: var(--ink-3) !important; margin: 16px 0 !important; }
.row-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
blockquote { margin: 16px 0; padding: 4px 0 4px 14px; border-left: 3px solid var(--line-2); color: var(--ink); font-style: italic; }
.note { font-size: .8rem; color: var(--ink-3); margin: 14px 0 0; line-height: 1.5; }
.note b { color: var(--ink-2); }

.viz-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { padding: 4px 11px; border-radius: 999px; font-size: .78rem; color: var(--ink-3); transition: background .2s, color .2s; }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--win-body); }

/* pareto */
.pareto { width: 100%; height: auto; overflow: visible; }
.pareto text { font-size: 11px; fill: var(--ink-3); }
.pareto .grid line { stroke: var(--line); }
.pareto .ax { fill: var(--ink-2); }
.pareto .frontier { fill: none; stroke: var(--cool); stroke-width: 2; stroke-dasharray: 5 5; opacity: .75; }
.pareto .pt.base { fill: var(--ink-3); }
.pareto .pt.cc { fill: var(--cool); }
.pareto .pt-label { fill: var(--ink-2); }
.pareto .halo { fill: none; stroke: var(--cool); stroke-width: 1.5; transition: cx .5s cubic-bezier(.2,.8,.2,1), cy .5s cubic-bezier(.2,.8,.2,1); }
.pareto .pulse-ring { transform-box: fill-box; transform-origin: center; animation: ring 1.8s infinite; }
@keyframes ring { from { opacity: .8; transform: scale(1); } to { opacity: 0; transform: scale(2.4); } }
.readout { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.readout div { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; }
.readout .k { display: block; color: var(--ink-3); font-size: .72rem; }
.readout .v { display: block; font-size: 1.02rem; font-variant-numeric: tabular-nums; font-weight: 500; }
.readout .v.cool { color: var(--cool); }

/* bars */
.bars { display: grid; gap: 18px; }
.bg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 7px; }
.bg-name { font-weight: 500; }
.bg-name em { font-style: normal; color: var(--violet); font-size: .66rem; margin-left: 6px; }
.verdict { font-size: .72rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-3); white-space: nowrap; }
.verdict.clear { border-color: color-mix(in srgb, var(--cool) 55%, transparent); color: var(--cool); }
.bar-row { display: grid; grid-template-columns: 1fr 96px; align-items: center; gap: 10px; margin-bottom: 5px; }
.bar-track { height: 14px; background: var(--bg-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.bar-fill { height: 100%; width: var(--w); border-radius: 3px; animation: grow .9s cubic-bezier(.2,.8,.2,1); }
@keyframes grow { from { width: 0; } }
.bar-fill.a { background: linear-gradient(90deg, color-mix(in srgb, var(--hot) 55%, transparent), var(--hot)); }
.bar-fill.f { background: linear-gradient(90deg, color-mix(in srgb, var(--ink-3) 35%, transparent), var(--ink-3)); }
.bar-val { font-size: .8rem; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.bar-val b { color: var(--ink); font-weight: 500; }
.bars-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); color: var(--ink-3); font-size: .68rem; }
.bars-legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.sw.a { background: var(--hot); } .sw.f { background: var(--ink-3); }

/* stepper */
.stepper { list-style: none; margin: 0; padding: 0; position: relative; }
.stepper::before { content: ""; position: absolute; left: 15px; top: 10px; bottom: 10px; width: 2px; background: linear-gradient(var(--cool), var(--hot)); opacity: .5; }
.stepper li { position: relative; display: grid; grid-template-columns: 32px 1fr auto; gap: 14px; align-items: start; padding: 10px 0; animation: slidein .45s both; animation-delay: calc(var(--i) * 70ms); }
@keyframes slidein { from { opacity: 0; transform: translateX(-8px); } }
.st-n { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--win-body); border: 1px solid var(--line-2); color: var(--hot); position: relative; }
.stepper b { display: block; margin-bottom: 2px; }
.stepper p { margin: 0; color: var(--ink-2); font-size: .88rem; }
.st-k { color: var(--ink-3); font-size: .66rem; padding-top: 4px; text-align: right; max-width: 170px; }

/* pipeline */
.pipeline { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 6px 0 16px; position: relative; }
.pipe-rail { position: absolute; left: 6%; right: 6%; top: 24px; height: 2px; background: var(--line); border-radius: 2px; }
.pipe-rail i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--cool), var(--hot)); border-radius: 2px; transition: width .5s ease; }
.stage { position: relative; z-index: 1; border: 1px solid var(--line); background: var(--bg-2); border-radius: 10px; padding: 12px 2px 10px; display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: .74rem; color: var(--ink-3); transition: border-color .2s, color .2s, background .2s, transform .2s; min-width: 0; }
.stage .dot { width: 22px; height: 22px; border-radius: 6px; border: 1px solid currentColor; display: grid; place-items: center; font-size: .6rem; background: var(--bg-2); }
.stage:hover { transform: translateY(-2px); color: var(--ink-2); }
.stage.active { border-color: var(--hot); color: var(--ink); background: color-mix(in srgb, var(--hot) 10%, var(--bg-2)); }
.stage.active .dot { background: var(--hot); border-color: var(--hot); color: #160803; }
.stage.done { color: var(--ink-2); }
.stage.done .dot { border-color: var(--cool); color: var(--cool); }
.stage-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pipe-detail { border-top: 1px dashed var(--line); padding-top: 14px; min-height: 130px; animation: fadein .25s; }
.pipe-detail h5 { font-size: 1.05rem; margin: 0 0 6px; }
.pipe-detail p { margin: 0 0 12px; color: var(--ink-2); font-size: .9rem; }
.pipe-kv { display: flex; flex-wrap: wrap; gap: 6px; }
.pipe-kv span { font-size: .76rem; padding: 4px 9px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink-3); }
.pipe-kv b { color: var(--ink); font-weight: 500; }

/* network */
.network { width: 100%; height: auto; overflow: visible; }
.network text { font-size: 11.5px; fill: var(--ink-2); pointer-events: none; }
.network .col { fill: var(--ink-3); font-size: 10.5px; }
.network .node rect { fill: var(--bg-2); stroke: var(--line-2); transition: stroke .2s; }
.network .node { cursor: pointer; outline: none; }
.network .stage-node rect { stroke: var(--hot); fill: color-mix(in srgb, var(--hot) 10%, var(--bg-2)); }
.network .stage-node text { fill: var(--ink); font-weight: 500; font-size: 11.5px; }
.network .node.lit rect { stroke: var(--cool); stroke-width: 1.6; }
.network .edge { fill: none; stroke-width: 1.5; transition: stroke .2s, opacity .2s; }
.network .edge.flow { stroke: var(--hot); stroke-dasharray: 3 7; animation: flow 1.2s linear infinite; opacity: .75; }
.network .edge.carry { stroke: var(--cool); stroke-dasharray: 3 7; animation: flow 1.6s linear infinite; }
.network .edge.lit { stroke: var(--cool); opacity: 1; stroke-width: 2; }
.network .edge.dimmed { opacity: .15; }
.network .carry-l { fill: var(--cool); font-size: 10px; }
@keyframes flow { to { stroke-dashoffset: -20; } }

/* live iframe */
.live { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.live-bar { display: flex; align-items: center; gap: 8px; padding: 7px 12px; background: var(--bg-2); border-bottom: 1px solid var(--line); flex: none; }
.live-bar .lock { font-size: .7rem; }
.live-bar .url { flex: 1; font-family: var(--mono); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--win-body); border: 1px solid var(--line); border-radius: 7px; padding: 4px 9px; }
.live-bar a { color: var(--cool); }
.live-stage { flex: 1; position: relative; min-height: 0; background: #fff; }
.live-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.live-cover, .live-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; text-align: center; background: var(--win-body); color: var(--ink-2); z-index: 1; }
.live-cover p { max-width: 42ch; margin: 0; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--hot); animation: rot .8s linear infinite; display: inline-block; }
.live-loading { flex-direction: row; gap: 12px; }
.gh .live-loading { position: static; padding: 60px 20px; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ============================================================
   Specific apps
   ============================================================ */
/* about */
.doc { padding: 26px 28px 30px; }
.doc-hero { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.doc-hero h1 { font-size: 1.7rem; letter-spacing: -.025em; margin: 0; line-height: 1.1; }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; background: var(--bg-2); }
.doc-lede { font-size: 1.12rem; line-height: 1.5; margin: 0 0 8px; color: var(--ink); }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick button { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); transition: border-color .15s, transform .15s; }
.quick button:hover { border-color: var(--hot); transform: translateY(-1px); }
.quick b { display: block; font-size: .9rem; }
.quick small { display: block; color: var(--ink-3); font-size: .74rem; line-height: 1.3; }
.rules { margin: 0; padding-left: 20px; color: var(--ink-2); }
.rules li { margin-bottom: 6px; }
.rules li::marker { color: var(--hot); font-size: .8em; }
.rules b { color: var(--ink); }
.doc p { color: var(--ink-2); }
.doc-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.tip { margin-top: 20px; padding-top: 14px; border-top: 1px dashed var(--line); color: var(--ink-3); font-size: .72rem; }

.notepad { display: flex; flex-direction: column; overflow: hidden !important; }
.np-menu { display: flex; gap: 2px; padding: 3px 6px; border-bottom: 1px solid var(--line); background: var(--win-body); flex: none; }
.np-menu button { padding: 3px 9px; border-radius: 5px; font-size: .82rem; color: var(--ink); }
.np-menu button:hover { background: rgba(127,127,127,.15); }
.np-text { flex: 1; margin: 0; overflow: auto; padding: 12px 14px; font-family: var(--mono); font-size: 14px; line-height: 1.5; color: var(--ink); white-space: pre; outline: none; }
.np-text.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.np-ln { display: block; padding-left: var(--i, 0); text-indent: calc(-1 * var(--i, 0)); }
.np-text a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.np-text a:hover { color: var(--hot); text-decoration-color: currentColor; }
.np-status { display: flex; flex: none; border-top: 1px solid var(--line); background: var(--bg-2); font-size: .74rem; color: var(--ink-2); }
.np-status span { padding: 4px 14px; border-right: 1px solid var(--line); white-space: nowrap; }
.np-status span:first-child { flex: 1; }
@media (max-width: 720px) { .np-status span:nth-child(n+3) { display: none; } }

/* explorer */
.explorer { display: grid; grid-template-columns: 160px 1fr; }
.ex-side { border-right: 1px solid var(--line); padding: 10px 8px; background: var(--bg-2); display: flex; flex-direction: column; gap: 2px; }
.ex-side button { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 8px; font-size: .84rem; color: var(--ink-2); text-align: left; }
.ex-side button:hover { background: rgba(127,127,127,.12); }
.ex-side button[aria-pressed="true"] { background: rgba(127,127,127,.2); color: var(--ink); }
.ex-main { display: flex; flex-direction: column; min-width: 0; }
.ex-path { padding: 10px 16px; border-bottom: 1px solid var(--line); color: var(--ink-3); }
.ex-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; padding: 14px; align-content: start; }
.ex-item { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px; border-radius: 10px; border: 1px solid transparent; font-size: .78rem; text-align: center; color: var(--ink-2); cursor: default; }
.ex-item:hover { background: rgba(127,127,127,.1); }
.ex-item[aria-selected="true"] { background: rgba(70,150,255,.22); border-color: rgba(100,170,255,.6); color: var(--ink); }
.ex-info { border-top: 1px solid var(--line); padding: 12px 16px; color: var(--ink-2); line-height: 1.6; min-height: 60px; background: var(--bg-2); }
.ex-info .btn-sm { margin-top: 8px; font-family: var(--sans); }
.ex-info b { color: var(--ink); }

/* github */
.gh { padding: 20px 22px 24px; }
.gh-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.gh-head img { border-radius: 50%; border: 1px solid var(--line-2); }
.gh-head div { flex: 1; min-width: 0; }
.gh-head b { display: block; font-size: 1.05rem; }
.gh-head span { display: block; }
.gh-langbar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 2px; margin-bottom: 8px; }
.gh-langs { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--ink-2); margin-bottom: 16px; }
.gh-langs i, .gh-lang i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.gh-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.gh-list a { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); transition: background .15s; }
.gh-list li:last-child a { border-bottom: 0; }
.gh-list a:hover { background: var(--bg-2); }
.gh-name { font-weight: 500; min-width: 0; }
.gh-name small { display: block; font-weight: 400; color: var(--ink-3); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gh-lang, .gh-time { color: var(--ink-3); white-space: nowrap; }

/* music */
.music { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; height: 100%; }
.music-top b { font-size: 1.05rem; }
.music-top .note { margin: 4px 0 0; }
.music-top a { color: var(--cool); }
.roll { width: 100%; height: 170px; border-radius: 12px; border: 1px solid var(--line); flex: 1; min-height: 140px; }
.music-ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.music-ctrl label { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.music-ctrl input[type=range] { accent-color: var(--hot); width: 110px; }
.music-ctrl select { background: var(--bg-2); color: var(--ink); border: 1px solid var(--line-2); border-radius: 8px; padding: 5px 8px; font: inherit; }

/* contact */
.contact-list { margin-top: 18px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.c-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.c-row:last-child { border-bottom: 0; }
.c-row a { color: var(--ink); font-weight: 500; }
.c-row a:hover { color: var(--hot); }
.c-row .btn-sm { height: 26px; font-size: .74rem; }

/* bin */
.bin { padding: 18px 20px; }
.bin p.mono { margin: 0 0 10px; }
.bin ul { list-style: none; margin: 0; padding: 0; }
.bin li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.bin li:last-child { border-bottom: 0; }
.bin li .ico { flex: none; opacity: .75; }
.bin b { font-size: .8rem; text-decoration: line-through; text-decoration-color: var(--hot); color: var(--ink); }
.bin li p { margin: 3px 0 0; color: var(--ink-2); font-size: .86rem; }

/* settings */
.settings { padding: 8px 22px 22px; }
.settings section { padding-bottom: 6px; }
.switch { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: var(--ink-2); cursor: pointer; }
.switch input { accent-color: var(--cool); width: 16px; height: 16px; }

/* terminal */
.term { background: #0a0b0e !important; color: #d7d8dc; font-family: var(--mono); font-size: .82rem; line-height: 1.6; padding: 14px 16px 18px; cursor: text; }
.term-out div { white-space: pre-wrap; word-break: break-word; }
.term c { color: #5eead4; }
.term k { color: #5eead4; }
.term .dim { color: #6b6e78; }
.term t1 { color: #ffe39a; } .term t2 { color: #ff9a3c; } .term t3 { color: #d23f2a; } .term t4 { color: #6b1a3a; }
.term .nf { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; padding: 4px 0; }
.term .nf-logo { line-height: 1.05; font-family: Consolas, 'Courier New', monospace; }
.term-line { display: flex; gap: 8px; align-items: baseline; }
.term-ps { color: #aeb0b8; white-space: nowrap; }
.term-ps b { color: #a78bfa; font-weight: 400; }
.term-in { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: #fff; font: inherit; caret-color: #ff6a3d; padding: 0; }

/* ============================================================
   Animated icons (itshover, Apache-2.0), ported from motion/react to CSS.
   Each animation plays while its button (or link, row, tab) is hovered.
   ============================================================ */
.ih { overflow: visible; flex: none; }
.ih * { transform-box: fill-box; transform-origin: center; }
.ih .ih-draw { stroke-dasharray: 1; stroke-dashoffset: 0; }
@keyframes ih-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes ih-pop { 0% { transform: scale(0); opacity: 0; } 70% { transform: scale(1.2); opacity: 1; } 100% { transform: scale(1); } }
:hover > .ih-about .a-fold, :hover > .ih-file .a-fold { animation: ih-draw .3s ease-out; }
:hover > .ih-about .a-line, :hover > .ih-file .a-line { animation: ih-draw .4s ease-out .3s both; }
.ih-projects .p-top, .ih-projects .p-bot { transition: transform .3s ease-out, opacity .3s ease-out; }
:hover > .ih-projects .p-top { transform: translateY(-2px) scale(1.05); }
:hover > .ih-projects .p-bot { transform: translateY(1px); opacity: .7; }
@keyframes ih-sig-in { 50% { transform: scale(1.15); opacity: .6; } }
@keyframes ih-sig-out { 50% { transform: scale(1.25); opacity: .4; } }
@keyframes ih-dish { 33% { transform: rotate(-2deg); } 66% { transform: rotate(2deg); } }
.ih-coolcity .c-in { transform-box: view-box; transform-origin: 14px 10px; }
.ih-coolcity .c-out { transform-box: view-box; transform-origin: 16px 8px; }
.ih-coolcity .c-dish { transform-box: view-box; transform-origin: 9px 15px; }
:hover > .ih-coolcity .c-in { animation: ih-sig-in .6s ease-in-out; }
:hover > .ih-coolcity .c-out { animation: ih-sig-out .7s ease-in-out .1s; }
:hover > .ih-coolcity .c-dish { animation: ih-dish .5s ease-in-out .8s; }
:hover > .ih-fiskal .b-1 { animation: ih-draw .3s ease-in-out .1s both; }
:hover > .ih-fiskal .b-2 { animation: ih-draw .3s ease-in-out .45s both; }
:hover > .ih-fiskal .b-3 { animation: ih-draw .3s ease-in-out .8s both; }
@keyframes ih-grow-x { from { transform: scaleX(0); } }
@keyframes ih-grow-y { from { transform: scaleY(0); } }
@keyframes ih-nudge-x { 50% { transform: scaleX(1.05); } }
.ih-finscope .f-base { transform-box: view-box; transform-origin: 4px 19px; }
:hover > .ih-finscope .f-line { animation: ih-draw .6s ease-in-out; }
:hover > .ih-finscope .f-base { animation: ih-grow-x .4s ease-out; }
.ih-ndea .n-b1 { transform-box: view-box; transform-origin: 6px 20px; }
.ih-ndea .n-b2 { transform-box: view-box; transform-origin: 12px 20px; }
.ih-ndea .n-b3 { transform-box: view-box; transform-origin: 18px 20px; }
.ih-ndea .n-base { transform-box: view-box; transform-origin: 11px 20px; }
:hover > .ih-ndea .n-b1 { animation: ih-grow-y .3s ease-out both; }
:hover > .ih-ndea .n-b2 { animation: ih-grow-y .3s ease-out .1s both; }
:hover > .ih-ndea .n-b3 { animation: ih-grow-y .3s ease-out .2s both; }
:hover > .ih-ndea .n-base { animation: ih-nudge-x .4s ease-in-out; }
@keyframes ih-draw-pulse { 0% { stroke-dashoffset: 1; opacity: 0; } 66% { stroke-dashoffset: 0; opacity: 1; transform: scale(1); } 83% { transform: scale(1.05); } 100% { transform: scale(1); } }
:hover > .ih-speakup .m-path { animation: ih-draw-pulse .9s ease-in-out; }
@keyframes ih-scan { 0% { transform: translateY(0); opacity: 0; } 30% { opacity: 1; } 55% { transform: translateY(30px); opacity: 1; } 85% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(0); opacity: 0; } }
@keyframes ih-fade-in { from { opacity: 0; transform: scale(.8); } }
.ih-kupon .q-scan { opacity: 0; filter: drop-shadow(0 0 4px currentColor); }
:hover > .ih-kupon .q-c1 { animation: ih-draw .4s ease-out both; }
:hover > .ih-kupon .q-c2 { animation: ih-draw .4s ease-out .1s both; }
:hover > .ih-kupon .q-c3 { animation: ih-draw .4s ease-out .2s both; }
:hover > .ih-kupon .q-in { animation: ih-fade-in .3s ease-out .45s both; }
:hover > .ih-kupon .q-dot { animation: ih-pop .3s ease-out .75s both; }
:hover > .ih-kupon .q-scan { animation: ih-scan 1.5s ease-in-out .6s infinite; }
@keyframes ih-needle { 25% { transform: rotate(45deg); } 50% { transform: rotate(-20deg); } 75% { transform: rotate(30deg); } }
.ih-neurodrive .d-needle { transform-box: view-box; transform-origin: 12px 14px; }
:hover > .ih-neurodrive .d-needle { animation: ih-needle .8s ease-in-out; }
@keyframes ih-blink { 25%, 75% { opacity: 0; } 0%, 50%, 100% { opacity: 1; } }
@keyframes ih-nudge-r { 50% { transform: translateX(2px); } }
:hover > .ih-terminal .t-cur { animation: ih-blink .8s ease-in-out; }
:hover > .ih-terminal .t-chev { animation: ih-nudge-r .3s ease-in-out; }
@keyframes ih-spin { to { transform: rotate(360deg); } }
@keyframes ih-pulse { 50% { transform: scale(1.2); } }
.ih-music .v-disc { transform-box: view-box; transform-origin: 12px 12px; }
:hover > .ih-music .v-disc { animation: ih-spin 3s linear infinite; }
:hover > .ih-music .v-dot { animation: ih-pulse 1s ease-in-out infinite; }
@keyframes ih-wiggle { 25% { transform: scale(1.1) rotate(-5deg); } 60% { transform: scale(1.05) rotate(5deg); } }
:hover > .ih-github .g-cat { animation: ih-wiggle .5s ease-in-out; }
:hover > .ih-hf .h-c { animation: ih-draw .6s ease-in-out both; }
:hover > .ih-hf .h-t { animation: ih-pop .3s ease-out .5s both; }
@keyframes ih-fly { 0% { transform: none; opacity: 1; } 49% { transform: translate(24px, -24px); opacity: 0; } 50% { transform: translate(-24px, 24px); opacity: 0; } 100% { transform: none; opacity: 1; } }
:hover > .ih-contact .s-plane { animation: ih-fly .5s ease-in-out; }
.ih-trash .r-low, .ih-trash .r-up { transform-origin: 50% 100%; transition: transform .25s ease-out; }
:hover > .ih-trash .r-low { transform: translateY(-4px) rotate(-25deg); }
:hover > .ih-trash .r-up { transform: translate(-2px, -6px) rotate(-35deg); }
:hover > .ih-settings .k-rot { animation: ih-spin .9s ease-in-out; }
:hover > .ih-settings .k-mid { animation: ih-pulse .3s ease-out; }

/* Icon tone on the desktop: one colour for every icon, taken from the galaxy. Chosen in Settings. */
body[data-icons="starlight"] .d-icon .ih { color: #f3e2c4; filter: drop-shadow(0 0 6px rgba(243,226,196,.28)) drop-shadow(0 2px 4px rgba(0,0,0,.7)); }
body[data-icons="ice"] .d-icon .ih { color: #c9d5ff; filter: drop-shadow(0 0 6px rgba(201,213,255,.3)) drop-shadow(0 2px 4px rgba(0,0,0,.7)); }

/* ============================================================
   Responsive
   ============================================================ */
.hint-touch { display: none; }
@media (pointer: coarse) { .hint-mouse { display: none; } .hint-touch { display: inline; } }
/* Inputs under 16px make iOS zoom the whole page on focus. */
@media (pointer: coarse) { .term-in, .start-search input { font-size: 16px; } }
@media (max-width: 720px) {
  /* Keep the taskbar clear of the iPhone home indicator (the page uses viewport-fit=cover). */
  :root { --tb: calc(56px + env(safe-area-inset-bottom, 0px)); }
  .taskbar { padding-bottom: env(safe-area-inset-bottom, 0px); }
  /* Bigger title-bar buttons for fingers. */
  .win-bar { height: 44px; }
  .wc { width: 42px; height: 36px; }
  .icons { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); grid-template-rows: none; grid-auto-rows: 98px; right: 10px; overflow-y: auto; }
  .d-icon { width: auto; }
  .hide-sm { display: none !important; }
  /* Calmer wallpaper on phones. */
  #wall { filter: saturate(.8); }
  .wall-scrim { background: linear-gradient(rgba(6,7,10,.12), rgba(6,7,10,.12)); }
  .np-text { font-size: 13.5px; line-height: 1.6; padding: 14px 16px 20px; }
  .np-menu button { padding: 7px 11px; font-size: .86rem; }
  /* Compact explainer pinned above the taskbar. */
  .widget { top: auto; bottom: 10px; left: 10px; right: 10px; width: auto; padding: 10px 12px; border-radius: 14px; }
  .widget .w-grid, .widget .w-info { display: none; }
  .widget .w-head { margin-bottom: 8px; }
  .widget .legend { margin-bottom: 6px; }
  .widget .w-hint { margin-bottom: 8px; }
  .drive-panel { top: auto; bottom: 10px; left: 10px; right: 10px; width: auto; }
  /* While driving on a phone the pedals take the bottom, the panel sits above them and the icons get out of the way. */
  body.driving .drive-panel { bottom: 84px; }
  body.driving .wa-learn { display: none; }
  body.driving .icons { display: none; }
  .icons { bottom: 150px; }
  .task span { display: none; }
  .task { padding: 0 9px; }
  .win-grip { display: none; }
  .tab-panel { padding: 18px 16px 24px; }
  .doc { padding: 20px 18px 24px; }
  .quick { grid-template-columns: 1fr; }
  .readout { grid-template-columns: 1fr 1fr; }
  .pipeline { grid-template-columns: repeat(4, 1fr); }
  .pipe-rail { display: none; }
  .explorer { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .ex-side { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .ex-side button { flex: none; }
  .stepper li { grid-template-columns: 32px 1fr; }
  .st-k { grid-column: 2; text-align: left; padding-top: 0; }
  .c-row { grid-template-columns: 1fr auto; }
  .c-row > span:first-child { grid-column: 1 / -1; }
  .gh-list a { grid-template-columns: 1fr auto; }
  .gh-time { display: none; }
  .case-q { font-weight: 600; font-size: 1.3rem; line-height: 1.25; margin: 0 0 12px; }
  /* SVG charts shrink with the screen; enlarge their labels so they stay readable (~10px on a phone). */
  .pareto text { font-size: 17px; }
  .network text, .network .stage-node text { font-size: 14.5px; }
  .network .col, .network .carry-l { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
