/* 小兵防线 —— 休闲手游风界面
   版式：竖屏 9:16 游戏舞台居中，所有界面浮在画布上；粗描边圆角按钮 + 底部厚阴影（参考 Kenney UI Pack 等开源休闲 UI 的做法） */
:root {
  --ink: #2b2f45;
  --ink-soft: #4a5070;
  --cream: #fff8ec;
  --sand: #efe3cf;
  --blue: #2f7cf0;
  --blue-dk: #1c4fa8;
  --red: #ef4a3c;
  --red-dk: #a52a20;
  --gold: #ffd23f;
  --gold-dk: #c99a12;
  --green: #3fcf6a;
  --green-dk: #1f8a41;
  --backdrop: #1b2033;
  --font-display: 'ZCOOL KuaiLe', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-num: 'Lilita One', 'Arial Black', sans-serif;
  --font-body: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--backdrop);
  color: var(--ink);
  font-family: var(--font-body);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
}

#app {
  position: relative;
  width: 360px; height: 640px;            /* JS 会按窗口重新计算 */
  overflow: hidden;
  border-radius: 0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  container-type: inline-size;
}
@media (min-width: 700px) { #app { border-radius: 18px; } }

#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* 尺寸单位：1cqw = 舞台宽度的 1% */
.layer { position: absolute; inset: 0; }

/* ---------- HUD ---------- */
#hud { pointer-events: none; }
.hud-top {
  position: absolute; left: 3cqw; right: 3cqw; top: 2.6cqw;
  display: flex; align-items: center; gap: 2.4cqw;
}
.chip {
  background: rgba(27, 32, 51, 0.72);
  color: #fff;
  border-radius: 99px;
  padding: 1.2cqw 3cqw;
  font-family: var(--font-display);
  font-size: 4.2cqw;
  white-space: nowrap;
  display: flex; align-items: center; gap: 1.4cqw;
}
.chip b { font-family: var(--font-num); font-weight: 400; font-size: 4.6cqw; color: var(--gold); }
.prog {
  flex: 1; height: 3.4cqw; border-radius: 99px;
  background: rgba(27, 32, 51, 0.72);
  position: relative; padding: 0.7cqw;
}
.prog i {
  display: block; height: 100%; width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold), #ff9d2e);
}
.prog .skull {
  position: absolute; right: -1.6cqw; top: 50%; transform: translateY(-50%);
  width: 6.4cqw; height: 6.4cqw; border-radius: 50%;
  background: var(--red); border: 0.7cqw solid #fff;
  display: grid; place-items: center;
  font-family: var(--font-display); color: #fff; font-size: 3.2cqw;
}
.btn-icon {
  pointer-events: auto;
  width: 10cqw; height: 10cqw; flex: none;
  border-radius: 3cqw; border: 0;
  background: rgba(27, 32, 51, 0.72); color: #fff;
  font-family: var(--font-num); font-size: 4.6cqw;
  display: grid; place-items: center; cursor: pointer;
}
.btn-icon:focus-visible { outline: 0.8cqw solid var(--gold); }
.pause-glyph { display: flex; gap: 1.2cqw; }
.pause-glyph span { width: 1.4cqw; height: 4.4cqw; background: #fff; border-radius: 1cqw; }

.buff {
  position: absolute; left: 50%; top: 15cqw; transform: translateX(-50%);
  background: #ff8a2e; color: #fff; border-radius: 99px;
  padding: 1cqw 3.4cqw; font-family: var(--font-display); font-size: 3.8cqw;
  box-shadow: 0 0.8cqw 0 #b8561a;
}

.hint {
  position: absolute; left: 50%; bottom: 7cqw; transform: translateX(-50%);
  background: rgba(27, 32, 51, 0.78); color: #fff;
  border-radius: 99px; padding: 2cqw 5cqw;
  font-family: var(--font-display); font-size: 4.4cqw; white-space: nowrap;
  display: flex; align-items: center; gap: 2cqw;
}
.hint .hand { display: inline-block; width: 7cqw; height: 3cqw; position: relative; }
.hint .hand::before, .hint .hand::after {
  content: ''; position: absolute; top: 50%; width: 0; height: 0;
  border: 1.4cqw solid transparent; transform: translateY(-50%);
}
.hint .hand::before { left: 0; border-right-color: var(--gold); }
.hint .hand::after { right: 0; border-left-color: var(--gold); }
@media (prefers-reduced-motion: no-preference) {
  .hint { animation: bob 1.2s ease-in-out infinite; }
  @keyframes bob { 50% { transform: translate(-50%, -1.4cqw); } }
}

.toast {
  position: absolute; left: 6cqw; right: 6cqw; top: 30cqw;
  text-align: center;
  font-family: var(--font-display); font-size: 5.2cqw; color: #fff;
  text-shadow: 0 0.5cqw 0 rgba(0, 0, 0, 0.45), 0 0 2cqw rgba(0, 0, 0, 0.4);
  text-wrap: balance;
}

/* ---------- 道具 ---------- */
.item-bar {
  position: absolute; right: 3cqw; bottom: 22cqw;
  display: flex; flex-direction: column; gap: 3cqw;
  pointer-events: auto;
}
.item-btn {
  position: relative; width: 16cqw; height: 16cqw; border-radius: 50%;
  border: 0.9cqw solid #fff; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; font-family: var(--font-display);
  box-shadow: 0 1.2cqw 0 rgba(0, 0, 0, 0.3);
}
.item-btn b { font-weight: 400; font-size: 6.4cqw; line-height: 1; }
.item-btn span { font-size: 2.8cqw; }
.item-btn em {
  position: absolute; right: -1.6cqw; top: -1.6cqw; min-width: 6cqw; height: 6cqw;
  border-radius: 99px; background: var(--gold); color: var(--ink);
  font-style: normal; font-family: var(--font-num); font-size: 3.6cqw;
  display: grid; place-items: center; padding: 0 1cqw;
}
.item-btn.cannon { background: radial-gradient(circle at 35% 30%, #6b7a86, #2f3a44); }
.item-btn.fire { background: radial-gradient(circle at 35% 30%, #ff9b4a, #d8461f); }
.item-btn.empty { filter: grayscale(0.8); opacity: 0.75; }
.item-btn.empty em { background: var(--green); color: #fff; font-family: var(--font-display); font-size: 2.6cqw; }
.item-btn:active { transform: translateY(0.8cqw); box-shadow: 0 0.4cqw 0 rgba(0, 0, 0, 0.3); }
.item-btn:focus-visible { outline: 0.8cqw solid var(--gold); }

.bag-row { display: flex; align-items: center; gap: 2.4cqw; flex-wrap: wrap; justify-content: center; }
.bag {
  background: rgba(27, 32, 51, 0.72); color: #fff; border-radius: 99px;
  padding: 1cqw 2.6cqw 1cqw 1cqw; display: flex; align-items: center; gap: 1cqw;
  font-family: var(--font-num); font-size: 4cqw;
}
.bag b { font-weight: 400; color: var(--gold); }
.it {
  width: 6.4cqw; height: 6.4cqw; border-radius: 50%; display: grid; place-items: center;
  font-style: normal; font-family: var(--font-display); font-size: 3.6cqw; color: #fff;
}
.it.cannon { background: #2f3a44; }
.it.fire { background: #d8461f; }
.share-btn {
  border: 0; cursor: pointer; border-radius: 99px;
  background: var(--green); color: #fff; padding: 1.6cqw 3.6cqw;
  font-family: var(--font-display); font-size: 4cqw;
  box-shadow: 0 0.9cqw 0 var(--green-dk);
}
.share-btn:disabled { background: #9aa39c; box-shadow: none; cursor: default; }
.share-btn:focus-visible { outline: 0.8cqw solid var(--gold); }
.level-pick .lv { border: 0; cursor: pointer; font-family: var(--font-display); }
.level-pick .lv small { font-size: 3cqw; color: var(--ink-soft); margin-left: 1cqw; }
.btn.revive { background: #e2392d; box-shadow: 0 1.6cqw 0 #9e1f16, 0 2.6cqw 3cqw rgba(0,0,0,0.3); }

/* ---------- 分享引导 ---------- */
.share-guide { background: rgba(10, 12, 24, 0.82); justify-content: center; z-index: 30; }
.sg-arrow {
  position: absolute; right: 5cqw; top: 2cqw; width: 26cqw; height: 26cqw;
  border-top: 1.4cqw dashed #fff; border-right: 1.4cqw dashed #fff; border-radius: 0 60% 0 0;
}
.sg-arrow::after {
  content: ''; position: absolute; right: -4.4cqw; top: -1cqw;
  border: 3.6cqw solid transparent; border-bottom-color: #fff; border-top: 0;
}
.sg-arrow[hidden] { display: none; }
.sg-hint { margin: 0; text-align: center; font-size: 4.2cqw; color: var(--ink); text-wrap: balance; }
.sg-link { width: 100%; display: flex; gap: 2cqw; align-items: center; }
.sg-link input {
  flex: 1; min-width: 0; border: 0.4cqw solid #d8ccb6; border-radius: 2.4cqw;
  padding: 2cqw; font-size: 3.4cqw; background: #fff; color: var(--ink);
}
/* 微信卡片预览：好友在聊天里看到的样子 */
.sg-card-preview {
  width: 100%; display: flex; gap: 2.4cqw; align-items: flex-start;
  background: #fff; border-radius: 2.4cqw; padding: 2.6cqw 3cqw;
  box-shadow: 0 0.6cqw 2cqw rgba(0, 0, 0, 0.12);
}
.sg-cp-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1cqw; }
.sg-cp-text b {
  font-size: 3.8cqw; line-height: 1.35; color: #191919; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sg-cp-text span {
  font-size: 3cqw; line-height: 1.4; color: #8a8a8a;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sg-card-preview img { width: 14cqw; height: 14cqw; border-radius: 1.2cqw; object-fit: cover; flex: none; }
.btn.brag { background: var(--blue); box-shadow: 0 1.6cqw 0 var(--blue-dk), 0 2.6cqw 3cqw rgba(0,0,0,0.3); }

/* 好友点分享链接进来时，主页顶部的求援横幅 */
.invite {
  width: 100%; display: flex; align-items: center; gap: 2cqw;
  background: rgba(226, 57, 45, 0.92); color: #fff; border-radius: 3cqw;
  padding: 2.4cqw 3cqw; box-shadow: 0 1cqw 0 #9e1f16;
  animation: invite-pulse 1.6s ease-in-out infinite;
}
.invite[hidden] { display: none; }
.invite-tag {
  flex: none; background: var(--gold); color: var(--ink); border-radius: 99px;
  padding: 0.6cqw 2cqw; font-family: var(--font-display); font-size: 3.4cqw;
}
.invite b { font-size: 3.8cqw; line-height: 1.35; font-weight: 600; text-wrap: balance; }
@keyframes invite-pulse { 50% { transform: scale(1.02); } }
@media (prefers-reduced-motion: reduce) { .invite { animation: none; } }

/* ---------- 选关 ---------- */
#levels { z-index: 20; }
.levels-card { max-height: 100%; }
.level-grid {
  width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 2.4cqw;
  max-height: 96cqw; overflow-y: auto; padding: 1cqw;
}
.lvl {
  aspect-ratio: 1; border: 0; border-radius: 3cqw; cursor: pointer;
  background: var(--blue); color: #fff; box-shadow: 0 1cqw 0 var(--blue-dk);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4cqw;
  font-family: var(--font-num); font-size: 5.4cqw;
}
.lvl small { font-size: 2.6cqw; color: var(--gold); letter-spacing: 0.1em; }
.lvl.cur { background: var(--green); box-shadow: 0 1cqw 0 var(--green-dk); }
.lvl:disabled { background: #c9c1b3; box-shadow: 0 1cqw 0 #a99f8f; cursor: default; color: #f4efe6; }
.lvl:focus-visible { outline: 0.8cqw solid var(--gold); }

/* ---------- 消灭一波：表情包 ---------- */
.meme {
  position: absolute; left: 4cqw; top: 40cqw; width: 40cqw;
  background: #fff; border: 1cqw solid var(--ink); border-radius: 3cqw;
  padding: 2cqw 2cqw 2.6cqw;
  box-shadow: 0 1.6cqw 0 rgba(0, 0, 0, 0.35);
  transform: rotate(-5deg);
  display: flex; flex-direction: column; align-items: center; gap: 1.6cqw;
}
.meme img { width: 100%; aspect-ratio: 1; max-width: 100%; border-radius: 1.6cqw; display: block; }
.meme-text {
  font-family: var(--font-display); font-size: 4.8cqw; line-height: 1.2;
  color: var(--ink); text-align: center; text-wrap: balance;
}
@media (prefers-reduced-motion: no-preference) {
  .meme.show { animation: memeIn 2.6s cubic-bezier(.2,1.5,.4,1) both; }
  @keyframes memeIn {
    0% { transform: translateX(-70cqw) rotate(-25deg) scale(0.6); }
    14% { transform: rotate(-5deg) scale(1.06); }
    20% { transform: rotate(-5deg) scale(1); }
    86% { transform: rotate(-5deg) scale(1); opacity: 1; }
    100% { transform: translateX(-70cqw) rotate(-15deg); opacity: 0; }
  }
}

/* ---------- 优惠券 ---------- */
.tk {
  display: inline-block; width: 1.2em; height: 0.8em; border-radius: 0.15em;
  background: radial-gradient(circle at 0 50%, transparent 0.18em, var(--red) 0.2em) left / 51% 100% no-repeat,
              radial-gradient(circle at 100% 50%, transparent 0.18em, var(--red) 0.2em) right / 51% 100% no-repeat;
  vertical-align: -0.05em;
}
.coupon-chip { position: absolute; right: 3cqw; top: 15cqw; }
.coupon-chip b { color: #ff9d8f; }
.top-right { display: flex; gap: 2cqw; align-items: center; }
.wallet-btn { border: 0; cursor: pointer; font-family: var(--font-display); }
.wallet-btn b { color: #ff9d8f; }
.wallet-btn:focus-visible { outline: 0.8cqw solid var(--gold); }

.coupon-pop { position: absolute; left: 0; right: 0; top: 26cqw; display: flex; justify-content: center; }
.ticket {
  display: flex; width: 70cqw; min-height: 22cqw;
  border-radius: 3cqw; overflow: hidden;
  box-shadow: 0 1.4cqw 0 rgba(120, 30, 20, 0.6), 0 3cqw 6cqw rgba(0, 0, 0, 0.35);
}
.ticket .stub {
  flex: none; width: 20cqw;
  background: var(--red); color: var(--gold);
  display: grid; place-items: center;
  border-right: 0.8cqw dashed rgba(255, 255, 255, 0.7);
  font-family: var(--font-display); font-size: 9cqw;
}
.ticket .stub b { font-weight: 400; }
.ticket .body {
  flex: 1; min-width: 0;
  background: #fff4e0;
  padding: 2.4cqw 4cqw;
  display: flex; flex-direction: column; justify-content: center; gap: 0.6cqw;
}
.ticket .t1 { font-size: 3.2cqw; color: var(--ink-soft); letter-spacing: 0.1em; }
.ticket strong { font-family: var(--font-display); font-weight: 400; font-size: 7cqw; color: var(--red); line-height: 1.1; }
.ticket .t2 { font-size: 3.6cqw; color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .coupon-pop.show .ticket { animation: ticketIn 2.4s cubic-bezier(.2,1.4,.4,1) both; }
  @keyframes ticketIn {
    0% { transform: translateY(-8cqw) scale(0.4) rotate(-8deg); opacity: 0; }
    14% { transform: none; opacity: 1; }
    80% { transform: none; opacity: 1; }
    100% { transform: translate(28cqw, -14cqw) scale(0.2); opacity: 0; }
  }
}

.r-coupons { width: 100%; display: flex; flex-direction: column; gap: 2cqw; align-items: center; }
.r-coupons-title { font-size: 3.4cqw; color: var(--ink-soft); letter-spacing: 0.08em; }
.mini-tickets { display: flex; flex-wrap: wrap; gap: 2cqw; justify-content: center; }
.mini {
  display: flex; align-items: stretch; border-radius: 2cqw; overflow: hidden;
  font-size: 3.4cqw; box-shadow: 0 0.8cqw 0 rgba(165, 42, 32, 0.35);
}
.mini .s { background: var(--red); color: var(--gold); padding: 1.2cqw 2cqw; font-family: var(--font-display); border-right: 0.5cqw dashed rgba(255,255,255,0.7); }
.mini .b { background: #fff4e0; color: var(--red); padding: 1.2cqw 2.4cqw; font-family: var(--font-display); white-space: nowrap; }

.wallet-card { max-height: 100%; }
.wallet-list { width: 100%; display: flex; flex-direction: column; gap: 2.6cqw; max-height: 100cqw; overflow-y: auto; padding: 1cqw; }
.wallet-list .ticket { width: 100%; min-height: 18cqw; box-shadow: 0 1cqw 0 rgba(165, 42, 32, 0.35); }
.wallet-list .ticket .stub { width: 16cqw; font-size: 7cqw; }
.wallet-list .ticket strong { font-size: 5.6cqw; }
.wallet-list .code { font-family: var(--font-num); font-size: 3.4cqw; color: var(--ink-soft); letter-spacing: 0.08em; }
.wallet-empty { text-align: center; color: var(--ink-soft); font-size: 4cqw; padding: 6cqw 0; }

/* ---------- 真实优惠券 ---------- */
.rc-card { gap: 3.4cqw; }
.rc-ad {
  position: absolute; top: 3cqw; right: 3.4cqw;
  font-size: 2.8cqw; color: var(--ink-soft);
  border: 0.3cqw solid currentColor; border-radius: 1cqw; padding: 0.2cqw 1.4cqw;
}
.rc-item { width: 100%; display: flex; gap: 3.4cqw; align-items: center; }
.rc-pic {
  flex: none; width: 26cqw; height: 26cqw; border-radius: 3cqw; overflow: hidden;
  background: var(--sand); display: grid; place-items: center;
}
.rc-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rc-noimg { font-family: var(--font-display); font-size: 10cqw; color: var(--red); }
.rc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1.4cqw; }
.rc-info strong {
  font-size: 4cqw; font-weight: 600; line-height: 1.3; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rc-amount { align-self: flex-start; background: var(--red); color: #fff; border-radius: 1.4cqw; padding: 0.6cqw 2cqw; font-size: 3.4cqw; }
.rc-amount b { font-family: var(--font-num); font-weight: 400; font-size: 4.6cqw; color: var(--gold); }
.rc-final { font-size: 3.4cqw; color: var(--ink-soft); }
.rc-final b { font-family: var(--font-num); font-weight: 400; font-size: 6cqw; color: var(--red); }
.rc-final s { margin-left: 1cqw; }
.rc-tpwd {
  width: 100%; background: var(--sand); border-radius: 3cqw; padding: 2.4cqw 3cqw;
  display: flex; gap: 2cqw; align-items: center; min-width: 0;
}
.rc-label { flex: none; font-size: 3.2cqw; color: var(--ink-soft); }
.rc-tpwd code {
  flex: 1; min-width: 0; font-size: 3.4cqw; color: var(--ink);
  overflow-wrap: anywhere; user-select: text; -webkit-user-select: text;
}
.rc-open { text-decoration: none; text-align: center; }

.ticket.real .stub { flex-direction: column; font-size: 5.6cqw; gap: 0.4cqw; }
.ticket.real .stub small { font-family: var(--font-body); font-size: 2.8cqw; color: #fff; }
.ticket.real strong { font-family: var(--font-body); font-weight: 600; font-size: 3.8cqw; color: var(--ink); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.w-actions { display: flex; gap: 2cqw; margin-top: 1cqw; flex-wrap: wrap; }
.w-btn {
  border: 0; cursor: pointer; border-radius: 99px; padding: 1cqw 3cqw;
  background: var(--red); color: #fff; font-size: 3.2cqw; font-family: var(--font-body);
  text-decoration: none;
}
.w-btn.ghost { background: transparent; color: var(--red); box-shadow: inset 0 0 0 0.3cqw var(--red); }

/* ---------- 弹出界面 ---------- */
.screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4cqw; padding: 6cqw;
  background: rgba(20, 24, 40, 0.55);
}
.screen.home { justify-content: space-between; padding-block: 12cqw 9cqw; background: linear-gradient(180deg, rgba(20,24,40,0.65) 0%, rgba(20,24,40,0.1) 40%, rgba(20,24,40,0.1) 55%, rgba(20,24,40,0.75) 100%); }

.logo { text-align: center; }
.logo h1 {
  margin: 0;
  font-family: var(--font-display); font-weight: 400;
  font-size: 15cqw; line-height: 1.05; letter-spacing: 0.06em;
  color: var(--gold);
  -webkit-text-stroke: 1.2cqw var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 1.6cqw 0 var(--ink);
}
.logo h1 span { color: #fff; }
.logo p {
  margin: 3cqw 0 0; color: #fff;
  font-family: var(--font-display); font-size: 4.4cqw; letter-spacing: 0.08em;
  text-shadow: 0 0.5cqw 0 rgba(0, 0, 0, 0.5);
}

.home-bottom { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 3.6cqw; }

.level-pick { display: flex; align-items: center; gap: 3cqw; }
.level-pick .lv {
  min-width: 34cqw; text-align: center;
  background: var(--cream); border-radius: 4cqw;
  padding: 1.6cqw 3cqw;
  font-family: var(--font-display); font-size: 5cqw; color: var(--ink);
  box-shadow: 0 1.2cqw 0 #c9b79c;
}
.level-pick .lv b { font-family: var(--font-num); font-weight: 400; font-size: 6.4cqw; color: var(--blue); }
.arrow {
  width: 11cqw; height: 11cqw; border-radius: 50%; border: 0;
  background: var(--cream); color: var(--ink);
  font-family: var(--font-num); font-size: 6cqw; cursor: pointer;
  box-shadow: 0 1.2cqw 0 #c9b79c;
}
.arrow:disabled { opacity: 0.35; cursor: default; }

.btn {
  border: 0; cursor: pointer;
  font-family: var(--font-display); color: #fff;
  font-size: 6.4cqw; letter-spacing: 0.06em;
  padding: 3cqw 10cqw; border-radius: 5cqw;
  background: var(--green);
  box-shadow: 0 1.6cqw 0 var(--green-dk), 0 2.6cqw 3cqw rgba(0, 0, 0, 0.3);
  text-shadow: 0 0.5cqw 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:active { transform: translateY(1.2cqw); box-shadow: 0 0.4cqw 0 var(--green-dk); }
.btn:focus-visible { outline: 1cqw solid var(--gold); outline-offset: 1cqw; }
.btn.big { font-size: 7.6cqw; padding: 3.6cqw 14cqw; }
.btn.blue { background: var(--blue); box-shadow: 0 1.6cqw 0 var(--blue-dk), 0 2.6cqw 3cqw rgba(0, 0, 0, 0.3); }
.btn.blue:active { box-shadow: 0 0.4cqw 0 var(--blue-dk); }
.btn.ghost { background: var(--cream); color: var(--ink); text-shadow: none; box-shadow: 0 1.6cqw 0 #c9b79c; font-size: 5cqw; padding: 2.4cqw 8cqw; }
.btn.ghost:active { box-shadow: 0 0.4cqw 0 #c9b79c; }

.upgrades { display: grid; grid-template-columns: 1fr 1fr; gap: 3cqw; width: 100%; }
.up {
  border: 0; cursor: pointer; text-align: left;
  background: var(--cream); border-radius: 4cqw;
  padding: 2.4cqw 3cqw;
  box-shadow: 0 1.2cqw 0 #c9b79c;
  display: grid; grid-template-columns: auto 1fr; gap: 0.6cqw 2.4cqw; align-items: center;
  font-family: var(--font-body); color: var(--ink);
}
.up:disabled { cursor: default; }
.up:disabled .cost { background: #b9b2a5; }
.up .ico {
  grid-row: span 2;
  width: 10cqw; height: 10cqw; border-radius: 3cqw;
  display: grid; place-items: center;
  font-family: var(--font-num); font-size: 5cqw; color: #fff;
}
.up .ico.troops { background: var(--blue); }
.up .ico.fire { background: var(--red); }
.up .name { font-family: var(--font-display); font-size: 4.2cqw; }
.up .name small { font-family: var(--font-num); font-size: 3.4cqw; color: var(--ink-soft); margin-left: 1cqw; }
.up .cost {
  justify-self: start;
  background: var(--gold-dk); color: #fff; border-radius: 99px;
  padding: 0.4cqw 2.4cqw; font-family: var(--font-num); font-size: 3.6cqw;
  display: flex; align-items: center; gap: 1cqw;
}
.coin {
  display: inline-block; width: 1em; height: 1em; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff3b0 0 18%, var(--gold) 20% 60%, var(--gold-dk) 62%);
  box-shadow: inset 0 0 0 0.12em rgba(120, 80, 0, 0.35);
  vertical-align: -0.12em;
}
.top-row { position: absolute; left: 4cqw; right: 4cqw; top: 3cqw; display: flex; justify-content: space-between; align-items: center; }

.card {
  width: 100%;
  background: var(--cream); border-radius: 6cqw;
  padding: 7cqw 6cqw 6cqw;
  box-shadow: 0 2cqw 0 #c9b79c, 0 4cqw 8cqw rgba(0, 0, 0, 0.35);
  display: flex; flex-direction: column; align-items: center; gap: 4cqw;
  position: relative;
}
.card h2 {
  margin: 0; font-family: var(--font-display); font-weight: 400;
  font-size: 9cqw; letter-spacing: 0.06em; color: var(--blue);
  text-wrap: balance; text-align: center;
}
.card.lose h2 { color: var(--red); }
.ribbon {
  position: absolute; top: -5cqw; left: 50%; transform: translateX(-50%);
  background: var(--blue); color: #fff; white-space: nowrap;
  font-family: var(--font-display); font-size: 4.6cqw;
  padding: 1.4cqw 6cqw; border-radius: 99px;
  box-shadow: 0 1cqw 0 var(--blue-dk);
}
.card.lose .ribbon { background: var(--red); box-shadow: 0 1cqw 0 var(--red-dk); }

.stars { display: flex; gap: 3cqw; align-items: flex-end; }
.star {
  width: 15cqw; height: 15cqw;
  background: #d8ccb6;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.star.mid { width: 19cqw; height: 19cqw; }
.star.on { background: var(--gold); }
@media (prefers-reduced-motion: no-preference) {
  .star.on { animation: pop 0.45s cubic-bezier(.3,1.6,.5,1) both; }
  .star.on:nth-child(2) { animation-delay: 0.15s; }
  .star.on:nth-child(3) { animation-delay: 0.3s; }
  @keyframes pop { from { transform: scale(0) rotate(-40deg); } }
}

.stats { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2cqw; }
.stat { background: var(--sand); border-radius: 3cqw; padding: 2.4cqw 1cqw; text-align: center; }
.stat b { display: block; font-family: var(--font-num); font-weight: 400; font-size: 6.4cqw; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat span { font-size: 3.2cqw; color: var(--ink-soft); letter-spacing: 0.06em; }
.reward { font-family: var(--font-num); font-size: 7cqw; color: var(--gold-dk); display: flex; align-items: center; gap: 2cqw; }
.btn-row { display: flex; flex-direction: column; gap: 4cqw; align-items: center; width: 100%; }
.tip { margin: 0; font-size: 3.6cqw; color: var(--ink-soft); text-align: center; text-wrap: balance; }
