:root {
  color-scheme: dark;
  --bg: #1a1510;
  --arena: #2a2218;
  --panel: #241c14;
  --ink: #f4e6c8;
  --muted: #a89478;
  --accent: #e8943a;
  --accent-2: #6bbf59;
  --danger: #e2554a;
  --coin: #f0c14b;
  --line: #3d3226;
  --shadow: rgba(0, 0, 0, 0.45);
  /* Quase tela cheia, mantém 16:9 */
  --stage-w: min(98vw, calc((100vh - 16px) * 16 / 9));
  --stage-h: calc(var(--stage-w) * 9 / 16);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  background: radial-gradient(ellipse at 50% 20%, #2c241a 0%, var(--bg) 70%);
  color: var(--ink);
  font-family: "Space Grotesk", system-ui, sans-serif;
  overflow: hidden;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
}

#game {
  width: var(--stage-w);
  height: var(--stage-h);
  aspect-ratio: 16 / 9;
  background: var(--arena);
  border: 3px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 20px 60px var(--shadow);
  image-rendering: pixelated;
  display: block;
}

.hidden {
  display: none !important;
}

#hud {
  position: absolute;
  pointer-events: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: 6px;
  padding: clamp(7px, 1.2vw, 16px);
  width: var(--stage-w);
  height: var(--stage-h);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.hud-vitals,
.hud-right {
  display: grid;
  gap: 5px;
}

.hud-vitals {
  width: min(100%, 176px);
}

.hud-right {
  justify-items: end;
}

.hud-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

#hud .stat,
.wep-chip {
  min-width: 0;
  background: rgba(20, 15, 11, 0.95);
  border: 1px solid #685037;
  box-shadow: inset 0 0 0 2px var(--bg), 0 2px 0 rgba(0, 0, 0, 0.45);
  font-variant-numeric: tabular-nums;
}

#hud .stat {
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 700;
}

.hud-meter-header,
.hud-controls .materials,
.aim-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
}

.hud-meter-header {
  justify-content: space-between;
  margin-bottom: 4px;
  white-space: nowrap;
}

#hud .label {
  color: #cab89c;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hud-meter .bar {
  height: 9px;
  border: 1px solid #0e0a07;
  background: #463627;
  overflow: hidden;
}

#hp-fill,
#xp-fill {
  height: 100%;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.21);
}

#hp-fill {
  width: 100%;
  background: #ce5447;
}

#xp-fill {
  width: 0;
  background: var(--coin);
}

#hud .hud-round {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0;
  text-align: center;
}

.hud-round > div {
  display: grid;
  min-width: 48px;
  padding: 5px 7px;
  font-size: 17px;
  line-height: 1.15;
}

.hud-round > div + div {
  border-left: 1px solid #685037;
}

.danger-badge {
  grid-column: 1 / -1;
  padding: 2px 5px;
  border-top: 1px solid var(--line);
  color: var(--coin);
  font-size: 0.6875rem;
  font-weight: 700;
}

#hud .materials {
  color: var(--coin);
  font-size: 15px;
}

.aim-toggle {
  pointer-events: auto;
  cursor: pointer;
  color: var(--muted);
  font-family: inherit;
  white-space: nowrap;
}

.aim-indicator {
  width: 17px;
  height: 10px;
  padding: 1px;
  border: 1px solid currentColor;
  color: inherit;
}

.aim-indicator::after {
  display: block;
  content: "";
  width: 5px;
  height: 6px;
  background: currentColor;
}

#hud .aim-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--coin);
}

.aim-toggle[aria-pressed="true"] .aim-indicator::after {
  margin-left: auto;
}

#weapon-strip {
  display: flex;
  gap: 4px;
}

.wep-chip {
  display: grid;
  place-items: center;
  width: 31px;
  height: 30px;
  border-top: 2px solid var(--tier-color);
}

.wep-chip .asset-img {
  width: 24px;
  height: 24px;
}

#hud #crate-notice {
  position: absolute;
  inset: auto auto 14px 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px #412a17, 0 3px 0 #100b07;
  width: max-content;
  max-width: calc(100% - 20px);
  color: var(--coin);
  text-align: center;
}

#crate-notice:empty {
  opacity: 0;
  padding: 0;
}

@media (max-width: 520px) {
  #hud .stat { font-size: 11px; padding-inline: 5px; }
  .hud-meter .bar { height: 7px; }
  .hud-round > div { min-width: 35px; padding-inline: 4px; font-size: 13px; }
  .aim-indicator { display: none; }
  .wep-chip { width: 24px; height: 22px; }
  .wep-chip .asset-img { width: 19px; height: 19px; }
}

.opt-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  margin: 0 auto 18px;
  max-width: 320px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: #1a1510;
  cursor: pointer;
  user-select: none;
}

.opt-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.opt-switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: #32271c;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.opt-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--muted);
  transition: transform 0.15s ease, background 0.15s ease;
}

.opt-toggle input:checked + .opt-switch {
  background: #3d2a14;
  border-color: var(--accent);
}

.opt-toggle input:checked + .opt-switch::after {
  transform: translateX(18px);
  background: var(--accent);
}

.opt-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.opt-text strong {
  font-size: 14px;
}

.opt-text small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(12, 9, 6, 0.72);
  backdrop-filter: blur(2px);
  z-index: 5;
}

.panel {
  width: min(92vw, 520px);
  background: var(--panel);
  border: 2px solid var(--line);
  padding: 28px 28px 24px;
  box-shadow: 0 24px 48px var(--shadow);
}

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

/* —— Title splash (campo de batalha full-bleed + menu flutuante) —— */
.title-screen {
  background: rgba(6, 4, 2, 0.6);
  backdrop-filter: none;
  pointer-events: none;
}

.title-stage {
  pointer-events: auto;
  position: relative;
  width: var(--stage-w);
  height: var(--stage-h);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 3px solid #4a3424;
  box-shadow:
    0 0 0 1px #1a120a,
    0 24px 70px rgba(0, 0, 0, 0.65);
  background: #100a06;
}

.title-hero {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.title-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 42% center;
  transform: scale(1.05);
  animation: title-pan 20s ease-in-out infinite alternate;
}

.title-hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0%, transparent 48%, rgba(10, 6, 3, 0.45) 68%, rgba(10, 6, 3, 0.88) 100%),
    linear-gradient(180deg, rgba(20, 10, 4, 0.2) 0%, transparent 30%, rgba(6, 4, 2, 0.5) 100%);
  pointer-events: none;
  z-index: 1;
}

.title-hero-art {
  position: absolute;
  left: 0;
  bottom: 0;
  width: min(72%, 720px);
  height: auto;
  z-index: 3;
  image-rendering: auto;
  /* fundo preto do PNG some sobre o cenário escuro */
  mix-blend-mode: lighten;
  animation: hero-bob 2.6s ease-in-out infinite;
  transform-origin: 45% 85%;
}

.title-smoke {
  position: absolute;
  inset: auto 0 0 0;
  height: 24%;
  background:
    radial-gradient(ellipse at 30% 100%, rgba(232, 148, 58, 0.16), transparent 55%),
    radial-gradient(ellipse at 70% 120%, rgba(180, 80, 30, 0.12), transparent 50%);
  pointer-events: none;
  z-index: 2;
  animation: smoke-pulse 3.2s ease-in-out infinite;
}

.title-menu {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  width: min(34%, 300px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 5px;
  padding: 10px 12px 8px;
  background:
    linear-gradient(180deg, rgba(18, 12, 8, 0.88), rgba(10, 6, 4, 0.94));
  border-left: 1px solid rgba(90, 61, 40, 0.65);
  box-shadow: -24px 0 48px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  backdrop-filter: blur(2px);
}

.title-menu-head {
  text-align: center;
  flex-shrink: 0;
}

.title-menu-head .eyebrow {
  margin-bottom: 2px;
  font-size: 8px;
  letter-spacing: 0.12em;
  color: #f0a34a;
}

.title-logo {
  display: block;
  width: auto;
  max-width: min(100%, 190px);
  max-height: 72px;
  height: auto;
  margin: 0 auto 2px;
  object-fit: contain;
  image-rendering: auto;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.75));
}

.title-menu-head .tagline {
  margin-bottom: 0;
  font-size: 10px;
  line-height: 1.3;
  color: #c4a882;
}

.title-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.menu-btn {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 2px solid #4a3424;
  background: linear-gradient(180deg, rgba(47, 36, 24, 0.95), rgba(28, 20, 14, 0.95));
  color: var(--ink);
  font-family: inherit;
  font-weight: 700;
  font-size: 12px;
  padding: 7px 10px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.menu-btn:hover {
  border-color: var(--accent);
  background: linear-gradient(180deg, #3a2c1c, #2a2016);
  box-shadow: 0 0 0 1px rgba(232, 148, 58, 0.25);
}

.menu-btn:active {
  transform: translateY(1px);
}

.menu-btn.primary {
  background: linear-gradient(180deg, #f0a34a, #e8943a 40%, #c47328);
  border-color: #f0ba60;
  color: #1a120a;
  box-shadow: 0 0 22px rgba(232, 148, 58, 0.45);
}

.menu-btn.primary:hover {
  background: linear-gradient(180deg, #ffb85c, #f0a34a 45%, #e8943a);
}

.menu-btn.ghost {
  opacity: 0.78;
}

.menu-ico {
  width: 18px;
  text-align: center;
  color: var(--accent);
}

.menu-btn.primary .menu-ico {
  color: #1a120a;
}

.title-opt {
  margin: 0;
  max-width: none;
  padding: 6px 8px;
  gap: 8px;
  background: rgba(14, 9, 6, 0.7);
  border-color: #4a3424;
  flex-shrink: 0;
}

.title-opt .opt-text strong {
  font-size: 11px;
}

.title-opt .opt-text small {
  font-size: 9px;
}

.title-controls {
  margin-top: auto;
  padding: 6px 8px;
  border: 1px solid #4a3424;
  background: rgba(14, 9, 6, 0.62);
  flex-shrink: 0;
}

.controls-title {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.title-controls .controls {
  margin-top: 0;
}

.controls-compact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 6px;
}

.controls-compact li {
  font-size: 10px;
  color: #c4a882;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.controls-compact kbd {
  min-width: 36px;
  font-size: 9px;
  margin-right: 4px;
  border-color: #5a3d28;
  background: #1a120a;
  padding: 2px 4px;
}

.title-toast {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 8px;
  margin: 0;
  font-size: 12px;
  color: var(--accent);
  text-align: center;
  pointer-events: none;
}

@keyframes hero-bob {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.01); }
}

@keyframes title-pan {
  0% { transform: scale(1.05) translate(0, 0); }
  100% { transform: scale(1.1) translate(-1.8%, -1.2%); }
}

@keyframes smoke-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

@media (max-width: 820px) {
  .title-menu {
    width: 100%;
    top: auto;
    height: 58%;
    border-left: none;
    border-top: 1px solid rgba(90, 61, 40, 0.65);
    background: linear-gradient(180deg, rgba(18, 12, 8, 0.72), rgba(10, 6, 4, 0.96));
    backdrop-filter: blur(3px);
  }

  .title-hero-art {
    left: 50%;
    width: min(85%, 380px);
    bottom: 38%;
    animation: none;
    transform: translateX(-50%);
  }

  .title-logo {
    width: min(100%, 200px);
  }

  .controls-compact {
    grid-template-columns: 1fr 1fr;
  }
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 12px;
}

h1 {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(28px, 6vw, 42px);
  line-height: 1.25;
  margin-bottom: 16px;
  color: var(--ink);
}

h1 span {
  color: var(--accent);
}

h2 {
  font-family: "Press Start 2P", monospace;
  font-size: 16px;
  line-height: 1.4;
  margin-bottom: 8px;
}

.tagline {
  color: var(--muted);
  margin-bottom: 22px;
  line-height: 1.5;
}

.btn {
  appearance: none;
  border: 2px solid var(--line);
  background: #32271c;
  color: var(--ink);
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  background: #3d3023;
  border-color: var(--accent);
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: var(--accent);
  border-color: #c47328;
  color: #1a120a;
}

.btn.primary:hover {
  background: #f0a34a;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.controls {
  list-style: none;
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

kbd {
  display: inline-block;
  min-width: 52px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  background: #1a1510;
  color: var(--ink);
  font-family: inherit;
  font-size: 11px;
  margin-right: 6px;
  text-align: center;
}

.asset-img {
  display: inline-block;
  image-rendering: pixelated;
  vertical-align: middle;
  object-fit: contain;
}

.asset-img { width: 28px; height: 28px; }
.asset-img.xs { width: 18px; height: 18px; }
.asset-img.lg { width: 48px; height: 48px; }
.asset-img.xl { width: 64px; height: 64px; }
.asset-img.dim { opacity: 0.35; }

.game-panel {
  --frame-edge: #786044;
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: clamp(16px, 2.4vw, 28px);
  border: 2px solid var(--frame-edge);
  background: linear-gradient(180deg, #312419, var(--panel) 42%, #211910);
  box-shadow: inset 0 0 0 2px #18110b, inset 0 0 0 4px var(--line), inset 0 -12px 24px #1a130d;
  clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px);
  scrollbar-color: #745534 var(--bg);
}

.panel-heading .eyebrow {
  margin-bottom: 7px;
}

.panel-heading h2 {
  margin: 0;
  font-size: clamp(0.88rem, 2vw, 1.2rem);
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #160f08;
}

.panel-heading .tagline {
  margin: 8px 0 0;
  color: #c9b697;
  font-size: 0.875rem;
}

.game-panel button:focus-visible,
.aim-toggle:focus-visible {
  outline: 2px solid var(--coin);
  outline-offset: 2px;
}

.tier-1 { --tier-color: #c1b9aa; }
.tier-2 { --tier-color: #a6bd79; }
.tier-3 { --tier-color: #f0ba60; }
.tier-4 { --tier-color: #f08a75; }

.coin { color: var(--coin); }

.tier-card {
  box-shadow: inset 0 4px 0 var(--tier-color), inset 0 0 0 2px #130e09;
}

.lobby-panel,
.levelup-panel {
  width: min(calc(100vw - 24px), 960px);
}

.lobby-panel .panel-heading,
.levelup-panel .panel-heading,
.result-panel .panel-heading {
  margin-bottom: 19px;
}

.danger-select {
  min-width: 0;
  margin: 0 0 16px;
  padding: 8px 10px;
  border: 1px solid var(--line);
}

.danger-select legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 0.875rem;
}

.danger-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.danger-options .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
}

.danger-options input {
  margin: 0;
  accent-color: var(--accent);
}

.danger-options .btn:has(:checked) {
  border-color: var(--accent);
  color: var(--coin);
}

#danger-description {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.select-grid,
.levelup-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

#weapon-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.weapon-type {
  align-self: flex-start;
  width: fit-content;
  padding: 2px 5px;
  border: 1px solid #6e5030;
  background: #312116;
  color: #f3c98f;
  font-size: 0.65rem;
  font-weight: 700;
}

.shop-card .weapon-type {
  font-size: inherit;
}

.select-card {
  --select-accent: var(--accent);
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 2px solid #5a4431;
  background: #201811;
  padding: clamp(8px, 1.3vw, 14px);
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.select-card:hover:not(:disabled) {
  border-color: #a26c3b;
  background: #2b2016;
}

.select-card.selected,
.select-card.selected:hover {
  border-color: var(--accent);
  background: #302114;
  box-shadow: inset 0 0 0 2px #211309, inset 0 0 22px #e8943a38;
}

.select-card.locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.select-art {
  display: grid;
  place-items: center;
  height: clamp(82px, 15vh, 124px);
  margin-bottom: 11px;
  border: 1px solid var(--line);
  background: radial-gradient(ellipse at center, #493220, #1b140e 75%);
  box-shadow: inset 0 -2px 0 var(--select-accent);
}

.select-art .asset-img {
  width: clamp(80px, 12vw, 116px);
  height: clamp(80px, 12vh, 106px);
  filter: drop-shadow(3px 4px 0 rgba(0, 0, 0, 0.46));
}

.select-name {
  font-size: clamp(1rem, 2.1vw, 1.4rem);
  font-weight: 700;
}

.select-desc {
  margin: 3px 0 9px;
  color: #c5b193;
  font-size: 0.8125rem;
  line-height: 1.35;
}

.character-tags {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.75rem;
}

.character-passive {
  align-self: flex-start;
  margin: 0 0 9px;
  padding: 3px 6px;
  border: 1px solid #986033;
  background: #412818;
  color: #ffbe77;
  font-size: 0.75rem;
  font-weight: 700;
}

.select-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-top: auto;
}

.select-meta > span {
  display: grid;
  gap: 1px;
  min-width: 0;
  border: 1px solid #5a4732;
  background: var(--bg);
  padding: 4px 6px;
}

.select-meta .stat-label-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.select-meta small {
  color: #c5b193;
  font-size: 0.65rem;
}

.select-meta strong {
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

/* Bolinha ? compartilhada (lobby + loja) */
.stat-help {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 1px solid #7a5a38;
  border-radius: 50%;
  background: #1a120a;
  color: var(--accent);
  font: 700 10px/1 "Space Grotesk", system-ui, sans-serif;
  cursor: help;
  z-index: 2;
}

.stat-help::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 20;
  width: max-content;
  max-width: 180px;
  padding: 7px 8px;
  border: 1px solid var(--accent);
  background: #1a120a;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

.stat-help:hover::after,
.stat-help:focus-visible::after,
.stat-help.is-open::after {
  opacity: 1;
  visibility: visible;
}

.lobby-actions,
.levelup-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 17px;
  padding-top: 14px;
  border-top: 1px solid #5e462e;
}

.levelup-panel {
  width: min(calc(100vw - 24px), 890px);
}

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

.levelup-actions {
  justify-content: flex-end;
}

.levelup-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  min-height: 166px;
  padding: 14px;
  background: linear-gradient(160deg, #302218, #1b140f 68%);
}

.levelup-card:hover:not(:disabled) {
  background: #3a291a;
  box-shadow: inset 0 4px 0 var(--tier-color), inset 0 0 0 2px var(--accent), inset 0 0 24px #e8943a35;
}

.levelup-card .upgrade-art {
  display: grid;
  place-items: center;
  width: 44px;
  height: 42px;
  margin-bottom: 10px;
  border: 1px solid #64482c;
  background: #211811;
  font-size: 24px;
}

.levelup-card .card-tier {
  margin-bottom: 3px;
  color: var(--tier-color);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.6875rem;
  font-weight: 700;
}

.levelup-card .name {
  font-size: 1.125rem;
}

.levelup-card .desc {
  min-height: 0;
  margin-bottom: 0;
  color: #c9b697;
}

.result-panel {
  width: min(calc(100vw - 24px), 540px);
}

#screen-over[data-result="win"] .result-panel {
  --frame-edge: #a17d43;
}

#screen-over[data-result="loss"] .result-panel {
  --frame-edge: #935e49;
}

#screen-over[data-result="win"] h2 { color: var(--coin); }
#screen-over[data-result="loss"] h2 { color: #ffa993; }

.result-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 18px;
}

.result-stats > div {
  padding: 9px 11px;
  border: 1px solid #5a4431;
  background: var(--bg);
}

.result-stats dt {
  color: #c9b697;
  font-size: 0.75rem;
}

.result-stats dd {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.result-panel .btn {
  width: 100%;
}

@media (max-width: 740px) {
  #weapon-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .levelup-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .levelup-card { min-height: 142px; }
}

@media (max-width: 540px) {
  .danger-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #weapon-grid,
  .select-grid { grid-template-columns: minmax(0, 1fr); }
  .select-card {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    column-gap: 9px;
    align-items: start;
  }
  .select-art { grid-column: 1; grid-row: 1 / 5; height: 76px; margin: 0; }
  #char-grid .select-art { grid-row: 1 / 6; }
  .select-card > :not(.select-art) { grid-column: 2; }
  .select-art .asset-img { width: 70px; height: 70px; }
  .character-passive { justify-self: start; }
}

.pill {
  border: 1px solid var(--line);
  background: #1a1510;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--muted);
}

.pill strong {
  color: var(--ink);
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.card {
  border: 1px solid var(--line);
  background: #1a1510;
  padding: 12px;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.card:hover:not(:disabled) {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.card:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.card .icon {
  font-size: 22px;
  margin-bottom: 6px;
}

.card .name {
  font-weight: 700;
  margin-bottom: 4px;
}

.card .desc {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  min-height: 32px;
  margin-bottom: 8px;
}

.card .price {
  color: var(--coin);
  font-weight: 700;
  font-size: 13px;
}


/* —— Loja estilo Brotato: ofertas em fila + stats à direita + bag embaixo —— */
#screen-shop {
  place-items: center;
  overflow: hidden;
}

.brotato-shop.shop-panel {
  --shop-gutter: clamp(8px, 1.2vw, 14px);
  width: var(--stage-w);
  height: var(--stage-h);
  max-height: none;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0;
  padding: 0;
  overflow: hidden;
  clip-path: none;
}

.shop-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px var(--shop-gutter);
  border-bottom: 2px solid var(--line);
  background: #2a2017;
}

.shop-title-block h2 {
  margin: 0;
  font-size: clamp(0.75rem, 1.6vw, 1rem);
  text-transform: uppercase;
}

.shop-wave-inline {
  color: var(--muted);
  font-size: 0.85em;
  text-transform: none;
}

.shop-radar {
  margin: 3px 0 0;
  color: var(--coin);
  font-size: 0.75rem;
  font-weight: 700;
}

.shop-money {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 10px;
  border: 1px solid #6d542d;
  background: var(--bg);
  color: var(--coin);
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.shop-money .asset-img {
  width: 22px;
  height: 22px;
}

.shop-reroll {
  min-height: 36px;
  padding: 6px 12px;
  white-space: nowrap;
}

.shop-reroll .asset-img {
  margin: 0 2px;
}

.shop-body {
  min-height: 0;
  overflow: hidden;
  padding: var(--shop-gutter);
}

.shop-layout {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(168px, 210px);
  gap: var(--shop-gutter);
  align-items: stretch;
}

.shop-offers {
  min-width: 0;
  min-height: 0;
  overflow: visible;
}

#shop-grid.shop-grid,
.shop-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  gap: 8px;
  margin: 0;
}

.shop-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.shop-card.card,
.shop-card.card:hover {
  padding: 8px;
  cursor: default;
  transform: none;
}

.shop-card.card.is-locked {
  border-color: var(--accent);
  border-style: dashed;
}

.shop-card-top {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
}

.shop-card .card-art {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: radial-gradient(circle, #3d2a1b, var(--bg));
}

.shop-card .card-art .asset-img {
  width: 32px;
  height: 32px;
}

.shop-card .icon.emoji {
  font-size: 22px;
  margin: 0;
}

.shop-card-title .name {
  margin: 0 0 2px;
  font-size: 0.9rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.shop-card .card-kind {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 5px;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.shop-card .card-kind strong {
  color: var(--tier-color);
}

.shop-card .desc {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  font-size: 0.7rem;
  line-height: 1.3;
}

.shop-buy {
  width: 100%;
  min-height: 32px;
  padding: 4px 6px;
  font-size: 0.8rem;
}

.shop-buy strong {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--coin);
  font-variant-numeric: tabular-nums;
}

.shop-lock {
  width: 100%;
  min-height: 28px;
  padding: 3px 6px;
  font-size: 0.7rem;
}

.shop-lock-icon {
  position: relative;
  display: inline-block;
  width: 10px;
  height: 8px;
  margin-right: 4px;
  margin-top: 2px;
  vertical-align: middle;
  border: 1px solid currentColor;
}

.shop-lock-icon::before {
  position: absolute;
  content: "";
  top: -6px;
  left: 1px;
  width: 6px;
  height: 6px;
  border: 1px solid currentColor;
  border-bottom: 0;
}

.shop-lock[aria-pressed="true"] {
  border-color: var(--accent);
  background: #3a2818;
  color: var(--coin);
}

.shop-lock[aria-pressed="true"] .shop-lock-icon {
  background: currentColor;
}

.shop-card-empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  border: 1px dashed #675542;
  color: var(--muted);
  font-size: 0.8rem;
}

.shop-attrs {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 6px;
  min-width: 0;
  min-height: 0;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  box-shadow: inset 0 0 0 2px #13100d;
  overflow: visible;
}

.shop-attrs-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shop-attrs-head h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.inv-portrait {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border: 1px solid #6e5030;
  background: radial-gradient(circle, #50361f, #261d14);
}

.inv-portrait .asset-img {
  width: 36px;
  height: 36px;
}

.inv-char-name {
  font-size: 0.85rem;
  font-weight: 700;
}

.shop-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
  align-content: start;
  overflow: visible;
}

.shop-stats .pill {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 3px 5px;
  background: #221a13;
  font-size: 0.68rem;
  line-height: 1.2;
}

.shop-stats .pill:hover,
.shop-stats .pill:focus-within {
  z-index: 40;
}

.shop-stats .stat-pill-main {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.shop-stats .stat-help {
  appearance: none;
  width: 12px;
  height: 12px;
  padding: 0;
  margin: 0;
  font-size: 8px;
}

.shop-stats .stat-help::after {
  left: auto;
  right: 0;
  bottom: auto;
  top: calc(100% + 4px);
  transform: none;
  z-index: 80;
  max-width: 180px;
}

.shop-stats strong {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  color: var(--accent-2);
}

.shop-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 8px var(--shop-gutter);
  border-top: 2px solid var(--line);
  background: #2a2017;
}

.shop-bag {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.inv-section-title {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.inv-weapons,
.inv-items {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.inv-slot {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-top: 2px solid var(--tier-color, var(--line));
  background: #221a13;
}

.inv-slot .asset-img {
  width: 28px;
  height: 28px;
}

.inv-slot.filled {
  padding: 0;
  color: inherit;
  cursor: pointer;
}

.inv-slot.filled:hover,
.inv-slot[aria-pressed="true"] {
  border-color: var(--coin);
}

.inv-items {
  max-height: 84px;
  overflow-y: auto;
}

.shop-inv-actions:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 0.8rem;
}

.shop-inv-actions .btn {
  padding: 5px 8px;
  font-size: inherit;
}

.shop-notice {
  margin: 0;
  color: var(--coin);
  font-size: 0.8rem;
}

.shop-notice:empty {
  position: absolute;
}

.inv-slot.empty {
  border-style: dashed;
  border-top-width: 1px;
  background: transparent;
}

.inv-emoji {
  font-size: 18px;
  line-height: 1;
}

.shop-go {
  min-width: 110px;
  min-height: 52px;
  font-size: 1.05rem;
  text-transform: uppercase;
}

@media (max-width: 820px) {
  .shop-layout {
    grid-template-columns: minmax(0, 1fr) minmax(140px, 170px);
  }

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

@media (max-width: 560px) {
  .brotato-shop.shop-panel {
    height: min(680px, calc(100dvh - 16px));
  }

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

  .shop-reroll {
    grid-column: 1 / -1;
  }

  .shop-body {
    overflow-y: auto;
  }

  .shop-layout {
    height: auto;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }

  #shop-grid.shop-grid {
    height: auto;
    grid-template-rows: auto auto;
  }

  .shop-attrs {
    max-height: 140px;
    overflow: auto;
  }

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

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

  .shop-go {
    width: 100%;
  }
}
