:root {
  color-scheme: dark;
  --ambience-page: #cdbf91;
  --ambience-canvas: #d7c28d;
  --right-hud-width: min(260px, calc(100vw - 40px));
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--ambience-page);
  color: #f7edd0;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--ambience-page);
}

#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  background: var(--ambience-canvas);
}

.hud {
  position: fixed;
  top: 20px;
  left: 20px;
  width: min(390px, calc(100vw - 40px));
  padding: 16px 16px 14px;
  border: 1px solid rgba(255, 232, 169, 0.18);
  border-radius: 8px;
  background: rgba(15, 18, 24, 0.86);
  box-shadow: 0 18px 42px rgba(20, 12, 4, 0.24);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.hud-title {
  position: relative;
  display: flex;
  width: min(100%, 342px);
  aspect-ratio: 2113 / 744;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 19px 42px 24px;
  border-radius: 4px;
  background-image: url("./assets/ui/agentopia-title-plate.png?v=transparenttitle");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  filter: drop-shadow(0 7px 14px rgba(0, 0, 0, 0.5));
  overflow: hidden;
}

.hud-title-main,
.hud-title-sub {
  max-width: 100%;
  color: #f8d26a;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  letter-spacing: 0;
  line-height: 0.9;
  text-align: center;
  text-shadow:
    0 2px 0 #5c2c0a,
    0 4px 0 #1a0f08,
    0 0 12px rgba(255, 196, 80, 0.58);
  -webkit-text-stroke: 1px rgba(255, 238, 159, 0.44);
}

.hud-title-main {
  font-size: 34px;
}

.hud-title-sub {
  margin-top: 4px;
  font-size: 25px;
}

.hud-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 1fr;
  gap: 10px;
  align-items: end;
  margin-top: 10px;
  color: #ddd8ce;
  font-size: 14px;
  font-weight: 700;
}

#timer {
  color: #fff9e8;
  font-size: 30px;
  letter-spacing: 0;
  line-height: 0.9;
}

#shield {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 118px;
}

.shield-charge-bar {
  position: relative;
  width: 58px;
  height: 14px;
  border: 2px solid #9bd0ff;
  border-radius: 5px;
  background: rgba(8, 13, 21, 0.72);
  box-shadow: 0 0 11px rgba(94, 166, 255, 0.42);
  overflow: visible;
}

.shield-charge-bar::after {
  content: "";
  position: absolute;
  top: 3px;
  right: -6px;
  width: 4px;
  height: 6px;
  border-radius: 0 2px 2px 0;
  background: #9bd0ff;
}

.shield-charge-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 3px;
  transform: scaleX(var(--shield-charge, 0));
  transform-origin: left center;
  background: linear-gradient(90deg, #5ea6ff, #69fff1);
  box-shadow: 0 0 9px rgba(94, 166, 255, 0.82);
  transition: transform 160ms linear;
}

.shield-charge-sheen {
  position: absolute;
  inset: 2px;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.5) 45%, transparent 80%);
  opacity: 0.6;
  animation: shieldChargeSweep 1s linear infinite;
}

@keyframes shieldChargeSweep {
  from {
    transform: translateX(-46px);
  }
  to {
    transform: translateX(54px);
  }
}

.bar {
  width: 100%;
  height: 10px;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.bar span {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left center;
}

.health span {
  background: #ff5252;
}

.xp span {
  background: #5ce6ff;
}

.actions {
  position: fixed;
  top: 20px;
  right: 20px;
  display: grid;
  width: var(--right-hud-width);
  grid-template-columns: 1fr 42px 42px 42px;
  align-items: center;
  gap: 10px;
}

.win-count,
.actions button {
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 232, 169, 0.22);
  border-radius: 8px;
  background: rgba(16, 20, 27, 0.84);
  color: #ffe49a;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(20, 12, 4, 0.2);
}

.win-count {
  min-width: 0;
  padding: 0 12px;
  font-size: 14px;
  pointer-events: none;
  white-space: nowrap;
}

.end-panel button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 232, 169, 0.22);
  border-radius: 8px;
  background: rgba(16, 20, 27, 0.84);
  color: #ffe49a;
  font: inherit;
  font-weight: 900;
  line-height: 1.12;
  text-align: center;
  white-space: normal;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(20, 12, 4, 0.2);
}

.actions button:hover,
.end-panel button:hover {
  background: rgba(36, 42, 51, 0.92);
}

.agent-boss-panel {
  position: fixed;
  top: 74px;
  right: 20px;
  width: var(--right-hud-width);
  padding: 11px 12px 12px;
  border: 1px solid rgba(255, 93, 93, 0.28);
  border-radius: 8px;
  background: rgba(11, 14, 20, 0.86);
  box-shadow: 0 16px 36px rgba(20, 12, 4, 0.24);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.agent-boss-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: #ff6f6f;
  font-size: 13px;
  font-weight: 900;
}

.agent-boss-header span:last-child {
  color: #f4ddbd;
  font-size: 12px;
}

.agent-boss-bar {
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
}

.agent-boss-bar span {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, #ff5252, #ffdc68);
}

.agent-boss-teleport-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 9px;
  color: #69fff1;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}

.agent-boss-teleport-row span:last-child {
  color: #d7fff9;
}

.agent-boss-teleport-bar {
  height: 6px;
  margin-top: 5px;
  overflow: hidden;
  background: rgba(105, 255, 241, 0.12);
}

.agent-boss-teleport-row.hidden + .agent-boss-teleport-bar {
  display: none;
}

.agent-boss-teleport-bar span {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, #69fff1, #5ea6ff);
  box-shadow: 0 0 10px rgba(105, 255, 241, 0.58);
}

.story-tab {
  position: fixed;
  left: 50%;
  top: 0;
  z-index: 12;
  display: grid;
  align-content: center;
  min-width: 178px;
  min-height: 62px;
  padding: 8px 18px 13px;
  transform: translateX(-50%);
  border: 1px solid rgba(105, 255, 241, 0.36);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background:
    linear-gradient(180deg, rgba(17, 24, 30, 0.94), rgba(8, 13, 19, 0.88)),
    radial-gradient(circle at 50% 0%, rgba(255, 220, 104, 0.2), transparent 64%);
  color: #ffe49a;
  font: inherit;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: 0;
  text-align: center;
  cursor: pointer;
  box-shadow:
    0 14px 32px rgba(20, 12, 4, 0.22),
    inset 0 -1px 0 rgba(255, 232, 169, 0.14);
  backdrop-filter: blur(8px);
}

.story-tab span {
  display: block;
  margin-top: 2px;
  color: #9dfff4;
  font-size: 10px;
  text-transform: uppercase;
}

.story-tab::after {
  content: "";
  width: 10px;
  height: 10px;
  margin: 3px auto 0;
  border-right: 2px solid #9dfff4;
  border-bottom: 2px solid #9dfff4;
  transform: rotate(45deg);
  opacity: 0.78;
  animation: storyTabPull 1.35s ease-in-out infinite;
}

.story-tab:hover {
  border-color: rgba(255, 220, 104, 0.6);
  background:
    linear-gradient(180deg, rgba(31, 37, 44, 0.96), rgba(12, 17, 24, 0.92)),
    radial-gradient(circle at 50% 0%, rgba(255, 220, 104, 0.3), transparent 64%);
}

.story-tab.scout-report-tab.is-scout-active {
  min-width: 216px;
  border-color: rgba(255, 220, 104, 0.74);
  background:
    linear-gradient(180deg, rgba(42, 34, 16, 0.97), rgba(13, 19, 25, 0.93)),
    radial-gradient(circle at 50% 0%, rgba(105, 255, 241, 0.22), transparent 66%);
  box-shadow:
    0 16px 34px rgba(20, 12, 4, 0.3),
    0 0 24px rgba(255, 220, 104, 0.26),
    inset 0 -1px 0 rgba(255, 232, 169, 0.18);
}

.story-tab.scout-report-tab.is-scout-active::after {
  border-color: #ffdc68;
  opacity: 1;
}

.scout-report-help {
  position: fixed;
  inset: 0;
  z-index: 32;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 20%, rgba(105, 255, 241, 0.12), transparent 42%),
    rgba(6, 9, 14, 0.72);
  backdrop-filter: blur(6px);
}

.scout-help-card {
  position: relative;
  width: min(560px, calc(100vw - 40px));
  max-height: calc(100vh - 48px);
  padding: 26px;
  overflow: auto;
  border: 1px solid rgba(255, 220, 104, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(12, 20, 27, 0.97), rgba(32, 22, 10, 0.95)),
    rgba(11, 14, 20, 0.96);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.48),
    0 0 30px rgba(105, 255, 241, 0.12);
}

.scout-help-kicker {
  color: #9dfff6;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.scout-help-card h2 {
  margin: 8px 0 10px;
  color: #fff3d0;
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 950;
  line-height: 0.98;
}

.scout-help-card p {
  margin: 0;
  color: #d8d0bf;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.45;
}

.scout-help-example {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 14px;
  align-items: center;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid rgba(105, 255, 241, 0.22);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 50%, rgba(105, 255, 241, 0.12), transparent 56%),
    rgba(20, 25, 34, 0.76);
}

.scout-example-map {
  position: relative;
  min-height: 148px;
  border: 1px solid rgba(255, 220, 104, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(215, 194, 141, 0.18) 0 28%, rgba(21, 28, 32, 0.7) 28% 72%, rgba(215, 194, 141, 0.18) 72%),
    repeating-linear-gradient(0deg, rgba(255, 220, 104, 0.08) 0 2px, transparent 2px 18px),
    rgba(8, 13, 19, 0.78);
  overflow: hidden;
}

.scout-example-map::before,
.scout-example-map::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.scout-example-map::before {
  inset: 16px 74px;
  border-left: 2px dashed rgba(255, 220, 104, 0.45);
  border-right: 2px dashed rgba(255, 220, 104, 0.18);
}

.scout-example-map::after {
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 38px, rgba(201, 173, 113, 0.3) 76px),
    linear-gradient(90deg, rgba(201, 173, 113, 0.46), transparent 26%, transparent 74%, rgba(201, 173, 113, 0.46));
}

.scout-example-chip {
  position: absolute;
  z-index: 2;
  display: grid;
  min-width: 54px;
  min-height: 38px;
  place-items: center;
  padding: 6px 9px;
  border: 1px solid rgba(255, 220, 104, 0.62);
  border-radius: 8px;
  background: rgba(36, 25, 12, 0.9);
  color: #fff2c2;
  font-size: 16px;
  font-weight: 950;
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.22),
    0 0 14px rgba(255, 220, 104, 0.18);
}

.scout-example-chip.is-top {
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.scout-example-chip.is-right {
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
}

.scout-example-chip.is-bottom {
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.scout-example-chip.is-left {
  top: 50%;
  left: 8px;
  transform: translateY(-50%);
}

.scout-example-agent {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  display: grid;
  min-width: 58px;
  min-height: 34px;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(105, 255, 241, 0.42);
  border-radius: 999px;
  background: rgba(7, 29, 36, 0.88);
  color: #9dfff6;
  font-size: 12px;
  font-weight: 950;
}

.scout-example-work {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.scout-example-work strong {
  color: #9dfff6;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.scout-example-work span {
  color: #fff3d0;
  font-size: 24px;
  font-weight: 950;
  line-height: 1.08;
}

.scout-example-work b {
  color: #ffdc68;
  font-size: 30px;
}

.scout-example-work em {
  color: #cfc6b4;
  font-size: 13px;
  font-style: normal;
  font-weight: 850;
}

.scout-help-rules {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.scout-help-rules div {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid rgba(255, 220, 104, 0.16);
  border-radius: 8px;
  background: rgba(32, 37, 50, 0.68);
}

.scout-help-rules strong {
  color: #ffdc68;
  font-size: 14px;
  font-weight: 950;
}

.scout-help-rules span {
  color: #cfc6b4;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.28;
}

.scout-help-done {
  min-height: 46px;
  margin-top: 18px;
  padding: 11px 18px;
  border: 1px solid rgba(255, 232, 169, 0.34);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffe49a, #d58b32);
  color: #1d1309;
  font: inherit;
  font-size: 15px;
  font-weight: 950;
  cursor: pointer;
}

.scout-help-done:hover {
  background: linear-gradient(180deg, #fff0b5, #eca13f);
}

.scout-help-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 232, 169, 0.24);
  border-radius: 8px;
  background: rgba(16, 20, 27, 0.84);
  color: #ffe49a;
  font: inherit;
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.scout-help-close:hover {
  background: rgba(36, 42, 51, 0.94);
}

.scout-report-panel {
  position: fixed;
  left: 50%;
  top: 158px;
  z-index: 13;
  width: min(520px, calc(100vw - 40px));
  padding: 16px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 220, 104, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(12, 20, 27, 0.96), rgba(32, 22, 10, 0.93)),
    rgba(11, 14, 20, 0.94);
  box-shadow:
    0 20px 52px rgba(20, 12, 4, 0.36),
    0 0 26px rgba(105, 255, 241, 0.12);
  backdrop-filter: blur(10px);
  animation: scoutReportDrop 180ms ease-out;
}

.scout-report-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  color: #9dfff6;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.scout-report-topline span:last-child {
  min-width: 44px;
  padding: 3px 8px;
  border: 1px solid rgba(105, 255, 241, 0.32);
  border-radius: 999px;
  background: rgba(8, 18, 24, 0.72);
  color: #fff1bf;
  text-align: center;
}

.scout-report-prompt {
  margin-top: 10px;
  color: #fff3d0;
  font-size: clamp(22px, 2.8vw, 34px);
  font-weight: 950;
  line-height: 1.04;
  text-align: center;
}

.scout-report-hint {
  margin-top: 8px;
  color: #cfc6b4;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}

.scout-report-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.scout-choice {
  min-height: 50px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 220, 104, 0.34);
  border-radius: 8px;
  background: rgba(32, 37, 50, 0.96);
  color: #f9efd6;
  font: inherit;
  font-size: 18px;
  font-weight: 950;
  cursor: pointer;
}

.scout-choice:hover:not(:disabled) {
  border-color: rgba(255, 220, 104, 0.76);
  background: #2a3040;
}

.scout-choice.is-correct {
  border-color: rgba(150, 255, 148, 0.8);
  background: rgba(33, 83, 45, 0.92);
  color: #d7ffd3;
}

.scout-choice.is-wrong {
  border-color: rgba(255, 103, 103, 0.76);
  background: rgba(91, 31, 31, 0.92);
  color: #ffd4d4;
}

.scout-report-feedback {
  min-height: 20px;
  margin-top: 10px;
  color: #cfc6b4;
  font-size: 13px;
  font-weight: 850;
  text-align: center;
}

.scout-report-panel.is-correct .scout-report-feedback {
  color: #d7ffd3;
}

.scout-report-panel.is-wrong .scout-report-feedback {
  color: #ffd4d4;
}

.story-curtain {
  position: fixed;
  inset: 0;
  z-index: 34;
  display: grid;
  place-items: center;
  padding: 64px 20px 32px;
  background:
    linear-gradient(180deg, rgba(8, 12, 18, 0.98), rgba(11, 14, 20, 0.86) 48%, rgba(5, 7, 11, 0.94)),
    radial-gradient(circle at 50% 0%, rgba(105, 255, 241, 0.12), transparent 48%);
  backdrop-filter: blur(8px);
  animation: storyCurtainDrop 240ms ease-out;
}

.story-lightbox {
  position: relative;
  width: min(1180px, calc(100vw - 44px));
  max-height: calc(100vh - 96px);
  padding: 16px;
  overflow: auto;
  border: 1px solid rgba(255, 232, 169, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(22, 25, 31, 0.96), rgba(10, 13, 19, 0.96)),
    radial-gradient(circle at 50% 0%, rgba(255, 220, 104, 0.13), transparent 58%);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.58),
    0 0 32px rgba(105, 255, 241, 0.14);
}

.story-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
  color: #9dfff4;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.story-header strong {
  color: #ffdc68;
  font-size: 13px;
  text-align: right;
  text-transform: none;
}

.story-video-shell {
  position: relative;
  width: min(100%, 1120px);
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 218px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(105, 255, 241, 0.26);
  border-radius: 8px;
  background: #05070c;
}

.story-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #05070c;
  pointer-events: none;
}

.story-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
}

.story-player-button,
.story-tiktok-link {
  display: grid;
  min-width: 156px;
  min-height: 44px;
  place-items: center;
  padding: 10px 18px;
  border: 1px solid rgba(255, 232, 169, 0.34);
  border-radius: 8px;
  background: rgba(16, 20, 27, 0.84);
  color: #ffe49a;
  font: inherit;
  font-size: 14px;
  font-weight: 950;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
}

.story-player-button {
  background: linear-gradient(180deg, #ffe49a, #d58b32);
  color: #1d1309;
}

.story-player-button:hover {
  background: linear-gradient(180deg, #fff0b5, #eca13f);
}

.story-tiktok-link:hover {
  background: rgba(36, 42, 51, 0.94);
}

.story-close-button {
  position: fixed;
  top: 18px;
  right: 20px;
  z-index: 35;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(255, 232, 169, 0.34);
  border-radius: 8px;
  background: rgba(16, 20, 27, 0.84);
  color: #ffe49a;
  font: inherit;
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
}

.story-close-button:hover {
  background: rgba(36, 42, 51, 0.94);
}

body.splash-active .story-tab,
body.story-active .story-tab,
body.scout-help-active .story-tab,
body.splash-active .scout-report-panel,
body.story-active .scout-report-panel,
body.scout-help-active .scout-report-panel {
  opacity: 0;
  pointer-events: none;
}

@keyframes scoutReportDrop {
  from {
    opacity: 0;
    transform: translate(-50%, -10px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes storyTabPull {
  0%,
  100% {
    transform: translateY(0) rotate(45deg);
  }

  50% {
    transform: translateY(4px) rotate(45deg);
  }
}

@keyframes storyCurtainDrop {
  from {
    opacity: 0;
    transform: translateY(-24px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.inventory-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: min(360px, calc(100vw - 40px));
  padding: 12px;
  border: 1px solid rgba(255, 232, 169, 0.2);
  border-radius: 8px;
  background: rgba(11, 14, 20, 0.88);
  box-shadow: 0 18px 44px rgba(20, 12, 4, 0.28);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.inventory-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  color: #ffdc68;
  font-size: 14px;
  font-weight: 900;
}

.inventory-header span:last-child {
  color: #ddd4c3;
  font-size: 12px;
}

.inventory-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
  gap: 8px;
}

.inventory-slot {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  height: 62px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(32, 37, 50, 0.88);
  overflow: hidden;
}

.inventory-slot.empty {
  border-style: dashed;
  background: rgba(32, 37, 50, 0.42);
}

.inventory-slot.oldest:not(.empty) {
  border-color: rgba(255, 220, 104, 0.58);
}

.inventory-slot img {
  width: 46px;
  height: 46px;
  border-radius: 7px;
  object-fit: cover;
}

.inventory-slot .slot-level {
  position: absolute;
  right: 4px;
  bottom: 4px;
  min-width: 22px;
  padding: 2px 4px;
  border-radius: 6px;
  background: rgba(8, 10, 14, 0.9);
  color: #fff4bd;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.inventory-slot .slot-empty {
  color: rgba(221, 212, 195, 0.45);
  font-size: 20px;
  font-weight: 900;
}

.upgrade-panel {
  position: fixed;
  left: 20px;
  bottom: 20px;
  width: min(360px, calc(100vw - 40px));
  padding: 16px;
  border: 1px solid rgba(255, 232, 169, 0.2);
  border-radius: 8px;
  background: rgba(11, 14, 20, 0.91);
  box-shadow: 0 22px 56px rgba(20, 12, 4, 0.34);
  backdrop-filter: blur(10px);
  isolation: isolate;
  overflow: hidden;
}

.upgrade-panel::before,
.upgrade-panel::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.upgrade-panel::before {
  inset: 0;
  z-index: 0;
  border: 2px solid rgba(255, 220, 104, 0.72);
  border-radius: inherit;
  box-shadow:
    0 0 0 1px rgba(105, 255, 241, 0.24) inset,
    0 0 18px rgba(255, 220, 104, 0.48),
    0 0 34px rgba(105, 255, 241, 0.22);
  animation: upgradePanelPulse 1.15s ease-in-out infinite;
}

.upgrade-panel::after {
  inset: -3px;
  z-index: 0;
  padding: 3px;
  border-radius: 11px;
  background: conic-gradient(
    from 0turn,
    transparent 0turn,
    transparent 0.66turn,
    rgba(105, 255, 241, 0.2) 0.76turn,
    #69fff1 0.82turn,
    #ffdc68 0.9turn,
    transparent 0.99turn
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: upgradePanelScan 1.45s linear infinite;
}

.upgrade-title {
  position: relative;
  z-index: 1;
  color: #ffdc68;
  font-size: 20px;
  font-weight: 900;
  margin-bottom: 12px;
}

.upgrade-choices {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
}

@keyframes upgradePanelPulse {
  0%,
  100% {
    opacity: 0.62;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(0.996);
  }
}

@keyframes upgradePanelScan {
  to {
    transform: rotate(1turn);
  }
}

.upgrade-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 88px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: #202532;
  color: #f9efd6;
  text-align: left;
  cursor: pointer;
}

.upgrade-card:hover {
  border-color: rgba(255, 220, 104, 0.55);
  background: #2a3040;
}

.upgrade-card.is-boosted {
  border-color: rgba(105, 255, 241, 0.66);
  background:
    linear-gradient(135deg, rgba(105, 255, 241, 0.14), rgba(255, 220, 104, 0.08)),
    #202532;
  box-shadow:
    0 0 0 1px rgba(105, 255, 241, 0.16) inset,
    0 0 24px rgba(105, 255, 241, 0.2);
}

.upgrade-icon {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  object-fit: cover;
  background: #141821;
}

.upgrade-name {
  display: block;
  font-size: 16px;
  font-weight: 900;
}

.upgrade-boost-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 22px;
  margin-left: 8px;
  padding: 2px 7px;
  border: 1px solid rgba(105, 255, 241, 0.68);
  border-radius: 999px;
  background: rgba(7, 30, 39, 0.9);
  color: #9dfff6;
  font-size: 12px;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 0 0 16px rgba(105, 255, 241, 0.28);
}

.upgrade-meta {
  display: block;
  margin-top: 3px;
  color: #ffdc68;
  font-size: 12px;
  font-weight: 800;
}

.upgrade-desc {
  margin-top: 6px;
  color: #c9c3b8;
  font-size: 13px;
  line-height: 1.25;
}

.math-question-panel {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 5;
  width: min(640px, calc(100vw - 440px));
  min-height: 0;
  padding: 18px;
  transform: translateX(-50%);
  border: 1px solid rgba(105, 255, 241, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(10, 22, 31, 0.94), rgba(30, 22, 12, 0.91)),
    rgba(11, 14, 20, 0.94);
  box-shadow:
    0 22px 56px rgba(20, 12, 4, 0.34),
    0 0 32px rgba(105, 255, 241, 0.14);
  backdrop-filter: blur(10px);
}

.math-question-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: #9dfff6;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.math-question-prompt {
  margin-top: 13px;
  color: #fff3d0;
  font-size: clamp(20px, 2vw, 30px);
  font-weight: 950;
  line-height: 1.12;
  text-wrap: balance;
}

.math-question-choices {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 16px;
}

.math-choice {
  min-height: 54px;
  border: 1px solid rgba(255, 220, 104, 0.32);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(32, 37, 50, 0.96);
  color: #f9efd6;
  font-size: 17px;
  font-weight: 950;
}

.math-choice:hover:not(:disabled) {
  border-color: rgba(255, 220, 104, 0.72);
  background: #2a3040;
}

.math-choice.is-correct {
  border-color: rgba(150, 255, 148, 0.8);
  background: rgba(33, 83, 45, 0.92);
  color: #d7ffd3;
}

.math-choice.is-wrong {
  border-color: rgba(255, 103, 103, 0.76);
  background: rgba(91, 31, 31, 0.92);
  color: #ffd4d4;
}

.math-question-feedback {
  min-height: 22px;
  margin-top: 12px;
  color: #c9c3b8;
  font-size: 13px;
  font-weight: 800;
}

.math-question-panel.is-correct .math-question-feedback,
.math-question-panel.is-complete .math-question-feedback {
  color: #d7ffd3;
}

.math-question-panel.is-wrong .math-question-feedback {
  color: #ffd4d4;
}

.end-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(430px, calc(100vw - 40px));
  padding: 22px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 232, 169, 0.22);
  border-radius: 8px;
  background: rgba(13, 16, 22, 0.92);
  box-shadow: 0 28px 80px rgba(20, 12, 4, 0.45);
  text-align: center;
}

.end-title {
  color: #ffdc68;
  font-size: 30px;
  font-weight: 950;
}

.end-stats {
  margin: 12px 0 18px;
  color: #ddd4c3;
}

.end-actions {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 10px;
}

.end-actions button {
  width: 100%;
}

#endShopButton {
  min-height: 64px;
}

.end-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.pause-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 20;
  width: min(520px, calc(100vw - 40px));
  padding: 26px 30px 28px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 232, 169, 0.24);
  border-radius: 8px;
  background: rgba(13, 16, 22, 0.94);
  box-shadow: 0 28px 80px rgba(20, 12, 4, 0.5);
  color: #f7edd0;
  text-align: center;
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.pause-title {
  margin-bottom: 16px;
  color: #ffdc68;
  font-size: 30px;
  font-weight: 950;
}

.pause-control {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: center;
  padding: 15px 0;
  border-top: 1px solid rgba(255, 232, 169, 0.12);
  color: #ddd4c3;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
  text-align: left;
}

.pause-control.movement-help {
  grid-template-columns: 220px 1fr;
}

.movement-keys {
  display: flex;
  justify-content: center;
  gap: 18px;
}

.key-cluster {
  display: grid;
  grid-template-columns: repeat(3, 30px);
  grid-template-rows: repeat(2, 30px);
  gap: 4px;
  justify-content: center;
}

.key-cluster .key:nth-child(1) {
  grid-column: 2;
  grid-row: 1;
}

.key-cluster .key:nth-child(2) {
  grid-column: 1;
  grid-row: 2;
}

.key-cluster .key:nth-child(3) {
  grid-column: 2;
  grid-row: 2;
}

.key-cluster .key:nth-child(4) {
  grid-column: 3;
  grid-row: 2;
}

.key-row {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.key {
  display: grid;
  min-width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(255, 232, 169, 0.3);
  border-radius: 6px;
  background: rgba(32, 37, 50, 0.92);
  color: #ffe49a;
  font-size: 15px;
  font-weight: 950;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.28);
}

.key-up {
  grid-column: 2;
  grid-row: 1;
}

.key-wide {
  min-width: 52px;
  padding: 0 8px;
  font-size: 12px;
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center end;
  overflow: hidden;
  background: #060a12;
  background-image: url("../assets/video-clips/zombie-survivor/zombie-survivor-agent-cowboy-key-art.png");
  background-position: center;
  background-size: cover;
}

.splash-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.splash-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(3, 6, 13, 0.08) 0%, rgba(3, 6, 13, 0.16) 42%, rgba(3, 6, 13, 0.66) 100%),
    linear-gradient(180deg, rgba(3, 6, 13, 0.1) 0%, rgba(3, 6, 13, 0.08) 58%, rgba(3, 6, 13, 0.62) 100%);
}

.splash-panel {
  position: relative;
  width: min(560px, calc(100vw - 40px));
  margin-right: clamp(28px, 7vw, 118px);
  padding: 0;
  color: #f7edd0;
  text-align: center;
  filter: drop-shadow(0 18px 38px rgba(0, 0, 0, 0.54));
  transition:
    opacity 260ms ease,
    transform 260ms ease;
}

.splash-screen.intro-gate,
.splash-screen.intro-playing {
  place-items: center;
}

.splash-screen.intro-gate .splash-panel,
.splash-screen.intro-playing .splash-panel {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
}

.splash-screen.cta-ready .splash-video {
  display: none;
}

.splash-screen.ad-playing .splash-video {
  display: none;
}

.ad-slot {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(1120px, calc(100vw - 48px));
  gap: 12px;
  place-items: center;
  padding: 16px;
  border: 1px solid rgba(255, 232, 169, 0.26);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(16, 20, 27, 0.92), rgba(6, 9, 14, 0.92)),
    radial-gradient(circle at 50% 0%, rgba(105, 255, 241, 0.14), transparent 58%);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.5),
    0 0 28px rgba(105, 255, 241, 0.12);
}

.ima-ad-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background: #05070c;
  pointer-events: none;
}

.ad-status {
  color: #ffdc68;
  font-size: 13px;
  font-weight: 950;
  text-transform: uppercase;
}

.ad-continue-button {
  min-width: 140px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid rgba(255, 232, 169, 0.42);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffe49a, #d58b32);
  color: #1d1309;
  font: inherit;
  font-size: 14px;
  font-weight: 950;
  cursor: pointer;
}

.play-intro-button,
.skip-button {
  position: absolute;
  min-width: 96px;
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid rgba(255, 232, 169, 0.34);
  border-radius: 8px;
  background: rgba(16, 20, 27, 0.78);
  color: #ffe49a;
  font: inherit;
  font-size: 14px;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
}

.intro-countdown {
  position: absolute;
  left: 50%;
  top: clamp(54px, 11vh, 108px);
  min-width: 172px;
  padding: 16px 22px 18px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 232, 169, 0.38);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(16, 20, 27, 0.86), rgba(8, 10, 14, 0.78)),
    radial-gradient(circle at 50% 28%, rgba(255, 225, 124, 0.18), transparent 58%);
  color: #fff2bd;
  text-align: center;
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.34),
    inset 0 0 26px rgba(255, 211, 94, 0.08);
  backdrop-filter: blur(8px);
}

.intro-countdown-label {
  display: block;
  color: #dffef7;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.intro-countdown-value {
  display: block;
  margin-top: 4px;
  color: #ffe071;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: clamp(62px, 8vw, 104px);
  line-height: 0.9;
  letter-spacing: 0;
  text-shadow:
    0 3px 0 #7b3b0d,
    0 7px 0 #1a0f08,
    0 0 28px rgba(255, 209, 84, 0.7);
  -webkit-text-stroke: 1px rgba(255, 246, 189, 0.54);
}

.play-intro-button {
  left: 50%;
  bottom: clamp(44px, 9vh, 86px);
  min-width: 168px;
  min-height: 56px;
  transform: translateX(-50%);
  border-color: rgba(255, 232, 169, 0.52);
  background: linear-gradient(180deg, #ffe49a, #d58b32);
  color: #1d1309;
  font-size: 18px;
}

.skip-button {
  right: 24px;
  top: 24px;
}

.splash-screen.ad-playing .skip-button {
  display: none;
}

.play-intro-button:hover,
.skip-button:hover {
  background: rgba(36, 42, 51, 0.9);
}

.play-intro-button:hover {
  background: linear-gradient(180deg, #fff0b5, #eca13f);
}

.splash-screen:not(.intro-gate) .intro-countdown,
.splash-screen:not(.intro-gate) .play-intro-button,
.splash-screen:not(.intro-playing) .skip-button {
  display: none;
}

.studio-mark {
  display: inline-grid;
  min-height: 38px;
  place-items: center;
  padding: 8px 18px;
  border: 1px solid rgba(105, 255, 241, 0.42);
  border-radius: 8px;
  background: rgba(8, 28, 33, 0.76);
  color: #dffef7;
  font-size: 15px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
  box-shadow:
    0 0 16px rgba(105, 255, 241, 0.18),
    inset 0 0 18px rgba(105, 255, 241, 0.08);
}

.splash-title {
  display: flex;
  width: min(100%, 520px);
  aspect-ratio: 2113 / 744;
  box-sizing: border-box;
  margin: 22px auto 20px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 34px 66px;
  background-image: url("./assets/ui/agentopia-title-plate.png?v=transparenttitle");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.splash-title-main,
.splash-title-sub {
  max-width: 100%;
  color: #f8d26a;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  letter-spacing: 0;
  line-height: 0.88;
  text-align: center;
  text-shadow:
    0 3px 0 #5c2c0a,
    0 6px 0 #1a0f08,
    0 0 16px rgba(255, 196, 80, 0.62);
  -webkit-text-stroke: 1px rgba(255, 238, 159, 0.48);
}

.splash-title-main {
  font-size: clamp(42px, 5vw, 70px);
}

.splash-title-sub {
  font-size: clamp(30px, 3.8vw, 52px);
}

.start-button {
  min-width: 190px;
  min-height: 58px;
  padding: 14px 30px;
  border: 1px solid rgba(255, 232, 169, 0.52);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffe49a, #d58b32);
  color: #1d1309;
  font: inherit;
  font-size: 18px;
  font-weight: 950;
  cursor: pointer;
  box-shadow:
    0 16px 34px rgba(12, 6, 2, 0.4),
    0 0 22px rgba(255, 220, 104, 0.24);
}

.start-button:hover {
  background: linear-gradient(180deg, #fff0b5, #eca13f);
}

body.splash-active .hud,
body.splash-active .actions,
body.splash-active .agent-boss-panel,
body.splash-active .inventory-panel {
  opacity: 0;
  pointer-events: none;
}

.hidden {
  display: none;
}

@media (max-width: 720px) {
  .hud {
    top: 12px;
    left: 12px;
    width: calc(100vw - 24px);
    padding: 12px;
  }

  .hud-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    font-size: 12px;
  }

  #timer {
    font-size: 24px;
  }

  .actions {
    top: auto;
    right: 12px;
    bottom: 12px;
  }

  .story-tab {
    min-width: 148px;
    min-height: 56px;
    padding: 7px 14px 12px;
    font-size: 11px;
  }

  .story-tab.scout-report-tab.is-scout-active {
    min-width: 166px;
  }

  .scout-help-card {
    width: min(560px, calc(100vw - 24px));
    padding: 20px;
  }

  .scout-help-example {
    grid-template-columns: 1fr;
  }

  .scout-example-work span {
    font-size: 21px;
  }

  .scout-report-panel {
    top: 158px;
    width: calc(100vw - 24px);
    padding: 13px;
  }

  .scout-report-choices {
    grid-template-columns: 1fr;
  }

  .story-curtain {
    padding: 58px 12px 20px;
  }

  .story-lightbox {
    width: min(680px, calc(100vw - 24px));
    max-height: calc(100vh - 84px);
    padding: 10px;
  }

  .story-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .story-header strong {
    text-align: left;
  }

  .story-video-shell {
    width: 100%;
    max-height: calc(100vh - 198px);
  }

  .story-actions {
    flex-direction: column;
    gap: 8px;
  }

  .story-player-button,
  .story-tiktok-link {
    width: 100%;
  }

  .story-close-button {
    top: 10px;
    right: 12px;
    width: 40px;
    height: 40px;
  }

  .inventory-panel {
    right: 12px;
    bottom: 66px;
    width: min(320px, calc(100vw - 24px));
  }

  .upgrade-panel {
    left: 12px;
    bottom: 148px;
    width: calc(100vw - 24px);
  }

  .math-question-panel {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    min-height: 0;
    transform: none;
  }

  .math-question-choices {
    grid-template-columns: 1fr;
  }

  .end-actions {
    grid-template-columns: 1fr;
  }

  .pause-control {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .pause-control.movement-help {
    grid-template-columns: 1fr;
  }

  .splash-screen {
    place-items: end center;
  }

  .splash-shade {
    background:
      linear-gradient(180deg, rgba(3, 6, 13, 0.08) 0%, rgba(3, 6, 13, 0.24) 42%, rgba(3, 6, 13, 0.78) 100%);
  }

  .splash-panel {
    margin: 0 12px 28px;
  }

  .play-intro-button {
    bottom: 34px;
  }

  .ad-slot {
    width: calc(100vw - 24px);
    padding: 10px;
  }

  .intro-countdown {
    top: 28px;
    min-width: 148px;
    padding: 12px 18px 14px;
  }

  .skip-button {
    right: 14px;
    top: 14px;
  }

  .studio-mark {
    font-size: 12px;
  }

  .splash-title {
    margin: 14px auto 14px;
    padding: 26px 48px;
  }

  .start-button {
    min-width: 166px;
  }
}
