:root {
  --bg: #050816;
  --panel: rgba(11, 18, 39, 0.86);
  --panel-strong: rgba(14, 24, 52, 0.96);
  --line: rgba(102, 217, 255, 0.28);
  --text: #f3fbff;
  --muted: #9cb5d9;
  --blue: #2fb8ff;
  --green: #5df7c5;
  --purple: #9c7bff;
  --danger: #ff6ca8;
  --warning: #ffc96c;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --page-pad: clamp(14px, 2.4vw, 24px);
  --panel-pad: clamp(18px, 3vw, 30px);
  --gap: clamp(12px, 2vw, 22px);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Verdana, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(47, 184, 255, 0.18), transparent 30%),
    radial-gradient(circle at 82% 16%, rgba(156, 123, 255, 0.16), transparent 28%),
    radial-gradient(circle at 30% 88%, rgba(93, 247, 197, 0.12), transparent 26%),
    linear-gradient(180deg, #030510 0%, #071024 56%, #040811 100%);
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

.background-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(132, 214, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(132, 214, 255, 0.08) 1px, transparent 1px);
  background-size: 42px 42px;
  opacity: 0.55;
  transform: perspective(900px) rotateX(75deg) translateY(-12%);
  transform-origin: top center;
  animation: gridDrift 14s linear infinite;
  pointer-events: none;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: var(--page-pad);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.utility-bar,
.utility-actions,
.home-actions,
.result-actions,
.leaderboard-actions,
.order-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.utility-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  justify-content: stretch;
  min-width: 0;
}

.utility-actions {
  grid-column: 3;
  justify-content: flex-end;
}

.brand-chip {
  grid-column: 2;
  justify-self: center;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(8, 22, 46, 0.82);
  border: 1px solid rgba(93, 247, 197, 0.32);
  color: #dbfffa;
  font-family: "Franklin Gothic Medium", "Trebuchet MS", sans-serif;
  text-transform: uppercase;
}

.main-stage {
  flex: 1;
  display: flex;
  min-width: 0;
}

.screen {
  display: none;
  width: 100%;
  min-width: 0;
  animation: screenFade 0.25s ease;
}

.screen.active {
  display: block;
}

.glass-panel,
.modal-content {
  background: linear-gradient(180deg, rgba(12, 21, 45, 0.92), rgba(9, 15, 33, 0.8));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
  gap: var(--gap);
}

.hero-copy,
.hero-visual,
.instructions-card,
.summary-card,
.promo-card,
.leaderboard-layout {
  padding: var(--panel-pad);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

.eyebrow {
  margin: 0;
  color: #9bfbe6;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.82rem;
}

.home-title,
.mission-title {
  margin: 0;
  font-family: "Franklin Gothic Medium", "Trebuchet MS", sans-serif;
  line-height: 1.06;
}

.home-title {
  font-size: clamp(2.25rem, 5vw, 4.1rem);
}

.mission-title {
  font-size: clamp(1.5rem, 2.6vw, 2.25rem);
}

.home-subtitle,
.promo-note,
.leaderboard-subtitle,
.result-message,
.mission-question {
  margin: 0;
  color: #d3e6ff;
  line-height: 1.58;
  overflow-wrap: anywhere;
}

.name-panel {
  display: grid;
  gap: 10px;
  max-width: 560px;
}

.name-input {
  width: 100%;
  min-height: 58px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid rgba(146, 215, 255, 0.24);
  background: rgba(7, 17, 36, 0.9);
  color: var(--text);
  font-size: 1.08rem;
}

.name-input::placeholder {
  color: #8da7cb;
}

.button {
  min-height: 52px;
  padding: 13px 20px;
  max-width: 100%;
  border-radius: 12px;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.button-primary {
  background: linear-gradient(135deg, rgba(24, 145, 255, 0.96), rgba(29, 227, 158, 0.9));
  box-shadow: 0 14px 30px rgba(24, 145, 255, 0.28);
}

.button-secondary {
  background: rgba(20, 37, 72, 0.92);
  border: 1px solid rgba(93, 247, 197, 0.24);
}

.button-subtle {
  background: rgba(10, 20, 43, 0.72);
  border: 1px solid rgba(146, 215, 255, 0.2);
}

.message {
  min-height: 24px;
  margin: 0;
  font-weight: 700;
  color: var(--muted);
}

.message.error {
  color: #ff9cc6;
}

.message.success {
  color: #9bfbe6;
}

.message.helper {
  color: #bfd3f0;
}

.hero-visual {
  display: grid;
  gap: 18px;
  align-content: center;
}

.academy-preview {
  position: relative;
  min-height: 330px;
  border-radius: 14px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(47, 184, 255, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(47, 184, 255, 0.08) 1px, transparent 1px),
    rgba(4, 10, 24, 0.84);
  background-size: 34px 34px;
  border: 1px solid rgba(146, 215, 255, 0.18);
}

.preview-room,
.preview-path,
.preview-hero,
.preview-server {
  position: absolute;
  display: block;
}

.preview-room {
  border: 2px solid rgba(93, 247, 197, 0.36);
  background: rgba(15, 35, 72, 0.74);
}

.room-a { left: 30px; top: 36px; width: 130px; height: 110px; }
.room-b { left: 220px; top: 58px; width: 150px; height: 110px; }
.room-c { right: 42px; bottom: 38px; width: 150px; height: 120px; }

.preview-path {
  left: 100px;
  top: 130px;
  width: 290px;
  height: 130px;
  border-top: 10px solid rgba(47, 184, 255, 0.55);
  border-right: 10px solid rgba(47, 184, 255, 0.55);
  box-shadow: 0 0 18px rgba(47, 184, 255, 0.45);
}

.preview-hero {
  left: 92px;
  top: 100px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 24px rgba(93, 247, 197, 0.8);
}

.preview-server {
  right: 86px;
  bottom: 70px;
  width: 56px;
  height: 84px;
  border-radius: 8px;
  background: repeating-linear-gradient(180deg, #102144 0 16px, #5df7c5 17px 20px);
  border: 1px solid rgba(146, 215, 255, 0.28);
}

.feature-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.mini-card,
.instruction-item,
.status-chip,
.objective-box,
.summary-item,
.promo-pill {
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(133, 225, 255, 0.16);
}

.mini-card {
  text-align: center;
}

.mini-card__value {
  display: block;
  font-size: 1.55rem;
  font-weight: 900;
  color: #9bfbe6;
}

.mini-card__label {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.instructions-card {
  width: min(820px, 100%);
  margin: 8vh auto 0;
  display: grid;
  gap: 20px;
}

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

.instruction-item {
  display: grid;
  gap: 8px;
}

.instruction-item span {
  color: #d3e6ff;
  line-height: 1.45;
}

.win-guide,
.defeat-tips {
  padding: 16px 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(93, 247, 197, 0.18);
}

.win-guide h3,
.defeat-tips h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.win-guide ul,
.defeat-tips ul {
  margin: 0;
  padding-left: 20px;
  color: #d3e6ff;
  line-height: 1.55;
}

.mobile-instruction {
  display: none;
}

.show-mobile-controls .desktop-instruction {
  display: none;
}

.show-mobile-controls .mobile-instruction {
  display: grid;
}

.touch-device .desktop-instruction {
  display: none;
}

.touch-device .mobile-instruction {
  display: grid;
}

.game-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.map-hud,
.map-panel {
  padding: 16px;
  min-width: 0;
}

.map-panel {
  overflow: hidden;
}

.hud-toggle-btn {
  display: none;
}

.status-row {
  display: grid;
  gap: 10px;
}

.status-chip {
  min-height: 74px;
}

.status-chip span,
.objective-box span {
  display: block;
  margin-bottom: 7px;
  font-size: 0.82rem;
  color: var(--muted);
}

.status-chip strong,
.objective-box strong {
  color: #f7fdff;
  line-height: 1.35;
}

.objective-box {
  margin: 12px 0;
}

.route-tracker {
  display: grid;
  gap: 8px;
}

.route-step {
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(146, 215, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: #b9cae6;
  font-size: 0.86rem;
  font-weight: 800;
}

.route-step.completed {
  color: #bffff1;
  border-color: rgba(93, 247, 197, 0.56);
  box-shadow: 0 0 18px rgba(93, 247, 197, 0.16);
}

.route-step.current {
  color: #ffffff;
  border-color: rgba(47, 184, 255, 0.78);
  background: rgba(47, 184, 255, 0.2);
  box-shadow: 0 0 18px rgba(47, 184, 255, 0.22);
}

.route-step.locked {
  opacity: 0.52;
}

.map-viewport {
  position: relative;
  width: min(100%, 900px);
  max-width: 900px;
  height: 520px;
  overflow: hidden;
  margin: 0 auto;
  border-radius: 12px;
  background: rgba(6, 16, 38, 0.98);
}

.academy-map {
  position: absolute;
  left: 0;
  top: 0;
  width: 900px;
  height: 520px;
  border: 2px solid rgba(146, 215, 255, 0.22);
  background:
    linear-gradient(90deg, rgba(47, 184, 255, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(47, 184, 255, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(6, 16, 38, 0.98), rgba(4, 9, 22, 0.98));
  background-size: 30px 30px;
  transform-origin: top left;
  will-change: transform;
  contain: layout paint;
}

#map-layers,
.wall,
.door,
.choice-door,
.interactable,
.collectible-key,
.virus,
.glow-path,
.room-label,
.player-avatar,
.interaction-prompt,
.objective-marker {
  position: absolute;
}

#map-layers {
  inset: 0;
}

.room-label {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12px;
  border-radius: 10px;
  color: rgba(218, 238, 255, 0.72);
  font-size: 0.86rem;
  font-weight: 800;
  border: 1px solid rgba(146, 215, 255, 0.12);
  background: rgba(17, 34, 68, 0.26);
  pointer-events: none;
}

.wall {
  border-radius: 4px;
  background: linear-gradient(180deg, #1f3567, #101d3e);
  border: 1px solid rgba(146, 215, 255, 0.18);
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.28);
}

.door {
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 900;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.door.locked {
  background: rgba(255, 108, 168, 0.58);
  border: 1px solid rgba(255, 108, 168, 0.9);
  color: #fff2f8;
  box-shadow: 0 0 18px rgba(255, 108, 168, 0.34);
}

.door.unlocked {
  background: rgba(93, 247, 197, 0.18);
  border: 1px solid rgba(93, 247, 197, 0.58);
  color: #cffff6;
}

.choice-door {
  display: grid;
  place-items: center;
  z-index: 2;
  border-radius: 9px;
  background: rgba(13, 25, 52, 0.9);
  border: 1px solid rgba(255, 201, 108, 0.46);
  color: #fff1c8;
  font-size: 0.72rem;
  font-weight: 900;
  box-shadow: 0 0 14px rgba(255, 201, 108, 0.18);
}

.choice-door.completed-objective {
  border-color: rgba(93, 247, 197, 0.75);
  color: #cffff6;
  box-shadow: 0 0 20px rgba(93, 247, 197, 0.26);
}

.bonus-interactable {
  border-color: rgba(255, 201, 108, 0.72);
}

.bonus-interactable span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 201, 108, 0.2);
  color: #fff2c6;
}

.glow-path {
  border-radius: 999px;
  background: rgba(47, 184, 255, 0.32);
  box-shadow: 0 0 20px rgba(47, 184, 255, 0.45);
  pointer-events: none;
}

.interactable {
  display: grid;
  place-items: center;
  padding: 4px;
  border-radius: 12px;
  background: linear-gradient(180deg, #142854, #071126);
  border: 1px solid rgba(146, 215, 255, 0.32);
  box-shadow: inset 0 -12px 0 rgba(0, 0, 0, 0.2);
}

.interactable span {
  width: 28px;
  height: 16px;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--blue), var(--green));
  box-shadow: 0 0 14px rgba(93, 247, 197, 0.7);
}

.interactable strong {
  max-width: 90px;
  color: #e9f6ff;
  font-size: 0.58rem;
  line-height: 1.1;
  text-align: center;
}

.current-objective {
  border-color: rgba(47, 184, 255, 0.9);
  animation: objectivePulse 1s ease-in-out infinite;
}

.completed-objective {
  border-color: rgba(93, 247, 197, 0.78);
}

.server-console {
  background: linear-gradient(180deg, #132b47, #071126);
}

.collectible-key {
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff6cc;
  background: rgba(255, 201, 108, 0.2);
  border: 1px solid rgba(255, 201, 108, 0.72);
  box-shadow: 0 0 18px rgba(255, 201, 108, 0.66);
  animation: keyPulse 1.2s ease-in-out infinite;
}

.virus {
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
  background: radial-gradient(circle, #ff8ab8, #e51f6a);
  border: 2px solid rgba(255, 210, 228, 0.75);
  box-shadow: 0 0 20px rgba(255, 108, 168, 0.48);
}

.player-avatar {
  width: 32px;
  height: 32px;
  z-index: 5;
  transition: filter 0.1s ease;
}

.player-label {
  position: absolute;
  left: 50%;
  bottom: 36px;
  transform: translateX(-50%);
  min-width: 60px;
  color: #eaf8ff;
  font-size: 0.68rem;
  font-weight: 900;
  text-align: center;
  text-shadow: 0 2px 6px #000;
  pointer-events: none;
}

.player-head,
.player-body,
.player-pack {
  position: absolute;
  display: block;
}

.player-head {
  left: 9px;
  top: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f7d6b0;
  border: 2px solid #dff8ff;
  box-shadow: 0 0 14px rgba(93, 247, 197, 0.68);
}

.player-body {
  left: 6px;
  top: 13px;
  width: 20px;
  height: 19px;
  border-radius: 8px 8px 10px 10px;
  background: linear-gradient(180deg, #2fb8ff, #1b5bc9);
  border: 2px solid rgba(223, 248, 255, 0.82);
}

.player-pack {
  right: 0;
  top: 15px;
  width: 9px;
  height: 13px;
  border-radius: 5px;
  background: var(--green);
  box-shadow: 0 0 10px rgba(93, 247, 197, 0.8);
}

.player-avatar.hit {
  filter: drop-shadow(0 0 10px var(--danger));
  animation: hitFlash 0.2s ease 4;
}

.interaction-prompt {
  z-index: 8;
  transform: translate(-50%, -100%);
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(3, 9, 20, 0.92);
  border: 1px solid rgba(93, 247, 197, 0.62);
  color: #cffff6;
  font-weight: 900;
  box-shadow: 0 0 20px rgba(93, 247, 197, 0.22);
  pointer-events: none;
}

.objective-marker {
  z-index: 4;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 18px solid var(--warning);
  filter: drop-shadow(0 0 10px rgba(255, 201, 108, 0.75));
  animation: markerBounce 0.8s ease-in-out infinite;
}

.toast-area {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.toast-message {
  max-width: 320px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(7, 16, 34, 0.96);
  border: 1px solid rgba(146, 215, 255, 0.22);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.36);
  font-weight: 800;
  animation: toastIn 0.2s ease;
}

.toast-message.success {
  border-color: rgba(93, 247, 197, 0.65);
  color: #cffff6;
}

.toast-message.error {
  border-color: rgba(255, 108, 168, 0.65);
  color: #ffd8e8;
}

.mission-modal {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--page-pad);
  background: rgba(2, 6, 18, 0.78);
  backdrop-filter: blur(8px);
  overflow: hidden;
}

.mission-modal[hidden] {
  display: none;
}

.modal-content {
  width: min(980px, 100%);
  max-height: min(860px, calc(100dvh - (var(--page-pad) * 2)));
  margin: 0;
  overflow-y: auto;
  padding: var(--panel-pad);
  display: grid;
  gap: 16px;
  overscroll-behavior: contain;
}

.interaction-area {
  display: grid;
  gap: 14px;
}

.access-card-grid,
.email-grid,
.network-devices,
.terminal-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.access-card,
.email-card,
.network-device,
.terminal-command,
.switch-control,
.network-slot {
  border-radius: 12px;
  background: rgba(15, 28, 57, 0.94);
  border: 1px solid rgba(146, 215, 255, 0.18);
  color: var(--text);
  text-align: left;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.access-card,
.email-card,
.network-device,
.terminal-command,
.switch-control {
  cursor: pointer;
}

.access-card:hover,
.email-card:hover,
.network-device:hover,
.terminal-command:hover,
.switch-control:hover {
  transform: translateY(-1px);
  border-color: rgba(113, 241, 255, 0.46);
  box-shadow: 0 12px 28px rgba(17, 61, 118, 0.35);
}

.access-card {
  min-height: 118px;
  padding: 18px;
  display: grid;
  gap: 8px;
}

.access-card__chip {
  width: 38px;
  height: 26px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--warning), #ffe4a6);
}

.access-card small,
.email-card span {
  color: var(--muted);
}

.email-card {
  min-height: 132px;
  padding: 16px;
  display: grid;
  gap: 8px;
}

.email-card__from {
  font-size: 0.84rem;
}

.network-builder,
.switch-panel,
.terminal-panel {
  display: grid;
  gap: 14px;
}

.network-slots {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.network-slot {
  min-height: 82px;
  padding: 12px;
  display: grid;
  align-content: center;
  gap: 8px;
}

.network-slot span {
  color: var(--muted);
  font-size: 0.84rem;
}

.network-slot.filled {
  border-color: rgba(47, 184, 255, 0.48);
}

.network-slot.correct,
.is-correct {
  border-color: rgba(93, 247, 197, 0.72);
  background: rgba(10, 60, 53, 0.46);
}

.network-slot.incorrect,
.is-incorrect {
  border-color: rgba(255, 108, 168, 0.72);
  background: rgba(71, 13, 43, 0.44);
}

.network-device {
  min-height: 92px;
  padding: 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
}

.device-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(47, 184, 255, 0.14);
  color: #9bfbe6;
  font-size: 1.3rem;
}

.switch-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.switch-control {
  min-height: 98px;
  padding: 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
}

.switch-track {
  width: 76px;
  height: 38px;
  border-radius: 999px;
  background: rgba(255, 108, 168, 0.32);
  border: 1px solid rgba(255, 108, 168, 0.34);
  padding: 4px;
}

.switch-thumb {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff2f8;
  transition: transform 0.18s ease;
}

.switch-control.on {
  border-color: rgba(93, 247, 197, 0.58);
}

.switch-control.on .switch-track {
  background: rgba(93, 247, 197, 0.42);
  border-color: rgba(93, 247, 197, 0.55);
}

.switch-control.on .switch-thumb {
  transform: translateX(38px);
}

.terminal-panel {
  padding: 16px;
  border-radius: 12px;
  background: rgba(1, 6, 18, 0.94);
  border: 1px solid rgba(93, 247, 197, 0.24);
}

.terminal-panel pre {
  margin: 0;
  padding: 16px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.34);
  color: #c8fff1;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.6;
  white-space: pre-wrap;
}

.terminal-panel p {
  margin: 0;
  color: #e8f3ff;
  line-height: 1.5;
}

.terminal-command {
  min-height: 70px;
  padding: 14px 16px;
  font-weight: 800;
}

.file-grid,
.cable-panel {
  display: grid;
  gap: 12px;
}

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

.file-card,
.cable-card {
  min-height: 78px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(15, 28, 57, 0.94);
  border: 1px solid rgba(146, 215, 255, 0.18);
  color: var(--text);
  text-align: left;
  font-weight: 800;
  cursor: pointer;
}

.file-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-right: 10px;
  border-radius: 8px;
  background: rgba(47, 184, 255, 0.16);
  color: #9bfbe6;
}

.cable-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.cable-card.selected {
  border-color: rgba(255, 201, 108, 0.78);
  box-shadow: 0 0 18px rgba(255, 201, 108, 0.24);
}

.cable-blue { border-color: rgba(47, 184, 255, 0.52); }
.cable-green { border-color: rgba(93, 247, 197, 0.52); }
.cable-red { border-color: rgba(255, 108, 168, 0.52); }

.cable-result {
  padding: 12px;
  border-radius: 12px;
  color: #d3e6ff;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(146, 215, 255, 0.16);
}

.is-locked {
  cursor: default;
}

.feedback-panel {
  padding: 16px 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(129, 215, 255, 0.16);
  display: grid;
  gap: 8px;
}

.feedback-panel.correct {
  border-color: rgba(93, 247, 197, 0.55);
}

.feedback-panel.incorrect {
  border-color: rgba(255, 108, 168, 0.55);
}

.feedback-badge,
.feedback-text,
.feedback-note {
  margin: 0;
  line-height: 1.55;
}

.feedback-badge {
  font-weight: 900;
}

.feedback-note {
  color: #d0ddf8;
}

.mission-footer {
  display: flex;
  justify-content: flex-end;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.summary-card,
.promo-card {
  position: relative;
  overflow: hidden;
}

.final-badge {
  width: fit-content;
  margin: 18px 0 8px;
  padding: 16px 22px;
  border-radius: 12px;
  font-weight: 900;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.badge-blue { background: rgba(47, 184, 255, 0.25); box-shadow: 0 0 24px rgba(47, 184, 255, 0.24); }
.badge-green { background: rgba(93, 247, 197, 0.24); box-shadow: 0 0 24px rgba(93, 247, 197, 0.24); }
.badge-purple { background: rgba(156, 123, 255, 0.28); box-shadow: 0 0 24px rgba(156, 123, 255, 0.26); }
.badge-gold { background: rgba(255, 201, 108, 0.28); box-shadow: 0 0 28px rgba(255, 201, 108, 0.36); color: #fff8dc; }

.summary-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.summary-item__label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.summary-item__value {
  display: block;
  font-weight: 900;
}

.reward-qr-section {
  margin-top: 18px;
}

.reward-ticket {
  padding: 18px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(47, 184, 255, 0.14), rgba(93, 247, 197, 0.1)),
    rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(93, 247, 197, 0.5);
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
}

.reward-ticket h3 {
  margin: 0;
  font-size: 1.2rem;
}

.qr-box {
  width: min(260px, 100%);
  aspect-ratio: 1;
  padding: 10px;
  border-radius: 14px;
  background: #ffffff;
  display: grid;
  place-items: center;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.3);
}

.qr-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.claim-code {
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(4, 10, 24, 0.72);
  color: #9bfbe6;
  font-weight: 900;
  letter-spacing: 0.08em;
  overflow-wrap: anywhere;
}

.reward-status {
  margin: 0;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 900;
}

.reward-status.eligible {
  color: #04150f;
  background: #5df7c5;
}

.reward-status.not-eligible {
  color: #fff4fb;
  background: rgba(255, 108, 168, 0.38);
  border: 1px solid rgba(255, 108, 168, 0.44);
}

.reward-status.claimed {
  color: #211502;
  background: #ffc96c;
}

.reward-instruction {
  margin: 0;
  color: #d3e6ff;
  line-height: 1.55;
}

.promo-card__title {
  margin: 0 0 16px;
  font-size: 1.3rem;
}

.promo-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.promo-pill {
  min-height: 58px;
  display: flex;
  align-items: center;
  line-height: 1.4;
}

.final-slogan {
  margin: 20px 0 24px;
  font-size: 1.16rem;
  color: #9bfbe6;
  font-weight: 900;
}

.leaderboard-layout {
  display: grid;
  gap: 18px;
}

.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.table-shell {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid rgba(146, 215, 255, 0.18);
  background: rgba(5, 11, 24, 0.56);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 14px;
  text-align: left;
}

.leaderboard-table thead th {
  color: #b4cae8;
  background: rgba(10, 18, 35, 0.92);
}

.leaderboard-table tbody td {
  border-top: 1px solid rgba(146, 215, 255, 0.1);
}

.leaderboard-table tbody tr.place-1 {
  background: linear-gradient(90deg, rgba(255, 201, 108, 0.18), rgba(255, 255, 255, 0.03));
}

.leaderboard-table tbody tr.place-2 {
  background: linear-gradient(90deg, rgba(195, 208, 224, 0.18), rgba(255, 255, 255, 0.03));
}

.leaderboard-table tbody tr.place-3 {
  background: linear-gradient(90deg, rgba(156, 123, 255, 0.15), rgba(255, 255, 255, 0.03));
}

.rank-badge {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  min-height: 34px;
  margin-right: 8px;
  border-radius: 10px;
  background: rgba(10, 20, 43, 0.9);
  border: 1px solid rgba(146, 215, 255, 0.18);
  font-weight: 900;
}

.rank-1 { background: rgba(255, 201, 108, 0.32); }
.rank-2 { background: rgba(202, 218, 235, 0.28); }
.rank-3 { background: rgba(156, 123, 255, 0.28); }

.top-rank-label {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(93, 247, 197, 0.12);
  color: #bffff1;
  font-size: 0.82rem;
  font-weight: 900;
}

.empty-state {
  padding: 24px;
  border-radius: 12px;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(146, 215, 255, 0.22);
  color: #d7e8ff;
}

.admin-row {
  text-align: center;
}

.admin-link {
  background: none;
  color: rgba(198, 214, 238, 0.72);
  text-decoration: underline;
  cursor: pointer;
}

.confetti-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 12px;
  height: 22px;
  border-radius: 6px;
  opacity: 0;
  background: var(--piece-color, #2fb8ff);
  left: var(--piece-left, 50%);
  transform: rotate(var(--piece-rotate, 0deg));
  animation: confettiFall 2.8s linear forwards;
}

.noscript-box {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(82, 18, 42, 0.94);
  border: 1px solid rgba(255, 108, 168, 0.38);
  color: #fff1f7;
  z-index: 40;
}

.mobile-controls {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 18;
  display: none;
  justify-content: space-between;
  align-items: end;
  pointer-events: none;
}

.show-mobile-controls .mobile-controls {
  display: flex;
}

.mobile-map-mode {
  overflow: hidden;
  padding-bottom: 0;
}

.mobile-map-mode .background-grid {
  display: none;
}

.mobile-map-mode .app-shell {
  min-height: 100dvh;
  padding: 0;
}

.mobile-map-mode .utility-bar {
  display: none;
}

.mobile-map-mode .main-stage,
.mobile-map-mode #screen-game,
.mobile-map-mode .game-layout {
  min-height: 100dvh;
}

.mobile-map-mode .game-layout {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: block;
  background:
    radial-gradient(circle at 50% 50%, rgba(47, 184, 255, 0.14), transparent 48%),
    #020714;
}

.mobile-map-mode .map-panel {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 64px 6px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.mobile-map-mode.hud-collapsed .map-panel {
  padding-top: 8px;
}

.mobile-map-mode .map-hud {
  position: fixed;
  left: 8px;
  right: 8px;
  top: 8px;
  z-index: 19;
  padding: 8px;
  border-radius: 12px;
  background: rgba(5, 14, 32, 0.9);
  backdrop-filter: blur(10px);
}

.mobile-map-mode.hud-collapsed .map-hud {
  display: none;
}

.mobile-map-mode .hud-toggle-btn {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 24;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(146, 215, 255, 0.36);
  background: rgba(5, 14, 32, 0.88);
  color: #eaffff;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
}

.mobile-map-mode .status-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.mobile-map-mode .status-chip {
  min-height: 0;
  padding: 6px 7px;
}

.mobile-map-mode .status-chip span {
  margin-bottom: 2px;
  font-size: 0.64rem;
}

.mobile-map-mode .status-chip strong {
  font-size: 0.76rem;
  line-height: 1.15;
}

.mobile-map-mode .objective-box,
.mobile-map-mode .route-tracker,
.mobile-map-mode #map-message {
  display: none;
}

.mobile-map-mode .map-viewport {
  margin: 0 auto;
  border-radius: 12px;
  contain: strict;
  transform: translateZ(0);
}

.mobile-map-mode .toast-area {
  left: 10px;
  right: 10px;
  bottom: 96px;
  justify-items: center;
}

.mobile-map-mode .toast-message {
  max-width: min(420px, calc(100vw - 20px));
}

.mobile-map-mode .mobile-controls {
  display: flex;
  z-index: 22;
}

.mobile-map-mode .mission-modal {
  z-index: 30;
  padding: 10px;
  background: rgba(2, 6, 18, 0.62);
}

.mobile-map-mode .current-objective,
.mobile-map-mode .collectible-key,
.mobile-map-mode .objective-marker {
  animation: none;
}

.mobile-map-mode .glow-path,
.mobile-map-mode .current-objective,
.mobile-map-mode .collectible-key,
.mobile-map-mode .virus {
  box-shadow: none;
}

.mobile-map-mode .modal-content {
  width: min(96vw, 760px);
  max-height: calc(100dvh - 20px);
  scroll-padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

.mobile-map-mode .mission-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(9, 15, 33, 0), rgba(9, 15, 33, 0.96) 42%);
}

.joystick-pad {
  position: relative;
  width: 154px;
  height: 154px;
  border-radius: 50%;
  border: 1px solid rgba(146, 215, 255, 0.32);
  background:
    radial-gradient(circle at 50% 50%, rgba(93, 247, 197, 0.16), transparent 34%),
    rgba(8, 19, 42, 0.7);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.joystick-pad::before,
.joystick-pad::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72%;
  height: 1px;
  background: rgba(211, 230, 255, 0.18);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.joystick-pad::after {
  width: 1px;
  height: 72%;
}

.joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 1px solid rgba(234, 255, 255, 0.44);
  background: linear-gradient(135deg, rgba(47, 184, 255, 0.96), rgba(93, 247, 197, 0.9));
  box-shadow: 0 12px 26px rgba(47, 184, 255, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.24);
  transform: translate(-50%, -50%);
  transition: transform 0.08s ease-out;
  pointer-events: none;
}

.joystick-pad:active .joystick-knob {
  transition: none;
}

.action-button {
  border-radius: 16px;
  border: 1px solid rgba(146, 215, 255, 0.35);
  background: rgba(8, 19, 42, 0.88);
  color: #eaffff;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.action-button:active {
  background: rgba(47, 184, 255, 0.56);
}

.action-button {
  min-width: 118px;
  min-height: 78px;
  padding: 16px;
  pointer-events: auto;
  background: linear-gradient(135deg, rgba(24, 145, 255, 0.92), rgba(29, 227, 158, 0.86));
}

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

.event-mode .app-shell {
  padding: 10px;
}

.event-mode .button {
  min-height: 60px;
  font-size: 1.06rem;
}

.event-mode .game-layout {
  grid-template-columns: 245px minmax(0, 1fr);
}

:focus-visible {
  outline: 3px solid #9bfbe6;
  outline-offset: 3px;
}

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

@keyframes gridDrift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 42px, 42px 0; }
}

@keyframes objectivePulse {
  0%, 100% { box-shadow: 0 0 16px rgba(47, 184, 255, 0.34); }
  50% { box-shadow: 0 0 30px rgba(47, 184, 255, 0.82); }
}

@keyframes keyPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.14); }
}

@keyframes markerBounce {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -8px); }
}

@keyframes hitFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

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

@keyframes confettiFall {
  0% { opacity: 0; transform: translateY(-30px) rotate(0deg); }
  10% { opacity: 1; }
  100% { opacity: 0; transform: translateY(360px) rotate(300deg); }
}

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

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

  .route-tracker {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .hero-layout,
  .result-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 920px) {
  .instruction-grid,
  .status-row,
  .network-slots {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .access-card-grid,
  .email-grid,
  .network-devices,
  .terminal-buttons,
  .switch-list,
  .promo-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  body {
    padding-bottom: 0;
  }

  .show-mobile-controls {
    padding-bottom: 190px;
  }

  .mobile-map-mode.show-mobile-controls {
    padding-bottom: 0;
  }

  .modal-content {
    max-height: 85vh;
    overflow-y: auto;
  }

  .leaderboard-table {
    min-width: 680px;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: var(--page-pad);
  }

  .leaderboard-header {
    align-items: stretch;
    flex-direction: column;
  }

  .utility-bar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .brand-chip,
  .utility-actions {
    grid-column: 1;
  }

  .utility-actions,
  .home-actions,
  .result-actions,
  .leaderboard-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .feature-cards,
  .instruction-grid,
  .status-row,
  .route-tracker,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy,
  .hero-visual,
  .instructions-card,
  .summary-card,
  .promo-card,
  .leaderboard-layout,
  .modal-content {
    padding: var(--panel-pad);
  }

  .home-title {
    font-size: 2.25rem;
  }

  .mission-modal {
    align-items: stretch;
  }

  .modal-content {
    width: 100%;
  }

}

@media (max-width: 600px) {
  .app-shell {
    min-height: auto;
  }

  .glass-panel,
  .modal-content {
    border-radius: 12px;
  }

  .status-chip {
    min-height: auto;
    padding: 10px;
  }

  .route-tracker {
    display: flex;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .route-step {
    min-width: 118px;
  }

  .joystick-pad {
    width: 138px;
    height: 138px;
  }

  .joystick-knob {
    width: 60px;
    height: 60px;
  }

  .action-button {
    min-width: 104px;
    min-height: 70px;
    padding: 12px;
  }

  .reward-ticket {
    padding: 14px;
  }

  .qr-box {
    width: min(230px, 100%);
  }

  .mobile-controls {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }

  .file-grid,
  .cable-list {
    grid-template-columns: 1fr;
  }

  .leaderboard-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 10px;
  }

  .leaderboard-table thead {
    display: none;
  }

  .leaderboard-table,
  .leaderboard-table tbody,
  .leaderboard-table tr,
  .leaderboard-table td {
    display: block;
    width: 100%;
  }

  .leaderboard-table tbody tr {
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(146, 215, 255, 0.16);
  }

  .leaderboard-table td {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 0;
    border-top: 0;
    text-align: right;
  }

  .leaderboard-table td::before {
    color: var(--muted);
    font-weight: 800;
    text-align: left;
  }

  .leaderboard-table td:nth-child(1)::before { content: "Място"; }
  .leaderboard-table td:nth-child(2)::before { content: "Име"; }
  .leaderboard-table td:nth-child(3)::before { content: "Точки"; }
  .leaderboard-table td:nth-child(4)::before { content: "Време"; }
  .leaderboard-table td:nth-child(5)::before { content: "Титла"; }
  .leaderboard-table td:nth-child(6)::before { content: "Дата"; }

  .top-rank-label {
    display: none;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  .mobile-map-mode .map-panel {
    padding: 52px 6px 6px;
  }

  .mobile-map-mode.hud-collapsed .map-panel {
    padding-top: 6px;
  }

  .mobile-map-mode .status-row {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .mobile-controls {
    bottom: 8px;
  }

  .joystick-pad {
    transform: scale(0.86);
    transform-origin: bottom left;
  }

  .action-button {
    transform: scale(0.9);
    transform-origin: bottom right;
  }
}
