:root {
  --ink: #0a0806;
  --ink-2: #14100c;
  --panel: rgba(24, 18, 13, 0.9);
  --bone: #f6ead4;
  --bone-dim: #d8c6a9;
  --muted: #a3927b;
  --muted-2: #7d6f5d;
  --ember: #ff9a3e;
  --ember-2: #ffc978;
  --rust: #c75a2d;
  --blood: #d05340;
  --jade: #8ec8a4;
  --violet: #c79cf0;
  --gold: #ffd277;
  --line: rgba(255, 208, 148, 0.16);
  --line-soft: rgba(255, 208, 148, 0.09);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #070504;
  color: var(--bone);
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(100% 80% at 50% 0%, #241a12 0%, #0b0806 58%, #050403 100%);
}

button {
  font-family: inherit;
  border: 0;
  cursor: pointer;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--ink);
  touch-action: none;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.screen-vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(130% 95% at 50% 42%, transparent 42%, rgba(4, 3, 2, 0.52) 100%),
    linear-gradient(180deg, rgba(4, 3, 2, 0.28) 0%, transparent 16%, transparent 78%, rgba(4, 3, 2, 0.42) 100%);
}

.hidden {
  display: none !important;
}

/* ---------------- HUD ---------------- */

.hud {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  padding: calc(8px + var(--safe-top)) 16px 0;
}

.xp-rail {
  height: 4px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 214, 158, 0.1);
  overflow: hidden;
}

.xp-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c66a29, #ffd88d 70%, #fff2c8);
  box-shadow: 0 0 10px rgba(255, 176, 88, 0.9);
  transition: width 0.18s ease-out;
}

.hud-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.level-badge {
  flex: 0 0 auto;
  min-width: 42px;
  height: 30px;
  padding: 0 9px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #2b170a;
  background: linear-gradient(160deg, #ffe0a4, #e99b4a 60%, #c46a2d);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35), inset 0 1px rgba(255, 255, 255, 0.5);
}

.hp-pill {
  flex: 1 1 auto;
  min-width: 0;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border-radius: 10px;
  background: rgba(14, 10, 8, 0.62);
  border: 1px solid rgba(255, 208, 148, 0.13);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.hp-pill .mp-icon {
  width: 14px;
  height: 14px;
  color: #ff7b62;
  filter: drop-shadow(0 0 4px rgba(255, 96, 74, 0.5));
}

.hp-track {
  flex: 1 1 auto;
  height: 7px;
  min-width: 34px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.hp-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b33a2c, #ef6e4e 60%, #ffb085);
  box-shadow: 0 0 8px rgba(255, 100, 70, 0.45);
  transition: width 0.16s ease-out;
}

.hp-pill span {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  color: #f4d9c2;
  font-variant-numeric: tabular-nums;
  min-width: 22px;
  text-align: right;
}

.stage-pill {
  flex: 0 0 auto;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 9px;
  border-radius: 10px;
  background: rgba(14, 10, 8, 0.62);
  border: 1px solid rgba(255, 208, 148, 0.13);
  font-size: 11px;
  font-weight: 700;
  color: #f0dfc4;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.stage-pill .mp-icon {
  width: 14px;
  height: 14px;
  color: var(--ember-2);
}

.obj-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.objective {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 99px;
  background: rgba(12, 9, 7, 0.52);
  border: 1px solid rgba(255, 208, 148, 0.1);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #ddc9a9;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.obj-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 7px var(--ember);
  animation: dotPulse 1.5s ease-in-out infinite;
}

.timer {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  height: 24px;
  padding: 0 9px;
  border-radius: 99px;
  background: rgba(12, 9, 7, 0.5);
  border: 1px solid rgba(255, 208, 148, 0.09);
  font-size: 10px;
  color: #cbb89b;
  font-variant-numeric: tabular-nums;
}

.timer .mp-icon {
  width: 12px;
  height: 12px;
  color: #b7a184;
}

.boss-bar {
  margin-top: 12px;
  padding: 8px 10px 9px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(38, 15, 11, 0.78), rgba(14, 8, 6, 0.72));
  border: 1px solid rgba(255, 124, 92, 0.28);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), inset 0 1px rgba(255, 170, 140, 0.12);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.boss-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 5px;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: #ffd8c4;
}

.boss-head span:first-child {
  font-weight: 800;
}

.boss-head span:last-child {
  color: #f0a082;
  font-variant-numeric: tabular-nums;
}

.boss-track {
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.boss-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8e2118, #e6543f 55%, #ffb26b);
  box-shadow: 0 0 12px rgba(255, 92, 62, 0.55);
  transition: width 0.15s linear;
}

.hud.lowhp .hp-fill {
  animation: hpDanger 0.85s ease-in-out infinite;
}

.combo {
  position: absolute;
  right: 20px;
  top: 34%;
  display: flex;
  align-items: baseline;
  gap: 4px;
  color: var(--gold);
  text-shadow: 0 2px 0 rgba(60, 24, 7, 0.6), 0 0 22px rgba(255, 160, 60, 0.55);
  animation: comboPop 0.22s ease-out;
}

.combo b {
  font-size: 38px;
  line-height: 1;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.03em;
}

.combo span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #ffdfaa;
}

/* ---------------- touch controls ---------------- */

.joystick {
  position: absolute;
  z-index: 8;
  width: 132px;
  height: 132px;
  margin-left: -66px;
  margin-top: -66px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.14s ease;
  will-change: left, top;
}

.joystick.idle {
  opacity: 0.34;
}

.joystick.active {
  opacity: 1;
}

.joy-base {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 205, 140, 0.1), rgba(16, 12, 9, 0.34) 62%, rgba(10, 8, 6, 0.6) 100%);
  border: 1px solid rgba(255, 215, 165, 0.22);
  box-shadow: inset 0 0 26px rgba(255, 176, 90, 0.08), 0 8px 22px rgba(0, 0, 0, 0.28);
}

.joy-base::before {
  content: "";
  position: absolute;
  inset: 15px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 215, 165, 0.13);
}

.joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 236, 204, 0.95), rgba(232, 164, 88, 0.92) 48%, rgba(145, 79, 36, 0.95) 100%);
  border: 1px solid rgba(255, 240, 210, 0.7);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4), inset 0 -3px 8px rgba(95, 44, 15, 0.4);
  will-change: transform;
}

.joy-hint-label {
  position: absolute;
  left: 50%;
  bottom: -17px;
  transform: translateX(-50%);
  font-size: 9px;
  letter-spacing: 0.24em;
  color: rgba(240, 214, 178, 0.5);
  white-space: nowrap;
}

.dash-btn {
  position: absolute;
  right: 20px;
  bottom: calc(104px + var(--safe-bottom));
  z-index: 9;
  width: 88px;
  height: 88px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  color: #2b1708;
  background:
    radial-gradient(circle at 38% 28%, #fff0c9 0%, #ffc274 34%, #ec8b43 70%, #b95827 100%);
  border: 1px solid rgba(255, 238, 204, 0.72);
  box-shadow: 0 10px 24px rgba(120, 48, 13, 0.5), 0 0 0 5px rgba(255, 160, 70, 0.1), inset 0 -6px 12px rgba(120, 48, 13, 0.32);
  transition: transform 0.08s ease, filter 0.15s ease;
  touch-action: none;
}

.dash-btn:active {
  transform: scale(0.93);
  filter: brightness(1.06);
}

.dash-btn .mp-icon {
  width: 27px;
  height: 27px;
  margin-top: 2px;
}

.dash-btn em {
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.dash-cd {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  pointer-events: none;
  background: conic-gradient(rgba(7, 5, 3, 0.7) var(--p, 0deg), rgba(7, 5, 3, 0) 0);
  opacity: 0;
  transition: opacity 0.15s;
}

.dash-btn.cooling .dash-cd {
  opacity: 1;
}

.dash-btn.cooling {
  filter: saturate(0.55) brightness(0.85);
}

.dash-btn.cooling .mp-icon,
.dash-btn.cooling em {
  opacity: 0.55;
}

/* ---------------- toast ---------------- */

.toast {
  position: absolute;
  left: 50%;
  top: 28%;
  z-index: 12;
  transform: translate(-50%, 0);
  max-width: 86%;
  padding: 0 12px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
}

.toast.show {
  animation: toastShow 2.15s cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.toast b {
  display: block;
  font-size: 25px;
  line-height: 1.2;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fff0d5;
  text-shadow: 0 2px 0 rgba(56, 22, 7, 0.65), 0 0 26px rgba(255, 158, 66, 0.5);
}

.toast span {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: #e3c39a;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
}

/* ---------------- screens ---------------- */

.screen {
  position: absolute;
  inset: 0;
  z-index: 20;
}

.menu {
  display: flex;
  flex-direction: column;
  padding: calc(14px + var(--safe-top)) 20px calc(22px + var(--safe-bottom));
  overflow: hidden;
}

.menu-shade {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(6, 5, 4, 0.66) 0%, rgba(6, 5, 4, 0.2) 20%, rgba(6, 5, 4, 0.02) 42%, rgba(6, 5, 4, 0.3) 60%, rgba(6, 5, 4, 0.74) 78%, rgba(6, 5, 4, 0.95) 90%, #060504 100%);
}

.profile-chip {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 13px 5px 5px;
  border-radius: 99px;
  background: rgba(10, 8, 6, 0.48);
  border: 1px solid rgba(255, 212, 156, 0.14);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 900;
  color: #321b09;
  background-color: #2a1a14;
  background-image: radial-gradient(circle at 50% 28%, #7a4a30 0%, #3a2318 55%, #1a100b 100%);
  background-size: cover;
  background-position: 50% 28%;
  background-repeat: no-repeat;
  border: 1px solid rgba(255, 234, 202, 0.65);
  box-shadow: inset 0 -4px 8px rgba(110, 52, 18, 0.3);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-text {
  min-width: 0;
}

.profile-text strong {
  display: block;
  max-width: 168px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #f2e2c8;
}

.profile-text > span {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: #9f8c73;
}

.dot {
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #8bcf9c;
  box-shadow: 0 0 7px rgba(118, 202, 139, 0.8);
}

.logo {
  position: relative;
  z-index: 1;
  margin-top: clamp(20px, 5vh, 44px);
}

.kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 9px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.24em;
  color: #d5ad7d;
  white-space: nowrap;
}

.kicker span {
  display: block;
  width: 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 196, 128, 0.75));
}

.kicker span:last-child {
  background: linear-gradient(90deg, rgba(255, 196, 128, 0.75), transparent);
}

.logo h1 {
  margin: 0;
  font-size: clamp(42px, 12vw, 58px);
  line-height: 0.98;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #fff4de;
  text-shadow:
    0 2px 0 #6a3a1d,
    0 5px 0 rgba(45, 22, 9, 0.55),
    0 10px 32px rgba(0, 0, 0, 0.7),
    0 0 38px rgba(255, 148, 57, 0.24);
}

.logo h1 span {
  color: #ffab55;
  text-shadow:
    0 2px 0 #713315,
    0 5px 0 rgba(45, 22, 9, 0.55),
    0 10px 32px rgba(0, 0, 0, 0.7),
    0 0 38px rgba(255, 148, 57, 0.42);
}

.tagline {
  margin: 9px 0 0;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: #b7a186;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.menu-bottom {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding-bottom: 2px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 14px;
  padding: 11px 4px;
  border-radius: 17px;
  background: rgba(12, 9, 7, 0.86);
  border: 1px solid rgba(255, 208, 148, 0.12);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.stats > div {
  position: relative;
  text-align: center;
}

.stats > div + div::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 24px;
  transform: translateY(-50%);
  background: linear-gradient(180deg, transparent, rgba(255, 210, 150, 0.16), transparent);
}

.stats b {
  display: block;
  font-size: 21px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: 0.01em;
  color: #ffe1ae;
  text-shadow: 0 0 18px rgba(255, 166, 73, 0.25);
  font-variant-numeric: tabular-nums;
}

.stats span {
  display: block;
  margin-top: 3px;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: #99866d;
}

.btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 0 18px;
  border-radius: 17px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  transition: transform 0.09s ease, filter 0.16s ease, background 0.16s ease;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.975);
  filter: brightness(1.05);
}

.btn.primary {
  color: #2e1808;
  background:
    linear-gradient(145deg, #ffe5b4 0%, #ffbd6e 32%, #ee8c42 68%, #cf6229 100%);
  border: 1px solid rgba(255, 240, 206, 0.72);
  box-shadow:
    0 12px 28px rgba(163, 67, 22, 0.4),
    0 0 0 4px rgba(255, 156, 65, 0.08),
    inset 0 1px rgba(255, 255, 255, 0.65),
    inset 0 -5px 12px rgba(128, 56, 19, 0.24);
}

.btn.primary .mp-icon {
  width: 21px;
  height: 21px;
}

.start-btn {
  min-height: 65px;
  justify-content: space-between;
  padding: 0 18px 0 20px;
  border-radius: 19px;
  text-align: left;
}

.btn-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.btn-label small {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: rgba(72, 36, 12, 0.62);
}

.btn-label strong {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.07em;
  color: #2e1808;
}

.menu-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: #8d7b65;
}

.menu-hint .mp-icon {
  width: 13px;
  height: 13px;
  color: #b49a78;
}

/* ---------------- overlays ---------------- */

.overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(22px + var(--safe-top)) 18px calc(22px + var(--safe-bottom));
  overflow-y: auto;
  background:
    radial-gradient(120% 80% at 50% 28%, rgba(58, 34, 17, 0.35) 0%, rgba(7, 5, 4, 0.8) 58%, rgba(5, 4, 3, 0.92) 100%);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.22s ease-out;
  touch-action: pan-y;
}

.overlay-inner {
  width: 100%;
  max-width: 440px;
  margin: auto;
}

.levelup-head {
  text-align: center;
  margin-bottom: 20px;
}

.eyebrow {
  display: block;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.32em;
  color: #d2a570;
}

.levelup-head h2,
.result-card h2 {
  margin: 7px 0 0;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fff1d8;
  text-shadow: 0 2px 0 rgba(57, 26, 9, 0.6), 0 0 28px rgba(255, 159, 66, 0.2);
}

.levelup-head p {
  margin: 8px 0 0;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: #b9a184;
}

.levelup-head p b {
  color: #ffd79e;
  font-size: 13px;
}

.upgrade-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upgrade-card {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 88px;
  padding: 13px 13px 13px 14px;
  border-radius: 18px;
  text-align: left;
  color: var(--bone);
  background:
    linear-gradient(135deg, rgba(47, 35, 25, 0.97) 0%, rgba(24, 18, 13, 0.97) 58%, rgba(16, 12, 9, 0.98) 100%);
  border: 1px solid rgba(255, 207, 148, 0.16);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.34), inset 0 1px rgba(255, 255, 255, 0.06);
  animation: cardIn 0.34s cubic-bezier(0.2, 0.8, 0.25, 1) both;
  touch-action: manipulation;
}

.upgrade-card:nth-child(2) {
  animation-delay: 0.06s;
}

.upgrade-card:nth-child(3) {
  animation-delay: 0.12s;
}

.upgrade-card:active {
  transform: scale(0.985);
  filter: brightness(1.08);
}

.upgrade-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--rarity, #c9b191);
  box-shadow: 0 0 14px var(--rarity, #c9b191);
  opacity: 0.85;
}

.upgrade-card.r-common { --rarity: #c9b191; }
.upgrade-card.r-uncommon { --rarity: #8fc9a7; }
.upgrade-card.r-rare { --rarity: #c79cf0; }
.upgrade-card.r-epic { --rarity: #ffd277; }

.up-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--rarity, #e1c9a7);
  background:
    radial-gradient(circle at 36% 28%, rgba(255, 244, 222, 0.14), rgba(255, 199, 128, 0.04) 58%, transparent 100%),
    rgba(0, 0, 0, 0.26);
  border: 1px solid rgba(255, 224, 182, 0.14);
  box-shadow: inset 0 0 16px rgba(255, 180, 96, 0.08);
}

.up-icon .mp-icon {
  width: 25px;
  height: 25px;
}

.up-body {
  display: block;
  min-width: 0;
}

.up-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.up-top b {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fbe9cd;
}

.up-top em {
  font-style: normal;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--rarity, #c9b191);
  white-space: nowrap;
}

.up-desc {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.55;
  color: #a8947c;
}

.up-key {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  color: #8e7a61;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.overlay-hint {
  margin: 18px 0 0;
  text-align: center;
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: #7e6c56;
}

/* ---------------- result screens ---------------- */

.result-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: auto;
  padding: 27px 20px 20px;
  border-radius: 26px;
  text-align: center;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(97, 58, 27, 0.35) 0%, rgba(26, 19, 13, 0.98) 52%, rgba(14, 10, 7, 0.99) 100%);
  border: 1px solid rgba(255, 204, 138, 0.19);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), inset 0 1px rgba(255, 244, 218, 0.08);
  animation: resultIn 0.3s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

.result-card::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 21px;
  border: 1px solid rgba(255, 215, 160, 0.07);
  pointer-events: none;
}

.result-badge {
  width: 58px;
  height: 58px;
  margin: 0 auto 13px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #3a200b;
  background: radial-gradient(circle at 36% 28%, #fff1c9, #ffc470 52%, #d87937 100%);
  border: 1px solid rgba(255, 241, 208, 0.75);
  box-shadow: 0 0 0 7px rgba(255, 178, 87, 0.07), 0 10px 24px rgba(130, 55, 17, 0.4);
}

.result-badge .mp-icon {
  width: 29px;
  height: 29px;
}

.result-card.dead .result-badge {
  color: #fff1e2;
  background: radial-gradient(circle at 36% 28%, #ffb39e, #dd5f4b 52%, #8e2c22 100%);
  box-shadow: 0 0 0 7px rgba(255, 100, 74, 0.06), 0 10px 24px rgba(90, 22, 15, 0.45);
}

.result-sub {
  margin: 8px 0 0;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: #b39d80;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 21px 0 16px;
  padding: 12px 0;
  border-radius: 15px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 210, 152, 0.1);
}

.result-stats > div {
  position: relative;
  text-align: center;
}

.result-stats > div + div::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 22px;
  transform: translateY(-50%);
  background: linear-gradient(180deg, transparent, rgba(255, 210, 150, 0.15), transparent);
}

.result-stats span {
  display: block;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: #948169;
}

.result-stats b {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  font-weight: 900;
  color: #ffe2b3;
  font-variant-numeric: tabular-nums;
}

.reward-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 18px;
  padding: 8px 10px;
  border-radius: 11px;
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: #f0cf9f;
  background: rgba(255, 172, 80, 0.08);
  border: 1px solid rgba(255, 190, 112, 0.14);
}

.reward-line .mp-icon {
  width: 14px;
  height: 14px;
  color: #ffc46f;
}

.dead-tip {
  margin: -2px 0 18px;
  font-size: 9.5px;
  line-height: 1.65;
  letter-spacing: 0.03em;
  color: #88745d;
}

.result-btn + .result-btn {
  margin-top: 9px;
}

.btn.ghost {
  min-height: 47px;
  font-size: 13px;
  letter-spacing: 0.1em;
  color: #c2ab8d;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 210, 152, 0.12);
  box-shadow: none;
}

.btn.ghost:active {
  background: rgba(255, 255, 255, 0.07);
}

/* ---------------- responsive ---------------- */

@media (min-width: 700px) {
  #app {
    left: 50%;
    right: auto;
    width: 560px;
    transform: translateX(-50%);
    border-left: 1px solid rgba(255, 196, 128, 0.08);
    border-right: 1px solid rgba(255, 196, 128, 0.08);
    box-shadow: 0 0 90px rgba(0, 0, 0, 0.75);
  }
}

@media (max-height: 720px) {
  .logo {
    margin-top: 26px;
  }

  .logo h1 {
    font-size: clamp(40px, 12vw, 54px);
  }

  .tagline {
    margin-top: 9px;
  }

  .stats {
    padding: 8px 4px;
    margin-bottom: 10px;
  }

  .stats b {
    font-size: 18px;
  }

  .start-btn {
    min-height: 58px;
  }

  .btn-label strong {
    font-size: 16px;
  }

  .menu-hint {
    margin-top: 9px;
  }

  .levelup-head {
    margin-bottom: 12px;
  }

  .upgrade-card {
    min-height: 76px;
    padding: 10px 12px;
  }

  .up-icon {
    width: 42px;
    height: 42px;
  }

  .up-top b {
    font-size: 15px;
  }

  .result-card {
    padding-top: 20px;
  }

  .result-badge {
    width: 50px;
    height: 50px;
    margin-bottom: 10px;
  }

  .result-card h2 {
    font-size: 26px;
  }

  .result-stats {
    margin: 15px 0 12px;
    padding: 9px 0;
  }
}

@media (max-height: 620px) {
  .logo {
    margin-top: 18px;
  }

  .kicker,
  .tagline {
    display: none;
  }

  .profile-chip {
    transform: scale(0.92);
    transform-origin: top left;
  }

  .logo h1 {
    font-size: 38px;
  }

  .stats {
    margin-bottom: 8px;
  }

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

  .up-desc {
    margin-top: 2px;
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@keyframes hpDanger {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.45); }
}

@keyframes dotPulse {
  0%, 100% { opacity: 0.55; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

@keyframes comboPop {
  from { transform: scale(1.35) rotate(-2deg); opacity: 0.6; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes toastShow {
  0% { opacity: 0; transform: translate(-50%, 12px) scale(0.96); }
  12% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  78% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -10px) scale(0.99); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes resultIn {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
