:root {
  color-scheme: dark;
  --bg: #030712;
  --surface: #07111f;
  --surface-2: #0d1828;
  --line: rgba(148, 163, 184, 0.18);
  --text: #f8fafc;
  --muted: #94a3b8;
  --mint: #22c55e;
  --mint-2: #86efac;
  --cyan: #38bdf8;
  --coral: #fb7185;
  --amber: #facc15;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.46);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(34, 197, 94, 0.2), transparent 34rem),
    radial-gradient(circle at 84% 18%, rgba(56, 189, 248, 0.09), transparent 28rem),
    linear-gradient(145deg, #030712 0%, #07111f 48%, #050816 100%);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  background: rgba(11, 16, 32, 0.78);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand,
.nav {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand {
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--mint), var(--mint-2));
  color: #02130a;
  letter-spacing: 0;
}

.nav a {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.nav a:hover {
  color: var(--text);
}

main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
}

.hero {
  min-height: calc(100vh - 4.5rem);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(22rem, 0.95fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  padding: 3rem 0 4rem;
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--mint);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 12ch;
  margin-bottom: 1.2rem;
  font-size: clamp(3.15rem, 7vw, 6rem);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0.55rem;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.hero-text {
  max-width: 42rem;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.75;
}

.hero-actions,
.flag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.78rem 1.05rem;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.button.primary {
  background: var(--mint);
  color: #02130a;
  box-shadow: 0 16px 36px rgba(34, 197, 94, 0.24);
}

.button.ghost,
.button.run {
  border-color: var(--line);
  background: rgba(15, 23, 42, 0.82);
  color: var(--text);
}

.button:hover,
.icon-button:hover,
.lab-tab:hover {
  transform: translateY(-1px);
}

.signal-panel {
  position: relative;
  min-height: 31rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 50% 48%, rgba(34, 197, 94, 0.18), transparent 16rem),
    rgba(7, 17, 31, 0.86);
  background-size: 36px 36px, 36px 36px, auto, auto;
  box-shadow: var(--shadow);
}

.room-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.floating-card {
  position: absolute;
  z-index: 2;
  width: min(17rem, calc(100% - 2rem));
  padding: 0.9rem;
  border: 1px solid rgba(34, 197, 94, 0.28);
  border-radius: 8px;
  background: rgba(3, 7, 18, 0.86);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

.top-card {
  top: 1rem;
  left: 1rem;
}

.bottom-card {
  right: 1rem;
  bottom: 5.6rem;
}

.room-icon {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.16);
  color: var(--mint-2);
  font-weight: 900;
}

.room-card strong,
.room-card small {
  display: block;
}

.room-card small {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.dns-ring {
  position: absolute;
  inset: 15%;
  border: 1px dashed rgba(80, 227, 180, 0.36);
  border-radius: 50%;
  animation: spin 22s linear infinite;
}

.ring-two {
  inset: 28%;
  border-color: rgba(244, 200, 91, 0.45);
  animation-duration: 15s;
  animation-direction: reverse;
}

.dns-node {
  position: absolute;
  display: grid;
  place-items: center;
  width: 4.6rem;
  height: 4.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(3, 7, 18, 0.92);
  color: var(--mint);
  font-weight: 900;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.32);
}

.root {
  top: 16%;
  left: 45%;
}

.resolver {
  top: 44%;
  right: 17%;
}

.client {
  left: 16%;
  bottom: 17%;
}

.packet {
  position: absolute;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 3px;
  background: var(--coral);
  box-shadow: 0 0 24px rgba(255, 122, 107, 0.9);
  animation: packetMove 4s ease-in-out infinite;
}

.p1 {
  left: 28%;
  bottom: 31%;
}

.p2 {
  right: 31%;
  top: 33%;
  animation-delay: 0.8s;
  background: var(--mint);
}

.p3 {
  left: 52%;
  top: 54%;
  animation-delay: 1.5s;
  background: var(--amber);
}

.panel-stat {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  gap: 0.25rem;
  min-width: 11rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(3, 7, 18, 0.88);
}

.panel-stat span,
.intro-strip span,
.task-block p,
.lab-description,
.footer {
  color: var(--muted);
}

.panel-stat strong {
  color: var(--mint);
}

.intro-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  margin-bottom: 1.25rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.intro-strip div {
  display: grid;
  gap: 0.25rem;
  padding: 1.1rem;
  background: rgba(7, 17, 31, 0.86);
}

.intro-strip strong {
  font-size: 1.45rem;
}

.workspace {
  display: grid;
  grid-template-columns: 18rem minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  padding: 1rem 0 4rem;
}

.lab-list,
.lab-board,
.scoreboard {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 17, 31, 0.9);
  box-shadow: var(--shadow);
}

.lab-list {
  position: sticky;
  top: 5.5rem;
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(3, 7, 18, 0.76);
}

.lab-tab {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 3.25rem;
  padding: 0.8rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  font-weight: 700;
}

.lab-tab {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
}

.lab-tab b,
.lab-tab small {
  display: block;
  min-width: 0;
}

.lab-tab small {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.lab-tab span {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font-size: 0.82rem;
}

.lab-tab.active {
  border-color: rgba(80, 227, 180, 0.42);
  background: rgba(80, 227, 180, 0.12);
  color: var(--text);
}

.lab-board {
  padding: clamp(1rem, 3vw, 1.5rem);
}

.lab-heading,
.command-header,
.scoreboard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.status-pill {
  flex: 0 0 auto;
  padding: 0.45rem 0.7rem;
  border: 1px solid rgba(255, 122, 107, 0.35);
  border-radius: 999px;
  color: var(--coral);
  font-size: 0.82rem;
  font-weight: 800;
}

.status-pill.solved {
  border-color: rgba(80, 227, 180, 0.35);
  color: var(--mint);
}

.lab-description {
  max-width: 56rem;
  line-height: 1.7;
}

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

.task-block,
.command-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.58);
}

.task-block {
  padding: 1rem;
}

.task-block p {
  margin-bottom: 0;
  line-height: 1.65;
}

.solution-block {
  border-color: rgba(56, 189, 248, 0.28);
}

.platform-submit {
  display: grid;
  align-content: start;
  gap: 0.65rem;
  border-color: rgba(34, 197, 94, 0.34);
  background: rgba(34, 197, 94, 0.08);
}

.platform-note {
  display: grid;
  gap: 0.3rem;
  margin-top: 1.25rem;
  padding: 1rem;
  border: 1px solid rgba(34, 197, 94, 0.28);
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.08);
}

.platform-note span {
  color: var(--muted);
  line-height: 1.55;
}

.interactive-lab {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 0.75fr);
  gap: 1rem;
  margin: 1.25rem 0;
}

.topology-panel,
.action-panel,
.finding-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.58);
}

.topology-panel {
  display: grid;
  grid-template-columns: 1fr 3rem 1fr 3rem 1fr;
  align-items: center;
  gap: 0.75rem;
  min-height: 10rem;
  padding: 1rem;
}

.topology-node {
  display: grid;
  gap: 0.35rem;
  min-height: 6.8rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(3, 7, 18, 0.72);
}

.topology-node span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.topology-node strong {
  align-self: end;
  color: var(--text);
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 0.95rem;
  word-break: break-word;
}

.resolver-node {
  border-color: rgba(34, 197, 94, 0.34);
}

.attacker-node {
  border-color: rgba(251, 113, 133, 0.4);
}

.topology-link {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--mint), transparent);
}

.topology-link.danger {
  background: linear-gradient(90deg, transparent, var(--coral), transparent);
}

.action-panel {
  padding: 1rem;
}

.action-list {
  display: grid;
  gap: 0.6rem;
}

.action-button {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 3rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(3, 7, 18, 0.48);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.action-button span {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.action-button.complete {
  border-color: rgba(34, 197, 94, 0.42);
  background: rgba(34, 197, 94, 0.1);
}

.action-button.complete span {
  background: var(--mint);
  color: #02130a;
}

.finding-panel {
  display: grid;
  gap: 0.25rem;
  margin-top: 1rem;
  padding: 1rem;
  border-color: rgba(56, 189, 248, 0.28);
}

.finding-panel strong {
  color: var(--text);
  line-height: 1.55;
}

.command-box {
  overflow: hidden;
}

.command-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.icon-button {
  min-height: 2rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

code,
.output {
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
}

#labCommand {
  display: block;
  padding: 1rem;
  color: #d7e6ff;
}

.button.run {
  margin: 0 1rem 1rem;
}

.output {
  min-height: 8rem;
  padding: 1rem;
  border-top: 1px solid var(--line);
  background: #060c16;
  color: #bbf7d0;
  line-height: 1.6;
}

.scoreboard {
  margin-bottom: 3rem;
  padding: 1.25rem;
}

.score-items {
  display: grid;
  grid-template-columns: repeat(4, minmax(7rem, 1fr));
  gap: 0.75rem;
}

.score-card {
  min-height: 5.8rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.58);
}

.score-card strong {
  display: block;
  margin-bottom: 0.45rem;
}

.score-card span {
  color: var(--muted);
  font-size: 0.88rem;
}

.score-card.done {
  border-color: rgba(80, 227, 180, 0.42);
  background: rgba(80, 227, 180, 0.1);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes packetMove {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(4.5rem, -3.2rem, 0) scale(1.2);
  }
}

@media (max-width: 900px) {
  .hero,
  .workspace,
  .interactive-lab {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  h1 {
    max-width: 12ch;
  }

  .lab-list {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .score-items {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    width: 100%;
    justify-content: space-between;
  }

  h1 {
    font-size: 3.1rem;
  }

  .signal-panel {
    min-height: 24rem;
  }

  .intro-strip,
  .task-grid,
  .lab-list,
  .score-items,
  .topology-panel {
    grid-template-columns: 1fr;
  }

  .topology-link {
    width: 2px;
    height: 2.5rem;
    justify-self: center;
    background: linear-gradient(180deg, transparent, var(--mint), transparent);
  }

  .topology-link.danger {
    background: linear-gradient(180deg, transparent, var(--coral), transparent);
  }

  .lab-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
