:root {
  color-scheme: light;
  --ink: #18212b;
  --muted: #667085;
  --line: #d9e1e8;
  --surface: #ffffff;
  --soft: #f4f7f7;
  --accent: #18a058;
  --accent-2: #f0a020;
  --danger: #d94841;
}

* {
  box-sizing: border-box;
}

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

body {
  align-items: center;
  background: linear-gradient(180deg, #f7faf8 0%, #edf3f2 100%);
  color: var(--ink);
  display: flex;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  justify-content: center;
  padding: 20px;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  min-height: 44px;
  padding: 0 14px;
}

button:active {
  transform: translateY(1px);
}

.app-shell {
  display: grid;
  gap: 12px;
  max-width: 460px;
  width: min(100%, 460px);
}

.topbar,
.hud,
.controls {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.topbar h1 {
  font-size: 26px;
  line-height: 1.1;
  margin: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 4px;
}

.wallet,
.hud > div {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.wallet span,
.hud span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  line-height: 1.2;
}

.wallet strong,
.hud strong {
  display: block;
  font-size: 16px;
  line-height: 1.35;
  min-width: 44px;
}

.hud > div {
  flex: 1;
}

.stage-wrap {
  aspect-ratio: 3 / 4;
  background: #dfe9e4;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  touch-action: none;
  width: 100%;
}

#gameCanvas {
  display: block;
  height: 100%;
  width: 100%;
}

.toast {
  background: rgba(24, 33, 43, 0.86);
  border-radius: 8px;
  color: white;
  font-size: 14px;
  left: 50%;
  max-width: 80%;
  padding: 9px 12px;
  position: absolute;
  text-align: center;
  top: 18px;
  transform: translateX(-50%);
}

.hidden {
  display: none;
}

.controls {
  display: grid;
  grid-template-columns: 44px 1fr auto 44px;
}

#goldBladeBtn {
  background: #fff5d9;
  border-color: #f0cc6f;
  color: #8a5d00;
}

#restartBtn {
  background: #eef8f3;
  border-color: #b9dfc9;
  color: #126c3a;
}

.modal {
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  max-width: 330px;
  padding: 22px;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.38);
}

.modal h2 {
  font-size: 22px;
  margin: 0 0 8px;
}

.modal p {
  color: var(--muted);
  line-height: 1.65;
  margin: 0 0 18px;
}

.modal menu {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.modal button:first-child {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

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

  .topbar h1 {
    font-size: 23px;
  }

  .controls {
    grid-template-columns: 40px 1fr 58px 40px;
  }

  button {
    font-size: 13px;
    padding: 0 10px;
  }
}
