﻿:root {
  --ink: #f7ecd1;
  --muted: #c6b99a;
  --smoke: #8f866f;
  --night: #070806;
  --stone: #111512;
  --stone-2: #1a201b;
  --panel: rgba(23, 22, 17, 0.82);
  --panel-strong: rgba(31, 27, 20, 0.94);
  --gold: #d7aa55;
  --blood: #a83232;
  --ember: #d56a3a;
  --forest: #6f8e54;
  --silver: #bfc5bb;
  --frost: #82bad5;
  --violet: #ad82d8;
  --shadow: rgba(0, 0, 0, 0.52);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: "Cinzel", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  background:
    radial-gradient(circle at 72% 12%, rgba(168, 50, 50, 0.38), transparent 21rem),
    radial-gradient(circle at 18% 86%, rgba(111, 142, 84, 0.16), transparent 28rem),
    linear-gradient(145deg, #030403, #0d0f0d 48%, #1a0e0e);
}

button {
  font: inherit;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  isolation: isolate;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.hud {
  position: fixed;
  z-index: 5;
  top: 18px;
  left: 18px;
  right: 18px;
  display: grid;
  grid-template-columns: minmax(230px, 1.08fr) minmax(340px, 1.1fr) minmax(270px, 1fr);
  gap: 14px;
  align-items: stretch;
  pointer-events: none;
}

.brand,
.stat-card,
.bars,
.skill-dock,
.objective-card,
.story-panel,
.boss-panel,
.pause-badge,
.toast,
.panel {
  border: 1px solid rgba(215, 170, 85, 0.28);
  box-shadow: 0 18px 48px var(--shadow), inset 0 1px 0 rgba(255, 244, 210, 0.08);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  gap: 13px;
  align-items: center;
  min-height: 80px;
  padding: 14px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(33, 29, 22, 0.9), rgba(15, 18, 15, 0.76)),
    repeating-linear-gradient(135deg, rgba(215, 170, 85, 0.08) 0 1px, transparent 1px 9px);
  animation: slideIn 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand-mark {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 16px 16px 22px 22px;
  color: #20140d;
  font-weight: 900;
  letter-spacing: -0.08em;
  background:
    radial-gradient(circle at 50% 25%, #f4d78a, var(--gold) 55%, #8d532d 100%);
  clip-path: polygon(14% 0, 86% 0, 100% 48%, 50% 100%, 0 48%);
  animation: markGlow 3.1s ease-in-out infinite;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.brand h1,
.panel h2 {
  margin: 0;
  letter-spacing: -0.04em;
}

.brand h1 {
  font-size: clamp(1.35rem, 2vw, 2rem);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.stat-card {
  min-height: 80px;
  padding: 14px;
  border-radius: 20px;
  background: var(--panel);
}

.stat-card span,
.bars label,
.skill-dock p,
.objective-card span,
.boss-panel label {
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: clamp(1.2rem, 2.7vw, 1.95rem);
  line-height: 1;
}

.coin-stat strong {
  color: #f4d78a;
  text-shadow: 0 0 16px rgba(215, 170, 85, 0.45);
}

.bars {
  display: grid;
  gap: 7px;
  min-height: 80px;
  padding: 12px 14px;
  border-radius: 20px;
  background: var(--panel);
}

.bars label,
.boss-panel label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.bars label b,
.boss-panel label b {
  color: var(--ink);
  font-weight: 800;
}

.bar {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: rgba(247, 236, 209, 0.13);
}

.bar i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  transform-origin: left center;
}

.bar.hp i {
  background: linear-gradient(90deg, #6b1717, var(--blood), var(--ember));
  box-shadow: 0 0 18px rgba(168, 50, 50, 0.7);
}

.bar.xp i {
  background: linear-gradient(90deg, #7052b5, var(--violet), #d2a8ff);
  box-shadow: 0 0 18px rgba(173, 130, 216, 0.46);
}

.bar.boss {
  height: 12px;
}

.bar.boss i {
  background: linear-gradient(90deg, #3d0707, var(--blood), #f0a45b);
  box-shadow: 0 0 18px rgba(168, 50, 50, 0.66);
}

.objective-card {
  position: fixed;
  z-index: 5;
  top: 116px;
  right: 18px;
  width: min(360px, calc(100vw - 36px));
  padding: 14px;
  border-radius: 20px;
  background: rgba(15, 17, 13, 0.72);
  pointer-events: none;
}

.objective-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1rem;
  line-height: 1.35;
}

.objective-card span {
  display: block;
}

.story-panel {
  position: fixed;
  z-index: 5;
  top: 190px;
  right: 18px;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  align-items: center;
  width: min(360px, calc(100vw - 36px));
  padding: 13px;
  border-radius: 20px;
  background: rgba(15, 17, 13, 0.68);
  pointer-events: none;
}

.story-panel img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45));
}

.story-panel strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 1rem;
}

.story-panel span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.boss-panel {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: 24px;
  width: min(680px, calc(100vw - 36px));
  padding: 13px 16px;
  border-color: rgba(168, 50, 50, 0.66);
  border-radius: 18px;
  background: rgba(19, 9, 9, 0.82);
  transform: translateX(-50%);
  pointer-events: none;
}

.skill-dock {
  position: fixed;
  z-index: 5;
  left: 18px;
  top: 116px;
  width: min(292px, calc(100vw - 36px));
  padding: 9px;
  border-radius: 18px;
  background: rgba(11, 13, 10, 0.66);
  pointer-events: none;
}

.skill-dock p {
  margin: 0 0 7px;
}

.skill-dock-items {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.skill-pill {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 4px;
  border: 1px solid rgba(215, 170, 85, 0.2);
  border-radius: 14px;
  background: rgba(247, 236, 209, 0.08);
}

.skill-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 11px;
  color: #130d0a;
  font-size: 0.78rem;
  font-weight: 900;
  background: var(--gold);
}

.skill-pill b {
  position: absolute;
  right: -5px;
  bottom: -5px;
  display: grid;
  min-width: 19px;
  height: 19px;
  place-items: center;
  border: 1px solid rgba(247, 236, 209, 0.32);
  border-radius: 999px;
  color: #1a1209;
  font-size: 0.68rem;
  font-weight: 900;
  background: var(--gold);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.38);
}

.mobile-controls {
  position: fixed;
  z-index: 8;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  left: 14px;
  display: none;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.move-stick {
  position: relative;
  display: grid;
  width: 118px;
  height: 118px;
  place-items: center;
  border: 1px solid rgba(215, 170, 85, 0.28);
  border-radius: 999px;
  background: rgba(11, 13, 10, 0.58);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 244, 210, 0.12);
  backdrop-filter: blur(14px);
  pointer-events: auto;
}

.move-stick img {
  width: 72%;
  height: 72%;
  object-fit: contain;
  opacity: 0.72;
}

.move-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(247, 236, 209, 0.28);
  border-radius: 999px;
  background: radial-gradient(circle at 42% 30%, #f4d78a, var(--gold) 52%, #70401f);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.42);
  transform: translate(-50%, -50%);
}

.mobile-actions {
  display: grid;
  gap: 10px;
  width: min(44vw, 178px);
  pointer-events: auto;
}

.mobile-action {
  min-height: 50px;
  border: 1px solid rgba(215, 170, 85, 0.36);
  border-radius: 16px;
  color: var(--ink);
  font-weight: 900;
  letter-spacing: 0.05em;
  background:
    radial-gradient(circle at 20% 15%, rgba(215, 170, 85, 0.22), transparent 6rem),
    rgba(17, 18, 14, 0.78);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(14px);
}

.mobile-action:disabled {
  color: var(--smoke);
  opacity: 0.62;
}

.overlay {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 34%, rgba(168, 50, 50, 0.2), transparent 35rem),
    radial-gradient(circle at 50% 92%, rgba(215, 170, 85, 0.12), transparent 32rem),
    rgba(3, 4, 3, 0.56);
}

.hidden {
  display: none !important;
}

.panel {
  position: relative;
  overflow: auto;
  width: min(900px, 100%);
  max-height: calc(100vh - 40px);
  padding: clamp(24px, 4.6vw, 46px);
  border-radius: 34px;
  background:
    linear-gradient(135deg, rgba(34, 31, 24, 0.96), rgba(12, 14, 12, 0.9)),
    repeating-linear-gradient(135deg, rgba(247, 236, 209, 0.045) 0 2px, transparent 2px 10px);
  animation: panelRise 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.panel::before {
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  content: "";
  inset: -130px -90px auto auto;
  background: radial-gradient(circle, rgba(168, 50, 50, 0.28), transparent 68%);
}

.start-panel {
  width: min(1060px, 100%);
}

.logo-lockup {
  position: relative;
  display: grid;
  grid-template-columns: 122px 1fr;
  gap: clamp(16px, 3vw, 28px);
  align-items: center;
}

.logo-sigil {
  display: grid;
  width: 122px;
  height: 122px;
  place-items: center;
  border: 1px solid rgba(215, 170, 85, 0.36);
  border-radius: 34px;
  background:
    radial-gradient(circle at 50% 45%, rgba(215, 170, 85, 0.22), transparent 4.8rem),
    linear-gradient(145deg, rgba(168, 50, 50, 0.34), rgba(0, 0, 0, 0.42));
  box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.42), 0 18px 48px rgba(0, 0, 0, 0.36);
}

.logo-sigil img {
  width: 86%;
  height: 86%;
  object-fit: contain;
  filter: drop-shadow(0 0 22px rgba(215, 170, 85, 0.5));
}

.menu-tabs {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 16px;
}

.menu-tab {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(215, 170, 85, 0.24);
  border-radius: 999px;
  color: var(--muted);
  font-weight: 900;
  letter-spacing: 0.08em;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.menu-tab:hover,
.menu-tab.selected {
  color: var(--ink);
  border-color: rgba(215, 170, 85, 0.78);
  background:
    radial-gradient(circle at 50% 0, rgba(215, 170, 85, 0.2), transparent 5rem),
    rgba(247, 236, 209, 0.08);
}

.menu-pages {
  position: relative;
  min-height: 330px;
}

.menu-page {
  animation: panelRise 300ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.meta-card.wide {
  min-height: 330px;
}

.settings-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.settings-grid label {
  display: grid;
  gap: 9px;
  padding: 16px;
  border: 1px solid rgba(215, 170, 85, 0.2);
  border-radius: 20px;
  background: rgba(247, 236, 209, 0.065);
}

.settings-grid span {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.settings-grid select {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(247, 236, 209, 0.18);
  border-radius: 14px;
  color: var(--ink);
  background: rgba(6, 8, 7, 0.86);
  padding: 0 12px;
}

.settings-summary {
  position: relative;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.pause-details {
  position: fixed;
  z-index: 9;
  top: 50%;
  left: 50%;
  width: min(680px, calc(100vw - 30px));
  max-height: min(74vh, 720px);
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(215, 170, 85, 0.34);
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(29, 27, 21, 0.96), rgba(9, 12, 10, 0.92)),
    repeating-linear-gradient(135deg, rgba(247, 236, 209, 0.04) 0 2px, transparent 2px 10px);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.58);
  transform: translate(-50%, -50%);
  backdrop-filter: blur(16px);
}

.pause-heading strong {
  display: block;
  font-size: 1.32rem;
}

.pause-heading span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.pause-details-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.pause-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 11px;
  border: 1px solid rgba(215, 170, 85, 0.18);
  border-radius: 17px;
  background: rgba(0, 0, 0, 0.22);
}

.pause-item img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 13px;
  background: rgba(247, 236, 209, 0.08);
}

.pause-item strong,
.pause-item small,
.pause-item span {
  display: block;
}

.pause-item small {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.35;
}

.pause-item em {
  color: var(--gold);
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.minimap {
  position: fixed;
  z-index: 6;
  right: 18px;
  bottom: 18px;
  width: 180px;
  height: 132px;
  border: 1px solid rgba(215, 170, 85, 0.36);
  border-radius: 18px;
  background: rgba(5, 8, 6, 0.74);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.hero-panel h2,
.level-panel h2 {
  position: relative;
  max-width: 760px;
  font-size: clamp(2rem, 6.4vw, 4.8rem);
  line-height: 0.94;
}

.lead {
  position: relative;
  max-width: 740px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.68;
}

.lead.compact {
  margin-top: 10px;
  font-size: 1rem;
}

.hero-select {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0 18px;
}

.hero-card {
  display: grid;
  gap: 8px;
  min-height: 190px;
  padding: 16px;
  border: 1px solid rgba(215, 170, 85, 0.24);
  border-radius: 24px;
  color: var(--ink);
  text-align: left;
  background:
    radial-gradient(circle at 30% 12%, rgba(215, 170, 85, 0.16), transparent 9rem),
    rgba(247, 236, 209, 0.07);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.hero-card:hover,
.hero-card.selected {
  border-color: rgba(215, 170, 85, 0.84);
  background:
    radial-gradient(circle at 30% 12%, rgba(215, 170, 85, 0.26), transparent 9rem),
    rgba(247, 236, 209, 0.12);
  transform: translateY(-3px);
}

.hero-card strong {
  font-size: 1.16rem;
}

.hero-card small {
  color: var(--muted);
  line-height: 1.55;
}

.portrait {
  display: block;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(247, 236, 209, 0.2);
  border-radius: 19px;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.35);
}

.portrait.knight {
  background:
    radial-gradient(circle at 50% 68%, rgba(0, 0, 0, 0.44), transparent 68%),
    url("assets/generated/characters/knight.png") center 72% / 78% auto no-repeat,
    linear-gradient(135deg, #5c1616, #d7aa55);
}

.portrait.ranger {
  background:
    radial-gradient(circle at 50% 68%, rgba(0, 0, 0, 0.44), transparent 68%),
    url("assets/generated/characters/ranger.png") center 72% / 78% auto no-repeat,
    linear-gradient(135deg, #21351d, #6f8e54);
}

.portrait.witch {
  background:
    radial-gradient(circle at 50% 68%, rgba(0, 0, 0, 0.44), transparent 68%),
    url("assets/generated/characters/witch.png") center 72% / 78% auto no-repeat,
    linear-gradient(135deg, #2b153a, #ad82d8);
}

.portrait.paladin {
  background:
    radial-gradient(circle at 50% 68%, rgba(0, 0, 0, 0.38), transparent 68%),
    url("assets/generated/expansion/characters/paladin.png") center 72% / 78% auto no-repeat,
    linear-gradient(135deg, #7a4f12, #f7ecd1);
}

.portrait.star-archer {
  background:
    radial-gradient(circle at 50% 68%, rgba(0, 0, 0, 0.38), transparent 68%),
    url("assets/generated/expansion/characters/star-archer.png") center 72% / 78% auto no-repeat,
    linear-gradient(135deg, #1b4960, #82bad5);
}

.portrait.stag-priest {
  background:
    radial-gradient(circle at 50% 68%, rgba(0, 0, 0, 0.42), transparent 68%),
    url("assets/generated/expansion/characters/stag-priest.png") center 72% / 78% auto no-repeat,
    linear-gradient(135deg, #253a1e, #b7c47c);
}

.portrait.arcanist {
  background:
    radial-gradient(circle at 50% 68%, rgba(0, 0, 0, 0.4), transparent 68%),
    url("assets/generated/expansion/characters/arcanist.png") center 72% / 78% auto no-repeat,
    linear-gradient(135deg, #202a58, #ad82d8);
}

.portrait.vampire-hunter {
  background:
    radial-gradient(circle at 50% 68%, rgba(0, 0, 0, 0.44), transparent 68%),
    url("assets/generated/expansion/characters/vampire-hunter.png") center 72% / 78% auto no-repeat,
    linear-gradient(135deg, #3d0707, #d7aa55);
}

.portrait.templar-monk {
  background:
    radial-gradient(circle at 50% 68%, rgba(0, 0, 0, 0.36), transparent 68%),
    url("assets/generated/expansion/characters/templar-monk.png") center 72% / 78% auto no-repeat,
    linear-gradient(135deg, #6b5a2b, #d56a3a);
}

.control-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 22px 0;
}

.meta-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 12px;
  margin: 14px 0 20px;
}

.meta-card:first-child {
  grid-row: span 2;
}

.meta-card {
  min-height: 220px;
  padding: 15px;
  border: 1px solid rgba(215, 170, 85, 0.2);
  border-radius: 22px;
  background: rgba(247, 236, 209, 0.065);
}

.meta-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.meta-heading h3 {
  margin: 0;
  font-size: 1.18rem;
}

.meta-heading strong {
  padding: 7px 10px;
  border: 1px solid rgba(215, 170, 85, 0.28);
  border-radius: 999px;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.22);
}

.meta-copy {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

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

.growth-button,
.achievement-item {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 9px;
  align-items: center;
  width: 100%;
  padding: 9px;
  border: 1px solid rgba(215, 170, 85, 0.16);
  border-radius: 15px;
  color: var(--ink);
  text-align: left;
  background: rgba(0, 0, 0, 0.18);
}

.growth-button {
  cursor: pointer;
}

.growth-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.growth-button:hover:not(:disabled) {
  border-color: rgba(215, 170, 85, 0.72);
  background: rgba(215, 170, 85, 0.1);
}

.meta-icon,
.card-icon img,
.skill-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.meta-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.26);
}

.growth-button strong,
.achievement-item strong {
  display: block;
  font-size: 0.84rem;
}

.growth-button small,
.achievement-item small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.growth-level,
.achievement-points {
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 900;
  white-space: nowrap;
}

.achievement-list {
  display: grid;
  max-height: 316px;
  gap: 8px;
  overflow: auto;
  padding-right: 4px;
}

.achievement-item.locked {
  opacity: 0.48;
}

.control-grid span {
  padding: 12px 14px;
  border: 1px solid rgba(215, 170, 85, 0.2);
  border-radius: 16px;
  color: var(--ink);
  background: rgba(247, 236, 209, 0.07);
}

.primary-button {
  position: relative;
  padding: 14px 24px;
  border: 0;
  border-radius: 999px;
  color: #1a1009;
  font-weight: 900;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, #f0cf82, var(--gold), #b56d3a);
  box-shadow: 0 18px 40px rgba(168, 50, 50, 0.28);
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease;
}

.primary-button:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
}

.level-panel {
  width: min(980px, 100%);
}

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

.upgrade-card {
  position: relative;
  min-height: 238px;
  padding: 18px;
  border: 1px solid rgba(215, 170, 85, 0.24);
  border-radius: 26px;
  color: var(--ink);
  text-align: left;
  background:
    radial-gradient(circle at 20% 12%, rgba(215, 170, 85, 0.18), transparent 9rem),
    rgba(247, 236, 209, 0.075);
  cursor: pointer;
  opacity: 0;
  animation: cardIn 360ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.upgrade-card:hover {
  border-color: rgba(215, 170, 85, 0.86);
  background:
    radial-gradient(circle at 20% 12%, rgba(215, 170, 85, 0.28), transparent 9rem),
    rgba(247, 236, 209, 0.12);
  transform: translateY(-4px);
}

.upgrade-card .card-icon {
  display: grid;
  width: 56px;
  height: 56px;
  margin-bottom: 18px;
  place-items: center;
  border-radius: 19px;
  color: #17100a;
  font-weight: 900;
  background: linear-gradient(135deg, #f0cf82, var(--gold));
  overflow: hidden;
}

.upgrade-card h3 {
  margin: 0;
  font-size: 1.35rem;
}

.upgrade-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.upgrade-card small {
  position: absolute;
  right: 18px;
  bottom: 16px;
  color: var(--gold);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pause-badge,
.toast {
  position: fixed;
  z-index: 7;
  padding: 11px 16px;
  border-radius: 999px;
  color: var(--gold);
  background: rgba(11, 13, 10, 0.78);
  animation: panelRise 240ms ease-out both;
  pointer-events: none;
}

.pause-badge {
  top: 116px;
  left: 18px;
}

.toast {
  left: 50%;
  top: 116px;
  max-width: min(620px, calc(100vw - 36px));
  color: var(--ink);
  text-align: center;
  transform: translateX(-50%);
}

@keyframes panelRise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }

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

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-18px);
  }

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

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(12px) rotateX(8deg);
  }

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

@keyframes markGlow {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(215, 170, 85, 0);
  }

  50% {
    box-shadow: 0 0 26px rgba(215, 170, 85, 0.42);
  }
}

@media (max-width: 980px) {
  .hud {
    grid-template-columns: 1fr;
    right: auto;
    width: min(430px, calc(100vw - 36px));
    gap: 9px;
  }

  .brand {
    min-height: 68px;
  }

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

  .stat-card {
    min-height: 62px;
    padding: 10px;
  }

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

  .bars {
    min-height: 70px;
  }

  .objective-card {
    top: auto;
    right: 18px;
    bottom: 148px;
    width: min(330px, calc(100vw - 36px));
  }

  .story-panel {
    top: auto;
    right: 18px;
    bottom: 234px;
    width: min(330px, calc(100vw - 36px));
  }

  .hero-select,
  .meta-grid,
  .settings-grid,
  .upgrade-grid,
  .control-grid {
    grid-template-columns: 1fr;
  }

  .logo-lockup {
    grid-template-columns: 86px 1fr;
  }

  .logo-sigil {
    width: 86px;
    height: 86px;
    border-radius: 24px;
  }

  .hero-card {
    min-height: 132px;
  }

  .upgrade-card {
    min-height: 176px;
  }

  .mobile-controls {
    display: flex;
  }
}

@media (max-width: 560px) {
  .hud {
    top: 10px;
    left: 10px;
    width: calc(100vw - 20px);
  }

  .brand h1 {
    font-size: 1.16rem;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .stat-card strong {
    font-size: 1.04rem;
  }

  .skill-dock {
    left: 10px;
    top: 318px;
    width: min(214px, calc(100vw - 20px));
  }

  .skill-pill {
    width: 38px;
    height: 38px;
  }

  .skill-icon {
    width: 29px;
    height: 29px;
  }

  .objective-card {
    right: 10px;
    bottom: 238px;
    width: calc(100vw - 20px);
  }

  .story-panel {
    right: 10px;
    bottom: 318px;
    width: calc(100vw - 20px);
  }

  .pause-details {
    width: calc(100vw - 20px);
    padding: 13px;
  }

  .pause-item {
    grid-template-columns: 42px 1fr;
  }

  .pause-item em {
    grid-column: 2;
  }

  .minimap {
    right: 10px;
    bottom: 146px;
    width: 138px;
    height: 104px;
  }

  .logo-lockup {
    grid-template-columns: 1fr;
  }

  .logo-sigil {
    display: none;
  }

  .move-stick {
    width: 106px;
    height: 106px;
  }

  .mobile-action {
    min-height: 48px;
    font-size: 0.86rem;
  }
}
