:root {
  --bg: #1e1f22;
  --sidebar: #232428;
  --panel: #2b2d31;
  --panel-hover: #313338;
  --input: #1e1f22;
  --border: #3f4147;
  --text: #f2f3f5;
  --muted: #a1a5ad;
  --subtle: #6d717a;
  --accent: #d5d7dc;
  --green: #57b879;
  --yellow: #d6b45d;
  --red: #d46b6b;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 Arial, Helvetica, sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid #b7bac2;
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 10;
  transition: transform .2s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #393b41;
  border: 1px solid #555861;
  color: white;
  font-size: 22px;
  font-weight: 800;
}

.brand strong {
  display: block;
  font-size: 17px;
  letter-spacing: 2px;
}

.brand small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 1.2px;
}

.case-card {
  margin: 18px 13px 10px;
  padding: 14px;
  border: 1px solid var(--border);
  background: #292b30;
  border-radius: 7px;
}

.case-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.case-card small {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 1px;
}

.case-card strong {
  display: block;
  margin: 10px 0 4px;
  font-family: Consolas, monospace;
  font-size: 16px;
}

.case-card > span {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .6px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.side-label {
  padding: 19px 20px 9px;
  color: var(--subtle);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.4px;
}

.nav {
  display: grid;
  gap: 4px;
  padding: 0 11px;
}

.nav-link {
  width: 100%;
  border: 0;
  border-radius: 5px;
  padding: 11px 12px;
  background: transparent;
  color: #b5b8bf;
  text-align: left;
  font-size: 11px;
  transition: background .15s, color .15s;
}

.nav-link span {
  display: inline-block;
  width: 25px;
  color: #c3c6cd;
  font-size: 15px;
}

.nav-link b {
  float: right;
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #3b3d43;
  color: #e5e6e9;
  font-size: 9px;
  text-align: center;
}

.nav-link:hover {
  background: #303238;
  color: white;
}

.nav-link.active {
  background: #3a3c42;
  color: white;
  box-shadow: inset 2px 0 #d5d7dc;
}

.sidebar-bottom {
  margin-top: auto;
  padding: 17px 18px;
  border-top: 1px solid var(--border);
}

.system-status {
  color: var(--green);
  font-family: Consolas, monospace;
  font-size: 9px;
}

.system-status i {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--green);
}

.sidebar-note {
  margin-top: 12px;
  color: var(--subtle);
  font-family: Consolas, monospace;
  font-size: 8px;
  line-height: 1.8;
}

.reset-btn {
  margin-top: 13px;
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
}

.reset-btn:hover {
  color: var(--red);
}

.main {
  min-height: 100vh;
  margin-left: 250px;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 64px;
  padding: 0 28px;
  background: #232428;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.breadcrumb {
  color: var(--muted);
  font-family: Consolas, monospace;
  font-size: 10px;
  letter-spacing: .8px;
}

.breadcrumb span {
  padding: 0 8px;
  color: var(--subtle);
}

.breadcrumb strong {
  color: var(--text);
  font-weight: 600;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.xp-display {
  color: var(--yellow);
  font-family: Consolas, monospace;
  font-size: 11px;
}

.clock {
  padding-left: 16px;
  border-left: 1px solid var(--border);
  color: var(--muted);
  font-family: Consolas, monospace;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
}

.avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid #555861;
  border-radius: 50%;
  background: #393b41;
  color: white;
  font-family: Consolas, monospace;
  font-size: 10px;
}

.user-chip strong {
  display: block;
  font-size: 9px;
  letter-spacing: .5px;
}

.user-chip small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
}

.hamburger {
  display: none;
  padding: 5px;
  border: 0;
  background: transparent;
  color: white;
  font-size: 20px;
}

.content {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 28px 30px 45px;
  flex: 1;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 30px;
  border-top: 1px solid var(--border);
  color: var(--subtle);
  font-family: Consolas, monospace;
  font-size: 8px;
  letter-spacing: .5px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 15px;
  margin-bottom: 22px;
}

.eyebrow {
  color: #c3c6cd;
  font-family: Consolas, monospace;
  font-size: 9px;
  letter-spacing: 1.5px;
}

h1 {
  margin: 8px 0 5px;
  font-size: 27px;
  letter-spacing: -.6px;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.panel {
  margin-bottom: 14px;
  padding: 19px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel);
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 12px;
}

.panel p {
  color: #c0c2c8;
  font-size: 11px;
  line-height: 1.8;
}

.hero {
  margin-bottom: 15px;
  padding: 27px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #292b30;
}

.hero h1 {
  max-width: 650px;
  font-size: 30px;
}

.hero p {
  max-width: 650px;
  color: #c0c2c8;
  font-size: 12px;
  line-height: 1.8;
}

.hero .btn {
  margin-top: 10px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 14px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 11px;
  margin-bottom: 15px;
}

.stat {
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
}

.stat small {
  color: var(--muted);
  font-family: Consolas, monospace;
  font-size: 9px;
}

.stat strong {
  display: block;
  margin: 8px 0 3px;
  font-size: 25px;
}

.stat span {
  color: var(--muted);
  font-size: 9px;
}

.btn {
  padding: 10px 14px;
  border: 1px solid #666a73;
  border-radius: 5px;
  background: #41434a;
  color: white;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .3px;
  transition: background .15s, border-color .15s;
}

.btn:hover {
  border-color: #888c95;
  background: #50525a;
}

.btn.secondary {
  border-color: var(--border);
  background: #303238;
  color: #d2d4d9;
}

.btn.green {
  border-color: #397b51;
  background: #244b32;
  color: #b9e7c7;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: .5;
}

.tag {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 4px;
  background: #3b3d43;
  color: #e0e1e5;
  font-family: Consolas, monospace;
  font-size: 9px;
}

.tag.green {
  background: #294635;
  color: #a9d9b7;
}

.tag.yellow {
  background: #4b4029;
  color: #e5d09a;
}

.tag.red {
  background: #4b2e31;
  color: #edaaaa;
}

.task {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
}

.task:last-child {
  border: 0;
}

.task small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
}

.progress {
  height: 6px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 9px;
  background: #41434a;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #c3c6cd;
  transition: width .3s;
}

.device-card,
.evidence-card,
.challenge-card,
.suspect-card {
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel);
}

.device-card {
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.device-card:hover,
.evidence-card:hover {
  border-color: #777b84;
  background: var(--panel-hover);
}

.device-icon {
  display: grid;
  width: 43px;
  height: 43px;
  margin-bottom: 14px;
  place-items: center;
  border-radius: 7px;
  background: #3a3c42;
  font-size: 22px;
}

.device-card h3,
.evidence-card h3,
.challenge-card h3,
.suspect-card h3 {
  margin: 0 0 7px;
  font-size: 12px;
}

.device-card p,
.evidence-card p,
.challenge-card p,
.suspect-card p {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.device-card small {
  color: #d0d2d7;
  font-family: Consolas, monospace;
  font-size: 9px;
}

.evidence-card .btn {
  margin-top: 10px;
}

.evidence-card .evidence-icon {
  margin-bottom: 11px;
  font-size: 21px;
}

.challenge-card {
  display: flex;
  min-height: 190px;
  flex-direction: column;
}

.challenge-card .btn {
  align-self: flex-start;
  margin-top: auto;
}

.challenge-card .points {
  margin: 12px 0;
  color: var(--yellow);
  font-family: Consolas, monospace;
  font-size: 9px;
}

.question {
  margin: 14px 0;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #24262a;
}

.question h3 {
  font-size: 14px;
  line-height: 1.6;
}

.choice {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #303238;
  color: #e0e1e5;
  text-align: left;
  font-size: 11px;
}

.choice:hover {
  border-color: #8a8e97;
  background: #3a3c42;
}

.choice.correct {
  border-color: var(--green);
  color: var(--green);
}

.choice.wrong {
  border-color: var(--red);
  color: var(--red);
}

.feedback {
  margin-top: 12px;
  padding: 13px;
  border-radius: 5px;
  background: #294635;
  color: #c0e5ca;
  font-size: 11px;
  line-height: 1.7;
}

.feedback.bad {
  background: #4b2e31;
  color: #edb6b6;
}

.timeline {
  margin: 15px 0 10px 9px;
  padding-left: 22px;
  border-left: 2px solid #555861;
}

.timeline-event {
  position: relative;
  padding: 0 0 22px;
}

.timeline-event:before {
  position: absolute;
  top: 3px;
  left: -29px;
  width: 10px;
  height: 10px;
  border: 3px solid #3a3c42;
  border-radius: 50%;
  background: #c3c6cd;
  content: "";
}

.timeline-event time {
  color: #d5d7dc;
  font-family: Consolas, monospace;
  font-size: 10px;
}

.timeline-event b {
  display: block;
  margin: 5px 0;
  font-size: 11px;
}

.timeline-event small {
  color: var(--muted);
  font-size: 9px;
}

.field {
  display: grid;
  gap: 7px;
  margin: 13px 0;
}

.field label {
  color: var(--muted);
  font-family: Consolas, monospace;
  font-size: 9px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  outline: none;
  background: var(--input);
  color: white;
}

.field textarea {
  min-height: 130px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: #92959d;
}

.terminal {
  overflow-wrap: anywhere;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #1e1f22;
  color: #c7d8ca;
  font-family: Consolas, monospace;
  font-size: 10px;
  line-height: 2;
  white-space: pre-wrap;
}

.rank-card {
  padding: 23px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #292b30;
  text-align: center;
}

.rank-icon {
  font-size: 35px;
}

.rank-card h2 {
  margin: 10px 0 4px;
  font-size: 18px;
}

.rank-card p {
  color: var(--muted);
  font-size: 10px;
}

.empty {
  padding: 30px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  line-height: 1.8;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #000b;
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  width: min(580px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 23px;
  border: 1px solid #555861;
  border-radius: 8px;
  background: #2b2d31;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.modal h2 {
  margin: 5px 0 12px;
  font-size: 19px;
}

.modal-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 5px;
  background: #3a3c42;
  color: white;
  font-size: 22px;
}

.modal-close:hover {
  background: #50525a;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  padding: 13px 17px;
  border: 1px solid #555861;
  border-radius: 5px;
  background: #303238;
  color: white;
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: .2s;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 950px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 650px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .hamburger {
    display: block;
  }

  .topbar {
    height: 58px;
    padding: 0 13px;
  }

  .breadcrumb {
    font-size: 8px;
  }

  .top-actions {
    gap: 9px;
  }

  .user-chip {
    display: none;
  }

  .clock {
    padding-left: 9px;
  }

  .content {
    padding: 20px 14px 35px;
  }

  .grid-3 {
    grid-template-columns: 1fr;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero {
    padding: 20px;
  }

  .hero h1 {
    font-size: 24px;
  }

  .footer {
    flex-direction: column;
    padding: 12px;
  }
}