:root {
  --bg: #07111a;
  --panel: rgba(5, 14, 22, 0.68);
  --panel-strong: rgba(5, 14, 22, 0.92);
  --line: rgba(161, 212, 255, 0.22);
  --line-strong: rgba(161, 212, 255, 0.42);
  --text: #eef7ff;
  --muted: rgba(220, 236, 255, 0.72);
  --cyan: #73e0ff;
  --ice: #b5f3ff;
  --amber: #ffb347;
  --danger: #ff6f61;
  --good: #6ef0b2;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(115, 224, 255, 0.14), transparent 36%),
    linear-gradient(180deg, #0e2030 0%, #09121b 34%, #04090e 100%);
  color: var(--text);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
  min-height: 100vh;
}

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

.game-frame {
  position: relative;
  width: min(100vw - 20px, 430px);
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(198, 235, 255, 0.05), rgba(198, 235, 255, 0)),
    linear-gradient(180deg, #7f9bb0 0%, #445867 26%, #161d24 72%, #0b0f13 100%);
  box-shadow: var(--shadow);
  isolation: isolate;
}

.game-frame::before,
.game-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.game-frame::before {
  background:
    linear-gradient(90deg, transparent 11%, rgba(255, 255, 255, 0.05) 11.5%, transparent 12%, transparent 88%, rgba(255, 255, 255, 0.05) 88.5%, transparent 89%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 24%);
  opacity: 0.6;
}

.game-frame::after {
  background:
    radial-gradient(circle at 50% 100%, rgba(255, 179, 71, 0.1), transparent 32%),
    linear-gradient(180deg, rgba(7, 17, 26, 0) 64%, rgba(7, 17, 26, 0.86) 100%);
}

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

.hud {
  position: absolute;
  left: 18px;
  right: 18px;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hud-top {
  top: 14px;
}

.hud-stats {
  top: 82px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.brand-block h1,
.brand-block p {
  margin: 0;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--ice);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand-block h1 {
  font-size: clamp(1.22rem, 2.8vw, 1.58rem);
  line-height: 0.95;
}

.action-row {
  display: flex;
  gap: 10px;
}

.stat {
  min-height: 62px;
  padding: 8px 10px 10px;
  border: 1px solid rgba(161, 212, 255, 0.16);
  border-radius: 16px;
  background: rgba(7, 17, 26, 0.46);
  backdrop-filter: blur(10px);
}

.stat.wide {
  grid-column: 1 / -1;
}

.status-pill {
  min-height: auto;
  padding-block: 8px 9px;
}

.label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.64rem;
}

.stat strong {
  display: block;
  font-size: 0.88rem;
  line-height: 1.15;
}

.status-pill strong {
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-button,
.ghost-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease;
}

.action-button {
  background: linear-gradient(135deg, var(--amber), #ff8b39);
  color: #1d1303;
  box-shadow: 0 14px 32px rgba(255, 140, 57, 0.28);
}

.action-button-wide {
  width: 100%;
}

.ghost-button {
  background: rgba(7, 17, 26, 0.56);
  color: var(--text);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.action-button:active,
.ghost-button:active {
  transform: translateY(1px) scale(0.99);
}

.banner {
  position: absolute;
  top: 238px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(6, 13, 20, 0.76);
  border: 1px solid var(--line-strong);
  color: var(--ice);
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.game-frame.is-running .brand-block h1 {
  font-size: 1.05rem;
  opacity: 0.82;
}

.game-frame.is-running .eyebrow {
  opacity: 0.68;
}

.game-frame.is-running .hud-stats {
  top: 70px;
}

.game-frame.is-running .stat {
  background: rgba(7, 17, 26, 0.38);
}

.game-frame.is-running .status-pill {
  display: none;
}

.hidden {
  opacity: 0;
  pointer-events: none;
}

.progress-wrap {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 74px;
  z-index: 2;
}

.progress-label {
  display: block;
  margin-bottom: 8px;
  color: rgba(233, 245, 255, 0.8);
  font-size: 0.76rem;
}

.progress-rail {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--good), var(--cyan));
  box-shadow: 0 0 30px rgba(110, 240, 178, 0.45);
}

.touch-hint {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 24px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  z-index: 2;
  color: rgba(233, 245, 255, 0.82);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
}

.overlay,
.upgrade-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, rgba(5, 14, 22, 0.26), rgba(5, 14, 22, 0.86));
  backdrop-filter: blur(10px);
}

.upgrade-overlay {
  z-index: 5;
}

.overlay-panel,
.upgrade-panel {
  width: min(100%, 340px);
  padding: 28px 24px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(18, 35, 49, 0.92), rgba(6, 13, 20, 0.96)),
    var(--panel-strong);
  border: 1px solid rgba(181, 243, 255, 0.18);
  box-shadow: var(--shadow);
}

.upgrade-panel {
  width: min(100%, 360px);
}

.overlay-tag {
  margin: 0 0 10px;
  color: var(--cyan);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.7rem;
}

.overlay-panel h2,
.upgrade-panel h2 {
  margin: 0;
  font-size: 2rem;
  line-height: 0.95;
}

.overlay-copy {
  margin: 14px 0 22px;
  color: var(--muted);
  line-height: 1.5;
}

.overlay-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.overlay-meta div {
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.overlay-meta span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  margin-bottom: 6px;
}

.overlay-meta strong {
  font-size: 1rem;
}

.upgrade-grid {
  display: grid;
  gap: 12px;
}

.upgrade-card {
  width: 100%;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(115, 224, 255, 0.14), rgba(255, 255, 255, 0.02)),
    rgba(5, 14, 22, 0.74);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.upgrade-card strong,
.upgrade-card span {
  display: block;
}

.upgrade-card strong {
  margin-bottom: 8px;
  font-size: 1rem;
}

.upgrade-card span {
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.82rem;
}

.upgrade-card:active {
  transform: scale(0.99);
}

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

  .game-frame {
    width: 100vw;
    min-height: 100vh;
    aspect-ratio: auto;
    border-radius: 0;
  }

  .hud-stats {
    top: 78px;
  }
}
