/* alexlee.sh — TUI mock
   A btop/tmux/lazygit-flavored dashboard. One mono family, a character-cell rhythm,
   panes with titles cut into their borders, and three swappable color themes. */

/* ---------- tokens ---------- */

:root {
  --font: "JetBrains Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --fs: 13px;
  --lh: 1.5;
  --row: calc(var(--fs) * var(--lh));
  --cw: 7.8px; /* measured char width, replaced by JS */
  --gap: 10px;
  --radius: 8px;
  --pad-y: 14px;
  --pad-x: 1.6ch;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

[data-theme="tokyo-night"] {
  --bg: #0b0e14;
  --pane: #0d1119;
  --raise: #131a28;
  --border: #1f2739;
  --border-hi: #2d3753;
  --fg: #c8d1f5;
  --fg-2: #a9b1d6;
  --dim: #7c86ad;
  --muted: #3b4261;
  --faint: #171d2b;
  --sel: #1d2843;
  --cyan: #7dcfff;
  --blue: #7aa2f7;
  --violet: #bb9af7;
  --green: #9ece6a;
  --amber: #e0af68;
  --coral: #f7768e;
  --accent-a: #7dcfff;
  --accent-b: #7aa2f7;
  --accent-c: #bb9af7;
  --glow: rgba(125, 207, 255, .2);
  --hdr-bg: #7aa2f7;
  --hdr-fg: #0b0e14;
  --fig-shadow: #3d4766;
  --tmux-bg: #10141d;
  --sess-bg: #7aa2f7;
}

[data-theme="catppuccin-mocha"] {
  --bg: #11111b;
  --pane: #161622;
  --raise: #1e1e2e;
  --border: #272738;
  --border-hi: #3a3a54;
  --fg: #cdd6f4;
  --fg-2: #bac2de;
  --dim: #9399b2;
  --muted: #45475a;
  --faint: #1c1c2b;
  --sel: #292a3e;
  --cyan: #89dceb;
  --blue: #89b4fa;
  --violet: #cba6f7;
  --green: #a6e3a1;
  --amber: #f9e2af;
  --coral: #f38ba8;
  --accent-a: #f5c2e7;
  --accent-b: #cba6f7;
  --accent-c: #89b4fa;
  --glow: rgba(203, 166, 247, .2);
  --hdr-bg: #cba6f7;
  --hdr-fg: #11111b;
  --fig-shadow: #4a4b66;
  --tmux-bg: #181825;
  --sess-bg: #cba6f7;
}

[data-theme="gruvbox"] {
  --bg: #1a1c1d;
  --pane: #1d2021;
  --raise: #282828;
  --border: #322f2d;
  --border-hi: #4a433e;
  --fg: #ebdbb2;
  --fg-2: #d5c4a1;
  --dim: #a89984;
  --muted: #504945;
  --faint: #24272a;
  --sel: #33302d;
  --cyan: #8ec07c;
  --blue: #83a598;
  --violet: #d3869b;
  --green: #b8bb26;
  --amber: #fabd2f;
  --coral: #fb4934;
  --accent-a: #fabd2f;
  --accent-b: #fe8019;
  --accent-c: #fb4934;
  --glow: rgba(250, 189, 47, .16);
  --hdr-bg: #fabd2f;
  --hdr-fg: #1d2021;
  --fig-shadow: #5a514a;
  --tmux-bg: #202223;
  --sess-bg: #b8bb26;
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--fs);
  line-height: var(--lh);
  font-variant-ligatures: none;
  font-feature-settings: "calt" 0, "liga" 0;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--sel); color: var(--fg); }

button { font: inherit; color: inherit; }
kbd { font: inherit; }
p { margin: 0; }

a, button, [tabindex] { outline: none; }
a:focus-visible, button:focus-visible {
  outline: 1px solid var(--accent-a);
  outline-offset: 2px;
  border-radius: 3px;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip {
  position: fixed;
  left: 12px; top: 8px;
  z-index: 50;
  padding: 6px 1ch;
  background: var(--hdr-bg);
  color: var(--hdr-fg);
  font-weight: 700;
  text-decoration: none;
  border-radius: 4px;
  transform: translateY(-160%);
  transition: transform .2s var(--ease);
}
.skip:focus-visible { transform: none; }

.dim { color: var(--dim); }

/* ---------- app frame ---------- */

.app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.topbar {
  flex: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 2ch;
  min-height: calc(var(--row) + 14px);
  padding: env(safe-area-inset-top) 14px 0;
  color: var(--dim);
}
.tb-l, .tb-r { display: flex; align-items: center; gap: 2ch; min-width: 0; white-space: nowrap; }
.tb-r { justify-content: flex-end; }
.brand { color: var(--fg); font-weight: 700; letter-spacing: .01em; }
.online { display: inline-flex; align-items: center; gap: .9ch; color: var(--green); }
.online i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 55%, transparent);
  animation: pulse 2.8s var(--ease) infinite;
}
.clock { color: var(--fg); font-weight: 500; letter-spacing: .04em; }
.tz { overflow: hidden; text-overflow: ellipsis; }
.tz-short { display: none; }
@media (max-width: 999.98px) {
  .tz-long { display: none; }
  .tz-short { display: inline; }
}

.tb-btn {
  display: inline-flex; align-items: center; gap: .8ch;
  height: 26px; padding: 0 1ch;
  background: transparent; color: var(--dim);
  border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer;
  transition: color .18s var(--ease), border-color .18s var(--ease), background-color .18s var(--ease);
}
.tb-btn svg { width: 12px; height: 12px; color: var(--accent-a); }
.tb-btn:active { transform: translateY(1px); }

.desk {
  flex: 1 1 auto;
  padding: 6px 12px 10px;
}

/* ---------- pane ---------- */

.pane {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: var(--pad-y) var(--pad-x) calc(var(--pad-y) - 2px);
  background: var(--pane);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  container-type: inline-size;
  scroll-margin-top: 14px;
  transition: border-color .2s var(--ease), box-shadow .35s var(--ease);
  --d: calc(var(--i, 0) * 75ms + 140ms);
}

/* gradient ring shown when the pane has focus */
.pane::before {
  content: "";
  position: absolute;
  inset: -1px;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(120deg, var(--accent-a), var(--accent-b) 55%, var(--accent-c));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0;
  transition: opacity .25s var(--ease);
  pointer-events: none;
}
.pane[data-focused], .pane:focus-visible { box-shadow: 0 0 32px -10px var(--glow); }
.pane[data-focused]::before, .pane:focus-visible::before { opacity: 1; }

.pane-title, .pane-meta {
  position: absolute;
  top: 0;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0 .9ch;
  font-size: inherit;
  line-height: 1;
  white-space: nowrap;
  transform: translateY(-50%);
  /* cut the border line: page color above it, pane color below */
  background: linear-gradient(to bottom, var(--bg) 50%, var(--pane) 50%);
}
.pane-title {
  left: 1.1ch;
  gap: .25ch;
  color: var(--fg);
  font-weight: 600;
  letter-spacing: .01em;
  transition: color .2s var(--ease);
}
.pane-title .pn {
  position: relative;
  top: -.38em;
  margin-right: .15ch;
  font-size: .72em;
  font-weight: 700;
  color: var(--accent-a);
}
.pane-meta {
  right: 1.1ch;
  max-width: calc(100% - 22ch);
  color: var(--dim);
  font-size: .92em;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pane[data-focused] .pane-title, .pane:focus-visible .pane-title { color: var(--accent-a); }

.pane-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.cursor {
  display: inline-block;
  width: .62em;
  height: 1.12em;
  margin-left: .2ch;
  vertical-align: -.2em;
  background: var(--fg);
  animation: blink 1.1s steps(1) infinite;
}

/* ---------- 1 · whoami ---------- */

.who {
  display: grid;
  grid-template-columns: auto minmax(0, 66ch);
  justify-content: center;
  align-items: center;
  column-gap: 3.5ch;
  height: 100%;
}
.who-art {
  position: relative;
  align-self: stretch;
  display: grid;
  place-items: center;
  min-height: 0;
}
.portrait {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.who-text { min-width: 0; }
.who-cmd { color: var(--fg-2); margin-bottom: 10px; }
.ps1 { color: var(--green); }
.ps-path { color: var(--blue); }

.who-name { margin: 0 0 12px; line-height: 0; }
.fig { display: block; width: 100%; max-width: 560px; height: auto; overflow: visible; }
.fig-blocks { filter: drop-shadow(0 0 14px var(--glow)); }
.fig-shadow { stroke: var(--fig-shadow); }
.fig-plain {
  display: block;
  font-size: clamp(28px, 9cqi, 44px);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -.02em;
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b), var(--accent-c));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.who-role { color: var(--fg); font-size: 1.12em; font-weight: 500; margin-bottom: 6px; }
.who-role .sep { color: var(--muted); margin: 0 1ch; }
.who-role .loc { color: var(--fg-2); font-weight: 400; }
.who-bio { color: var(--dim); max-width: 62ch; text-wrap: pretty; }
.who-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 1.6ch;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-hi);
}
.who-status .run {
  grid-row: span 2;
  align-self: start;
  display: inline-flex;
  align-items: center;
  gap: .9ch;
  height: var(--row);
  color: var(--green);
  font-weight: 600;
}
.who-status .run svg { width: .7em; height: .7em; }
.who-status .what { min-height: var(--row); color: var(--fg); }
.who-status .at { grid-column: 2; display: flex; flex-wrap: wrap; column-gap: 1.6ch; color: var(--fg-2); }
.who-status .co, .who-status .since { white-space: nowrap; }
.who-status .since { color: var(--dim); }

.who-actions { display: flex; flex-wrap: wrap; gap: 8px 1.5ch; margin-top: 14px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: .8ch;
  min-height: 30px;
  padding: 0 1.2ch;
  border: 1px solid var(--border-hi);
  border-radius: 5px;
  background: transparent;
  color: var(--fg);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), transform .12s var(--ease);
}
.btn .k { color: var(--accent-a); font-weight: 700; }
.btn svg { width: .85em; height: .85em; flex: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--hdr-bg); border-color: var(--hdr-bg); color: var(--hdr-fg); font-weight: 700; }
.btn-primary .k { color: inherit; opacity: .7; }



/* ---------- 2 · proc ---------- */

.proc {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.proc th {
  padding: 1px 1ch;
  background: var(--hdr-bg);
  color: var(--hdr-fg);
  font-weight: 700;
  font-size: .9em;
  letter-spacing: .04em;
  text-align: left;
  white-space: nowrap;
}
.proc td {
  padding: 2px 1ch;
  white-space: nowrap;
  transition: background-color .14s var(--ease);
}
.proc .c-pid, .proc .c-time { text-align: right; }
.proc td.c-pid { color: var(--dim); }
.proc td.c-role { color: var(--fg-2); }
.proc td.c-start { color: var(--fg-2); }
.proc td.c-time { color: var(--fg); }
.proc .cmd { color: var(--c); font-weight: 600; }
.proc tbody tr { cursor: pointer; }
.proc tbody tr.is-peek td { background: var(--raise); }
.proc tbody tr[aria-selected="true"] td { background: var(--sel); }
/* square-edged block bar, like a terminal selection */
.proc tbody tr[aria-selected="true"] td:first-child { box-shadow: inset 3px 0 0 var(--c); }
.proc tbody tr:focus-visible td { background: var(--sel); }
.proc tbody tr:focus-visible td:first-child { box-shadow: inset 3px 0 0 var(--accent-a); }

.st { display: inline-flex; align-items: center; gap: .8ch; }
.st i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.st svg { width: .85em; height: .85em; flex: none; }
.st.run { color: var(--green); }
.st.run i { box-shadow: 0 0 8px currentColor; animation: pulse-dot 2.4s var(--ease) infinite; }
.st.done { color: var(--dim); }

.proc-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2ch;
  margin-top: 8px;
  color: var(--dim);
}
.proc-foot b { color: var(--fg-2); font-weight: 500; }
.proc-foot .run-n { color: var(--green); }

@container (max-width: 520px) { .proc .c-role { display: none; } }
@container (max-width: 400px) { .proc .c-start { display: none; } }

/* ---------- 3 · inspect ---------- */

.insp {
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--muted) transparent;
  padding-right: .5ch;
}
.insp.has-more {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent);
}
.ins-cmd { color: var(--dim); }
.ins-cmd .arg { color: var(--fg-2); }
.ins-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1ch 2ch;
  flex-wrap: wrap;
  margin: 12px 0 2px;
}
.ins-name {
  margin: 0;
  color: var(--c);
  font-size: 1.38em;
  font-weight: 700;
  letter-spacing: -.015em;
  line-height: 1.25;
}
.ins-sub { color: var(--fg-2); }

.kv {
  display: grid;
  grid-template-columns: 9ch minmax(0, 1fr);
  gap: 3px 1.5ch;
  margin: 14px 0 0;
}
.kv dt {
  color: var(--dim);
  font-size: .85em;
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: calc(var(--row) / .85);
}
.kv dd { margin: 0; color: var(--fg); min-width: 0; }
.kv dd .dim { margin-left: .5ch; }

.ins-sec {
  display: flex;
  align-items: center;
  gap: 1ch;
  margin: 18px 0 8px;
  color: var(--dim);
  font-size: .85em;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.ins-sec::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.hl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hl-list li { position: relative; padding-left: 2.2ch; color: var(--fg-2); text-wrap: pretty; }
.hl-list li::before { content: "›"; position: absolute; left: .4ch; color: var(--c); font-weight: 700; }

.tags { display: flex; flex-wrap: wrap; gap: 4px 1.5ch; margin-top: 2px; }
.tag { color: var(--c); white-space: nowrap; }
.tag::before { content: "["; color: var(--muted); margin-right: .25ch; }
.tag::after { content: "]"; color: var(--muted); margin-left: .25ch; }

.pager {
  display: flex;
  align-items: center;
  gap: 1ch;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-hi);
}
.pg-btn {
  display: inline-flex;
  align-items: center;
  gap: .8ch;
  min-height: 28px;
  padding: 0 1ch;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--fg-2);
  cursor: pointer;
  transition: color .18s var(--ease), border-color .18s var(--ease), background-color .18s var(--ease);
}
.pg-btn kbd { color: var(--accent-a); font-weight: 700; }
.pg-btn:active:not(:disabled) { transform: translateY(1px); }
.pg-btn:disabled { opacity: .4; cursor: default; }
.pager { justify-content: space-between; }
.pg-pos { color: var(--dim); }
@media (pointer: coarse) { .pg-btn { min-height: 44px; padding: 0 1.6ch; } }

/* google chapters: a character gantt */
.chap { display: grid; gap: 0 2px; margin-top: 4px; }
.chap-seg { min-width: 0; display: grid; grid-template-rows: auto auto auto; }
.chap-yr { color: var(--dim); font-size: .9em; display: flex; justify-content: space-between; }
.chap-bar {
  height: 10px;
  margin: 4px 0 6px;
  background: repeating-linear-gradient(90deg, var(--c) 0 calc(var(--cw) - 2px), transparent calc(var(--cw) - 2px) var(--cw));
  opacity: .92;
}
.chap-name { color: var(--c); font-size: .92em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.research { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.research li { display: grid; gap: 1px; }
.research .r-head { display: flex; justify-content: space-between; gap: 2ch; flex-wrap: wrap; }
.research .r-lab { color: var(--fg); font-weight: 600; }
.research .r-when { color: var(--dim); white-space: nowrap; }
.research .r-note { color: var(--fg-2); text-wrap: pretty; }

/* ---------- 4 · timeline ---------- */

.tl { --tl-cols: 10ch minmax(0, 1fr) 7ch; position: relative; display: grid; gap: 2px; }
.tl-grid {
  position: absolute;
  top: 0; bottom: 0;
  left: calc(10ch + 1ch);
  pointer-events: none;
}
.tl-yl {
  position: absolute;
  top: 0;
  bottom: calc(var(--row) + 2px);
  width: 0;
  border-left: 1px dashed var(--faint);
}
.tl-now {
  position: absolute;
  top: -4px;
  bottom: calc(var(--row) + 2px);
  width: 0;
  border-left: 1px solid var(--accent-a);
  box-shadow: 0 0 10px var(--glow);
}
.tl-row, .tl-axis {
  display: grid;
  grid-template-columns: var(--tl-cols);
  column-gap: 1ch;
  align-items: center;
  height: calc(var(--row) + 3px);
}
.tl-row {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background-color .14s var(--ease);
}
.tl-row.is-peek { background: var(--raise); }
.tl-row:focus-visible { background: var(--raise); outline: 1px dashed var(--accent-a); outline-offset: -1px; }
.tl-label { padding-left: .6ch; color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-row.is-sel .tl-label { color: var(--c); font-weight: 600; }
.tl-track { position: relative; height: 100%; }
.tl-track::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 3px;
  transform: translateY(-50%);
  background: radial-gradient(circle at center, var(--muted) 0 .8px, transparent 1.3px) 0 50% / var(--cw) 3px repeat-x;
  opacity: .9;
}
.tl-bar {
  position: absolute;
  top: 50%;
  left: calc(var(--s) * var(--cw));
  width: calc(var(--n) * var(--cw));
  height: 62%;
  display: flex;
  transform: translateY(-50%);
  transform-origin: left center;
}
.tl-seg {
  flex: none;
  height: 100%;
  width: calc(var(--n) * var(--cw));
  background: repeating-linear-gradient(90deg, var(--c) 0 calc(var(--cw) - 2px), transparent calc(var(--cw) - 2px) var(--cw));
  transition: filter .2s var(--ease), opacity .2s var(--ease);
}
.tl-row.is-sel .tl-seg { filter: drop-shadow(0 0 5px color-mix(in srgb, var(--c) 60%, transparent)); }
.tl-row.edu .tl-seg {
  background: repeating-linear-gradient(90deg, var(--c) 0 calc(var(--cw) - 4px), transparent calc(var(--cw) - 4px) var(--cw));
  opacity: .85;
}
.tl-dur { padding-right: .6ch; text-align: right; color: var(--dim); white-space: nowrap; }
.tl-axis { color: var(--dim); font-size: .88em; }
.tl-axis .tl-track::before { display: none; }
.tl-tick { position: absolute; top: 50%; transform: translate(-50%, -50%); white-space: nowrap; }
.tl-tick.now { color: var(--accent-a); font-weight: 600; }

/* ---------- 5 · modules ---------- */

.mods {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(21ch, 1fr));
  gap: 3px 2ch;
}
.mods li { display: inline-flex; align-items: center; gap: 1ch; white-space: nowrap; color: var(--fg); }
.mods .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px color-mix(in srgb, var(--green) 70%, transparent); flex: none; }

/* ---------- 6 · locale ---------- */

.greet {
  display: flex;
  align-items: center;
  gap: 1ch;
  min-height: 1.5em;
  margin-bottom: 8px;
  font-size: 1.32em;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
}
.greet-ps { color: var(--accent-a); }
.greet .cursor { height: 1em; vertical-align: -.12em; background: var(--accent-a); }
.locales { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.locales li {
  display: grid;
  grid-template-columns: 6ch minmax(0, 1fr) auto;
  column-gap: 1.5ch;
  color: var(--fg-2);
  transition: color .2s var(--ease);
}
.locales .loc { color: var(--dim); transition: color .2s var(--ease); }
.locales .lvl { color: var(--dim); }
.locales li.on { color: var(--fg); }
.locales li.on .loc { color: var(--accent-a); }
@container (max-width: 214px) { .locales li { grid-template-columns: 6ch minmax(0, 1fr); } .locales .lvl { display: none; } }

/* ---------- 7 · net ---------- */

.net { display: grid; gap: 12px; }
.net-k {
  margin-bottom: 4px;
  color: var(--dim);
  font-size: .85em;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.iface { display: grid; grid-template-columns: auto auto; justify-content: start; gap: 2px 1.5ch; align-items: baseline; }
.if-name { color: var(--fg-2); }
.if-state { color: var(--green); font-weight: 700; font-size: .85em; letter-spacing: .06em; }
.if-link {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  gap: .8ch;
  justify-self: start;
  max-width: 100%;
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px dashed var(--border-hi);
  transition: color .18s var(--ease), border-color .18s var(--ease);
}
.if-link svg { width: .8em; height: .8em; flex: none; color: var(--accent-a); }
.if-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.net-edu { padding-top: 10px; border-top: 1px dashed var(--border-hi); }
.net-edu .school { color: var(--fg); }
.net-edu .deg { color: var(--fg-2); text-wrap: pretty; }
.net-edu .yr { color: var(--dim); }
@container (min-width: 400px) {
  .net { grid-template-columns: auto minmax(0, 1fr); column-gap: 3ch; }
  .net-edu { padding: 0 0 0 3ch; border-top: 0; border-left: 1px dashed var(--border-hi); }
}
.link-btn {
  display: inline-flex; align-items: center; gap: .8ch;
  margin-top: 4px; padding: 0;
  background: none; border: 0;
  color: var(--accent-a);
  cursor: pointer;
}
.link-btn svg { width: .8em; height: .8em; transition: transform .2s var(--ease); }

/* ---------- bottom bars ---------- */

.bottombar {
  flex: none;
  display: flex;
  align-items: stretch;
  min-height: calc(var(--row) + 8px);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--tmux-bg);
  border-top: 1px solid var(--border);
  white-space: nowrap;
}
.tmux { display: flex; align-items: stretch; min-width: 0; }
.hints {
  display: flex;
  align-items: center;
  gap: 0 2.6ch;
  margin-left: auto;
  padding: 0 2ch;
  color: var(--dim);
  overflow: hidden;
}
.hint { display: inline-flex; align-items: baseline; gap: .9ch; }
.hint kbd { color: var(--accent-a); font-weight: 700; }
.hint kbd + kbd::before { content: "/"; color: var(--muted); font-weight: 400; margin-right: .3ch; }
.hint kbd + kbd { margin-left: -.6ch; }
.hint-btn { padding: 0; background: none; border: 0; color: inherit; cursor: pointer; transition: color .18s var(--ease); }

.notify {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 42px);
  right: 16px;
  z-index: 40;
  padding: 7px 1.4ch;
  border: 1px solid var(--border-hi);
  border-radius: 6px;
  background: var(--pane);
  color: var(--fg-2);
  box-shadow: 0 14px 34px -14px rgba(0, 0, 0, .7);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.notify.show { opacity: 1; transform: none; }
.notify b { color: var(--accent-a); font-weight: 600; }

.tmux-sess {
  display: inline-flex; align-items: center;
  padding: 0 1.2ch;
  background: var(--sess-bg);
  color: var(--hdr-fg);
  font-weight: 700;
}
.tmux-wins {
  display: flex;
  align-items: stretch;
  margin: 0;
  padding: 0 .5ch;
  list-style: none;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tmux-wins::-webkit-scrollbar { display: none; }
.tmux-wins button {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 1ch;
  background: transparent;
  border: 0;
  color: var(--dim);
  cursor: pointer;
  transition: color .15s var(--ease), background-color .15s var(--ease);
}
.tmux-wins .flag { display: inline-block; width: 1ch; color: var(--accent-a); }
.tmux-wins [aria-current="true"] { color: var(--fg); background: var(--sel); }
.tmux-wins [aria-current="true"] .n { color: var(--accent-a); }
.tmux-right { display: flex; align-items: center; gap: 1ch; padding: 0 14px 0 2ch; color: var(--dim); border-left: 1px solid var(--border); }
.tmux-right .t { color: var(--fg-2); }

/* ---------- help dialog ---------- */

.dlg {
  width: min(540px, calc(100vw - 24px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  overflow: visible;
}
.dlg::backdrop { background: rgba(4, 6, 10, .6); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.dlg[open] { animation: dlg-in .26s var(--ease-out); }
.dlg-pane { padding-top: 18px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7), 0 0 40px -12px var(--glow); }
.keys { display: grid; gap: 4px; margin: 0; }
.keys div { display: grid; grid-template-columns: 16ch 1fr; gap: 1ch; }
.keys dt { color: var(--accent-a); font-weight: 700; }
.keys dt kbd { display: inline-block; min-width: 2.2ch; padding: 0 .5ch; border: 1px solid var(--border-hi); border-radius: 4px; text-align: center; line-height: 1.35; }
.keys dd { margin: 0; color: var(--fg-2); }
.dlg-note { margin-top: 14px; color: var(--dim); }
.dlg-foot { display: flex; justify-content: flex-end; margin-top: 14px; }
.dlg-close { display: inline-flex; gap: 1ch; padding: 4px 1.2ch; background: transparent; border: 1px solid var(--border-hi); border-radius: 5px; color: var(--fg-2); cursor: pointer; }
.dlg-close kbd { color: var(--accent-a); font-weight: 700; }

/* ---------- layouts ---------- */

/* desktop: one viewport, two columns of stacked panes (narrow laptops need a little more height) */
@media (min-width: 1100px) and (min-height: 820px), (min-width: 1240px) and (min-height: 640px) {
  html, body { height: 100%; overflow: hidden; }
  .app { height: 100dvh; }
  .desk {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: var(--gap);
    min-height: 0;
  }
  .col { display: flex; flex-direction: column; gap: calc(var(--gap) + 2px); min-height: 0; }
  .pane-who { flex: 1 1 0; }
  .pane-time, .pane-proc, .pane-net { flex: none; }
  .pane-insp { flex: 1 1 0; }
  .row { flex: none; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--gap); }
}
@media (min-width: 1100px) and (max-height: 819.98px) {
  .who-cmd { display: none; }
  .who-name { margin-bottom: 10px; }
  .who-status { margin-top: 10px; padding-top: 9px; }
  .who-actions { margin-top: 12px; }
}
@media (min-width: 1100px) and (max-width: 1359.98px), (min-width: 1100px) and (max-height: 819.98px) {
  :root { --fs: 12px; --pad-y: 12px; }
}

/* tablet: two columns, the page scrolls, tmux bar sticks */
@media (min-width: 700px) and (max-width: 1099.98px),
       (min-width: 1100px) and (max-width: 1239.98px) and (max-height: 819.98px),
       (min-width: 1240px) and (max-height: 639.98px) {
  .desk {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "who  who"
      "proc proc"
      "time time"
      "insp mods"
      "insp loc"
      "insp net";
    gap: 14px var(--gap);
    padding-top: 8px;
  }
  .col, .row { display: contents; }
  .pane-who { grid-area: who; }
  .pane-proc { grid-area: proc; }
  .pane-time { grid-area: time; }
  .pane-insp { grid-area: insp; }
  .pane-mods { grid-area: mods; }
  .pane-loc { grid-area: loc; }
  .pane-net { grid-area: net; }
  .insp { overflow: visible; }
  .hints, .tmux-right { display: none; }
  .bottombar {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--tmux-bg) 88%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}

/* phone: one column; the tmux bar becomes the tab bar */
@media (max-width: 699.98px) {
  :root { --fs: 12.5px; --pad-x: 1.4ch; }
  .topbar { padding-left: 12px; padding-right: 12px; gap: 1ch; }
  .tb-c { display: none; }
  .topbar { grid-template-columns: minmax(0, 1fr) auto; }
  .tz { display: none; }
  .desk { display: flex; flex-direction: column; gap: 16px; padding: 8px 10px 16px; }
  .col, .row { display: contents; }
  .pane-who { order: 1; }
  .pane-proc { order: 2; }
  .pane-insp { order: 3; }
  .pane-time { order: 4; }
  .pane-mods { order: 5; }
  .pane-loc { order: 6; }
  .pane-net { order: 7; }
  .insp { overflow: visible; }
  .hints { display: none; }
  .bottombar {
    position: sticky;
    bottom: 0;
    z-index: 10;
    min-height: 48px;
    background: color-mix(in srgb, var(--tmux-bg) 90%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .tmux { flex: 1 1 auto; }
  .tmux-sess { padding: 0 1ch; }
  .tmux-wins { padding: 0; scroll-snap-type: x proximity; }
  .tmux-wins li { scroll-snap-align: start; }
  .tmux-wins button { min-height: 48px; padding: 0 1.2ch; }
  .tmux-right { display: none; }
  .who-cmd { margin-bottom: 8px; }
  .who { grid-template-columns: minmax(0, 1fr); row-gap: 18px; align-items: start; }
  .who-art { align-self: auto; }
  .who-text { max-width: none; }
  .tl { --tl-cols: 10ch minmax(0, 1fr) 6.5ch; }
}

/* hover feedback only where a real pointer hovers; on touch, :hover sticks after a tap */
@media (hover: hover) {
  .pane:not([data-focused]):hover { border-color: var(--border-hi); }
  .proc tbody tr:hover td { background: var(--raise); }
  .tl-row:hover { background: var(--raise); }
  .tb-btn:hover { color: var(--fg); border-color: var(--border-hi); background: var(--raise); }
  .btn:hover { background: var(--raise); border-color: var(--accent-b); }
  .btn-primary:hover { background: color-mix(in srgb, var(--hdr-bg) 86%, white); border-color: transparent; }
  .pg-btn:hover:not(:disabled) { color: var(--fg); border-color: var(--border-hi); background: var(--raise); }
  .if-link:hover { color: var(--accent-a); border-bottom-color: currentColor; }
  .link-btn:hover svg { transform: translateX(3px); }
  .link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
  .hint-btn:hover { color: var(--fg); }
  .tmux-wins button:hover { color: var(--fg); }
  .dlg-close:hover { background: var(--raise); color: var(--fg); }
}

/* no keyboard hints on touch-first devices */
@media (hover: none), (pointer: coarse) {
  .hints, .btn-help { display: none; }
}

/* touch: same look, thumb-sized targets */
@media (pointer: coarse) {
  .btn { min-height: 44px; padding: 0 1.6ch; }
  .tb-btn { position: relative; }
  .tb-btn::after { content: ""; position: absolute; inset: -9px -6px; }
  .if-link, .link-btn { position: relative; }
  .if-link::after, .link-btn::after { content: ""; position: absolute; inset: -12px -8px; }
  .proc td { padding-top: 9px; padding-bottom: 9px; }
  .tl-row { height: 34px; }
}

/* ---------- boot sequence ---------- */

.preboot .app { opacity: 0; }

.booting .topbar, .booting .bottombar { animation: fade-in .45s var(--ease) both; }
.booting .bottombar { animation-delay: .5s; }

.booting .desk .pane { animation: border-in .3s var(--ease) both; animation-delay: calc(var(--d) + 380ms); }
.booting .desk .pane::before { opacity: 0; }
.booting .desk .pane[data-focused] { box-shadow: none; }
.booting .desk .pane::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid var(--accent-a);
  border-radius: inherit;
  pointer-events: none;
  animation:
    trace .5s var(--ease-out) both,
    fade-out .5s var(--ease) both;
  animation-delay: var(--d), calc(var(--d) + 420ms);
}
.booting .desk .pane > .pane-title,
.booting .desk .pane > .pane-meta { animation: fade-in .3s var(--ease) both; animation-delay: calc(var(--d) + 120ms); }
.booting .desk .pane > .pane-body,
.booting .desk .pane > .pager { animation: rise .42s var(--ease) both; animation-delay: calc(var(--d) + 200ms); }
.booting .fig { animation: wipe .75s var(--ease-out) both; animation-delay: .5s; }
.booting .fig-shadow { animation: fade-in .5s var(--ease) both; animation-delay: 1s; }
.booting .tl-bar { animation: grow .6s var(--ease-out) both; animation-delay: calc(.75s + var(--j, 0) * 70ms); }

@keyframes trace {
  from { clip-path: inset(0 100% 100% 0 round var(--radius)); }
  to { clip-path: inset(0 0 0 0 round var(--radius)); }
}
@keyframes border-in { from { border-color: transparent; background-color: transparent; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } }
@keyframes wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes grow { from { transform: translateY(-50%) scaleX(0); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 55%, transparent); }
  70%, 100% { box-shadow: 0 0 0 6px transparent; }
}
@keyframes pulse-dot { 50% { opacity: .55; } }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
  }
  .cursor { animation: none; }
}
