.game-screen {
  overflow: hidden;
  background: #10131a;
}

.game-screen.active {
  display: block;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  touch-action: none;
}

.hud {
  position: absolute;
  z-index: 3;
  pointer-events: none;
}

.hud-top {
  top: max(9px, env(safe-area-inset-top));
  left: max(11px, env(safe-area-inset-left));
  right: max(11px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 9px;
}

.status-chip,
.small-hud-button {
  min-height: 36px;
  border: 3px solid #17120f;
  border-radius: 4px;
  background: var(--panel);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.36);
}

.status-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  font-size: clamp(0.75rem, 1.5vw, 0.92rem);
  font-weight: 800;
}

.status-chip span {
  color: var(--muted);
}

.vitals-chip {
  width: min(224px, 32vw);
  display: grid;
  gap: 3px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(0, 0, 0, 0.22);
  pointer-events: none;
}

.vital-row {
  display: block;
  line-height: 1;
}

.bar {
  width: 100%;
  height: 8px;
  border: 1px solid rgba(0, 0, 0, 0.72);
  background: rgba(54, 21, 25, 0.9);
}

.mana-bar {
  height: 6px;
  background: #172844;
}

.stamina-bar {
  height: 7px;
  background: #292929;
}

.bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--green), #e4f06a);
}

.mana-fill {
  background: linear-gradient(90deg, #52bfff, #9ee7ff);
}

.stamina-fill {
  background: linear-gradient(90deg, #f7f7ed, #cfd2d7);
}

.stamina-fill.exhausted {
  background: linear-gradient(90deg, #ff4f4f, #fff2f2);
  animation: staminaBlink 0.28s steps(2, end) infinite;
}

@keyframes staminaBlink {
  0% {
    filter: brightness(0.7);
  }

  100% {
    filter: brightness(1.75);
  }
}

.small-hud-button {
  padding: 0 12px;
  color: var(--muted);
  pointer-events: auto;
  font-size: 0.82rem;
  font-weight: 900;
}

.coin-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(0, 0, 0, 0.26);
  color: #f4d36b;
  font-size: 0.82rem;
  font-weight: 900;
  text-shadow: 0 2px 0 #000;
  pointer-events: none;
}

.coin-icon {
  width: 14px;
  height: 14px;
  aspect-ratio: 1;
  background: url("../assets/icons/gold.png") center / contain no-repeat;
  image-rendering: pixelated;
  filter: drop-shadow(0 1px 0 #000);
}

.gold-inline-icon {
  width: 0.95em;
  height: 0.95em;
  margin-left: 0.24em;
  vertical-align: -0.12em;
  image-rendering: pixelated;
  filter: drop-shadow(0 1px 0 #000);
}

.mana-inline-icon {
  width: 0.92em;
  height: 0.92em;
  margin-left: 0.22em;
  vertical-align: -0.1em;
  image-rendering: pixelated;
  filter: drop-shadow(0 1px 0 #00122a);
}

.top-right-controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  pointer-events: auto;
}

.minimap {
  position: absolute;
  z-index: 3;
  top: max(62px, calc(env(safe-area-inset-top) + 58px));
  right: max(11px, env(safe-area-inset-right));
  width: clamp(112px, 15vw, 172px);
  aspect-ratio: 1.4;
  display: none;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(4, 5, 6, 0.58);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.32);
  pointer-events: none;
  image-rendering: pixelated;
}

.minimap.active {
  display: block;
}

.minimap canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.circle-hud-button {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(38px, 5.2vw, 46px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(6, 6, 7, 0.5);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.34), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  pointer-events: auto;
  backdrop-filter: blur(2px);
}

.circle-hud-button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.34);
}

.hamburger-icon,
.hamburger-icon::before,
.hamburger-icon::after {
  display: block;
  width: 18px;
  height: 2px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 1px 0 #000;
}

.hamburger-icon {
  position: relative;
}

.hamburger-icon::before,
.hamburger-icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.hamburger-icon::before {
  top: -6px;
}

.hamburger-icon::after {
  top: 6px;
}

.bag-icon {
  width: 19px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 2px 2px 5px 5px;
  box-shadow: 0 1px 0 #000;
}

.bag-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 10px;
  width: 11px;
  height: 7px;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  transform: translateX(-50%);
}

.quick-menu-panel {
  position: absolute;
  z-index: 6;
  top: max(58px, calc(env(safe-area-inset-top) + 54px));
  right: max(11px, env(safe-area-inset-right));
  display: none;
  min-width: 148px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(4, 4, 5, 0.86);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.42);
  pointer-events: auto;
}

.quick-menu-panel.active {
  display: grid;
  gap: 6px;
}

.quick-menu-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: left;
}

.quick-menu-button:active {
  background: rgba(255, 255, 255, 0.12);
}

.quick-menu-button.danger {
  color: #e5b3ad;
}

.boss-hud {
  position: absolute;
  z-index: 4;
  top: max(9px, env(safe-area-inset-top));
  left: 50%;
  width: min(420px, 42vw);
  transform: translateX(-50%);
  display: none;
  padding: 4px 7px 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0;
  background: rgba(5, 5, 6, 0.55);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.26);
  pointer-events: none;
}

.boss-hud.active {
  display: block;
}

.boss-hud-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 3px;
  color: #f3e5c8;
  font-size: clamp(0.62rem, 1.1vw, 0.76rem);
  font-weight: 900;
  text-shadow: 0 2px 0 #000;
}

.boss-hud-label strong {
  color: #d6b48c;
  font-size: 0.82em;
}

.boss-hp-frame {
  position: relative;
  height: clamp(8px, 1.1vw, 11px);
  border: 1px solid #241817;
  background: #241518;
  overflow: hidden;
}

.boss-poise-frame {
  height: 4px;
  margin-top: 3px;
  border: 1px solid rgba(30, 24, 18, 0.92);
  background: rgba(52, 42, 28, 0.86);
  overflow: hidden;
}

.boss-hp-fill,
.boss-shield-fill,
.boss-poise-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  transform-origin: left center;
}

.boss-hp-fill {
  width: 100%;
  background: linear-gradient(90deg, #8f1e2a, #d84242, #ff7b52);
}

.boss-shield-fill {
  width: 100%;
  background: rgba(245, 250, 255, 0.44);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.68);
}

.boss-poise-fill {
  position: relative;
  display: block;
  width: 100%;
  background: linear-gradient(90deg, #f0dec0, #ffffff);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.38);
}

.weapon-slots {
  position: absolute;
  z-index: 4;
  top: max(194px, calc(env(safe-area-inset-top) + 188px));
  right: max(17px, env(safe-area-inset-right));
  display: grid;
  gap: 7px;
  pointer-events: auto;
}

.weapon-slot {
  width: clamp(34px, 4.8vw, 42px);
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid #171717;
  border-radius: 6px;
  background: rgba(28, 31, 36, 0.86);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.46), inset 0 0 0 2px rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.weapon-slot.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.24), 0 4px 0 rgba(0, 0, 0, 0.46);
}

.weapon-slot canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  pointer-events: none;
}

.rotate-hint {
  position: absolute;
  z-index: 4;
  top: 58px;
  left: 50%;
  display: none;
  transform: translateX(-50%);
  padding: 7px 12px;
  border: 2px solid #3b3d42;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.62);
  color: var(--accent);
  font-weight: 900;
}

.stage-loading {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: none;
  place-items: center;
  background: #030303;
  color: #ffffff;
  pointer-events: auto;
}

.stage-loading.active {
  display: grid;
}

.stage-loading strong {
  font-size: clamp(1rem, 3vw, 1.8rem);
  font-weight: 900;
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.18);
}

.stage-title-overlay {
  --stage-title-text-alpha: 0;
  position: absolute;
  inset: 0;
  z-index: 11;
  display: none;
  place-items: center;
  background: #000000;
  color: #ffffff;
  opacity: 0;
  pointer-events: none;
}

.stage-title-overlay.active {
  display: grid;
  pointer-events: auto;
}

.stage-title-overlay strong {
  opacity: var(--stage-title-text-alpha);
  font-size: clamp(1.25rem, 4vw, 2.8rem);
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.18), 0 4px 0 #000;
}

.floor-item-hint {
  position: absolute;
  z-index: 4;
  top: max(56px, calc(env(safe-area-inset-top) + 44px));
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: min(46vw, 300px);
  max-width: min(76vw, 500px);
  padding: 6px 10px;
  border: 2px solid rgba(17, 13, 10, 0.92);
  border-radius: 4px;
  background: rgba(10, 10, 10, 0.72);
  color: #f7f1d0;
  font-size: 0.68rem;
  line-height: 1.3;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.floor-item-hint.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.floor-item-hint strong {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #ffffff;
  font-size: 0.78rem;
  margin-bottom: 2px;
}

.floor-item-hint em {
  color: #ffd76a;
  font-style: normal;
  font-size: 0.66rem;
}

.floor-item-hint span {
  color: #d8d1b8;
}

.action-toast {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: max(20px, calc(env(safe-area-inset-bottom) + 14px));
  transform: translateX(-50%) translateY(8px);
  min-width: min(250px, 44vw);
  max-width: min(460px, 68vw);
  padding: 7px 13px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  background: rgba(10, 10, 10, 0.76);
  color: #ffffff;
  font-size: clamp(0.72rem, 1.45vw, 0.88rem);
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.action-toast.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.action-toast.danger {
  border-color: rgba(255, 95, 95, 0.42);
  color: #ff7474;
  box-shadow: 0 0 18px rgba(255, 64, 64, 0.12);
}

.action-toast.success {
  border-color: rgba(118, 224, 125, 0.4);
  color: #85f08f;
  box-shadow: 0 0 18px rgba(74, 255, 120, 0.1);
}

.action-toast.info {
  border-color: rgba(106, 183, 255, 0.36);
  color: #9ed1ff;
}

.tutorial-objective {
  position: absolute;
  z-index: 5;
  top: max(54px, calc(env(safe-area-inset-top) + 44px));
  left: 50%;
  display: none;
  min-width: min(560px, 82vw);
  max-width: min(680px, 88vw);
  transform: translateX(-50%);
  padding: 9px 14px;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(8, 9, 11, 0.72);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.28);
  pointer-events: none;
  text-align: center;
}

.tutorial-objective.active {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
}

.tutorial-objective span {
  color: #ffd34d;
  font-size: clamp(0.68rem, 1.25vw, 0.8rem);
  font-weight: 900;
}

.tutorial-objective strong {
  color: #fff9de;
  font-size: clamp(0.82rem, 1.8vw, 1.02rem);
  font-weight: 900;
  line-height: 1.25;
  word-break: keep-all;
}

.tutorial-objective.completed {
  border-color: rgba(114, 242, 142, 0.62);
  background: rgba(16, 44, 26, 0.78);
}

.tutorial-objective.completed strong,
.tutorial-objective.completed span {
  color: #72f28e;
}

.tutorial-hidden {
  display: none !important;
}
