:root {
  --ink: #1e2a32;
  --muted: #69808c;
  --line: rgba(45, 83, 82, 0.14);
  --paper: rgba(255, 255, 255, 0.88);
  --paper-solid: #fffdf6;
  --green: #62c46b;
  --teal: #28a7a0;
  --amber: #f2b94f;
  --rose: #ef6d78;
  --blue: #4e92d8;
  --shadow: 0 16px 44px rgba(55, 95, 90, 0.2);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(90, 196, 128, 0.22), transparent 28%),
    radial-gradient(circle at 86% 18%, rgba(242, 185, 79, 0.18), transparent 24%),
    linear-gradient(135deg, #e6fbff 0%, #f8f4df 52%, #e8f9ee 100%);
  letter-spacing: 0;
}

button {
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

button:focus-visible {
  outline: 3px solid rgba(78, 146, 216, 0.42);
  outline-offset: 2px;
}

img {
  display: block;
  max-width: 100%;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.demo-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.phone {
  width: min(100%, 430px);
  aspect-ratio: 390 / 844;
  max-height: calc(100vh - 56px);
  border: 10px solid #17242a;
  border-radius: 34px;
  overflow: hidden;
  background: #f6fbf2;
  box-shadow:
    0 28px 70px rgba(24, 54, 66, 0.3),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  position: relative;
  display: grid;
  /* grid-template-rows: 34px 1fr; */
}

.phone-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.82);
  font-weight: 700;
  font-size: 13px;
  z-index: 4;
}

.status-bars {
  color: #273740;
  font-size: 12px;
}

.screen {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.scene {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
}

.scene.is-active {
  display: block;
}

.scene-home {
  --home-gap: clamp(8px, 1.45vh, 16px);
  padding: clamp(12px, 2vh, 20px) 14px;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--home-gap);
  height: 100%;
}

.scene-home.is-active {
  display: grid;
}

.home-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.06)),
    url("../images/首页场景.png") center / cover no-repeat;
  z-index: 0;
}

.resource-bar,
.unlock-strip,
.city-board,
.storage-row,
.home-actions {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.resource-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.resource-card {
  position: relative;
  min-width: 0;
  padding: 10px 8px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow: 0 8px 22px rgba(58, 109, 95, 0.13);
  display: grid;
  grid-template-columns: 22px 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 5px;
  align-items: center;
}

.resource-card svg {
  grid-row: 1 / 4;
  color: var(--teal);
}

.resource-card:nth-child(2) svg {
  color: var(--amber);
}

.resource-card:nth-child(3) svg {
  color: var(--rose);
}

.resource-card span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.resource-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 17px;
  line-height: 1.15;
}

.resource-card em {
  margin-top: 2px;
  color: #8a6116;
  font-size: 10px;
  line-height: 1;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.unlock-strip {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
  color: #42636a;
  font-size: 11px;
  font-weight: 800;
}

.unlock-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(45, 95, 92, 0.12);
  overflow: hidden;
}

.unlock-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--amber));
}

.city-board {
  position: relative;
  width: min(100%, clamp(250px, calc(100vh - 310px), 352px));
  width: min(100%, clamp(250px, calc(100dvh - 310px), 352px));
  max-height: 100%;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  padding: clamp(12px, 4.4vw, 18px);
  border-radius: 22px;
  background:
    linear-gradient(145deg, #c8e88e, #a8d46e);
  box-shadow:
    0 16px 40px rgba(55, 95, 90, 0.25),
    inset 0 2px 3px rgba(255, 255, 255, 0.5),
    inset 0 -3px 6px rgba(0, 0, 0, 0.06);
  border: 3px solid rgba(255, 255, 255, 0.35);
  transform: perspective(800px) rotateX(8deg);
  transform-style: preserve-3d;
}

.grid-plate {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: clamp(7px, 2.5vw, 10px);
}

.city-pedestrians {
  position: absolute;
  inset: clamp(12px, 4.4vw, 18px);
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.pedestrian {
  position: absolute;
  left: var(--from-x);
  top: var(--from-y);
  width: 5px;
  height: 8px;
  border-radius: 3px 3px 2px 2px;
  background: #246d68;
  box-shadow: 0 1px 2px rgba(31, 80, 65, 0.22);
  animation: pedestrianWalk var(--duration) linear infinite;
  animation-delay: var(--delay);
}

.pedestrian::before {
  content: "";
  position: absolute;
  left: 1px;
  top: -4px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #ffe4b8;
  box-shadow: 0 0 0 1px rgba(38, 94, 76, 0.12);
}

.pedestrian::after {
  content: "";
  position: absolute;
  left: -1px;
  right: -1px;
  bottom: -2px;
  height: 2px;
  border-radius: 999px;
  background: rgba(30, 88, 67, 0.22);
}

.pedestrian.is-blue {
  background: #407fb7;
}

.pedestrian.is-amber {
  background: #ba7b17;
}

.pedestrian.is-rose {
  background: #b94d65;
}

@keyframes pedestrianWalk {
  0% {
    left: var(--from-x);
    top: var(--from-y);
    opacity: 0;
  }

  8%,
  92% {
    opacity: 1;
  }

  100% {
    left: var(--to-x);
    top: var(--to-y);
    opacity: 0;
  }
}

.plot,
.storage-slot {
  min-width: 0;
  min-height: 0;
  position: relative;
  z-index: 3;
  border-radius: 10px;
  background:
    linear-gradient(145deg, #d4f0a0, #b8e07a);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.55),
    inset 0 -2px 4px rgba(0, 0, 0, 0.08),
    0 1px 2px rgba(0, 0, 0, 0.04);
  display: grid;
  place-items: center;
  color: #6d9772;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid rgba(255, 255, 255, 0.25);
  touch-action: none;
  user-select: none;
}

.plot::after,
.storage-slot::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 8px;
  border: 1px dashed rgba(50, 120, 82, 0.25);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.plot:hover::after,
.storage-slot:hover::after {
  opacity: 1;
}

.plot.has-building,
.storage-slot.has-building {
  background:
    linear-gradient(145deg, #e0f8b8, #c8e890);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.6),
    inset 0 -2px 4px rgba(0, 0, 0, 0.06),
    0 1px 2px rgba(0, 0, 0, 0.04);
}

.plot img,
.storage-slot img {
  width: 92%;
  height: 92%;
  object-fit: contain;
  filter: drop-shadow(0 7px 7px rgba(64, 98, 64, 0.22));
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.plot span {
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #356465;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

.plot[data-locked="true"] {
  color: rgba(55, 86, 84, 0.54);
  background: rgba(80, 94, 88, 0.12);
}

/* Drag and Drop */
.plot.dragging,
.storage-slot.dragging {
  opacity: 0.4;
}

.plot.drop-target,
.storage-slot.drop-target {
  outline: 3px solid #f2b94f;
  outline-offset: 2px;
  background:
    linear-gradient(145deg, rgba(255, 236, 164, 0.92), rgba(198, 232, 144, 0.92));
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.62),
    inset 0 -2px 4px rgba(0, 0, 0, 0.06),
    0 0 16px rgba(242, 185, 79, 0.35);
}

.drag-clone {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  pointer-events: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
  transform: translate3d(-9999px, -9999px, 0) translate(-50%, -50%);
  will-change: transform;
  contain: layout paint style;
}

.drag-clone img {
  width: 88%;
  height: 88%;
  object-fit: contain;
}

.storage-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, clamp(250px, calc(100vh - 310px), 342px));
  width: min(100%, clamp(250px, calc(100dvh - 310px), 342px));
  gap: clamp(7px, 2.5vw, 10px);
  padding: clamp(9px, 2.6vw, 12px);
  margin: 0 auto;
  border-radius: 18px;
  background: linear-gradient(145deg, #c8e88e, #a8d46e);
  border: 3px solid rgba(255, 255, 255, 0.35);
  box-shadow:
    0 14px 28px rgba(34, 95, 78, 0.2),
    inset 0 2px 3px rgba(255, 255, 255, 0.5),
    inset 0 -3px 6px rgba(0, 0, 0, 0.06);
}

.storage-slot {
  aspect-ratio: 1 / 1;
}

.home-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 0.82fr;
  gap: 10px;
}

.primary-action,
.secondary-action {
  height: 46px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, var(--teal), #4fc27f);
  box-shadow: 0 12px 24px rgba(35, 140, 111, 0.22);
}

.primary-action.is-shop {
  background: linear-gradient(135deg, #f0a93e, #efca5d);
  box-shadow: 0 12px 24px rgba(196, 132, 37, 0.22);
}

.secondary-action {
  background: rgba(255, 255, 255, 0.88);
  color: #3f626a;
  box-shadow: 0 10px 22px rgba(59, 98, 91, 0.12);
}

.scene-game {
  background: #dff7ff;
}

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

.game-hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.1fr 0.8fr 0.9fr 1fr 0.8fr;
  gap: 6px;
}

.game-hud div,
.shop-balance div,
.podium article,
.ranking-row,
.goods-card {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(65, 113, 124, 0.13);
}

.game-hud div {
  padding: 6px 7px;
}

.game-hud span,
.shop-balance span,
.page-head span,
.goods-card small,
.goods-card p {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.game-hud strong {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-actions {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 10px;
}

.scene-ranking,
.scene-shop {
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(232, 248, 239, 0.92)),
    url("../images/首页场景.png") center / cover no-repeat;
  overflow-y: auto;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.page-head h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1;
}

.segmented,
.metric-tabs {
  display: grid;
  gap: 8px;
  padding: 5px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 8px 20px rgba(54, 101, 98, 0.12);
}

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

.metric-tabs {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 9px;
}

.segmented button,
.metric-tabs button {
  height: 34px;
  border-radius: 7px;
  background: transparent;
  color: #4d7072;
  font-size: 13px;
  font-weight: 900;
}

.segmented button.is-active,
.metric-tabs button.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--blue));
}

.podium {
  display: grid;
  grid-template-columns: 1fr 1.14fr 1fr;
  align-items: end;
  gap: 8px;
  margin: 14px 0 12px;
}

.podium article {
  min-height: 104px;
  display: grid;
  place-items: center;
  padding: 10px 6px;
  text-align: center;
}

.podium .champion {
  min-height: 128px;
  background: linear-gradient(180deg, rgba(255, 244, 195, 0.94), rgba(255, 255, 255, 0.88));
}

.podium span {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff4cd;
  color: #b37a16;
  font-weight: 900;
}

.podium strong {
  font-size: 13px;
  margin-top: 6px;
}

.podium small {
  color: var(--muted);
  font-weight: 800;
}

.ranking-list {
  display: grid;
  gap: 8px;
}

.rank-note {
  margin: 4px 0 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(255, 244, 205, 0.7);
  color: #8a6116;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.ranking-row {
  display: grid;
  grid-template-columns: 32px 38px 1fr auto;
  gap: 9px;
  align-items: center;
  padding: 9px;
}

.ranking-row .rank {
  color: #31565d;
  font-weight: 900;
  text-align: center;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, var(--teal), var(--amber));
}

.player-name {
  font-size: 13px;
  font-weight: 900;
}

.player-meta {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  margin-top: 2px;
}

.rank-value {
  color: #176f70;
  font-size: 13px;
  font-weight: 900;
}

.shop-balance {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.shop-balance div {
  padding: 12px;
}

.shop-balance strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.goods-list {
  display: grid;
  gap: 10px;
}

.goods-card {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px;
}

.goods-icon {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}

.heart-goods {
  color: #fff;
  background: linear-gradient(135deg, #ef6d78, #f7a050);
}

.coin-goods {
  color: #8a6116;
  background: linear-gradient(135deg, #fff2b8, #f2b94f);
}

.cooldown-goods {
  background:
    linear-gradient(135deg, rgba(78, 146, 216, 0.95), rgba(40, 167, 160, 0.92)),
    radial-gradient(circle at 50% 50%, #fff 0 12%, transparent 13%);
  position: relative;
}

.cooldown-goods::before,
.prosperity-goods::before {
  content: "";
  width: 26px;
  height: 26px;
  border: 3px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
}

.prosperity-goods {
  background: linear-gradient(135deg, #73cc68, #f2c456);
}

.goods-card h2 {
  margin: 0 0 3px;
  font-size: 15px;
}

.goods-card p {
  margin: 0 0 2px;
}

.goods-card button {
  width: 70px;
  min-height: 34px;
  border-radius: 8px;
  color: #fff;
  background: #236f71;
  font-size: 12px;
  font-weight: 900;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 40%, rgba(20, 48, 54, 0.28), rgba(12, 26, 30, 0.52));
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.sheet.is-open {
  display: grid;
  animation: sheetVeil 0.24s ease;
}

.sheet-panel {
  width: min(360px, calc(100vw - 40px));
  max-height: calc(100% - 40px);
  overflow-y: auto;
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% -10%, rgba(255, 244, 205, 0.9), transparent 46%),
    linear-gradient(180deg, #fffdf6 0%, #f4fbef 100%);
  box-shadow:
    0 24px 60px rgba(20, 43, 47, 0.42),
    inset 0 2px 0 rgba(255, 255, 255, 0.9),
    inset 0 0 0 2px rgba(255, 255, 255, 0.6),
    inset 0 0 0 4px rgba(120, 196, 156, 0.28);
  padding: 20px 18px 18px;
  position: relative;
  animation: sheetPop 0.32s cubic-bezier(0.24, 1.2, 0.4, 1);
}

/* 顶部一条“城市天际线”装饰，让弹窗贴合盖楼主题 */
.sheet-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 12px;
  border-radius: 24px 24px 0 0;
  background:
    linear-gradient(90deg, var(--teal), #4fc27f 45%, var(--amber));
  box-shadow: 0 2px 8px rgba(40, 130, 120, 0.28);
}

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

@keyframes sheetPop {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.icon-button {
  position: absolute;
  top: 16px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #3f6167;
  background: linear-gradient(180deg, #ffffff, #e7f2ec);
  box-shadow:
    0 4px 10px rgba(40, 90, 88, 0.2),
    inset 0 0 0 1.5px rgba(120, 196, 156, 0.35);
  transition: transform 0.15s ease;
}

.icon-button:active {
  transform: scale(0.9) rotate(90deg);
}

.sheet-title {
  margin: 4px 44px 14px 2px;
  font-size: 21px;
  font-weight: 900;
  color: #17505a;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sheet-title::before {
  content: "";
  width: 6px;
  height: 22px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--amber), #f0a93e);
  box-shadow: 0 2px 6px rgba(196, 132, 37, 0.4);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}

.choice-card {
  min-height: 132px;
  border-radius: 16px;
  padding: 12px 10px;
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 255, 255, 0.9), transparent 60%),
    linear-gradient(180deg, #f4fbef, #e6f5df);
  border: 2px solid rgba(120, 196, 156, 0.32);
  box-shadow: 0 8px 18px rgba(60, 120, 96, 0.14);
  display: grid;
  grid-template-rows: 72px auto auto;
  place-items: center;
  text-align: center;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.choice-card:hover {
  transform: translateY(-3px);
  border-color: var(--teal);
  box-shadow: 0 14px 26px rgba(45, 140, 118, 0.24);
}

.choice-card:active {
  transform: translateY(0) scale(0.97);
}

.choice-card img {
  height: 68px;
  object-fit: contain;
  filter: drop-shadow(0 6px 6px rgba(60, 110, 80, 0.28));
}

.choice-card strong {
  font-size: 14px;
  margin-top: 6px;
  color: #1f5a56;
}

.choice-card small {
  color: var(--muted);
  font-weight: 800;
  margin-top: 2px;
}

.building-detail {
  display: grid;
  gap: 12px;
}

/* Game Over Summary */
.game-summary {
  display: grid;
  gap: 12px;
}

.summary-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.summary-row {
  padding: 10px;
  border-radius: var(--radius);
  background: #f2fbf2;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.summary-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.summary-row strong {
  font-size: 17px;
  color: #176f70;
}

.summary-row .text-fail {
  color: #ef5f6c;
}

.quality-bar {
  display: flex;
  height: 28px;
  border-radius: 8px;
  overflow: hidden;
  gap: 2px;
}

.quality-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  min-width: 0;
  flex: 1;
}

.quality-seg.perfect {
  background: #4fd276;
}

.quality-seg.good {
  background: #4e9ee8;
}

.quality-seg.normal {
  background: #f18a55;
}

.quality-seg.failed {
  background: #ef5f6c;
}

.summary-note {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.detail-hero {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  align-items: center;
}

.detail-hero img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.9), transparent 62%),
    linear-gradient(180deg, #edf8e8, #dcf0d4);
  box-shadow: inset 0 0 0 2px rgba(120, 196, 156, 0.3);
  filter: drop-shadow(0 6px 6px rgba(60, 110, 80, 0.22));
}

.detail-hero h2 {
  margin: 0 0 6px;
  font-size: 21px;
}

.detail-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat-grid div {
  padding: 10px 8px;
  border-radius: 12px;
  background: linear-gradient(180deg, #f4fbf2, #e9f6e6);
  box-shadow: inset 0 0 0 1.5px rgba(120, 196, 156, 0.22);
  text-align: center;
}

.stat-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.stat-grid strong {
  display: block;
  margin-top: 4px;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.detail-actions button {
  min-height: 42px;
  border-radius: 13px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent),
    linear-gradient(135deg, #12979e, #43c878);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(35, 140, 111, 0.26);
  transition: transform 0.14s ease;
}

.detail-actions button:active {
  transform: translateY(1px) scale(0.97);
}

.detail-actions button:nth-child(2) {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent),
    linear-gradient(135deg, #f39b3d, #f2d35b);
  box-shadow: 0 8px 18px rgba(196, 132, 37, 0.26);
}

.detail-actions button:last-child {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent),
    linear-gradient(135deg, #e6636f, #f0868f);
  box-shadow: 0 8px 18px rgba(200, 70, 82, 0.26);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 30;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  padding: 10px 14px;
  border-radius: 999px;
  color: #fff;
  background: rgba(31, 48, 52, 0.92);
  font-weight: 800;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 520px) {
  .demo-shell {
    padding: 0;
  }

  .phone {
    width: 100vw;
    height: 100vh;
    max-height: none;
    border: 0;
    border-radius: 0;
    aspect-ratio: auto;
  }

  .sheet {
    padding: 18px;
  }

  .sheet-panel {
    width: min(360px, calc(100vw - 36px));
    border-radius: 24px;
  }
}

@media (max-height: 760px) and (min-width: 521px) {
  .phone {
    width: 390px;
  }

  .city-board {
    width: min(100%, clamp(250px, calc(100vh - 330px), 312px));
    width: min(100%, clamp(250px, calc(100dvh - 330px), 312px));
    padding: 14px;
  }

  .grid-plate {
    gap: 8px;
  }

  .storage-row {
    width: min(100%, clamp(250px, calc(100vh - 330px), 312px));
    width: min(100%, clamp(250px, calc(100dvh - 330px), 312px));
  }
}

/* v2 visual polish: richer city-builder art direction */
.phone {
  border-color: #112632;
  background: #cdeff7;
}

.phone-status {
  background: rgba(249, 253, 249, 0.9);
  backdrop-filter: blur(10px);
}

.scene-home {
  background:
    linear-gradient(180deg, rgba(113, 208, 237, 0.35), rgba(234, 255, 213, 0.22)),
    #dff8f5;
}

.home-bg {
  opacity: 0.92;
  filter: saturate(1.18) contrast(1.03);
}

.home-masthead {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  color: #16404b;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(236, 255, 246, 0.76)),
    linear-gradient(90deg, rgba(247, 197, 77, 0.2), rgba(55, 176, 160, 0.16));
  border: 1px solid rgba(255, 255, 255, 0.68);
  box-shadow: 0 14px 30px rgba(47, 104, 105, 0.16);
}

.home-masthead span {
  display: block;
  color: #477178;
  font-size: 12px;
  font-weight: 800;
}

.home-masthead h1 {
  margin: 2px 0 0;
  font-size: 25px;
  line-height: 1;
}

.home-masthead strong {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 999px;
  color: #7d550b;
  background: linear-gradient(180deg, #fff3c5, #ffd66d);
  box-shadow: inset 0 -2px 0 rgba(135, 92, 10, 0.14);
  font-size: 12px;
}

.resource-bar {
  gap: 9px;
}

.resource-card {
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(242, 255, 245, 0.84)),
    radial-gradient(circle at 85% 0, rgba(80, 194, 127, 0.22), transparent 42%);
  box-shadow: 0 12px 26px rgba(31, 102, 105, 0.16);
}

.resource-card:nth-child(2) {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 248, 224, 0.9)),
    radial-gradient(circle at 85% 0, rgba(242, 185, 79, 0.28), transparent 42%);
}

.resource-card:nth-child(3) {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 235, 237, 0.88)),
    radial-gradient(circle at 85% 0, rgba(239, 109, 120, 0.24), transparent 42%);
}

.unlock-strip {
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 10px 22px rgba(53, 98, 101, 0.12);
}

.city-board {
  width: min(100%, clamp(250px, calc(100vh - 310px), 342px));
  width: min(100%, clamp(250px, calc(100dvh - 310px), 342px));
  margin: 0 auto;
  border-radius: 26px;
  background:
    linear-gradient(145deg, #c8e88e, #a8d46e);
  transform: perspective(900px) rotateX(2deg);
  box-shadow:
    0 22px 36px rgba(34, 95, 78, 0.26),
    inset 0 2px 3px rgba(255, 255, 255, 0.5),
    inset 0 -3px 6px rgba(0, 0, 0, 0.06);
  border: 3px solid rgba(255, 255, 255, 0.35);
}

.plot,
.storage-slot {
  transition:
    transform 0.18s ease,
    filter 0.18s ease;
}

.plot:hover,
.storage-slot:hover {
  transform: translateY(-3px);
  filter: saturate(1.08);
}

.plot.has-building,
.storage-slot.has-building {
  background:
    linear-gradient(145deg, #e0f8b8, #c8e890);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.6),
    inset 0 -2px 4px rgba(0, 0, 0, 0.06),
    0 1px 2px rgba(0, 0, 0, 0.04);
}

.plot img,
.storage-slot img {
  filter:
    drop-shadow(0 9px 8px rgba(41, 92, 62, 0.22))
    saturate(1.06);
}

.storage-row {
  width: min(100%, clamp(250px, calc(100vh - 310px), 342px));
  width: min(100%, clamp(250px, calc(100dvh - 310px), 342px));
  border-radius: 20px;
  background: linear-gradient(145deg, #c8e88e, #a8d46e);
}

.storage-slot {
  background:
    linear-gradient(145deg, #d4f0a0, #b8e07a);
  border-color: rgba(255, 255, 255, 0.25);
}

.primary-action,
.secondary-action {
  border-radius: 13px;
}

.primary-action {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent),
    linear-gradient(135deg, #12979e, #43c878);
}

.primary-action.is-shop {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent),
    linear-gradient(135deg, #f39b3d, #f2d35b);
}

.primary-action.is-settings {
  gap: 5px;
  font-size: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent),
    linear-gradient(135deg, #5b8f96, #7fb8bd);
  box-shadow: 0 12px 24px rgba(48, 104, 105, 0.22);
}

.primary-action.is-settings svg {
  width: 18px;
  height: 18px;
}

.scene-game {
  background: linear-gradient(180deg, #86d9f3 0%, #eaf9ff 42%, #f7f0d4 100%);
}

.game-hud {
  top: 10px;
  grid-template-columns: 1.1fr 0.8fr 0.9fr 1fr 0.8fr;
}

.game-hud div {
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(235, 251, 255, 0.78));
  box-shadow: 0 12px 24px rgba(32, 92, 111, 0.16);
}

.game-hud strong {
  color: #174c59;
}

.game-actions {
  bottom: 14px;
}

.scene-ranking,
.scene-shop {
  background:
    linear-gradient(180deg, rgba(121, 213, 236, 0.34), rgba(255, 246, 217, 0.84)),
    url("../images/首页场景.png") center / cover no-repeat;
}

.page-head h1 {
  color: #173f4d;
}

.segmented,
.metric-tabs,
.podium article,
.ranking-row,
.shop-balance div,
.goods-card {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 26px rgba(43, 96, 105, 0.14);
}

.podium .champion {
  background:
    linear-gradient(180deg, rgba(255, 241, 167, 0.96), rgba(255, 255, 255, 0.9)),
    radial-gradient(circle at 50% 0, rgba(239, 109, 120, 0.18), transparent 48%);
}

.ranking-row:nth-child(odd),
.goods-card:nth-child(odd) {
  background: rgba(255, 253, 242, 0.92);
}

.goods-icon {
  border-radius: 14px;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.08);
}


/* Coin popup animation on buildings */
.coin-popup {
  position: absolute;
  z-index: 10;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 2px;
  color: #f2b94f;
  font-size: 13px;
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
  animation: coinFloat 1.6s ease-out forwards;
  white-space: nowrap;
}

.coin-popup svg {
  width: 14px;
  height: 14px;
  color: #f2b94f;
  stroke: #f2b94f;
}

@keyframes coinFloat {
  0% {
    opacity: 1;
    transform: translateY(0) scale(0.7);
  }
  20% {
    opacity: 1;
    transform: translateY(-14px) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translateY(-48px) scale(0.7);
  }
}

/* Building golden glow when coin spawns */
.plot.coin-glow {
  animation: buildingGlow 1.2s ease-out;
}

.plot.coin-glow img {
  animation: buildingGlowImg 1.2s ease-out;
}

@keyframes buildingGlow {
  0% {
    box-shadow: 0 0 0 rgba(242, 185, 79, 0), inset 0 -5px 10px rgba(50, 115, 68, 0.12);
  }
  30% {
    box-shadow: 0 0 22px rgba(242, 185, 79, 0.55), 0 0 44px rgba(255, 210, 80, 0.28), inset 0 -5px 10px rgba(50, 115, 68, 0.12);
  }
  100% {
    box-shadow: 0 0 0 rgba(242, 185, 79, 0), inset 0 -5px 10px rgba(50, 115, 68, 0.12);
  }
}

@keyframes buildingGlowImg {
  0% {
    filter: drop-shadow(0 9px 8px rgba(41, 92, 62, 0.22)) saturate(1.06);
  }
  30% {
    filter: drop-shadow(0 9px 8px rgba(41, 92, 62, 0.22)) saturate(1.6) brightness(1.15);
  }
  100% {
    filter: drop-shadow(0 9px 8px rgba(41, 92, 62, 0.22)) saturate(1.06);
  }
}

/* ========== Game feel: goal bar, combo, mute, record ========== */
.game-goal {
  position: absolute;
  top: 74px;
  left: 12px;
  right: 12px;
  z-index: 2;
  padding: 7px 10px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(235, 251, 255, 0.8));
  box-shadow: 0 10px 22px rgba(32, 92, 111, 0.14);
}

.goal-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 5px;
}

.goal-head span:first-child {
  font-size: 11px;
  font-weight: 800;
  color: #2f6d70;
}

#goalProgressText {
  font-size: 11px;
  font-weight: 900;
  color: #f0a93e;
}

.goal-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(70, 130, 128, 0.16);
  overflow: hidden;
}

.goal-track i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4fc27f, #28a7a0);
  transition: width 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.goal-track i.is-complete {
  background: linear-gradient(90deg, #f2b94f, #f0a93e);
}

/* combo HUD cell */
.hud-combo {
  position: relative;
  transition: transform 0.12s ease;
}

.hud-combo strong {
  color: #9aa7ad;
  transition: color 0.2s ease;
}

.hud-combo.is-hot {
  background:
    linear-gradient(180deg, rgba(255, 244, 205, 0.98), rgba(255, 231, 179, 0.9)) !important;
  box-shadow: 0 0 0 2px rgba(242, 185, 79, 0.5), 0 12px 24px rgba(196, 132, 37, 0.24) !important;
}

.hud-combo.is-hot strong {
  color: #e07d1a;
}

.hud-combo.pop {
  animation: comboPop 0.32s ease;
}

@keyframes comboPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.22); }
  100% { transform: scale(1); }
}

/* mute toggle */
.mute-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  width: 34px;
  height: 34px;
  display: none; /* revealed on game scene only */
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 16px rgba(32, 92, 111, 0.2);
}

.scene-game .mute-btn {
  display: inline-flex;
  top: auto;
  bottom: 70px;
  right: 16px;
}

.mute-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: #2f6d70;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mute-btn svg path:first-child {
  fill: #2f6d70;
  stroke: none;
}

.mute-btn.is-muted svg .wave {
  display: none;
}

.mute-btn.is-muted {
  opacity: 0.6;
}

.mute-btn.is-muted::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 2px;
  background: #ef6d78;
  transform: rotate(-45deg);
  border-radius: 2px;
}

/* settings entry on home scene */
.settings-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 6;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 16px rgba(32, 92, 111, 0.2);
}

.settings-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #2f6d70;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-btn:active {
  transform: scale(0.94);
}

/* settings sheet */
.settings-panel .setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
}

.settings-panel .setting-row:last-of-type {
  border-bottom: none;
}

.settings-panel .setting-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-panel .setting-label strong {
  font-size: 15px;
  color: var(--ink);
}

.settings-panel .setting-label small {
  font-size: 12px;
  color: var(--muted);
}

.switch {
  position: relative;
  flex: none;
  width: 50px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: #d5dee2;
  transition: background 0.22s ease;
  cursor: pointer;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(30, 70, 80, 0.3);
  transition: transform 0.22s ease;
}

.switch[aria-checked="true"] {
  background: linear-gradient(135deg, var(--teal), #4fc27f);
}

.switch[aria-checked="true"]::after {
  transform: translateX(22px);
}

.settings-hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* music track chooser */
.settings-panel .setting-block {
  padding: 14px 4px 4px;
}

.track-chips {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.track-chip {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f6faf8;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.track-chip strong {
  font-size: 13px;
  color: var(--ink);
}

.track-chip small {
  font-size: 11px;
  color: var(--muted);
}

.track-chip.is-active {
  border-color: var(--teal);
  background: linear-gradient(135deg, rgba(40, 167, 160, 0.16), rgba(79, 194, 127, 0.16));
  transform: translateY(-1px);
}

.track-chip.is-active strong {
  color: var(--teal);
}

.track-chip:active {
  transform: scale(0.97);
}

/* record + goal result in summary */
.record-badge {
  text-align: center;
  padding: 9px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 900;
  color: #a35c00;
  background: linear-gradient(135deg, #fff1a6, #ffd98a);
  box-shadow: 0 8px 20px rgba(196, 132, 37, 0.28);
  animation: recordPulse 1.4s ease-in-out infinite;
}

@keyframes recordPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

.goal-result {
  text-align: center;
  padding: 8px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  background: #f2fbf2;
}

.goal-result.is-done {
  color: #1f8f5b;
  background: #e5f8ec;
}

.summary-row .text-combo {
  color: #e07d1a;
}

.reward-row {
  text-align: center;
  padding: 9px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #2f6d70;
  background: linear-gradient(180deg, rgba(255, 244, 205, 0.7), rgba(235, 251, 255, 0.7));
}

.reward-row strong {
  color: #f0a93e;
  font-size: 16px;
}

/* breathing replay button */
.detail-actions .is-breathing {
  animation: breathe 1.8s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% {
    box-shadow: 0 10px 22px rgba(35, 140, 111, 0.22);
    transform: translateY(0);
  }
  50% {
    box-shadow: 0 14px 30px rgba(35, 140, 111, 0.4);
    transform: translateY(-2px);
  }
}

/* home best marker + coin gain float */
.home-best {
  color: #f0a93e !important;
  font-weight: 900 !important;
}

.coin-popup.home-gain {
  left: 50%;
  top: 4px;
  transform: translateX(-50%);
  font-size: 15px;
  z-index: 20;
}

#coinTicker.bump {
  display: inline-block;
  animation: coinBump 0.3s ease;
  color: #f0a93e;
}

@keyframes coinBump {
  0% { transform: scale(1); }
  50% { transform: scale(1.25); }
  100% { transform: scale(1); }
}
