:root {
  color-scheme: dark;
  --bg: #071019;
  --panel: rgba(13, 25, 35, 0.86);
  --panel-strong: #122436;
  --text: #edf7f8;
  --muted: #a9bdc3;
  --line: rgba(255, 255, 255, 0.14);
  --gold: #f1bc4b;
  --teal: #25d0b8;
  --red: #f06363;
  --green: #75d66b;
  --blue: #5ea3ff;
  --magenta: #d174ff;
  --amber: #f2774b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 20% 10%, rgba(37, 208, 184, 0.16), transparent 28%),
    radial-gradient(circle at 80% 0%, rgba(241, 188, 75, 0.12), transparent 24%),
    linear-gradient(145deg, #071019 0%, #14202a 45%, #0c151c 100%);
  background-size: 42px 42px, 42px 42px, auto, auto, auto;
}

button,
input {
  font: inherit;
}

button {
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  touch-action: manipulation;
}

#app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

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

.topbar h1,
.screen h2,
.clue-drawer h3 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(1.1rem, 2vw, 1.7rem);
}

.eyebrow,
.mission-tag {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.status-panel {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.status-panel span {
  min-width: 78px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.035));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

main {
  position: relative;
  min-height: 640px;
}

.screen {
  display: none;
  min-height: calc(100vh - 82px);
  padding: clamp(18px, 4vw, 44px);
  animation: screenIn 360ms ease both;
}

.screen.active {
  display: block;
}

.briefing-layout {
  min-height: 68vh;
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(300px, 1.15fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
}

.screen-intro {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.briefing-copy h2,
.screen-heading h2,
.complete-screen h2 {
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 1;
  max-width: 760px;
}

.briefing-copy p,
.screen-heading p,
.complete-screen p,
.final-panel p {
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  line-height: 1.6;
  max-width: 760px;
}

.briefing-actions,
.room-footer,
.modal-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.primary,
.ghost,
.vault-access {
  min-height: 44px;
  border-radius: 6px;
  padding: 11px 16px;
  border: 1px solid transparent;
  color: var(--text);
  font-weight: 700;
  transition: transform 160ms ease, filter 160ms ease, border-color 160ms ease;
}

.primary {
  background: linear-gradient(135deg, #0f8c7e, #2574d0);
  box-shadow: 0 14px 36px rgba(37, 116, 208, 0.26);
}

.ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
}

.mission-path {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin: 28px 0 6px;
}

.mission-path span {
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #d9eff0;
  background: linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.035));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  font-weight: 800;
}

.vault-visual {
  position: relative;
  width: min(70vw, 420px);
  aspect-ratio: 1;
  margin: 0 auto;
  display: grid;
  place-items: center;
}

.vault-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 18px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 55px rgba(37, 208, 184, 0.22), 0 0 90px rgba(94, 163, 255, 0.15);
}

.ring-two {
  inset: 13%;
  border-width: 10px;
  border-color: rgba(241, 188, 75, 0.45);
}

.vault-core {
  z-index: 1;
  width: 38%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d7e9e9;
  color: #10202c;
  font-size: clamp(1.8rem, 5vw, 3.8rem);
  font-weight: 900;
}

.lobby-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 16px;
  margin: 42px 0 24px;
}

.door {
  min-height: 300px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02)),
    var(--panel-strong);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
  box-shadow: 0 18px 44px rgba(0,0,0,0.24);
  transition: transform 180ms ease, filter 180ms ease, box-shadow 180ms ease;
}

.door::before {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
}

.door::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 42%;
  height: 1px;
  background: rgba(255,255,255,0.16);
  box-shadow: 0 52px 0 rgba(255,255,255,0.1);
}

.door span {
  color: var(--gold);
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
}

.door strong {
  font-size: 1.25rem;
  margin-top: 6px;
  z-index: 1;
}

.risk-door { background-color: #193545; }
.integrity-door { background-color: #3b2636; }
.shariah-door { background-color: #1c3b31; }
.compliance-door { background-color: #38351d; }

.vault-access {
  width: min(100%, 360px);
  background: #151a20;
  border-color: rgba(241, 188, 75, 0.55);
}

.room {
  position: relative;
  overflow: hidden;
}

.room::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.34;
  background:
    linear-gradient(90deg, transparent 24%, rgba(255,255,255,0.08) 25%, transparent 26%),
    linear-gradient(0deg, transparent 24%, rgba(255,255,255,0.06) 25%, transparent 26%);
  background-size: 70px 70px;
  pointer-events: none;
}

.risk-room { background: linear-gradient(145deg, #071822, #183748); }
.integrity-room { background: linear-gradient(145deg, #180f1b, #42273c); }
.shariah-room { background: linear-gradient(145deg, #081a16, #214637); }
.compliance-room { background: linear-gradient(145deg, #17150a, #3d3a22); }

.room-copy,
.room-footer,
.room-stage {
  position: relative;
  z-index: 1;
}

.room-copy {
  max-width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255,255,255,0.11), rgba(255,255,255,0.035));
  box-shadow: 0 22px 50px rgba(0,0,0,0.18);
}

.room-copy h2 {
  font-size: clamp(1.8rem, 4vw, 3.4rem);
}

.room-copy p {
  color: var(--muted);
  margin-bottom: 0;
}

.level-card {
  flex: 0 0 190px;
  padding: 14px;
  border: 1px solid rgba(241, 188, 75, 0.36);
  border-radius: 8px;
  background: rgba(241, 188, 75, 0.08);
  text-align: right;
}

.level-card span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.level-card strong {
  display: block;
  margin-top: 6px;
  color: var(--gold);
  font-size: 1.35rem;
}

.task-stack {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  margin: 14px 0 18px;
}

.task-stack span {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #e4f5f5;
  background: rgba(0,0,0,0.22);
  font-weight: 700;
  text-align: center;
}

.room-stage {
  height: min(60vh, 540px);
  min-height: 430px;
  margin: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.02) 42%, transparent 43%),
    linear-gradient(122deg, transparent 57%, rgba(255,255,255,0.06) 58%, transparent 59%),
    linear-gradient(238deg, transparent 57%, rgba(255,255,255,0.05) 58%, transparent 59%),
    linear-gradient(0deg, rgba(0,0,0,0.48) 0%, rgba(0,0,0,0.18) 34%, transparent 35%);
  overflow: hidden;
  box-shadow: inset 0 -80px 80px rgba(0,0,0,0.25), 0 24px 60px rgba(0,0,0,0.2);
}

.room-stage::before {
  content: "";
  position: absolute;
  left: 4%;
  right: 4%;
  top: 13%;
  height: 1px;
  background: rgba(255,255,255,0.13);
  box-shadow:
    0 72px 0 rgba(255,255,255,0.08),
    0 144px 0 rgba(255,255,255,0.06);
}

.room-stage::after {
  content: "";
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: -12%;
  height: 36%;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.06) 0 1px, transparent 1px 88px),
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(0,0,0,0.22));
  transform: perspective(360px) rotateX(42deg);
  transform-origin: bottom;
  pointer-events: none;
}

.object {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: end center;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255,255,255,0.1);
  box-shadow: 0 12px 28px rgba(0,0,0,0.2);
  min-width: 82px;
  min-height: 58px;
  font-size: 0.9rem;
  font-weight: 800;
  isolation: isolate;
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.object::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 10px 16px auto;
  height: 38%;
  border-radius: 6px;
  background: rgba(255,255,255,0.16);
  box-shadow: inset 0 0 18px rgba(255,255,255,0.08);
}

.object::after {
  content: "Click";
  position: absolute;
  top: -12px;
  right: -10px;
  padding: 4px 7px;
  border-radius: 999px;
  color: #071019;
  background: var(--gold);
  font-size: 0.68rem;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(0,0,0,0.25);
}

.object:hover,
.door:hover,
.primary:hover,
.ghost:hover,
.vault-access:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.object:hover {
  border-color: rgba(241,188,75,0.74);
  box-shadow: 0 18px 34px rgba(0,0,0,0.3), 0 0 0 4px rgba(241,188,75,0.09);
}

.laptop, .secure-laptop { left: 8%; bottom: 14%; width: 210px; height: 112px; background: linear-gradient(180deg, #1d3445, #111a24); }
.cctv { right: 10%; top: 13%; width: 190px; height: 112px; background: linear-gradient(180deg, #284a5c, #172732); }
.usb { left: 44%; bottom: 18%; width: 100px; height: 72px; background: linear-gradient(180deg, #707984, #363d46); }
.cabinet { right: 7%; bottom: 12%; width: 150px; height: 178px; background: linear-gradient(180deg, #476976, #243842); }
.board { left: 33%; top: 14%; width: 190px; height: 128px; background: linear-gradient(180deg, #536b51, #27372a); }
.phone { right: 24%; bottom: 18%; width: 104px; height: 164px; background: linear-gradient(180deg, #222, #070707); }
.folder { left: 14%; bottom: 18%; width: 210px; height: 120px; background: linear-gradient(180deg, #b98a34, #5f451b); }
.shredder { right: 8%; bottom: 12%; width: 132px; height: 178px; background: linear-gradient(180deg, #454b57, #20242d); }
.idcards { left: 42%; top: 18%; width: 158px; height: 96px; background: linear-gradient(180deg, #68708a, #34394d); }
.dashboard { left: 9%; top: 14%; width: 290px; height: 154px; background: linear-gradient(180deg, #1f5664, #112d36); }
.calculator { left: 44%; bottom: 16%; width: 124px; height: 170px; background: linear-gradient(180deg, #33444b, #1c252a); }
.stamp { right: 14%; bottom: 18%; width: 154px; height: 118px; background: linear-gradient(180deg, #81384a, #421824); }
.bookshelf { right: 10%; top: 11%; width: 164px; height: 186px; background: linear-gradient(180deg, #684f3d, #32261d); }
.sop { left: 10%; bottom: 16%; width: 200px; height: 132px; background: linear-gradient(180deg, #9c8032, #554414); }
.printer { right: 9%; bottom: 16%; width: 196px; height: 122px; background: linear-gradient(180deg, #eef4f4, #9aa6aa); color: #112; }
.calendar { right: 28%; top: 14%; width: 150px; height: 128px; background: linear-gradient(180deg, #315365, #182d38); }

.clue-drawer {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: min(320px, calc(100vw - 36px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(13, 25, 35, 0.94), rgba(5, 13, 20, 0.9));
  backdrop-filter: blur(12px);
  z-index: 5;
  box-shadow: 0 18px 44px rgba(0,0,0,0.3);
}

.clue-drawer h3 {
  font-size: 0.95rem;
  margin-bottom: 10px;
}

#clues {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.clue-pill {
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(37, 208, 184, 0.16);
  border: 1px solid rgba(37, 208, 184, 0.34);
  color: #dffdf7;
  font-size: 0.82rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.62);
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(680px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  position: relative;
  padding: 24px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), transparent 32%),
    #101d28;
  box-shadow: 0 24px 80px rgba(0,0,0,0.42);
}

.close {
  position: absolute;
  right: 12px;
  top: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 1.4rem;
}

.modal-card h2 {
  margin: 0 36px 12px 0;
}

.modal-card p,
.modal-card li,
.modal-card td,
.modal-card th {
  color: var(--muted);
  line-height: 1.55;
}

.evidence,
.question-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255,255,255,0.05);
}

.answer-button {
  width: 100%;
  text-align: left;
  margin-top: 8px;
  padding: 11px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.07);
  color: var(--text);
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.answer-button:hover {
  transform: translateX(2px);
  background: rgba(37, 208, 184, 0.12);
  border-color: rgba(37, 208, 184, 0.4);
}

.feedback {
  min-height: 24px;
  font-weight: 700;
}

.feedback.good { color: var(--green); }
.feedback.bad { color: var(--red); }

.vault-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(300px, 1fr);
  gap: clamp(20px, 4vw, 44px);
  align-items: stretch;
  margin: 32px 0;
}

.vault-console,
.final-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02)),
    var(--panel);
  box-shadow: 0 22px 54px rgba(0,0,0,0.22);
}

.vault-console {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.clue-slot {
  min-height: 110px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(241, 188, 75, 0.4);
  border-radius: 8px;
  color: var(--gold);
  font-weight: 900;
  font-size: clamp(1rem, 2vw, 1.6rem);
  background: rgba(241, 188, 75, 0.08);
}

label {
  display: block;
  margin: 18px 0 8px;
  color: var(--text);
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.08);
  color: var(--text);
  margin-bottom: 12px;
  font-size: 16px;
}

.small {
  font-size: 0.85rem;
}

.complete-screen {
  text-align: center;
  display: none;
  place-items: center;
}

.complete-screen.active {
  display: grid;
}

.open .vault-core {
  background: var(--green);
  font-size: clamp(1.2rem, 3vw, 2.4rem);
}

.scoreline {
  color: var(--gold) !important;
  font-weight: 800;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
}

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

@supports not ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))) {
  .topbar,
  .clue-drawer {
    background: rgba(5, 13, 20, 0.96);
  }
}

@media (max-width: 900px) {
  .briefing-layout,
  .vault-grid {
    grid-template-columns: 1fr;
  }

  .lobby-grid,
  .mission-path,
  .task-stack {
    grid-template-columns: repeat(2, 1fr);
  }

  .door {
    min-height: 210px;
  }

  .clue-drawer {
    position: static;
    width: auto;
    margin: 0 18px 18px;
  }

  .room-copy {
    align-items: stretch;
    flex-direction: column;
  }

  .level-card {
    flex-basis: auto;
    text-align: left;
  }
}

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

  .lobby-grid,
  .mission-path,
  .vault-console {
    grid-template-columns: 1fr;
  }

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

  .screen {
    padding: 14px;
  }

  .room-stage {
    min-height: 480px;
  }

  .room-copy {
    padding: 16px;
  }

  .room-copy h2 {
    font-size: 1.75rem;
  }

  .task-stack span {
    min-height: 38px;
    font-size: 0.86rem;
  }

  .object {
    transform: scale(0.9);
  }

  .laptop, .secure-laptop { left: 6%; bottom: 12%; }
  .cctv { right: 6%; top: 10%; }
  .usb { left: 48%; bottom: 36%; }
  .cabinet { right: 6%; bottom: 10%; }
  .board { left: 6%; top: 24%; }
  .phone { right: 10%; bottom: 42%; }
  .folder { left: 6%; bottom: 18%; }
  .shredder { right: 6%; bottom: 10%; }
  .idcards { left: 8%; top: 14%; }
  .dashboard { left: 5%; top: 10%; width: 240px; }
  .calculator { left: 10%; bottom: 12%; }
  .stamp { right: 7%; bottom: 22%; }
  .bookshelf { right: 6%; top: 32%; }
  .sop { left: 6%; bottom: 18%; }
  .printer { right: 6%; bottom: 12%; }
  .calendar { left: 8%; top: 12%; }
}
