:root {
  --bg-0: #111516;
  --bg-1: #1c2223;
  --bg-2: #293233;
  --bg-3: #475556;
  --ink: #f0ead8;
  --muted: #b9b39f;
  --red: #d65e54;
  --red-deep: #8e342d;
  --yellow: #e3c15d;
  --yellow-soft: #f0d993;
  --line: rgba(255, 255, 255, 0.08);
  --panel: rgba(16, 20, 20, 0.84);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(227, 193, 93, 0.08), transparent 30%),
    radial-gradient(circle at 20% 20%, rgba(214, 94, 84, 0.08), transparent 35%),
    linear-gradient(180deg, #202829 0%, #0c0f10 100%);
  color: var(--ink);
}

body {
  min-height: 100dvh;
  overflow: hidden;
}

.shell {
  position: relative;
  width: 100vw;
  height: 100dvh;
}

.masthead {
  position: absolute;
  left: clamp(14px, 1.8vw, 24px);
  bottom: clamp(14px, 1.8vw, 24px);
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(430px, calc(100% - 28px));
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 13, 13, 0.62);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.eyebrow,
.modal__eyebrow {
  margin: 0 0 6px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--yellow-soft);
  font-size: 0.74rem;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.75rem, 3vw, 3rem);
  line-height: 0.92;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary {
  max-width: 26rem;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.95rem;
}

.frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: linear-gradient(180deg, rgba(47, 58, 60, 0.24), rgba(13, 16, 16, 0.7));
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.hud {
  position: absolute;
  inset: clamp(12px, 1.6vw, 20px) clamp(12px, 1.6vw, 20px) auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(8px, 1vw, 12px);
  pointer-events: none;
}

.hud__block {
  min-width: 0;
  padding: clamp(9px, 1vw, 12px) clamp(10px, 1.2vw, 14px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(9, 12, 12, 0.6);
  backdrop-filter: blur(8px);
}

.hud__block--wide {
  grid-column: span 2;
}

.hud__label {
  font-size: clamp(0.62rem, 0.9vw, 0.72rem);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 6px;
}

.hud__value {
  font-size: clamp(0.8rem, 1.2vw, 1rem);
  line-height: 1.25;
}

.hud__value--accent {
  color: var(--yellow);
  font-weight: 700;
}

.meter {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.meter__fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red-deep), var(--red), var(--yellow));
  transition: width 120ms linear;
}

.meter--boss {
  height: 18px;
}

.meter__fill--boss {
  background: linear-gradient(90deg, #7f2724, #b84038, #f2cf69);
}

.boss-bar {
  position: absolute;
  left: 50%;
  top: clamp(14px, 1.8vw, 22px);
  transform: translateX(-50%);
  width: min(560px, calc(100% - 32px));
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(214, 94, 84, 0.28);
  background: rgba(19, 11, 11, 0.78);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.35);
}

.boss-bar__title {
  margin-bottom: 8px;
  text-align: center;
  color: var(--yellow-soft);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.88rem;
}

.hint,
.toast {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(12, 15, 15, 0.84);
  border: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  pointer-events: none;
}

.hint {
  bottom: clamp(18px, 2vw, 24px);
  min-width: 300px;
}

.toast {
  bottom: clamp(70px, 8vw, 92px);
  color: var(--yellow-soft);
}

.modal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 9, 9, 0.62);
  backdrop-filter: blur(10px);
}

.modal__card {
  width: min(980px, 100%);
  max-height: calc(100% - 20px);
  overflow: auto;
  padding: 28px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(51, 61, 62, 0.74), rgba(15, 19, 19, 0.94)),
    radial-gradient(circle at top right, rgba(227, 193, 93, 0.12), transparent 35%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
}

.modal__copy {
  margin-bottom: 20px;
}

.modal__copy h2 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal__copy p {
  color: var(--muted);
  line-height: 1.6;
  max-width: 44rem;
}

.modal__content {
  display: grid;
  gap: 20px;
}

.shop-summary {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.shop-pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--yellow-soft);
}

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

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

.move-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(10, 13, 13, 0.6);
  border: 1px solid var(--line);
}

.move-card--special {
  border-color: rgba(214, 94, 84, 0.26);
  box-shadow: inset 0 0 0 1px rgba(227, 193, 93, 0.08);
}

.move-card strong {
  font-size: 1.02rem;
}

.move-card p {
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.94rem;
}

.move-card__combo {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--yellow-soft);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.shop-section h3 {
  margin-bottom: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--yellow-soft);
  font-size: 0.88rem;
}

.item-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(10, 13, 13, 0.6);
  border: 1px solid var(--line);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.item-card.is-equipped {
  border-color: rgba(227, 193, 93, 0.45);
  box-shadow: inset 0 0 0 1px rgba(227, 193, 93, 0.16);
}

.item-card.is-actionable {
  cursor: pointer;
}

.item-card.is-actionable:hover {
  transform: translateY(-2px);
  border-color: rgba(214, 94, 84, 0.35);
  background: rgba(16, 20, 20, 0.72);
}

.item-card__title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.item-card__title strong {
  font-size: 1.05rem;
}

.item-card__cost {
  color: var(--yellow-soft);
}

.item-card__stats,
.item-card__blurb {
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.94rem;
}

.modal__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  background: linear-gradient(180deg, rgba(90, 42, 38, 0.9), rgba(55, 22, 21, 0.95));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 120ms ease, filter 120ms ease, opacity 120ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button--primary {
  background: linear-gradient(180deg, rgba(195, 128, 46, 0.95), rgba(126, 74, 18, 0.95));
}

.button--secondary {
  background: linear-gradient(180deg, rgba(55, 63, 64, 0.95), rgba(29, 35, 36, 0.95));
}

.controls {
  position: absolute;
  right: clamp(14px, 1.8vw, 24px);
  bottom: clamp(14px, 1.8vw, 24px);
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 10px 16px;
  max-width: min(620px, calc(100% - 28px));
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 13, 13, 0.62);
  backdrop-filter: blur(10px);
  color: var(--muted);
  pointer-events: none;
}

.controls strong {
  color: var(--yellow-soft);
  margin-right: 6px;
}

.hidden {
  display: none;
}

@media (max-width: 980px) {
  .summary {
    display: none;
  }

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

  .hud__block--wide {
    grid-column: span 2;
  }

  .boss-bar {
    width: calc(100% - 40px);
  }

  .shop-grid {
    grid-template-columns: 1fr;
  }

  .move-grid {
    grid-template-columns: 1fr;
  }

  .controls {
    left: 14px;
    right: 14px;
    justify-content: center;
    bottom: 14px;
    max-width: none;
  }
}

@media (max-width: 720px) {
  .masthead {
    display: none;
  }

  .hud {
    inset: 10px 10px auto;
    gap: 8px;
  }

  .hud__block {
    padding: 10px;
    border-radius: 14px;
  }

  .hud__block--wide {
    grid-column: span 2;
  }

  .hint,
  .toast {
    width: calc(100% - 20px);
    min-width: 0;
  }

  .controls {
    display: none;
  }

  .modal {
    padding: 12px;
  }

  .modal__card {
    padding: 18px;
  }
}

@media (max-height: 760px) {
  .masthead {
    display: none;
  }

  .controls {
    display: none;
  }

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

  .hud__block--wide {
    grid-column: span 2;
  }
}
