:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --paper: #d6d1c7;
  --muted: #8e8a82;
  --red: #9b111e;
  --red-bright: #d31f32;
  --black: #030303;
  --panel: rgba(6, 6, 6, 0.9);
  --line: rgba(255, 255, 255, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #020202;
  color: var(--paper);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.hidden {
  display: none !important;
}

.grain {
  position: fixed;
  inset: -50%;
  z-index: 20;
  pointer-events: none;
  opacity: 0.11;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
  animation: grain-shift 0.23s steps(2) infinite;
}

@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(3%, -2%); }
  50% { transform: translate(-2%, 3%); }
  75% { transform: translate(2%, 1%); }
  100% { transform: translate(-3%, -1%); }
}

.login-page {
  background:
    radial-gradient(circle at 50% 28%, rgba(100, 0, 0, 0.13), transparent 34%),
    linear-gradient(rgba(0, 0, 0, 0.58), rgba(0, 0, 0, 0.92)),
    repeating-linear-gradient(90deg, #070707 0 2px, #0b0908 2px 10px);
}

.login-page::before,
.login-page::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.login-page::before {
  background: linear-gradient(90deg, transparent 49.8%, rgba(255,255,255,.035) 50%, transparent 50.2%);
}

.login-page::after {
  box-shadow: inset 0 0 180px 60px #000;
}

.login-shell {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 28px;
  position: relative;
  z-index: 2;
}

.login-card {
  width: min(620px, 100%);
  padding: clamp(30px, 6vw, 64px);
  text-align: center;
  background: rgba(4, 4, 4, 0.78);
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 35px 100px rgba(0,0,0,.72), inset 0 0 0 1px rgba(130,0,0,.12);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 14px;
  font-size: 0.68rem;
  letter-spacing: 0.34em;
  font-weight: 800;
  color: #9f9990;
}

.login-card h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4.7rem, 14vw, 8rem);
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 0.86;
  text-shadow: 0 0 35px rgba(170,0,0,.2);
}

.login-copy {
  max-width: 460px;
  margin: 28px auto 24px;
  color: #a9a49a;
  line-height: 1.7;
}

.warning-strip {
  margin: 0 auto 28px;
  padding: 10px 12px;
  border-top: 1px solid rgba(159, 17, 30, .4);
  border-bottom: 1px solid rgba(159, 17, 30, .4);
  font-size: .64rem;
  letter-spacing: .13em;
  color: #b3767d;
}

.google-signin {
  min-height: 44px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-status {
  min-height: 22px;
  margin: 16px 0 8px;
  color: #7f7a72;
  font-size: .82rem;
}

.login-status.error,
.config-error {
  color: #e06b78;
}

.config-error {
  padding: 12px;
  border: 1px solid rgba(211,31,50,.3);
  background: rgba(211,31,50,.08);
}

.control-preview,
.overlay-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px 22px;
  color: #817d76;
  font-size: .72rem;
}

.control-preview {
  margin-top: 28px;
}

kbd {
  display: inline-block;
  padding: 3px 7px;
  margin-right: 4px;
  border: 1px solid rgba(255,255,255,.18);
  border-bottom-color: rgba(255,255,255,.33);
  border-radius: 3px;
  color: #c5c0b6;
  background: #111;
  box-shadow: 0 2px 0 #000;
  font-family: inherit;
  font-size: .67rem;
  letter-spacing: .06em;
}

.primary-button,
.secondary-button,
.text-button,
.icon-button {
  cursor: pointer;
  border: 0;
}

.primary-button {
  min-width: 210px;
  padding: 14px 22px;
  margin-top: 28px;
  background: #9d1421;
  color: #fff;
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .16em;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
  box-shadow: 0 12px 40px rgba(157,20,33,.22);
}

.primary-button:hover,
.primary-button:focus-visible {
  transform: translateY(-1px);
  background: #bd1b2c;
  box-shadow: 0 14px 46px rgba(189,27,44,.32);
}

.secondary-button {
  min-width: 210px;
  padding: 12px 18px;
  margin-top: 12px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.04);
  color: #bbb5aa;
  font-size: .75rem;
}

.text-button {
  margin-top: 18px;
  background: transparent;
  color: #807b73;
  text-decoration: underline;
  text-underline-offset: 4px;
  font-size: .78rem;
}

.game-page {
  user-select: none;
}

#game-root,
#game-root canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.game-grain {
  z-index: 7;
  opacity: .08;
}

#damage-vignette {
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle, transparent 30%, rgba(130,0,0,.82) 100%);
  transition: opacity .12s linear;
}

.hud {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 420px) minmax(220px, 1fr);
  align-items: start;
  gap: 28px;
  padding: 22px 26px;
  pointer-events: none;
  background: linear-gradient(rgba(0,0,0,.7), transparent);
}

.hud-left,
.hud-center,
.hud-right {
  min-width: 0;
}

.hud-center {
  padding-top: 1px;
}

.hud-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.objective-label,
.stamina-heading,
.stamina-state {
  margin: 0;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .15em;
  color: #8f8b84;
}

.objective-text {
  margin: 4px 0 0;
  font-size: .78rem;
  color: #d6d0c5;
}

.stamina-heading {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
}

.stamina-track {
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.7);
}

.stamina-fill {
  width: 100%;
  height: 100%;
  transform-origin: left center;
  background: linear-gradient(90deg, #d9d4ca, #7f7a72);
  box-shadow: 0 0 15px rgba(255,255,255,.18);
  transition: background .2s ease;
}

.stamina-fill.low {
  background: linear-gradient(90deg, #bc1c2d, #641018);
}

.stamina-state {
  margin-top: 6px;
  text-align: center;
  font-size: .56rem;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 180px;
  color: #a29d94;
  font-size: .72rem;
}

.user-badge img {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.24);
}

.user-badge span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  width: 35px;
  height: 35px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.48);
  color: #d8d2c8;
  font-weight: 800;
}

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

.crosshair span {
  position: absolute;
  background: rgba(235,230,220,.75);
  box-shadow: 0 0 5px #000;
}

.crosshair span:first-child {
  width: 1px;
  height: 10px;
  left: 8px;
  top: 4px;
}

.crosshair span:last-child {
  width: 10px;
  height: 1px;
  left: 4px;
  top: 8px;
}


.weapon-hud {
  position: fixed;
  z-index: 11;
  right: 24px;
  bottom: 22px;
  display: grid;
  grid-template-columns: auto auto;
  gap: 3px 12px;
  min-width: 190px;
  padding: 8px 10px;
  pointer-events: none;
  border: 1px solid rgba(140, 205, 225, .18);
  background: rgba(2, 8, 11, .62);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .4);
  color: #87959a;
  font-size: .54rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  transition: border-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.weapon-hud kbd {
  padding: 2px 5px;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(0, 0, 0, .68);
  color: #c8d4d8;
  font-size: .52rem;
}

.weapon-label {
  color: #b7c2c5;
}

.weapon-shots {
  justify-self: end;
  color: #82b6c7;
}

.weapon-status {
  grid-column: 1 / -1;
  padding-top: 3px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  color: #758287;
  font-size: .49rem;
}

.weapon-hud.equipped {
  border-color: rgba(64, 179, 232, .44);
  box-shadow: 0 0 22px rgba(20, 131, 190, .14), 0 8px 28px rgba(0, 0, 0, .4);
}

.weapon-hud.equipped .weapon-status {
  color: #a6d9e8;
}

.weapon-hud.target-ready {
  border-color: rgba(86, 222, 255, .82);
  box-shadow: 0 0 24px rgba(35, 180, 255, .28), inset 0 0 18px rgba(21, 125, 185, .08);
}

.weapon-hud.target-ready .weapon-status,
.weapon-hud.target-ready .weapon-shots {
  color: #b9f3ff;
  text-shadow: 0 0 8px rgba(77, 211, 255, .72);
}

.weapon-hud.empty {
  border-color: rgba(158, 55, 66, .35);
}

.weapon-hud.empty .weapon-shots,
.weapon-hud.empty .weapon-status {
  color: #a65d65;
}

.crosshair.stun-ready span {
  background: #83e9ff;
  box-shadow: 0 0 8px #168cff, 0 0 16px rgba(22, 140, 255, .7);
}

.danger-message {
  position: fixed;
  z-index: 9;
  left: 50%;
  bottom: 13%;
  transform: translateX(-50%);
  min-height: 24px;
  color: #d04b59;
  text-shadow: 0 2px 12px #000;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 2vw, 1.45rem);
  letter-spacing: .08em;
  opacity: 0;
  transition: opacity .25s ease;
}

.danger-message.visible {
  opacity: 1;
}

.danger-message.entity-voice {
  color: #f5f1e8;
  font-size: clamp(1.45rem, 4vw, 3.1rem);
  font-weight: 900;
  letter-spacing: .34em;
  text-shadow:
    -4px 0 0 rgba(130,0,0,.42),
    4px 0 0 rgba(255,255,255,.08),
    0 0 18px #000,
    0 0 42px rgba(160,0,18,.75);
  animation: entityVoiceGlitch .11s steps(2, end) infinite;
}

@keyframes entityVoiceGlitch {
  0% { transform: translateX(-50%) skewX(-2deg) scale(1); }
  35% { transform: translateX(calc(-50% - 3px)) skewX(4deg) scale(1.025); }
  70% { transform: translateX(calc(-50% + 3px)) skewX(-5deg) scale(.99); }
  100% { transform: translateX(-50%) skewX(1deg) scale(1.01); }
}

.overlay {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: none;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at center, rgba(30,0,0,.22), rgba(0,0,0,.94) 72%);
  backdrop-filter: blur(7px);
}

.overlay.visible {
  display: grid;
}

.overlay-panel {
  width: min(690px, 100%);
  padding: clamp(30px, 6vw, 62px);
  text-align: center;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(4,4,4,.88);
  box-shadow: 0 30px 100px rgba(0,0,0,.75);
}

.overlay-panel.compact {
  width: min(470px, 100%);
}

.overlay-panel h1,
.overlay-panel h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: .06em;
}

.overlay-panel h1 {
  font-size: clamp(2.2rem, 7vw, 4.8rem);
}

.overlay-panel h2 {
  font-size: clamp(2rem, 6vw, 4rem);
}

.overlay-panel p:not(.eyebrow) {
  max-width: 540px;
  margin: 22px auto;
  color: #9f9a91;
  line-height: 1.7;
}

.overlay-controls {
  margin-top: 26px;
}

.end-panel {
  animation: end-appear 1.1s ease both;
}

@keyframes end-appear {
  from { opacity: 0; transform: scale(.96); filter: blur(8px); }
  to { opacity: 1; transform: scale(1); filter: blur(0); }
}

body.survived #end-overlay {
  background: #000;
}

body.survived .end-panel {
  border-color: rgba(255,255,255,.06);
  background: #000;
  box-shadow: none;
}

body.survived #end-title {
  font-size: clamp(3rem, 10vw, 7rem);
  color: #e4dfd5;
}

body.consumed #end-overlay {
  background: radial-gradient(circle, rgba(110,0,0,.42), rgba(0,0,0,.98) 65%);
}

body.consumed #end-title {
  color: #d02b3c;
}

@media (max-width: 840px) {
  .weapon-hud {
    right: 14px;
    bottom: 14px;
    min-width: 168px;
    padding: 7px 8px;
  }

  .hud {
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 15px;
  }

  .hud-left {
    display: none;
  }

  .hud-center {
    width: min(58vw, 360px);
  }

  .user-badge span {
    display: none;
  }
}
