@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --navy: #071725;
  --panel: rgba(6, 20, 31, .88);
  --line: rgba(176, 213, 229, .22);
  --blue: #34a9e8;
  --yellow: #f4ce34;
  --green: #63df9d;
  --red: #ff5c5c;
  --muted: #9fb3bf;
  --text: #f5f7f8;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #07121b;
  color: var(--text);
  font-family: Inter, sans-serif;
  user-select: none;
}

#game,
#game canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.hidden {
  display: none !important;
}

.webgl-error {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--text);
  font: 600 16px/1.6 Inter, sans-serif;
  background: #07121b;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 21px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .08);
  color: white;
  font: 700 10px Inter;
}

.topbar {
  position: fixed;
  z-index: 5;
  top: 0;
  left: 0;
  right: 0;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  background: linear-gradient(180deg, rgba(3, 12, 19, .9), transparent);
  pointer-events: none;
}

.brand {
  display: flex;
  gap: 13px;
  align-items: center;
}

.badge {
  background: #fff;
  color: #0c2a40;
  padding: 8px 9px;
  font: 800 13px/1 "Barlow Condensed";
  letter-spacing: 1.8px;
  transform: rotate(-2deg);
}

.brand h1 {
  margin: 0;
  font: 800 19px/1 "Barlow Condensed";
  letter-spacing: 2.2px;
}

.brand p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .8px;
  text-transform: uppercase;
}

.status-cluster {
  display: flex;
  gap: 10px;
  align-items: center;
  pointer-events: auto;
}

.role-chip,
.status-cluster button {
  height: 38px;
  border: 1px solid var(--line);
  background: rgba(5, 20, 30, .72);
  color: var(--muted);
  padding: 0 13px;
  font: 600 10px Inter;
  letter-spacing: 1px;
}

.role-chip {
  display: flex;
  align-items: center;
  gap: 6px;
}

.role-chip strong {
  color: var(--yellow);
}

.status-cluster button {
  color: white;
  cursor: pointer;
}

.status-cluster button:hover {
  border-color: var(--blue);
  background: rgba(20, 75, 105, .65);
}

.icon-button {
  width: 38px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
}

.mission-card {
  position: fixed;
  z-index: 4;
  left: 34px;
  top: 112px;
  width: 305px;
  padding: 19px 20px;
  border-left: 3px solid var(--yellow);
  background: linear-gradient(110deg, var(--panel), rgba(6, 20, 31, .55));
  backdrop-filter: blur(8px);
  clip-path: polygon(0 0, 94% 0, 100% 16%, 100% 100%, 0 100%);
}

.eyebrow,
.attempt-row {
  color: var(--yellow);
  font: 700 10px Inter;
  letter-spacing: 1.5px;
}

.mission-card h2 {
  margin: 9px 0 6px;
  font: 700 20px/1.08 "Barlow Condensed";
  text-transform: uppercase;
}

.mission-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.attempt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
}

.attempt-pips {
  display: flex;
  gap: 4px;
}

.attempt-pips i {
  width: 19px;
  height: 4px;
  background: rgba(255, 255, 255, .13);
}

.attempt-pips i.used {
  background: var(--red);
}

.attempt-pips i.current {
  background: var(--yellow);
}

.inventory {
  position: fixed;
  z-index: 5;
  bottom: 28px;
  left: 50%;
  display: flex;
  gap: 6px;
  transform: translateX(-50%);
}

.item {
  position: relative;
  width: 85px;
  height: 76px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-bottom: 3px solid transparent;
  background: rgba(5, 18, 28, .83);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font: 600 9px Inter;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.item kbd {
  position: absolute;
  top: 5px;
  left: 5px;
}

.item-icon {
  color: white;
  font: 700 25px/1 "Barlow Condensed";
  transform: skew(-5deg);
}

.item:hover,
.item.active {
  color: white;
  border-color: rgba(52, 169, 232, .65);
  border-bottom-color: var(--yellow);
  background: rgba(13, 48, 67, .9);
}

.item.active::before {
  content: "";
  position: absolute;
  top: -5px;
  width: 25px;
  height: 2px;
  background: var(--yellow);
}

.controls-card {
  position: fixed;
  z-index: 4;
  left: 34px;
  bottom: 28px;
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 8px 15px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  background: rgba(5, 18, 28, .72);
}

.controls-card div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.controls-card span {
  color: var(--muted);
  font: 600 8px Inter;
  letter-spacing: .8px;
}

.crowd-feed {
  position: fixed;
  z-index: 4;
  right: 34px;
  top: 113px;
  width: 265px;
  pointer-events: none;
}

.feed-title {
  padding: 9px 11px;
  background: rgba(5, 18, 28, .8);
  color: var(--muted);
  font: 600 9px Inter;
  letter-spacing: 1px;
}

.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
  margin-right: 5px;
}

#comments {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
}

.comment {
  padding: 9px 11px;
  background: rgba(6, 20, 31, .72);
  border-right: 2px solid var(--blue);
  animation: commentIn .35s ease-out;
  backdrop-filter: blur(5px);
}

.comment strong {
  display: block;
  color: var(--blue);
  font: 700 9px Inter;
  letter-spacing: .6px;
  margin-bottom: 3px;
}

.comment span {
  font-size: 10px;
  color: #dce6eb;
  line-height: 1.35;
}

@keyframes commentIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
}

.pull-panel,
.timing-panel {
  position: fixed;
  z-index: 6;
  left: 50%;
  bottom: 125px;
  width: 430px;
  transform: translateX(-50%);
  background: rgba(4, 16, 25, .94);
  border: 1px solid var(--line);
  padding: 15px 18px;
  backdrop-filter: blur(10px);
}

.pull-heading,
.pull-progress {
  display: flex;
  justify-content: space-between;
  font: 700 10px Inter;
  letter-spacing: 1px;
}

.pull-heading strong {
  color: var(--red);
}

.tension-track,
.progress-track,
.timing-track {
  position: relative;
  height: 16px;
  margin: 9px 0 12px;
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
}

.safe-zone {
  position: absolute;
  left: 40%;
  width: 35%;
  height: 100%;
  background: rgba(99, 223, 157, .2);
  border-left: 1px solid var(--green);
  border-right: 1px solid var(--green);
}

.danger-zone {
  position: absolute;
  right: 0;
  width: 16%;
  height: 100%;
  background: rgba(255, 92, 92, .17);
}

.tension-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--blue), var(--yellow), var(--red));
  opacity: .8;
}

.tension-marker {
  position: absolute;
  top: -3px;
  width: 4px;
  height: 22px;
  background: white;
  box-shadow: 0 0 8px white;
}

.progress-track {
  height: 7px;
  margin-bottom: 9px;
}

#progressFill {
  height: 100%;
  background: var(--yellow);
  width: 0;
}

.energy-block {
  margin-top: 2px;
}

#energyFill {
  height: 100%;
  background: var(--green);
  width: 100%;
}

.pull-panel p {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 10px;
}

.timing-panel {
  text-align: center;
}

.timing-panel>span {
  color: var(--yellow);
  font: 700 10px Inter;
  letter-spacing: 1.2px;
}

.timing-panel strong {
  font: 800 15px "Barlow Condensed";
  letter-spacing: 1px;
}

.timing-sweet {
  position: absolute;
  left: 42%;
  width: 18%;
  height: 100%;
  background: rgba(99, 223, 157, .35);
  border-left: 2px solid var(--green);
  border-right: 2px solid var(--green);
}

#timingCursor {
  position: absolute;
  top: 0;
  width: 5px;
  height: 100%;
  background: white;
  box-shadow: 0 0 9px white;
}

.interaction-prompt {
  position: fixed;
  z-index: 5;
  left: 50%;
  top: 58%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(5, 18, 28, .82);
  border: 1px solid var(--line);
  padding: 8px 11px;
  font: 600 9px Inter;
  letter-spacing: .7px;
}

.crosshair {
  position: fixed;
  z-index: 3;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  opacity: .45;
  pointer-events: none;
}

.crosshair i {
  position: absolute;
  background: white;
}

.crosshair i:first-child {
  width: 12px;
  height: 1px;
  left: 3px;
  top: 8px;
}

.crosshair i:last-child {
  width: 1px;
  height: 12px;
  left: 8px;
  top: 3px;
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  box-shadow: inset 0 0 160px rgba(0, 0, 0, .48);
}

.toast {
  position: fixed;
  z-index: 9;
  left: 50%;
  top: 28%;
  transform: translate(-50%, -50%);
  color: white;
  font: 800 42px/1 "Barlow Condensed";
  letter-spacing: 2px;
  text-align: center;
  text-shadow: 0 4px 22px #000;
  animation: toast .25s ease-out;
}

.toast small {
  display: block;
  color: var(--yellow);
  font: 700 12px Inter;
  margin-top: 8px;
}

@keyframes toast {
  from {
    opacity: 0;
    transform: translate(-50%, -40%) scale(.8);
  }
}

.start-screen {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(90deg, rgba(3, 14, 22, .96), rgba(3, 14, 22, .65)), radial-gradient(circle at 70% 40%, rgba(32, 133, 170, .25), transparent 40%);
}

.start-panel {
  width: 510px;
  border-left: 4px solid var(--yellow);
  padding: 35px 42px;
  background: rgba(5, 19, 29, .88);
  box-shadow: 0 28px 90px #000;
}

.incident-code {
  color: var(--blue);
  font: 700 10px Inter;
  letter-spacing: 2px;
}

.start-panel h1 {
  margin: 13px 0 16px;
  font: 800 58px/.82 "Barlow Condensed";
  letter-spacing: 1px;
}

.start-panel h1 em {
  color: var(--yellow);
  font-style: normal;
}

.start-panel>p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.role-preview {
  display: flex;
  gap: 9px;
  margin: 23px 0;
}

.role-preview div {
  flex: 1;
  padding: 11px;
  border: 1px solid var(--line);
}

.role-preview strong,
.role-preview span {
  display: block;
}

.role-preview strong {
  color: white;
  font: 800 16px "Barlow Condensed";
}

.role-preview span {
  color: var(--muted);
  font-size: 9px;
  margin-top: 3px;
}

.start-panel button {
  width: 100%;
  height: 48px;
  border: 0;
  background: var(--yellow);
  color: #12202a;
  font: 800 15px "Barlow Condensed";
  letter-spacing: 1.5px;
  cursor: pointer;
}

.start-panel button:hover {
  background: #ffe15b;
}

.start-panel small {
  display: block;
  text-align: center;
  color: #69818f;
  font-size: 9px;
  margin-top: 10px;
}

.end-screen {
  position: fixed;
  z-index: 21;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(90deg, rgba(3, 14, 22, .96), rgba(3, 14, 22, .7)), radial-gradient(circle at 70% 40%, rgba(32, 133, 170, .22), transparent 42%);
}

.end-screen.win .start-panel {
  border-left-color: var(--green);
}

.end-screen.lose .start-panel {
  border-left-color: var(--red);
}

.end-screen.win .incident-code {
  color: var(--green);
}

.end-screen.lose .incident-code {
  color: var(--red);
}

.end-stats {
  display: flex;
  gap: 9px;
  margin: 22px 0;
}

.end-stats div {
  flex: 1;
  padding: 13px 11px;
  border: 1px solid var(--line);
  text-align: center;
}

.end-stats strong {
  display: block;
  color: white;
  font: 800 26px "Barlow Condensed";
}

.end-stats span {
  display: block;
  color: var(--muted);
  font: 600 9px Inter;
  letter-spacing: 1px;
  margin-top: 4px;
}

.end-actions {
  display: flex;
  gap: 9px;
}

.end-actions button {
  flex: 1;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  background: var(--yellow);
  color: #12202a;
  font: 800 14px "Barlow Condensed";
  letter-spacing: 1.2px;
  cursor: pointer;
}

.end-actions button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

.end-actions button:hover {
  background: #ffe15b;
}

.end-actions button.ghost:hover {
  background: rgba(20, 75, 105, .55);
  border-color: var(--blue);
}

@media (max-width: 900px) {
  .crowd-feed {
    display: none;
  }

  .mission-card {
    left: 15px;
    top: 92px;
    transform: scale(.88);
    transform-origin: left top;
  }

  .controls-card {
    display: none;
  }

  .topbar {
    padding: 0 15px;
  }

  .brand p {
    display: none;
  }

  .inventory {
    bottom: 12px;
    transform: translateX(-50%) scale(.8);
  }
}
