:root {
  --bg: #0a0a0d;
  --bg-soft: #111117;
  --ink: #f5f5f2;
  --muted: #b0b3be;
  --panel: rgba(20, 20, 28, 0.88);
  --line: rgba(255, 255, 255, 0.13);
  --primary: #ff6a1a;
  --primary-strong: #e34913;
  --accent: #ff8f38;
  --compare: #ff9f43;
  --swap: #ff4b5d;
  --sorted: #18c99a;
  --found: #4cc9f0;
  --pivot: #c77dff;
  --visited: #8d99ae;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.45);
  --run-hue: 204;
  --run-sat: 56%;
  --run-light-high: 40%;
  --run-light-low: 32%;
  --run-glow: 0.16;
}

html {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 106, 26, 0.62) rgba(20, 20, 28, 0.9);
}

*::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

*::-webkit-scrollbar-track {
  background: rgba(20, 20, 28, 0.9);
  border-radius: 12px;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(255, 106, 26, 0.9), rgba(227, 73, 19, 0.9));
  border-radius: 12px;
  border: 2px solid rgba(20, 20, 28, 0.9);
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(255, 125, 52, 0.98), rgba(255, 84, 24, 0.98));
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Inter", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 14%, rgba(255, 106, 26, 0.17) 0%, rgba(255, 106, 26, 0) 34%),
    radial-gradient(circle at 88% 18%, rgba(199, 125, 255, 0.2) 0%, rgba(199, 125, 255, 0) 30%),
    linear-gradient(155deg, #09090c 0%, #0f1016 45%, #09090c 100%);
  background-size: 130% 130%;
  animation: backdropShift 18s ease-in-out infinite alternate;
}

.brutalist-shell {
  position: relative;
}

.brutalist-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 42px 42px;
  pointer-events: none;
  z-index: -1;
}

.app-shell {
  width: min(1250px, 95vw);
  margin: 2rem auto;
  padding: 0.5rem 0 2rem;
}

.school-topbar {
  margin-bottom: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(100deg, rgba(18, 18, 26, 0.98), rgba(26, 26, 36, 0.96));
  padding: 0.58rem 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
  overflow: hidden;
}

.school-topbar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.14) 44%, transparent 72%);
  transform: translateX(-120%);
  animation: topbarSweep 6.2s linear infinite;
  pointer-events: none;
}

.school-topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.school-topbar-title {
  margin: 0;
  color: #ffd29e;
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  font-weight: 800;
}

.school-logo {
  display: block;
  object-fit: contain;
}

.school-logo-small {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(255, 143, 56, 0.7);
  background: #111117;
}

.school-logo-crest {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 3px solid rgba(255, 143, 56, 0.74);
  background: #111117;
}

.school-logo-inline {
  margin: 0.15rem 0 0.4rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(255, 143, 56, 0.66);
  background: #111117;
}

.school-topbar-links {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.school-topbar-links a {
  text-decoration: none;
  color: #f5f5f2;
  font-size: 0.82rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 0.26rem 0.6rem;
  transition: transform 180ms ease, background-color 140ms ease, border-color 140ms ease;
}

.school-topbar-links a:hover {
  background: rgba(255, 143, 56, 0.18);
  border-color: rgba(255, 143, 56, 0.8);
  transform: translateY(-2px);
}

.visualizer-page .app-shell {
  width: 100%;
  margin: 0;
  padding: 1rem;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.compare-page {
  scrollbar-width: none;
}

.compare-page::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.compare-page .app-shell {
  width: min(1320px, 98vw);
}

.hero {
  text-align: left;
  margin-bottom: 1.2rem;
  animation: heroMorph 720ms cubic-bezier(0.24, 0.9, 0.25, 1);
}

.back-link {
  display: inline-block;
  margin-bottom: 0.8rem;
  color: var(--primary-strong);
  text-decoration: none;
  font-weight: 700;
}

.back-link:hover {
  text-decoration: underline;
}

.eyebrow {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.78rem;
  margin-bottom: 0.25rem;
}

h1,
h2,
h3 {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  margin: 0;
}

h1 {
  font-size: clamp(2.2rem, 4vw, 3.2rem);
}

.subtitle {
  margin-top: 0.35rem;
  color: var(--muted);
}

.layout-grid {
  display: grid;
  grid-template-columns: 320px 1fr 330px;
  gap: 1rem;
}

.compare-layout {
  display: grid;
  gap: 1rem;
}

.compare-page .panel {
  overflow: hidden;
}

.compare-controls {
  animation-delay: 70ms;
}

.compare-control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.compare-actions {
  margin-top: 0.95rem;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.55rem;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.compare-side {
  animation-delay: 130ms;
  overflow: clip;
  scrollbar-width: none;
}

.compare-side::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.compare-side-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
}

.side-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.compare-bars {
  min-height: 330px;
  height: 330px;
  overflow: hidden;
}

.compare-stats {
  margin-top: 0.7rem;
}

.compare-result {
  animation-delay: 210ms;
}

.visualizer-page .layout-grid {
  min-height: 0;
  height: 100%;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr) minmax(290px, 330px);
}

.visualizer-page .panel {
  height: 100%;
  overflow: auto;
}

.visualizer-page .visual {
  min-height: 0;
  grid-template-rows: auto minmax(260px, 1fr) auto;
}

.visualizer-page .bar-container {
  min-height: 0;
  height: 100%;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.school-hero {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background:
    linear-gradient(115deg, rgba(23, 23, 32, 0.98), rgba(12, 12, 18, 0.94)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0));
  color: #f5f5f2;
  padding: 1.3rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(0.4px);
  pointer-events: none;
}

.orb-one {
  width: 190px;
  height: 190px;
  top: -56px;
  right: -40px;
  background: radial-gradient(circle, rgba(247, 216, 139, 0.36), rgba(247, 216, 139, 0));
  animation: floatDrift 11s ease-in-out infinite;
}

.orb-two {
  width: 150px;
  height: 150px;
  bottom: -62px;
  left: -30px;
  background: radial-gradient(circle, rgba(114, 172, 255, 0.3), rgba(114, 172, 255, 0));
  animation: floatDrift 9.5s ease-in-out infinite reverse;
}

.orb-three {
  width: 110px;
  height: 110px;
  top: 44%;
  right: 38%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0));
  animation: floatDrift 7.5s ease-in-out infinite;
}

.school-brand-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.school-hero .eyebrow {
  color: #ffaf68;
}

.school-hero .subtitle {
  color: rgba(245, 245, 242, 0.86);
}

.school-motto-strip {
  margin-top: 1rem;
  display: inline-flex;
  gap: 0.6rem;
  align-items: center;
  padding: 0.45rem 0.75rem;
  border: 1px solid rgba(255, 143, 56, 0.58);
  border-radius: 999px;
  background: rgba(255, 143, 56, 0.11);
  position: relative;
  overflow: hidden;
}

.school-motto-strip::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 28%, rgba(255, 255, 255, 0.18) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: chipSweep 4.5s linear infinite;
}

.campus-marquee {
  margin-top: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(33, 20, 12, 0.96), rgba(26, 14, 10, 0.95));
}

.campus-marquee-track {
  display: flex;
  align-items: center;
  gap: 1.7rem;
  padding: 0.48rem 1rem;
  width: max-content;
  animation: marqueeSlide 22s linear infinite;
}

.campus-marquee-track span {
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffd9b3;
  white-space: nowrap;
}

.campus-marquee-track span::before {
  content: "◆";
  margin-right: 0.5rem;
  color: #ff8f38;
}

.school-motto-strip span {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: rgba(245, 205, 102, 0.92);
}

.school-motto-strip strong {
  font-size: 0.92rem;
  letter-spacing: 0.04em;
}

.school-info-grid {
  margin-top: 1.1rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.school-panel {
  animation-delay: 110ms;
}

.motive-box {
  margin-top: 1.15rem;
  border: 1px solid rgba(11, 58, 117, 0.2);
  background:
    radial-gradient(circle at 86% 18%, rgba(245, 205, 102, 0.2), rgba(245, 205, 102, 0) 34%),
    linear-gradient(162deg, rgba(248, 251, 255, 0.97), rgba(236, 245, 255, 0.9));
  position: relative;
  overflow: hidden;
}

.motive-box::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(104deg, transparent 22%, rgba(255, 255, 255, 0.32) 50%, transparent 74%);
  transform: translateX(-120%);
  animation: topbarSweep 7.5s linear infinite;
  pointer-events: none;
}

.school-list {
  margin: 0.6rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  display: grid;
  gap: 0.42rem;
}

.school-copy {
  margin-top: 0.55rem;
  color: var(--muted);
}

.school-meta {
  margin-top: 0.6rem;
  font-size: 0.88rem;
  color: #ffb985;
}

.kpi-grid {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.kpi-grid div {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0.62rem;
  background: linear-gradient(180deg, rgba(255, 106, 26, 0.16), rgba(255, 255, 255, 0.03));
  display: grid;
  gap: 0.12rem;
}

.kpi-grid strong {
  font-size: 1.15rem;
  color: #ffd0a1;
}

.kpi-grid span {
  font-size: 0.83rem;
  color: var(--muted);
}

.school-showcase-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.school-chip-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.95rem;
  background: linear-gradient(160deg, rgba(255, 106, 26, 0.16), rgba(255, 255, 255, 0.02));
  box-shadow: var(--shadow);
}

.school-chip-card h3 {
  margin-bottom: 0.38rem;
}

.school-chip-card p {
  margin: 0;
  color: var(--muted);
}

.school-footer {
  margin-top: 1.5rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(17, 17, 23, 0.9);
}

.school-footer p {
  margin: 0.26rem 0;
  color: #d8dbe1;
  font-size: 0.92rem;
}

.school-callout {
  margin-top: 1.4rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background:
    radial-gradient(circle at 88% 18%, rgba(255, 143, 56, 0.23), rgba(255, 143, 56, 0) 35%),
    linear-gradient(125deg, rgba(23, 23, 32, 0.97), rgba(12, 12, 18, 0.96));
  box-shadow: var(--shadow);
  color: #f5f5f2;
  padding: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
  overflow: hidden;
}

.school-callout::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(104deg, transparent 20%, rgba(255, 255, 255, 0.16) 45%, transparent 72%);
  transform: translateX(-120%);
  animation: topbarSweep 8s linear infinite;
  pointer-events: none;
}

.school-callout h2 {
  font-size: clamp(1.2rem, 2.2vw, 1.7rem);
}

.school-callout p {
  margin: 0.42rem 0 0;
  color: rgba(244, 248, 255, 0.9);
}

.school-callout-kicker {
  margin: 0;
  color: #ffb679;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
}

.school-callout-actions {
  display: grid;
  gap: 0.55rem;
  min-width: 240px;
}

.school-callout .btn {
  text-align: center;
  text-decoration: none;
}

.dashboard-section + .dashboard-section {
  margin-top: 1.3rem;
}

.dashboard-section-title {
  margin: 0 0 0.7rem;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  animation: morphIn 500ms ease-out forwards;
}

.dashboard-section:nth-of-type(2) .dashboard-section-title {
  animation-delay: 120ms;
}

.algo-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: var(--shadow);
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
  opacity: 0;
  transform: translateY(12px) scale(0.985);
  animation: morphIn 560ms cubic-bezier(0.24, 0.9, 0.25, 1) forwards;
}

.dashboard-grid .algo-card:nth-child(1) { animation-delay: 100ms; }
.dashboard-grid .algo-card:nth-child(2) { animation-delay: 170ms; }
.dashboard-grid .algo-card:nth-child(3) { animation-delay: 240ms; }
.dashboard-grid .algo-card:nth-child(4) { animation-delay: 310ms; }
.dashboard-grid .algo-card:nth-child(5) { animation-delay: 380ms; }
.dashboard-grid .algo-card:nth-child(6) { animation-delay: 450ms; }

.algo-card h2,
.algo-card h3 {
  margin-bottom: 0.35rem;
}

.algo-card p {
  margin: 0;
  color: var(--muted);
}

.algo-card:hover {
  transform: translateY(-5px) scale(1.01);
  border-color: rgba(255, 106, 26, 0.72);
  background: rgba(255, 106, 26, 0.09);
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow);
  border-radius: 16px;
  padding: 1rem;
  opacity: 0;
  transform: translateY(10px) scale(0.985);
  animation: morphIn 620ms cubic-bezier(0.24, 0.9, 0.25, 1) forwards;
}

.panel:hover {
  transform: translateY(-2px);
}

.layout-grid .panel:nth-child(1) { animation-delay: 80ms; }
.layout-grid .panel:nth-child(2) { animation-delay: 170ms; }
.layout-grid .panel:nth-child(3) { animation-delay: 260ms; }

.panel h2 {
  margin-bottom: 0.8rem;
}

label {
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  display: inline-block;
}

select,
input,
textarea,
button {
  font: inherit;
}

select,
input,
textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.62rem 0.7rem;
  color: var(--ink);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 10px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(180deg, rgba(255, 106, 26, 0.25), rgba(199, 125, 255, 0.25));
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 106, 26, 0.45), rgba(199, 125, 255, 0.45));
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  margin-top: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(248, 251, 255, 0.95);
  background: linear-gradient(145deg, var(--primary), var(--primary-strong));
  box-shadow: 0 4px 10px rgba(7, 42, 85, 0.24);
}

input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(90deg, rgba(255, 106, 26, 0.45), rgba(199, 125, 255, 0.45));
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(248, 251, 255, 0.95);
  background: linear-gradient(145deg, var(--primary), var(--primary-strong));
  box-shadow: 0 4px 10px rgba(7, 42, 85, 0.24);
}

input[type="range"]:focus-visible {
  outline: 2px solid rgba(255, 106, 26, 0.45);
  outline-offset: 2px;
}

input[type="range"]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

textarea {
  resize: vertical;
}

.field-row {
  margin-top: 0.85rem;
}

.input-stack {
  margin-top: 1rem;
  display: grid;
  gap: 0.6rem;
}

.btn {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #1a1a22;
  padding: 0.58rem 0.72rem;
  cursor: pointer;
  transition: transform 150ms ease, background-color 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: #252530;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(145deg, var(--primary), var(--primary-strong));
}

.btn-primary:hover {
  background: linear-gradient(145deg, #ff8135, #ff5f1b);
}

.playback-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.timeline-control {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.7rem;
}

.timeline-control label {
  font-size: 0.88rem;
  color: var(--muted);
}

#timelineRange {
  width: 100%;
}

#timelineValue {
  font-size: 0.85rem;
  color: var(--muted);
}

.visual {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 530px;
}

.visual-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

#message {
  color: var(--muted);
  font-size: 0.9rem;
}

.bar-container {
  margin-top: 0.8rem;
  border-radius: 14px;
  border: 1px dashed var(--line);
  background:
    repeating-linear-gradient(
      to right,
      rgba(255, 255, 255, 0.04) 0,
      rgba(255, 255, 255, 0.04) 24px,
      rgba(0, 0, 0, 0) 24px,
      rgba(0, 0, 0, 0) 48px
    ),
    linear-gradient(to top, rgba(255, 106, 26, 0.16), rgba(255, 255, 255, 0.04));
  min-height: 430px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding: 0.85rem;
  overflow: hidden;
}

.graph-wrap {
  margin-top: 0.8rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(17, 17, 23, 0.88);
  padding: 0.75rem;
  min-height: 430px;
}

.graph-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.7rem;
}

.graph-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

#graphHint {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.graph-svg {
  width: 100%;
  margin-top: 0.45rem;
  display: block;
}

.graph-edge {
  stroke: rgba(29, 27, 25, 0.34);
  stroke-width: 2;
}

.graph-edge.considered {
  stroke: var(--compare);
  stroke-width: 3;
}

.graph-edge.relaxed {
  stroke: var(--found);
  stroke-width: 3;
}

.graph-edge.path {
  stroke: var(--sorted);
  stroke-width: 4;
}

.graph-edge-label {
  fill: var(--muted);
  font-size: 16px;
  font-weight: 700;
  text-anchor: middle;
}

.graph-node {
  fill: #f7efe4;
  stroke: rgba(29, 27, 25, 0.34);
  stroke-width: 2;
  cursor: grab;
}

.graph-node:active {
  cursor: grabbing;
}

.graph-node.frontier {
  fill: #f6ddb1;
}

.graph-node.visited {
  fill: #cde7df;
}

.graph-node.finalized {
  fill: #c1dbf6;
  stroke: #0b3a75;
}

.graph-node.active {
  fill: var(--compare);
}

.graph-node.path {
  fill: var(--sorted);
  stroke: #0f6f4d;
}

.graph-node.start {
  stroke: #072a55;
  stroke-width: 3;
}

.graph-node.end {
  stroke: var(--accent);
  stroke-width: 3;
}

.graph-node-label {
  fill: var(--ink);
  font-size: 17px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.graph-node-distance {
  fill: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
}

.heap-graph-wrap {
  margin-top: 0.8rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(17, 17, 23, 0.88);
  padding: 0.75rem;
}

.heap-graph-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.7rem;
}

.heap-graph-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

#heapGraphHint {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.heap-graph {
  width: 100%;
  margin-top: 0.45rem;
  display: block;
}

.heap-edge {
  stroke: rgba(29, 27, 25, 0.28);
  stroke-width: 2;
}

.heap-node {
  fill: #f7efe4;
  stroke: rgba(29, 27, 25, 0.34);
  stroke-width: 2;
}

.heap-node.compare {
  fill: var(--compare);
}

.heap-node.swap {
  fill: var(--swap);
  stroke: #a23726;
}

.heap-node.root {
  fill: #e0efe9;
}

.heap-label {
  fill: var(--ink);
  font-size: 19px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
}

.bar {
  flex: 1;
  border-radius: 8px 8px 0 0;
  min-width: 4px;
  background: linear-gradient(
    180deg,
    hsl(var(--run-hue) var(--run-sat) calc(var(--run-light-high) + 5%)) 0%,
    hsl(var(--run-hue) var(--run-sat) var(--run-light-low)) 100%
  );
  transition: height 260ms cubic-bezier(0.2, 0.78, 0.24, 1), background-color 190ms ease, transform 180ms ease;
  box-shadow: 0 0 0 rgba(13, 122, 109, 0);
}

.algo-running .bar {
  box-shadow: 0 0 14px rgba(11, 58, 117, var(--run-glow));
}

.bar.compare {
  background: var(--compare);
}

.bar.swap {
  background: var(--swap);
  transform: translateY(-3px);
}

.bar.sorted {
  background: var(--sorted);
}

.bar.found {
  background: var(--found);
}

.bar.pivot {
  background: var(--pivot);
}

.bar.visited {
  background: var(--visited);
}

.bar.in-range {
  outline: 1px solid rgba(18, 132, 163, 0.34);
  outline-offset: -1px;
}

.details p {
  margin: 0.3rem 0;
}

.complexity {
  color: var(--muted);
}

.stats-grid {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.stats-grid div {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.5rem 0.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
}

.code-panel {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.7rem;
}

#pseudocodeList {
  margin: 0.3rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

#pseudocodeList li {
  margin: 0.3rem 0;
  padding: 0.12rem 0.2rem;
  border-radius: 6px;
}

#pseudocodeList li.active {
  color: var(--ink);
  background: rgba(216, 90, 47, 0.14);
}

.hidden {
  display: none;
}

.reveal-target {
  opacity: 0;
  transform: translateY(18px) scale(0.985);
  filter: blur(3px);
  transition:
    opacity 620ms cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 680ms cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 520ms ease;
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal-target.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

.interactive-surface {
  position: relative;
  isolation: isolate;
}

.interactive-surface::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    220px circle at var(--pointer-x, 50%) var(--pointer-y, 50%),
    rgba(255, 255, 255, 0.16),
    rgba(255, 255, 255, 0) 65%
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
  z-index: 1;
}

.interactive-surface:hover::before {
  opacity: 1;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes morphIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.975);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes heroMorph {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
    letter-spacing: 0.01em;
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    letter-spacing: 0;
  }
}

@keyframes backdropShift {
  0% {
    background-position: 0% 0%, 100% 20%, 50% 50%;
  }
  100% {
    background-position: 18% 14%, 84% 26%, 50% 42%;
  }
}

@keyframes floatDrift {
  0% {
    transform: translateY(0) translateX(0) scale(1);
  }
  50% {
    transform: translateY(-16px) translateX(10px) scale(1.05);
  }
  100% {
    transform: translateY(0) translateX(0) scale(1);
  }
}

@keyframes marqueeSlide {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

@keyframes topbarSweep {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(120%);
  }
}

@keyframes chipSweep {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(120%);
  }
}

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

@media (max-width: 1080px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .visualizer-page .app-shell {
    min-height: auto;
  }

  .visualizer-page .layout-grid {
    height: auto;
  }

  .visualizer-page .panel {
    height: auto;
    overflow: visible;
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .school-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .campus-marquee {
    border-radius: 16px;
  }

  .school-topbar-brand {
    width: 100%;
  }

  .school-callout {
    flex-direction: column;
    align-items: flex-start;
  }

  .school-callout-actions {
    width: 100%;
    min-width: 0;
  }

  .school-info-grid,
  .school-showcase-grid {
    grid-template-columns: 1fr;
  }

  .school-brand-row {
    align-items: flex-start;
  }

  .hero-orb {
    opacity: 0.75;
  }

  .compare-control-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compare-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .compare-grid {
    grid-template-columns: 1fr;
  }

  .visual {
    order: -1;
    min-height: 420px;
  }

  .bar-container {
    min-height: 320px;
  }
}

@media (max-width: 700px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .compare-control-grid,
  .compare-actions {
    grid-template-columns: 1fr;
  }

  .school-topbar-links {
    width: 100%;
  }

  .school-topbar-links a {
    flex: 1;
    text-align: center;
  }

  .school-brand-row {
    flex-direction: column;
  }

  .school-motto-strip {
    width: 100%;
    justify-content: center;
    text-align: center;
    border-radius: 12px;
    flex-direction: column;
  }

  .campus-marquee-track {
    gap: 1rem;
  }
}
