:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --ink: #1f2933;
  --muted: #667085;
  --panel: #ffffff;
  --line: #d7dee8;
  --accent: #0f8b8d;
  --accent-dark: #0a6264;
  --gold: #f2b705;
  --danger: #d64545;
  --pipe: #e8eef5;
  --pipe-shadow: #aeb9c7;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(15, 139, 141, 0.08), rgba(242, 183, 5, 0.07)),
    var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
}

.app-shell {
  width: min(100%, 880px);
  margin: 0 auto;
}

.home-view {
  min-height: calc(100vh - 48px);
  display: grid;
  align-content: center;
  gap: 22px;
}

.home-header {
  display: grid;
  gap: 8px;
}

.brand,
.home-header h1 {
  margin: 0;
}

.brand {
  color: var(--accent-dark);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
}

.home-header h1 {
  font-size: clamp(36px, 7vw, 64px);
  line-height: 1;
}

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

.game-card {
  min-height: 292px;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 18px 46px rgba(31, 41, 51, 0.12);
}

.game-card:hover,
.game-card:focus-visible {
  outline: 3px solid rgba(15, 139, 141, 0.22);
  border-color: var(--accent);
}

.game-card-disabled {
  cursor: default;
  opacity: 0.72;
}

.game-card-disabled:hover,
.game-card-disabled:focus-visible {
  outline: none;
  border-color: var(--line);
}

.game-card-art {
  position: relative;
  min-height: 178px;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(180deg, #fafdff, #e9f1f5);
}

.mini-pipe {
  position: absolute;
  top: 24px;
  bottom: 18px;
  width: 52px;
  border: 8px solid #b9c5d3;
  border-radius: 24px;
  background: linear-gradient(90deg, #c8d3df, #ffffff 42%, #d7e0ea);
}

.mini-pipe:nth-child(1) {
  left: 38px;
}

.mini-pipe:nth-child(2) {
  left: 122px;
}

.mini-pipe:nth-child(3) {
  left: 206px;
}

.mini-coin {
  position: absolute;
  top: 50px;
  left: 148px;
  width: 34px;
  height: 34px;
  border: 4px solid #b77900;
  border-radius: 50%;
  background: var(--gold);
}

.mini-bill {
  position: absolute;
  top: 92px;
  left: 62px;
  width: 54px;
  height: 30px;
  border: 3px solid #177245;
  border-radius: 5px;
  background: #36a96a;
  transform: rotate(-12deg);
}

.mini-vacuum {
  position: absolute;
  left: 30px;
  bottom: 10px;
  width: 82px;
  height: 42px;
  border-radius: 15px;
  background: var(--accent);
}

.mini-vacuum::before,
.mini-vacuum::after {
  position: absolute;
  bottom: 8px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--gold);
  content: "";
}

.mini-vacuum::before {
  left: 16px;
}

.mini-vacuum::after {
  right: 16px;
}

.empty-art {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 18px;
  align-items: end;
}

.empty-art span {
  height: 44%;
  border-radius: 8px;
  background: #d7dee8;
}

.empty-art span:nth-child(2) {
  height: 66%;
  background: #c6d2de;
}

.empty-art span:nth-child(3) {
  height: 82%;
  background: #dfe7ef;
}

.game-card-copy {
  display: grid;
  gap: 8px;
}

.game-state {
  width: fit-content;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(15, 139, 141, 0.12);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
}

.game-card-copy strong {
  font-size: 24px;
  line-height: 1.1;
}

.game-card-copy span:last-child {
  color: var(--muted);
  font-size: 15px;
}

.game-view {
  width: min(100%, 680px);
  margin: 0 auto;
}

.topbar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 6vw, 44px);
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--accent-dark);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(31, 41, 51, 0.08);
}

.icon-button:hover,
.icon-button:focus-visible {
  outline: 3px solid rgba(15, 139, 141, 0.2);
  border-color: var(--accent);
}

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

.hud div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(31, 41, 51, 0.06);
}

.hud span,
.hud strong {
  display: block;
}

.hud span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
}

.hud strong {
  margin-top: 4px;
  font-size: clamp(18px, 4vw, 24px);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#gameCanvas {
  width: 100%;
  aspect-ratio: 640 / 760;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafdff;
  box-shadow: 0 18px 46px rgba(31, 41, 51, 0.16);
  touch-action: none;
}

@media (max-width: 420px) {
  body {
    padding: 14px;
  }

  .home-view {
    min-height: calc(100vh - 28px);
  }

  .game-grid {
    grid-template-columns: 1fr;
  }

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