:root {
  /* --bg: #f7f6f2;
  --surface: #fafaf7;
  --surface2: #f3f0ec;
  --border: #d4d1ca;
  --divider: #e4e1db;
  --text: #28251d;
  --muted: #6f6b63;
  --faint: #a19d94;
  --primary: #01696f;
  --primary-hl: #cddcda;
  --primary-dim: #e6f0ef;

  --alert15: #e8af34;
  --alert5: #d96b1a;
  --alert0: #d64545;
  --alert1: #f2c94c; */

  --bg: #f5f5f2;
  --surface: #ffffff;
  --surface2: #f0efe9;
  --border: #d8d6cd;
  --divider: #e6e4dc;
  --text: #0d0d0d;
  --muted: #55534c;
  --faint: #9b988c;
  --primary: #ff030d;
  --primary-hl: #ffd4d6;
  --primary-dim: #ffeceb;
  --alert15: #fad617;
  --alert5: #ff8000;
  --alert0: #ff030d;
  --alert1: #ffe600;
  --fsg-blue: #0080ff;
  --fsg-green: #66ff00;
  --fsg-cyan: #66ffe6;
  --fsg-magenta: #ff00ff;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.07), 0 8px 24px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
  /* --bg: #141312;
  --surface: #1a1917;
  --surface2: #201f1d;
  --border: #353330;
  --divider: #252320;
  --text: #cccac7;
  --muted: #908e89;
  --faint: #5e5c58;
  --primary: #649152;
  --primary-hl: #33331e;
  --primary-dim: #192526;
  --alert15: #e8af34;
  --alert5: #ff8a3d;
  --alert0: #ff6b6b; */
    /* --bg: #05040a;
  --surface: #0c0a16;
  --surface2: #120f20;
  --border: #2a2440;
  --divider: #201a34;
  --text: #e4e0ff;
  --muted: #8f8ab8;
  --faint: #5b5480;
  --primary: #43ff2a;
  --primary-hl: #3a1240;
  --primary-dim: #23102c;
  --alert15: #f5d300;
  --alert5: #ff7a1a;
  --alert0: #ff2a5e;
  --alert1: #f5d300;
  --fsg-blue: #00e0ff;
  --fsg-green: #39ff88;
  --fsg-cyan: #00fff2;
  --fsg-magenta: #ff2ad1; */
  --bg: #282a36;
  --surface: #2d2f3d;
  --surface2: #343746;
  --border: #44475a;
  --divider: #3b3e50;
  --text: #f8f8f2;
  --muted: #a9adc1;
  --faint: #6272a4;
  --primary: #c05c95;
  --primary-hl: #44475a;
  --primary-dim: #3a2f3d;
  --alert15: #f1fa8c;
  --alert5: #ffb86c;
  --alert0: #ff5555;
  --alert1: #f1fa8c;
  --fsg-blue: #8be9fd;
  --fsg-green: #50fa7b;
  --fsg-cyan: #8be9fd;
  --fsg-magenta: #bd93f9;
}

[data-theme="dark"] .hero-card {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--primary-dim) 85%, var(--surface)) 0%,
    color-mix(in srgb, var(--primary-hl) 40%, var(--surface)) 100%
  );
  box-shadow:   0 0 0 1px color-mix(in srgb, var(--primary) 22%, transparent),
                0 0 20px color-mix(in srgb, var(--primary) 16%, transparent),
                0 8px 24px rgba(0, 0, 0, 0.5);
}


* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
  cursor: pointer;
}

a {
  color: inherit;
}

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem;
  padding-bottom: 5rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0 0.5rem;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--divider);
  margin-bottom: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 5px;
}

.logo {
  width: 2rem;
  height: 2rem;
  border-radius: 0.4rem;
  background: var(--primary-hl);
  color: var(--primary);
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  font-size: 1rem;
}

.title {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.sub {
  font-size: 0.72rem;
  color: var(--muted);
}

.topbar-right {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: grid;
  place-items: center;
  font-size: 0.9rem;
}

select.chip {
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.8rem;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.search-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.search {
  flex: 1;
  min-width: 180px;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.seg {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface2);
}

.seg button {
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.seg button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.chip-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.chip {
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

.chip.active {
  background: var(--primary-hl);
  color: var(--primary);
  border-color: var(--primary);
}

.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0.75rem 0 0.5rem;
}

.hero-card {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--primary-dim) 85%, var(--surface)) 0%,
    color-mix(in srgb, var(--primary-hl) 40%, var(--surface)) 100%
  );
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
  border-radius: 1.2rem;
  padding: 1.4rem;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.hero-time {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.hero-what {
  font-size: 1.2rem;
  font-weight: 800;
  margin-top: 0.2rem;
}

.hero-where {
  font-size: 0.95rem;
  color: var(--muted);
}

.hero-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1rem;
}

/* .upcoming-15 {
  animation: shiftStartShake 3.6s ease-in-out infinite;
}

.upcoming-5 {
  animation: shiftStartShake 1.6s ease-in-out infinite;
}

.upcoming-now {
  animation: shiftStartShake 0.6s ease-in-out infinite, shiftStartGlitch 5.2s steps(1) infinite;
} */

@keyframes shiftStartShake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-2px, 1px); }
  40% { transform: translate(2px, -1px); }
  60% { transform: translate(-1px, 2px); }
  80% { transform: translate(1px, -2px); }
}

@keyframes shiftStartGlitch {
  0%, 80%, 100% {
    box-shadow: 0 0 0 rgba(255,0,60,0), 0 0 0 rgba(0,255,220,0);
    filter: none;
  }
  85% {
    box-shadow: 3px 0 0 rgba(255,0,60,0.5), -3px 0 0 rgba(0,255,220,0.4);
    filter: contrast(1.2) saturate(1.4) hue-rotate(8deg);
  }
  90% {
    box-shadow: -3px 0 0 rgba(255,0,60,0.5), 3px 0 0 rgba(0,255,220,0.4);
    filter: contrast(1.3) saturate(1.5) hue-rotate(-8deg);
  }
  95% {
    box-shadow: 0 0 0 rgba(255,0,60,0), 0 0 0 rgba(0,255,220,0);
    filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .upcoming-now {
    animation: none;
  }
}

.blink-text {
  animation: blinkText 1s step-start infinite;
}

@keyframes pulse5border {
  0%, 100% { border-left-width: 4px; }
  50% { border-left-width: 8px; }
}

@keyframes pulseNowBorder {
  0%, 100% { border-left-width: 4px; }
  50% { border-left-width: 8px; }
}

@keyframes blinkText {
  50% { opacity: 0.35; }
}

.stats-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.stat {
  flex: 1;
  min-width: 80px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.6rem 0.8rem;
}

.stat .sn {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.stat .sl {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.cards {
  display: grid;
  gap: 0.45rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.65rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-left-color 0.2s ease;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.5rem;
}

.card-what {
  font-weight: 800;
  font-size: 1.1rem;
  line-height: 1.2;
}

.card-where {
  color: var(--muted);
  font-size: 0.78rem;
}

.time-pill {
  white-space: nowrap;
  border-radius: var(--radius-full);
  font-size: 1.50rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  background: color-mix(in srgb, var(--primary) 10%, var(--surface2));
  border: 1px solid color-mix(in srgb, var(--primary) 40%, var(--border));
  color: var(--primary);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.card.card-info {
  padding: 0.45rem 0.7rem;
  gap: 0.2rem;
}

.card.card-info .card-what {
  font-size: 0.92rem;
}

.card.card-info .card-where {
  font-size: 0.72rem;
}

.card.card-info .time-pill {
  font-size: 1.00rem;
  padding: 0.2rem 0.5rem;
}

.card.card-info .card-note {
  font-size: 0.78rem;
  padding: 0.5rem 0.6rem;
  background: var(--surface2);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  color: var(--muted);
  line-height: 1.4;
  white-space: pre-line;
}

.tag {
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.tag.category {
  font-weight: 700;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.assigned-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.person-chip {
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--primary-hl);
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.person-chip.mine {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

[data-theme="dark"] .person-chip.mine {
  color: #0c1211;
}


.nobody {
  color: var(--faint);
  font-size: 0.75rem;
  font-style: italic;
}

.card-note {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 0.4rem 0.6rem;
  font-size: 0.78rem;
  color: var(--muted);
  border-left: 2px solid var(--border);
  white-space: pre-line;
}

.table-wrap {
  overflow: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th {
  background: var(--surface2);
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.7rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--divider);
  vertical-align: top;
  font-size: 0.85rem;
}

tr:last-child td {
  border-bottom: 0;
}

.bottom-nav {
  position: fixed;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 1.5rem), 420px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.3rem;
  padding: 0.3rem;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius-xl) + 0.3rem);
  box-shadow: var(--shadow);
}

.bottom-nav button {
  height: 48px;
  border: 0;
  background: transparent;
  border-radius: var(--radius-lg);
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
}

.bottom-nav button.active {
  background: var(--primary-hl);
  color: var(--primary);
}

.empty,
.loading {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.tag.cat-place, .timeline-block.cat-place { background: #d3d3d3; color: #111; border-color: #bdbdbd; }
.tag.cat-event-support, .timeline-block.cat-event-support,
.tag.cat-officials, .timeline-block.cat-officials { background: #ff0000; color: #111; border-color: #d10000; }
.tag.cat-inspection, .timeline-block.cat-inspection { background: #adff2f; color: #111; border-color: #87cf21; }
.tag.cat-meals, .timeline-block.cat-meals { background: #228b22; color: #fff; border-color: #1b6f1b; }
.tag.cat-partner, .timeline-block.cat-partner { background: #daa520; color: #111; border-color: #b8860b; }
.tag.cat-statics, .timeline-block.cat-statics { background: #4682b4; color: #fff; border-color: #38698f; }
.tag.cat-pr-media, .tag.cat-pr-media-,
.timeline-block.cat-pr-media, .timeline-block.cat-pr-media- { background: #ffa500; color: #111; border-color: #d48a00; }
.tag.cat-dynamics, .timeline-block.cat-dynamics,
.tag.cat-tk, .timeline-block.cat-tk { background: #ffff00; color: #111; border-color: #d4d400; }
.tag.cat-teams, .timeline-block.cat-teams { background: #ff1493; color: #111; border-color: #d3117b; }
.tag.cat-academy, .timeline-block.cat-academy { background: #dda0dd; color: #111; border-color: #c983c9; }
.tag.cat-external, .timeline-block.cat-external { background: #2f4f4f; color: #fff; border-color: #233c3c; }
.tag.cat-it, .timeline-block.cat-it { background: #000; color: #fff; border-color: #222; }

[data-theme="dark"] .tag.cat-place, [data-theme="dark"] .timeline-block.cat-place { background: #6a6a6a; color: #fff; border-color: #888; }
[data-theme="dark"] .tag.cat-event-support, [data-theme="dark"] .timeline-block.cat-event-support,
[data-theme="dark"] .tag.cat-officials, [data-theme="dark"] .timeline-block.cat-officials { background: #ff6b6b; color: #111; border-color: #ff8787; }
[data-theme="dark"] .tag.cat-inspection, [data-theme="dark"] .timeline-block.cat-inspection { background: #7cc61a; color: #111; border-color: #98e234; }
[data-theme="dark"] .tag.cat-meals, [data-theme="dark"] .timeline-block.cat-meals { background: #2f9d46; color: #fff; border-color: #48b55f; }
[data-theme="dark"] .tag.cat-partner, [data-theme="dark"] .timeline-block.cat-partner { background: #c9961a; color: #111; border-color: #e4b33b; }
[data-theme="dark"] .tag.cat-statics, [data-theme="dark"] .timeline-block.cat-statics { background: #5f9ed1; color: #fff; border-color: #7cb7e5; }
[data-theme="dark"] .tag.cat-pr-media, [data-theme="dark"] .tag.cat-pr-media-,
[data-theme="dark"] .timeline-block.cat-pr-media, [data-theme="dark"] .timeline-block.cat-pr-media- { background: #ffb347; color: #111; border-color: #ffc46f; }
[data-theme="dark"] .tag.cat-dynamics, [data-theme="dark"] .timeline-block.cat-dynamics,
[data-theme="dark"] .tag.cat-tk, [data-theme="dark"] .timeline-block.cat-tk { background: #e6e65c; color: #111; border-color: #f0f087; }
[data-theme="dark"] .tag.cat-teams, [data-theme="dark"] .timeline-block.cat-teams { background: #ff5ab1; color: #111; border-color: #ff7bc1; }
[data-theme="dark"] .tag.cat-academy, [data-theme="dark"] .timeline-block.cat-academy { background: #d7a6ea; color: #111; border-color: #e2bdf0; }
[data-theme="dark"] .tag.cat-external, [data-theme="dark"] .timeline-block.cat-external { background: #557676; color: #fff; border-color: #6e9191; }
[data-theme="dark"] .tag.cat-it, [data-theme="dark"] .timeline-block.cat-it { background: #1f1f1f; color: #fff; border-color: #444; }

@media (max-width: 780px) {
  .hero-card {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 900px) {
  .app {
    padding: 1.5rem;
  }

  .bottom-nav {
    display: none;
  }

  .controls {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.timeline-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.timeline-head,
.timeline-row {
  display: flex;
  align-items: stretch;
  width: max-content;
  min-width: 100%;
}

.timeline-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.timeline-corner {
  flex: 0 0 180px;
  position: sticky;
  left: 0;
  z-index: 6;
  padding: 0.75rem 1rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-right: 1px solid var(--border);
  background: var(--surface2);
}

.timeline-hours {
  position: relative;
  display: grid;
  min-height: 52px;
}

.timeline-hour {
  padding: 0.75rem 0.25rem 0.35rem;
  font-size: 0.74rem;
  color: var(--muted);
  border-left: 1px solid var(--divider);
  text-align: left;
}

.timeline-hour.compressed {
  color: var(--faint);
}

.timeline-row {
  border-bottom: 1px solid var(--divider);
}

.timeline-row:last-child {
  border-bottom: 0;
}

.timeline-name {
  flex: 0 0 180px;
  position: sticky;
  left: 0;
  z-index: 2;
  padding: 0.8rem 1rem;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface2) 65%, var(--surface));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.15rem;
}

.timeline-name strong {
  font-size: 0.86rem;
}

.timeline-name span {
  font-size: 0.73rem;
  color: var(--muted);
}

.timeline-lane {
  position: relative;
  min-height: 72px;
}

.timeline-now {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--alert0);
  z-index: 3;
  opacity: 0.9;
}

.timeline-block {
  position: absolute;
  top: 8px;
  bottom: 8px;
  border-radius: 0.7rem;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
  background: color-mix(in srgb, var(--primary-hl) 78%, var(--surface));
  color: var(--text);
  padding: 0 0.6rem;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  cursor: default;
  transition: transform 0.12s ease, box-shadow 0.12s ease, z-index 0s;
}

.timeline-block:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  z-index: 4;
}

.timeline-block.mine {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  font-weight: 800;
}

.timeline-block .tb-what {
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.timeline-info-rail {
  position: sticky;
  top: 52px;
  z-index: 4;
  width: max-content;
  min-width: 100%;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
}

.timeline-info-row .timeline-name {
  background: color-mix(in srgb, var(--alert1) 22%, var(--surface2));
}

.timeline-info-row .timeline-block.info-block {
  font-weight: 700;
}

.timeline-row-empty .timeline-lane::after {
  content: 'No assignment';
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  font-size: 0.76rem;
  font-style: italic;
}

@media (max-width: 780px) {
  .timeline-corner,
  .timeline-name {
    flex: 0 0 130px;
  }

  .timeline-info-rail {
    top: 46px;
  }
}

.day-header {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  padding: 1rem 0.2rem 0.3rem;
  border-bottom: 2px solid var(--divider);
  margin-bottom: 0.3rem;
}

.day-header:first-child {
  padding-top: 0.2rem;
}

.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  padding: 0.5rem 0.2rem 0.1rem;
}

.timeline-block.compact {
  padding: 0;
  justify-content: center;
}

.timeline-block.compact .tb-what {
  display: none;
}

/* ============================================================
   Time-based UI Glitch System — styles
   ============================================================ */

body.glitch-rgb-active {
  text-shadow:
    1px 0 rgba(255, 0, 60, 0.35),
    -1px 0 rgba(0, 255, 220, 0.3);
}

body.phase-3.glitch-rgb-active {
  text-shadow:
    2px 0 rgba(255, 0, 60, 0.5),
    -2px 0 rgba(0, 255, 220, 0.45);
}

.glitch-cursor-ghost {
  position: fixed;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(180, 200, 255, 0.35);
  pointer-events: none;
  z-index: 9998;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 0.15s ease;
}

.glitch-cursor-ghost.active {
  opacity: 1;
}

body.phase-3 .glitch-cursor-ghost.active {
  background: rgba(255, 120, 160, 0.4);
  box-shadow: 0 0 8px rgba(255, 120, 160, 0.3);
}

.glitch-mirror-slice {
  position: relative;
  display: inline-block;
  animation: mirrorSliceAnim 0.18s steps(2, end);
}

@keyframes mirrorSliceAnim {
  0% { clip-path: inset(0 0 0 0); transform: none; }
  40% { clip-path: inset(20% 0 40% 0); transform: scaleX(-1); }
  41% { clip-path: inset(0 0 0 0); transform: none; }
  100% { clip-path: inset(0 0 0 0); transform: none; }
}

.glitch-glyph-flip {
  display: inline-block;
  animation: glyphFlipAnim 0.22s steps(3, end);
}

@keyframes glyphFlipAnim {
  0% { transform: none; }
  50% { transform: rotate(180deg); }
  100% { transform: none; }
}

.glitch-bar {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 0, 60, 0.18) 0px,
    rgba(0, 255, 220, 0.14) 6px,
    transparent 6px,
    transparent 14px
  );
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 9997;
}

.glitch-smear {
  animation: smearAnim 0.28s ease-out;
}

@keyframes smearAnim {
  0% { filter: none; }
  30% { filter: blur(1.5px) saturate(1.3); transform: translateX(1px); }
  60% { filter: blur(2.5px) saturate(1.4); transform: translateX(-1px); }
  100% { filter: none; transform: none; }
}

body.phase-3 .glitch-smear {
  animation: smearAnimStrong 0.4s ease-out;
}

@keyframes smearAnimStrong {
  0% { filter: none; }
  30% { filter: blur(3px) saturate(1.5); transform: translateX(2px); }
  60% { filter: blur(4px) saturate(1.6); transform: translateX(-2px); }
  100% { filter: none; transform: none; }
}

body.glitch-layout-slip .app {
  animation: layoutSlipAnim 0.15s ease-in-out;
}

@keyframes layoutSlipAnim {
  0% { transform: translateX(0); }
  50% { transform: translateX(1.5px); }
  100% { transform: translateX(0); }
}

body.phase-3.glitch-layout-slip .app {
  animation: layoutSlipAnimStrong 0.22s ease-in-out;
}

@keyframes layoutSlipAnimStrong {
  0% { transform: translateX(0); }
  30% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}

.glitch-vhs-tear {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 0;
  background: linear-gradient(
    to top,
    rgba(255, 255, 255, 0.06) 0%,
    rgba(0, 255, 220, 0.08) 30%,
    rgba(255, 0, 60, 0.06) 60%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 9996;
  opacity: 0;
  transform: translateY(0);
}

.glitch-vhs-tear.active {
  opacity: 1;
  animation: vhsTearAnim 0.3s ease-out;
}

@keyframes vhsTearAnim {
  0% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
  100% { transform: translateY(0); }
}

.glitch-lock {
  will-change: transform, filter, clip-path;
}

body.glitch-maxout .app {
  animation: maxoutShake 0.12s infinite;
  filter: contrast(1.15) saturate(1.3);
}

@keyframes maxoutShake {
  0% { transform: translate(0, 0); }
  20% { transform: translate(2px, -1px); }
  40% { transform: translate(-3px, 1px); }
  60% { transform: translate(2px, 2px); }
  80% { transform: translate(-2px, -2px); }
  100% { transform: translate(0, 0); }
}

body.glitch-maxout::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 0, 60, 0.05) 0px,
    rgba(0, 255, 220, 0.04) 2px,
    transparent 2px,
    transparent 4px
  );
  animation: maxoutStrobe 0.25s infinite;
  mix-blend-mode: screen;
}

@keyframes maxoutStrobe {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.9; }
}

body.glitch-maxout .glitch-cursor-ghost {
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  .glitch-rgb-active,
  .glitch-mirror-slice,
  .glitch-glyph-flip,
  .glitch-smear,
  .glitch-layout-slip .app,
  .glitch-vhs-tear.active,
  .glitch-cursor-ghost,
  body.glitch-maxout .app,
  body.glitch-maxout::before {
    animation: none !important;
    transition: none !important;
  }
}

.chicken-cursor {
  position: fixed;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
  font-size: 26px;
  pointer-events: none;
  z-index: 10000;
  display: none;
  transition: transform .08s ease-out;
  user-select: none;
}

body.chicken-mode,
body.chicken-mode * {
  cursor: none !important;
}

/* Past-today shifts fade toward the background as the day progresses */
.card.shift-past {
  opacity: 0.35;
  filter: grayscale(0.4);
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.card.shift-past:hover {
  opacity: 0.7;
  filter: none;
}

tr.shift-past {
  opacity: 0.35;
  filter: grayscale(0.4);
  transition: opacity 0.3s ease, filter 0.3s ease;
}

tr.shift-past:hover {
  opacity: 0.7;
  filter: none;
}

.timeline-block.shift-past {
  opacity: 0.3;
  filter: grayscale(0.5);
}

.timeline-block.shift-past:hover {
  opacity: 0.75;
  filter: none;
}

#togglePast.active {
  background: var(--primary-hl);
  color: var(--primary);
  border-color: var(--primary);
}

.feather {
  position: fixed;
  font-size: 22px;
  pointer-events: none;
  z-index: 99999;
  animation-duration: var(--fall-duration);
  animation-timing-function: ease-in-out;
  animation-fill-mode: forwards;
  will-change: transform, opacity;
}

.sway-a { animation-name: featherSwayA; }
.sway-b { animation-name: featherSwayB; }
.sway-c { animation-name: featherSwayC; }
.sway-d { animation-name: featherSwayD; }

@keyframes featherSwayA {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  8%   { transform: translate(calc(var(--drift-x) * 0.25), var(--pop-up)) rotate(calc(var(--spin) * 0.15)); opacity: 1; }
  25%  { transform: translate(calc(var(--drift-x) * 1.6), calc(var(--pop-up) + 16vh)) rotate(calc(var(--spin) * 0.5)); }
  45%  { transform: translate(calc(var(--drift-x) * -1.3), calc(var(--pop-up) + 32vh)) rotate(calc(var(--spin) * 0.7)); }
  65%  { transform: translate(calc(var(--drift-x) * 1.8), calc(var(--pop-up) + 50vh)) rotate(var(--spin)); }
  85%  { transform: translate(calc(var(--drift-x) * -1.0), calc(var(--pop-up) + 66vh)) rotate(calc(var(--spin) * 1.15)); }
  100% { transform: translate(var(--drift-x), 78vh) rotate(calc(var(--spin) * 1.3)); opacity: 0; }
}

@keyframes featherSwayB {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  8%   { transform: translate(calc(var(--drift-x) * 0.25), var(--pop-up)) rotate(calc(var(--spin) * 0.15)); opacity: 1; }
  20%  { transform: translate(calc(var(--drift-x) * -1.5), calc(var(--pop-up) + 10vh)) rotate(calc(var(--spin) * -0.3)); }
  38%  { transform: translate(calc(var(--drift-x) * 1.9), calc(var(--pop-up) + 28vh)) rotate(calc(var(--spin) * 0.6)); }
  58%  { transform: translate(calc(var(--drift-x) * -1.4), calc(var(--pop-up) + 46vh)) rotate(calc(var(--spin) * 0.4)); }
  78%  { transform: translate(calc(var(--drift-x) * 1.6), calc(var(--pop-up) + 64vh)) rotate(var(--spin)); }
  100% { transform: translate(var(--drift-x), 80vh) rotate(calc(var(--spin) * 1.4)); opacity: 0; }
}

@keyframes featherSwayC {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  8%   { transform: translate(calc(var(--drift-x) * 0.25), var(--pop-up)) rotate(calc(var(--spin) * 0.15)); opacity: 1; }
  30%  { transform: translate(calc(var(--drift-x) * 1.7), calc(var(--pop-up) + 22vh)) rotate(calc(var(--spin) * 0.35)); }
  50%  { transform: translate(calc(var(--drift-x) * -1.6), calc(var(--pop-up) + 40vh)) rotate(calc(var(--spin) * 0.8)); }
  70%  { transform: translate(calc(var(--drift-x) * 1.5), calc(var(--pop-up) + 58vh)) rotate(calc(var(--spin) * 0.9)); }
  88%  { transform: translate(calc(var(--drift-x) * -0.8), calc(var(--pop-up) + 70vh)) rotate(var(--spin)); }
  100% { transform: translate(var(--drift-x), 78vh) rotate(var(--spin)); opacity: 0; }
}

@keyframes featherSwayD {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  8%   { transform: translate(calc(var(--drift-x) * 0.25), var(--pop-up)) rotate(calc(var(--spin) * 0.15)); opacity: 1; }
  22%  { transform: translate(calc(var(--drift-x) * -1.8), calc(var(--pop-up) + 14vh)) rotate(calc(var(--spin) * -0.4)); }
  40%  { transform: translate(calc(var(--drift-x) * 1.5), calc(var(--pop-up) + 30vh)) rotate(calc(var(--spin) * 0.3)); }
  60%  { transform: translate(calc(var(--drift-x) * -1.7), calc(var(--pop-up) + 48vh)) rotate(calc(var(--spin) * 0.55)); }
  80%  { transform: translate(calc(var(--drift-x) * 1.4), calc(var(--pop-up) + 66vh)) rotate(calc(var(--spin) * 1.1)); }
  100% { transform: translate(var(--drift-x), 77vh) rotate(calc(var(--spin) * 1.5)); opacity: 0; }
}

.app-footer {
  text-align: center;
  padding: 1.5rem 1rem 5rem;
  font-size: 0.8rem;
}

.app-footer a {
  color: var(--muted);
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
  color: var(--primary);
}

/* 5 minutes before and 5 minutes after start only */
.upcoming-5,
.upcoming-started {
  animation: shiftStartShake 1.8s ease-in-out infinite;
}

/* Shift has been running longer than 5 minutes: color only */
.shift-active {
  border-left-color: var(--alert0);
  background: color-mix(in srgb, var(--alert0) 8%, var(--surface));
}

/* Long / informational items: clearly distinct but quiet */
.card.card-info,
.card.card-long-item {
  border-left-color: var(--fsg-blue);
  background: color-mix(in srgb, var(--fsg-blue) 8%, var(--surface));
  animation: none !important;
}

/* Ended shifts: subtle, clearly finished */
.card.shift-ended {
  opacity: 0.25;
  filter: grayscale(0.6);
  border-left-color: var(--faint);
}

tr.shift-ended {
  opacity: 0.25;
  filter: grayscale(0.6);
}

.timeline-block.shift-ended {
  opacity: 0.25;
  filter: grayscale(0.6);
  border-left: 3px solid var(--faint);
}

.shift-ended.blink-text,
.shift-ended .blink-text {
  animation: none !important;
  opacity: 1 !important;
}


/* ============================================================
   Last-10-seconds violent screen shake + shift-start egg squirt
   Add this block to the end of style-3.css
   ============================================================ */

body.imminent-shake {
  animation: violentScreenShake 0.28s infinite;
}

@keyframes violentScreenShake {
  0%   { transform: translate(0, 0) rotate(0deg); }
  10%  { transform: translate(-6px, 4px) rotate(-1deg); }
  20%  { transform: translate(7px, -5px) rotate(1.2deg); }
  30%  { transform: translate(-8px, -3px) rotate(-1.5deg); }
  40%  { transform: translate(6px, 6px) rotate(1deg); }
  50%  { transform: translate(-5px, -6px) rotate(-0.8deg); }
  60%  { transform: translate(8px, 3px) rotate(1.4deg); }
  70%  { transform: translate(-7px, 5px) rotate(-1.2deg); }
  80%  { transform: translate(5px, -4px) rotate(0.9deg); }
  90%  { transform: translate(-4px, 2px) rotate(-0.6deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

/* Egg squirt splat overlay */
.egg-splat-layer {
  position: fixed;
  inset: 0;
  z-index: 10050;
  pointer-events: none;
  overflow: hidden;
}

.egg-splat-blob {
  position: absolute;
  top: -5vh;
  border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 35% 30%, #fff9e6 0%, #fff2c2 40%, #f5da7a 70%, #e8c85a 100%);
  box-shadow: 0 0 12px rgba(232, 200, 90, 0.5), inset 0 -4px 8px rgba(180, 140, 30, 0.3);
  animation: eggSquirtFall var(--fall-dur, 2.4s) cubic-bezier(0.3, 0.7, 0.4, 1) forwards;
  will-change: transform, opacity;
}

.egg-splat-blob.yolk {
  background: radial-gradient(circle at 35% 30%, #ffe08a 0%, #ffb800 55%, #d98d00 100%);
  box-shadow: 0 0 14px rgba(255, 184, 0, 0.6);
}

@keyframes eggSquirtFall {
  0% {
    transform: translate(var(--start-x, 0), -10vh) scale(0.2, 0.2);
    opacity: 0;
  }
  8% {
    opacity: 1;
    transform: translate(var(--start-x, 0), -2vh) scale(1.3, 0.6);
  }
  18% {
    transform: translate(var(--mid-x, 0), var(--land-y, 55vh)) scale(0.9, 1.15);
  }
  24% {
    transform: translate(var(--mid-x, 0), var(--land-y, 55vh)) scale(1.35, 0.55);
  }
  30% {
    transform: translate(var(--mid-x, 0), calc(var(--land-y, 55vh) + 1vh)) scale(1, 1);
  }
  70% {
    transform: translate(var(--end-x, 0), calc(var(--land-y, 55vh) + 6vh)) scale(1.05, 0.9);
    opacity: 0.9;
  }
  100% {
    transform: translate(var(--end-x, 0), calc(var(--land-y, 55vh) + 22vh)) scale(0.8, 0.7);
    opacity: 0;
  }
}

.egg-splat-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, rgba(255,255,255,0.55), transparent 60%);
  opacity: 0;
  animation: eggSplatFlash 0.5s ease-out forwards;
}

@keyframes eggSplatFlash {
  0% { opacity: 0; }
  15% { opacity: 0.9; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  body.imminent-shake { animation: none; }
  .egg-splat-blob, .egg-splat-flash { animation: none; opacity: 0; }
}
