/* Campus friends. One design for every profile: a band in the signed-in person's color,
   grays for chrome, and each course in its own color (purple, cyan, orange, pink, green, lime;
   ink for work and other non-class time). */
:root {
  --band: #111111; --band-ink: #ffffff;
  --band-muted: color-mix(in srgb, var(--band-ink) 80%, var(--band));
  --band-line: color-mix(in srgb, var(--band-ink) 38%, var(--band));
  --bg: #f4f4f4;
  --surface: #ffffff;
  --ink: #111111;
  --muted: #666666;
  --line: #dadada;
  --line-soft: #ebebeb;
  --live: #d92d20;

  /* Course colors: bar, tinted fill, readable text */
  --p-purple: #6209f1; --p-purple-fill: #efe5fd; --p-purple-text: #5a08dc;
  --p-cyan:   #00a6e0; --p-cyan-fill:   #e5f6fd; --p-cyan-text:   #0a6f9a;
  --p-orange: #ff7f0a; --p-orange-fill: #fff3e7; --p-orange-text: #a8500a;
  --p-pink:   #e50276; --p-pink-fill:   #fce4f1; --p-pink-text:   #b8025c;
  --p-green:  #109e6e; --p-green-fill:  #e3f5ee; --p-green-text:  #0b6b4b;
  --p-lime:   #b1ca4a; --p-lime-fill:   #f7f9ec; --p-lime-text:   #5c6b12;
  --p-ink:    #15152d; --p-ink-fill:    #e7e7e9; --p-ink-text:    #15152d;

  --font-display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  --font-body: "Figtree", "Heebo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-he: "Heebo", "Figtree", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --hour: 88px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111111; --surface: #1a1a1a; --ink: #f0f0f0; --muted: #a0a0a0; --line: #333333; --line-soft: #242424;
    --live: #ff6b5e;
    --p-purple: #8b4dff; --p-purple-fill: #231742; --p-purple-text: #c9adff;
    --p-cyan:   #1cb6ec; --p-cyan-fill:   #0f2b37; --p-cyan-text:   #86d8f6;
    --p-orange: #ff8f2a; --p-orange-fill: #36230f; --p-orange-text: #ffbb7c;
    --p-pink:   #f0388f; --p-pink-fill:   #3b1428; --p-pink-text:   #ffa3cd;
    --p-green:  #2cc58d; --p-green-fill:  #0f2a21; --p-green-text:  #8fe3c3;
    --p-lime:   #bcd65a; --p-lime-fill:   #252b10; --p-lime-text:   #d6ea8c;
    --p-ink:    #d8d8e8; --p-ink-fill:    #26262e; --p-ink-text:    #e2e2ee;
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) .topband { box-shadow: inset 0 -1px 0 var(--line); }
}
:root[data-theme="dark"] {
  --bg: #111111; --surface: #1a1a1a; --ink: #f0f0f0; --muted: #a0a0a0; --line: #333333; --line-soft: #242424;
  --live: #ff6b5e;
  --p-purple: #8b4dff; --p-purple-fill: #231742; --p-purple-text: #c9adff;
  --p-cyan:   #1cb6ec; --p-cyan-fill:   #0f2b37; --p-cyan-text:   #86d8f6;
  --p-orange: #ff8f2a; --p-orange-fill: #36230f; --p-orange-text: #ffbb7c;
  --p-pink:   #f0388f; --p-pink-fill:   #3b1428; --p-pink-text:   #ffa3cd;
  --p-green:  #2cc58d; --p-green-fill:  #0f2a21; --p-green-text:  #8fe3c3;
  --p-lime:   #bcd65a; --p-lime-fill:   #252b10; --p-lime-text:   #d6ea8c;
  --p-ink:    #d8d8e8; --p-ink-fill:    #26262e; --p-ink-text:    #e2e2ee;
  color-scheme: dark;
}
:root[data-theme="dark"] .topband { box-shadow: inset 0 -1px 0 var(--line); }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
.page {
  max-width: 1060px; margin: 0 auto;
  padding-block: 32px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 36px;
}
[lang="he"] { font-family: var(--font-he); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
h2 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: -0.01em; text-wrap: balance; }
.section { display: flex; flex-direction: column; gap: 14px; }
.shead { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.shead p { margin: 0; color: var(--muted); font-size: 13px; }
.view { display: flex; flex-direction: column; gap: 36px; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--live); }

/* ---------- Band ---------- */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--band); }
.topband { background: var(--band); color: var(--band-ink); }
.topband-inner {
  max-width: 1060px; margin: 0 auto;
  padding-top: calc(28px + env(safe-area-inset-top, 0px)); padding-bottom: 0;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 10px;
}
.band-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.signout { font: inherit; font-size: 13px; font-weight: 600; color: var(--band-ink); background: transparent; border: 1px solid var(--band-line); border-radius: 999px; padding: 4px 12px; cursor: pointer; flex: none; }
.band-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.net { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--band-ink); background: color-mix(in srgb, var(--band-ink) 16%, transparent); border-radius: 999px; padding: 4px 10px; }
.net::before { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid currentColor; }
.signout:hover { background: color-mix(in srgb, var(--band-ink) 12%, transparent); }
.signout:focus-visible, .tabs a:focus-visible { outline: 2px solid var(--band-ink); outline-offset: 2px; }
h1 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(32px, 5.6vw, 52px); line-height: 1.02; letter-spacing: -0.02em; text-wrap: balance; }
.subtitle { margin: -2px 0 30px; font-family: var(--font-display); font-weight: 500; font-size: clamp(16px, 2.2vw, 19px); color: var(--band-muted); }
.topband-inner > :last-child { margin-bottom: 30px; }
.topband-inner > .tabs:last-child { margin-bottom: 0; }

.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who .av { width: 40px; height: 40px; font-size: 17px; background: var(--band-ink); color: var(--band); }
.who div b { display: block; font-weight: 700; font-size: 16px; line-height: 1.2; }
.who div span { display: block; font-size: 13px; color: var(--band-muted); }

.tabs { display: flex; gap: 4px; margin-top: 14px; }
.tabs a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px 12px; border-radius: 12px 12px 0 0;
  color: var(--band-muted); text-decoration: none; font-weight: 600; font-size: 15px;
}
.tabs a:hover { color: var(--band-ink); }
.tabs a.tab-end { margin-left: auto; }
.tabs a[aria-current="page"] { background: var(--bg); color: var(--ink); }
.tabs .live-dot { background: currentColor; }
.tabs a[aria-current="page"] .live-dot { background: var(--live); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tabs a[aria-current="page"] { box-shadow: inset 0 1px 0 var(--line), inset 1px 0 0 var(--line), inset -1px 0 0 var(--line); }
}
:root[data-theme="dark"] .tabs a[aria-current="page"] { box-shadow: inset 0 1px 0 var(--line), inset 1px 0 0 var(--line), inset -1px 0 0 var(--line); }

/* ---------- Avatars ---------- */
.av {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: var(--pc, #111); color: #fff;
  display: inline-grid; place-items: center; overflow: hidden;
  font-family: var(--font-display); font-weight: 700; font-size: 15px; line-height: 1;
}
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av.sm { width: 22px; height: 22px; font-size: 11px; }

/* ---------- Login ---------- */
.login { display: flex; justify-content: center; }
.login-card {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 24px; display: flex; flex-direction: column; gap: 16px;
}
.login-lede { margin: -6px 0 0; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.pw-wrap { display: flex; gap: 8px; }
.field input {
  flex: 1; min-width: 0; font: inherit; font-family: var(--font-mono); font-size: 17px; font-weight: 400; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px;
}
.field input:focus { outline: 2px solid var(--band); outline-offset: 1px; border-color: transparent; }
.pw-show { font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; cursor: pointer; }
.go { font: inherit; font-weight: 700; font-size: 16px; color: var(--band-ink); background: var(--band); border: 0; border-radius: 10px; padding: 12px 16px; cursor: pointer; }
.go:disabled { opacity: .6; cursor: progress; }
.go:focus-visible, .pw-show:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.err { margin: 0; color: var(--live); font-weight: 600; min-height: 1.5em; }
.err:empty { min-height: 0; margin-top: -16px; }

.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; user-select: none; }
.switch input { appearance: none; -webkit-appearance: none; flex: none; width: 36px; height: 20px; margin: 0; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background-color .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked { background: var(--band); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.preview { margin: 0; align-self: flex-start; font-size: 13px; font-weight: 600; color: var(--live); border: 1px solid var(--live); border-radius: 999px; padding: 3px 12px; }

/* ---------- Subject marks ---------- */
.ic { width: 14px; height: 14px; flex: none; vertical-align: -2px; margin-right: 5px; }
.subj { color: var(--c-text); white-space: nowrap; }
.sw { width: 12px; height: 12px; border-radius: 3px; flex: none; background: var(--c); }
.sw.lec { background: var(--line-soft); border: 1px solid var(--muted); border-top: 3px solid var(--ink); }
.sw.prac { background: repeating-linear-gradient(135deg, var(--line) 0 1.5px, var(--surface) 1.5px 4px); border: 1px dashed var(--muted); border-top: 3px solid var(--ink); }

/* ---------- Now: header ---------- */
.today-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 24px; }
.t-day { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(26px, 4vw, 34px); line-height: 1.1; letter-spacing: -0.015em; }
.t-meta { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.t-clock { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(44px, 9vw, 72px); line-height: .9; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.today-head.compact .t-clock { font-size: clamp(22px, 4.5vw, 36px); }

/* ---------- Now: your cards ---------- */
#me-now { display: flex; flex-direction: column; gap: 12px; }
.now-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.ncard {
  min-width: 0; border-radius: 14px; padding: 14px 16px 16px;
  background: var(--c-fill); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); border-top: 5px solid var(--c);
  display: flex; flex-direction: column; gap: 3px;
}
.nwhen { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-bottom: 4px; font-size: 13px; }
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--c-text); }
.st.live { color: var(--live); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.cd { color: var(--muted); }
.ncard h3 { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 700; line-height: 1.15; color: var(--c-text); text-wrap: balance; }
.nk { margin: 0; font-size: 14px; font-weight: 600; color: var(--c-text); }
.nroom { margin: 6px 0 0; font-size: 18px; font-weight: 500; color: var(--ink); }
.nwho { margin: 0; font-family: var(--font-he); font-size: 13px; color: var(--muted); }
.ntags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ntag { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--c) 50%, transparent); color: var(--c-text); }
.prog { display: block; height: 4px; margin-top: 10px; border-radius: 2px; overflow: hidden; background: color-mix(in srgb, var(--c) 22%, transparent); }
.prog i { display: block; height: 100%; border-radius: 2px; background: var(--c); }
.empty { list-style: none; background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.empty b { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.empty span { color: var(--muted); }

/* ---------- Now: who is in which building ---------- */
.shift { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px 10px; }
.shift-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.shift-top label { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.shift-val { font-weight: 600; font-size: 15px; }
.shift-val .mono { font-size: 14px; }
.shift-reset { margin-left: auto; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; cursor: pointer; }
.shift-reset:hover { border-color: var(--muted); }
.shift input[type="range"] { width: 100%; margin: 6px 0 0; accent-color: var(--ink); cursor: pointer; }
.shift input[type="range"]:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 4px; }
.shift-ticks { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.board.shifted .track::before { background: var(--ink); }
.board.shifted .axis-track span.now { color: var(--ink); }
.campus { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.campus .lbl { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.bchip { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 13px; }
.bchip b { font-family: var(--font-mono); font-weight: 500; }
.bchip .avs { display: inline-flex; }
.bchip .avs .av { box-shadow: 0 0 0 2px var(--surface); }
.bchip .avs .av + .av { margin-left: -6px; }
button.bchip { font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; }
button.bchip:hover { border-color: var(--muted); }
button.bchip:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.campus .none { color: var(--muted); font-size: 14px; }

/* ---------- Everyone: the 3D campus map ----------
   The map page's own look (its colors, Barlow Condensed numbers, square buttons), kept inside .m3d. */
.m3d {
  --paper: #F4F5F1; --ink: #1C2228; --muted: #59626A; --rule: #CDD3CA; --ground: #DCE0D8; --route: #2140E3;
  --gate-chip: rgba(196, 98, 18, 0.86); --gate-ink: #FFFFFF; --chip: rgba(28, 34, 40, 0.86); --chip-ink: #FFFFFF;
  --btn: #F5F5F5; --btn-ink: #1F1F1F; --btn-line: #D4D4D4; --btn-hover: #8A8A8A; --btn-on: #3D3D3D; --btn-on-ink: #FFFFFF;   /* buttons: neutral grays */
  --f-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --f-body: "IBM Plex Sans Hebrew", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  position: relative; height: min(78vh, 720px); min-height: 360px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 16px; background: var(--ground);
  font-family: var(--f-body); font-size: 14px; line-height: 1.45; color: var(--ink);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .m3d {
    --paper: #13181D; --ink: #E4E8EB; --muted: #98A2AB; --rule: #2B343C; --ground: #0E1216; --route: #8A9BFF;
    --chip: rgba(10, 13, 16, 0.86); --chip-ink: #F1F3F5; --gate-chip: rgba(227, 149, 82, 0.9); --gate-ink: #1B1209;
    --btn: #262626; --btn-ink: #E5E5E5; --btn-line: #404040; --btn-hover: #8A8A8A; --btn-on: #D4D4D4; --btn-on-ink: #171717;
  }
}
:root[data-theme="dark"] .m3d {
  --paper: #13181D; --ink: #E4E8EB; --muted: #98A2AB; --rule: #2B343C; --ground: #0E1216; --route: #8A9BFF;
  --chip: rgba(10, 13, 16, 0.86); --chip-ink: #F1F3F5; --gate-chip: rgba(227, 149, 82, 0.9); --gate-ink: #1B1209;
  --btn: #262626; --btn-ink: #E5E5E5; --btn-line: #404040; --btn-hover: #8A8A8A; --btn-on: #D4D4D4; --btn-on-ink: #171717;
}
.m3d .stage { position: absolute; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
.m3d .stage canvas { display: block; width: 100%; height: 100%; outline: none; }
.m3d .stage.pointing canvas { cursor: pointer; }
.m3d .poster { position: absolute; inset: 0; width: 100%; height: 100%; max-width: 100%; object-fit: contain; transition: opacity 400ms; pointer-events: none; }
.m3d.ready .poster { opacity: 0; }
.m3d .status {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: min(360px, 80%);
  padding: 10px 14px; border-radius: 4px; background: var(--paper); color: var(--ink); border: 1px solid var(--rule); font-size: 13px; text-align: center;
}
/* building numbers float over the model */
.m3d .labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.m3d .lbl {
  position: absolute; left: 0; top: 0; pointer-events: none;
  font: 700 14px/1 var(--f-display); letter-spacing: 0.02em; color: var(--chip-ink); background: var(--chip);
  border: 0; border-radius: 3px; padding: 3px 5px 2px; white-space: nowrap; will-change: transform;
}
.m3d .lbl.part { font-weight: 600; font-size: 13px; }
.m3d .lbl.ncamp { background: transparent; color: #FFFFFF; text-shadow: 0 0 3px #000, 0 0 6px rgba(0, 0, 0, 0.7); }
.m3d .lbl.gate { background: var(--gate-chip); color: var(--gate-ink); padding: 3px 4px; line-height: 0; cursor: default; }
.m3d .lbl.gate svg { display: block; width: 15px; height: 15px; }
.m3d .lbl.off, .m3d .m-pin.off { visibility: hidden; }
/* friends in class: a pin of avatars beside the building's number */
.m3d .pins { position: absolute; inset: 0; }
.m3d .m-pin {
  position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform;
  display: inline-flex; padding: 3px; background: var(--surface); border-radius: 999px;
  box-shadow: 0 0 0 1px var(--line), 0 2px 6px rgba(0, 0, 0, .22);
}
.m3d .m-pin::after { content: ""; position: absolute; left: -4px; top: 50%; width: 8px; height: 8px; background: var(--surface); transform: translateY(-50%) rotate(45deg); box-shadow: -1px 1px 0 var(--line); }
.m3d .m-pin.flip::after { left: auto; right: -4px; box-shadow: 1px -1px 0 var(--line); }
.m3d .m-pin .av { position: relative; z-index: 1; width: 26px; height: 26px; font-size: 12px; box-shadow: 0 0 0 2px var(--surface); }
.m3d .m-pin .av + .av { margin-left: -6px; }
.m3d .m-pin .av.me { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--ink); }
/* map chrome */
.m3d .tools { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; }
.m3d .tools button, .m3d .north { font: 600 13px/1 var(--f-body); color: var(--btn-ink); background: var(--btn); border: 1px solid var(--btn-line); border-radius: 4px; cursor: pointer; }
.m3d .tools button { width: 34px; height: 34px; font-size: 18px; display: grid; place-items: center; padding: 0; }
.m3d .tools button.txt { width: auto; min-width: 34px; padding: 0 8px; font-size: 12px; height: 28px; }
.m3d .tools button[aria-pressed="true"] { background: var(--btn-on); color: var(--btn-on-ink); border-color: var(--btn-on); }
.m3d .tools button:hover, .m3d .north:hover { border-color: var(--btn-hover); }
.m3d button:focus-visible { outline: 2px solid var(--btn-hover); outline-offset: 2px; }
.m3d .north { position: absolute; top: 10px; left: 10px; width: 34px; height: 40px; display: grid; justify-items: center; align-content: center; gap: 1px; font: 700 13px/1 var(--f-display); padding: 0; }
.m3d .north svg { width: 12px; height: 16px; transition: transform 80ms linear; }
.m3d .north path { fill: var(--btn-ink); }
.m3d .help { position: absolute; left: 10px; bottom: 10px; font-size: 11px; color: var(--btn-ink); background: var(--btn); border: 1px solid var(--btn-line); border-radius: 3px; padding: 3px 7px; pointer-events: none; }
.m3d .tip {
  position: absolute; pointer-events: none; padding: 5px 8px; border-radius: 3px;
  background: var(--ink); color: var(--paper); font-size: 12px; white-space: nowrap; transform: translate(-50%, calc(-100% - 14px));
}
.m3d .tip b { font-family: var(--f-display); font-size: 14px; letter-spacing: 0.02em; margin-right: 4px; }
.m3d .tip.below { transform: translate(-50%, 18px); }
.m3d .tip .tip-who { margin: 6px 0 1px; padding: 7px 0 0; display: grid; gap: 8px; border-top: 1px solid color-mix(in srgb, var(--paper) 22%, transparent); }
/* one block per room: the room, then its people; a line between blocks */
.m3d .tip .tip-group { display: grid; gap: 6px; }
.m3d .tip .tip-group + .tip-group { border-top: 1px solid color-mix(in srgb, var(--paper) 22%, transparent); padding-top: 8px; }
.m3d .tip .tip-room { font-family: var(--f-mono); font-size: 11.5px; opacity: .7; }
.m3d .tip .tip-who ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.m3d .tip .tip-who li { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.m3d .tip .tip-who .av { box-shadow: 0 0 0 1.5px var(--paper); }
.m3d .tip .tg-short { font-weight: 500; opacity: .5; }
@media (max-width: 860px) {
  .m3d { height: 62vh; min-height: 360px; }
  .m3d .help { display: none; }
  .m3d .tools { top: auto; bottom: 10px; flex-direction: row; flex-wrap: wrap; justify-content: flex-end; left: 54px; }
  .m3d .tools button.txt { height: 34px; }
}
@media (max-width: 680px) {
  .m3d {
    margin-left: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); margin-right: calc(-1 * max(16px, env(safe-area-inset-right, 0px)));
    border-radius: 0; border-left: 0; border-right: 0;
  }
}
@media (max-width: 860px) {
  .m3d .m-pin { padding: 2px; }
  .m3d .m-pin .av { width: 22px; height: 22px; font-size: 10.5px; }
  .m3d .m-pin .av + .av { margin-left: -5px; }
}
@media (prefers-reduced-motion: reduce) { .m3d .poster, .m3d .north svg { transition: none; } }

/* ---------- Now: everyone, next 3 hours ---------- */
.board { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; overflow: clip; }
.brow { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 8px 20px; padding: 14px 16px; border-top: 1px solid var(--line-soft); align-items: center; }
.brow.axis { border-top: 0; padding-block: 12px 2px; }
.brow.me { background: color-mix(in srgb, var(--band) 6%, var(--surface)); }
.bwho { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 0 12px; align-items: start; min-width: 0; color: inherit; text-decoration: none; }
.bwho a { color: inherit; text-decoration: none; }
.bwho .bav { display: block; }
.bname a:hover b { text-decoration: underline; text-underline-offset: 3px; }
.bwho a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
.tg { font-size: 12.5px; font-weight: 500; color: var(--muted); text-decoration: none; overflow-wrap: anywhere; }
.bwho .tg { display: inline-block; color: var(--muted); line-height: 1.35; }
.tg:hover, .bwho .tg:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
#week-tg { margin-top: -4px; }
#week-tg .tg { font-size: 14px; }
.bname { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; line-height: 1.3; }
.bname b { font-weight: 700; font-size: 15.5px; }
.bname small { font-size: 12px; color: var(--muted); }
.bstat { margin: 2px 0 0; font-size: 14px; font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.bstat .st { font-size: 11px; }
.bsub { margin: 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.bsub .mono { font-size: 12.5px; }
.walk { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; white-space: nowrap; }
.walk svg { flex: none; }

.track { position: relative; height: var(--h, 34px); border-radius: 8px; background: color-mix(in srgb, var(--line-soft) 55%, transparent); }
.track::before { content: ""; position: absolute; left: 0; top: -6px; bottom: -6px; width: 2px; border-radius: 1px; background: var(--live); z-index: 3; }
.track .tick { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); z-index: 0; }
.track .idle { position: absolute; inset: 0; display: flex; align-items: center; padding-left: 12px; font-size: 12px; color: var(--muted); }
.seg {
  position: absolute; z-index: 1; height: 26px; top: calc(4px + var(--lane, 0) * 30px);
  border-radius: 6px; padding: 0 7px; min-width: 6px;
  display: flex; align-items: center; gap: 2px;
  background: var(--c-fill); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); border-left: 4px solid var(--c);
  color: var(--c-text); font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap; overflow: hidden;
}
.seg.prac { border-style: dashed; border-left-style: solid; background: repeating-linear-gradient(135deg, var(--c-fill) 0 6px, color-mix(in srgb, var(--c-fill) 45%, var(--surface)) 6px 11px); }
.seg.cont { border-left: 1px solid color-mix(in srgb, var(--c) 45%, transparent); border-top-left-radius: 0; border-bottom-left-radius: 0; }
.seg .ic { margin-right: 3px; }
.seg .sb { font-family: var(--font-mono); font-weight: 500; opacity: .9; }
.seg span { overflow: hidden; text-overflow: ellipsis; }
.axis-track { position: relative; height: 18px; }
.axis-track span { position: absolute; top: 0; transform: translateX(-50%); font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.axis-track span.now { transform: none; color: var(--live); font-weight: 500; }
.axis-track span.end { transform: translateX(-100%); }

/* ---------- Week ---------- */
.week-top { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: -12px; }
.week-top h2 { font-size: clamp(26px, 4vw, 34px); line-height: 1.1; letter-spacing: -0.015em; }
.back { color: var(--ink); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--line); }
.back:hover { border-color: var(--ink); }
.stats { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.stats div { background: var(--surface); padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 22px; line-height: 1.15; }
.stats dd small { font-family: var(--font-body); font-weight: 500; font-size: 13px; color: var(--muted); margin-left: 4px; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.weekcard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.week-scroll { overflow-x: auto; padding-bottom: 12px; }
.week { display: grid; min-width: 820px; }
.dayhead { grid-row: 1; padding: 0 8px 10px; display: flex; flex-direction: column; justify-content: flex-end; gap: 1px; border-left: 1px solid var(--line-soft); }
.dayhead .dn { font-family: var(--font-display); font-weight: 700; font-size: 16px; display: flex; gap: 8px; align-items: baseline; }
.dayhead .dn [lang="he"] { font-weight: 400; font-size: 13px; color: var(--muted); }
.dayhead .dh { font-size: 12px; color: var(--muted); }
.cell { border-top: 1px solid var(--line-soft); border-left: 1px solid var(--line-soft); }
.hour { grid-column: 1; align-self: start; transform: translateY(-0.55em); font-size: 11px; color: var(--muted); padding-right: 8px; text-align: right; }
.hour.last { align-self: end; transform: translateY(0.55em); }

.block {
  --lane: 0; --lanes: 1; --inset: 0px;
  z-index: 2; margin: 3px 0; min-width: 0; justify-self: start;
  width: calc((100% - 6px - var(--inset)) / var(--lanes) - (var(--lanes) - 1) * 2px);
  margin-left: calc(3px + var(--inset) + ((100% - 6px - var(--inset)) / var(--lanes)) * var(--lane));
  border-radius: 8px; padding: 6px 8px;
  display: flex; flex-direction: column; gap: 1px; overflow: hidden;
  color: var(--ink); background: var(--c-fill);
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  border-top: 4px solid var(--c);
}
.block.prac {
  border-style: dashed; border-top-style: solid;
  background: repeating-linear-gradient(135deg, var(--c-fill) 0 7px, color-mix(in srgb, var(--c-fill) 45%, var(--surface)) 7px 13px);
}
.block.ghost { background: var(--surface); border: 1.5px dashed var(--c); border-top: 4px solid var(--c); }
.block .bn { font-weight: 700; font-size: 13px; line-height: 1.2; color: var(--c-text); }
.block .bm { font-size: 11.5px; line-height: 1.25; font-weight: 600; color: var(--c-text); }
.block .bt { font-size: 11px; font-weight: 400; opacity: .85; }
.block .bw, .block .br { font-size: 11px; line-height: 1.25; overflow-wrap: anywhere; }
.block .bw { font-family: var(--font-he); font-weight: 600; margin-top: 2px; }
.block .br.na { color: var(--muted); font-family: var(--font-body); font-style: italic; }
.block.ghost .br.na { color: var(--live); font-style: normal; font-weight: 600; }
.block.short { gap: 0; padding-block: 3px; }
.block.short .bn, .block.short .bm, .block.short .bw, .block.short .br { line-height: 1.2; }
.block.short .bw { margin-top: 0; }
.block .bk { font-weight: 600; font-size: 11.5px; }
.wband {
  z-index: 1; margin: 3px; border-radius: 8px; padding: 6px 8px;
  background: repeating-linear-gradient(180deg, var(--c-fill) 0 10px, color-mix(in srgb, var(--c-fill) 60%, var(--surface)) 10px 20px);
  border: 1px solid color-mix(in srgb, var(--c) 25%, transparent); border-left: 4px solid var(--c);
  color: var(--c-text); font-size: 11.5px; font-weight: 600; line-height: 1.25;
  display: flex; flex-direction: column; gap: 1px; overflow: hidden;
}
.wband .bt { font-weight: 400; }
.gap { z-index: 0; margin: 3px; border-radius: 8px; border: 1px dashed var(--line); display: flex; align-items: center; justify-content: center; font-size: 11.5px; color: var(--muted); }
.free { z-index: 0; margin: 3px; border-radius: 10px; background: repeating-linear-gradient(135deg, transparent 0 10px, var(--line-soft) 10px 11px); display: flex; align-items: center; justify-content: center; }
.free span { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--muted); background: var(--surface); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); }

.agenda { display: none; flex-direction: column; gap: 18px; }
.aday { display: flex; flex-direction: column; gap: 8px; }
.aday h3 { margin: 0; font-family: var(--font-display); font-size: 17px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.aday h3 small { font-family: var(--font-body); font-weight: 500; font-size: 13px; color: var(--muted); }
.aday ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.arow { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; align-items: start; }
.arow .t { font-size: 12.5px; color: var(--muted); padding-top: 9px; }
.arow .block { --lanes: 1; --lane: 0; --inset: 0px; margin: 0; width: auto; justify-self: stretch; }
.arow .wband { margin: 0; }
.arow .gap { margin: 0; padding: 4px 8px; justify-content: flex-start; }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
#courses { min-width: 760px; }
th, td { text-align: left; padding: 11px 14px; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
tr:last-child td { border-bottom: 0; }
th { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: color-mix(in srgb, var(--line-soft) 60%, var(--surface)); }
.cname { display: flex; flex-direction: column; min-width: 0; }
.cname b { font-weight: 600; }
.cname [lang="he"] { font-size: 13px; color: var(--muted); }
.cell-stack { display: flex; flex-direction: column; align-items: flex-start; }
.grp { font-weight: 600; }
.cell-stack .grp:not(:first-child) { margin-top: 12px; }
.sub { display: block; font-size: 12.5px; color: var(--muted); }
.slot { display: flex; flex-direction: column; margin-top: 4px; font-size: 12.5px; }
.slot .room { color: var(--muted); }
.flag { display: inline-block; margin-top: 6px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--live); color: var(--live); }
td bdi { font-family: var(--font-he); }

/* ---------- Exams ---------- */
.exams { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
.panel { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.panel h3 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.pnote { margin: 0; font-size: 13px; color: var(--muted); }
.quizzes { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.quizzes li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); align-items: baseline; }
.quizzes li:last-child { border-bottom: 0; }
.quizzes li.past { opacity: .5; }
.quizzes .d { font-size: 13px; color: var(--muted); }
.quizzes .what { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.quizzes .wn { display: block; font-weight: 600; }
.quizzes .note, .quizzes .loc { font-size: 12.5px; color: var(--muted); padding-left: 19px; overflow-wrap: anywhere; }
.quizzes .cal { grid-column: 2; justify-self: start; margin-left: 14px; }
.quizzes .none { grid-column: 1 / -1; color: var(--muted); }
#finals { min-width: 400px; }
.fd { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.fd .sub { flex-basis: 100%; }
.cal {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 600; color: var(--ink);
  text-decoration: none; border-radius: 6px; padding: 2px 6px; margin: -2px -6px;
}
.cal span { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.cal:hover { background: var(--line-soft); }
.cal:hover span { text-decoration-color: var(--ink); }
.cal:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.cal svg { flex: none; }

/* ---------- Today ---------- */
.tl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.trow { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; align-items: start; }
.tt { display: flex; flex-direction: column; gap: 3px; padding-top: 9px; }
.tt .mono { font-size: 13px; }
.tchip { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.trow.live .tchip { color: var(--live); }
.trow.done { opacity: .45; }
.trow .block { --lanes: 1; --lane: 0; --inset: 0px; margin: 0; width: auto; justify-self: stretch; }
.trow .wband { margin: 0; }
.tnow { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; align-items: center; color: var(--live); font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.tnow i { display: block; height: 2px; border-radius: 1px; background: var(--live); }
.olist { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.orow { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.orow:last-child { border-bottom: 0; }
.orow .on { flex: 1 1 260px; min-width: 0; }
.orow .or, .orow .ow { color: var(--muted); font-size: 13px; }
.orow .ost { margin-left: auto; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.orow .ost.live { color: var(--live); }
.orow.done { opacity: .5; }

footer { font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; display: flex; flex-direction: column; gap: 14px; }
footer p { margin: 0; }
.install { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.install-link { font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.install-link:hover { border-color: var(--muted); }
.install-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.install-help { font-size: 13.5px; color: var(--muted); max-width: 56ch; }
.install-help b { color: var(--ink); font-weight: 600; }

@media (max-width: 680px) {
  .page { gap: 30px; padding-top: 24px; }
  .week-scroll, .legend .pat { display: none; }
  .agenda { display: flex; }
  .exams { grid-template-columns: minmax(0, 1fr); }
  .weekcard { padding: 14px; }
  .stats div:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .brow { grid-template-columns: minmax(0, 1fr); padding: 14px 14px 16px; }
  .brow.axis { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line-soft); padding-bottom: 6px; }
  .brow.axis .bwho { display: none; }
  .tabs a { padding: 10px 14px 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
