* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #ffffff;
  color: #111111;
}

.game-site-nav {
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 16px 0;
  font-size: 14px;
}

.game-site-nav a {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
}

.game-site-nav a:hover {
  text-decoration: underline;
}

.game-site-nav .sep {
  color: #999999;
  margin: 0 6px;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

.game-screen {
  border: 2px solid #e8e8e8;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
  background: #fafafa;
}

.game-screen .game-wrap {
  border: none;
  box-shadow: none;
  margin-bottom: 0;
  border-radius: 0;
}

.app h1 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.lead {
  margin: 0 0 12px;
  color: #444444;
  font-size: 14px;
}

.game-wrap {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin: 0 auto 16px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  border: 1px solid #e8e8e8;
  background: #87ceeb;
  touch-action: none;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.game-credit {
  position: absolute;
  right: 8px;
  bottom: 6px;
  margin: 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  z-index: 2;
}

.hud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
}

.hud span {
  color: #333333;
}

.hud .bank {
  color: #b45309;
}

.hud .hud-time.hud-time-warn {
  color: #dc2626;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}

.controls-row button {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #cccccc;
  background: #f8f8f8;
  cursor: pointer;
}

.controls-row button:hover {
  background: #eeeeee;
}

.controls-row button.primary {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
}

.controls-row button.primary:hover {
  background: #1d4ed8;
}

.controls-row button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.touch-hint {
  text-align: center;
  font-size: 13px;
  color: #666666;
  margin-bottom: 12px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-overlay.is-open {
  display: flex;
}

.modal {
  background: #ffffff;
  border-radius: 12px;
  padding: 20px 22px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.modal h2 {
  margin: 0 0 10px;
  font-size: 1.15rem;
}

.modal p {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.5;
  color: #333333;
}

.modal .modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.modal .modal-actions button {
  flex: 1;
  min-width: 100px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #cccccc;
  background: #f0f0f0;
  cursor: pointer;
}

.modal .modal-actions button.primary {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
}

.shop-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.shop-items li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #eeeeee;
  font-size: 14px;
}

.shop-items li:last-child {
  border-bottom: none;
}

.shop-items button {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #1d4ed8;
  background: #eff6ff;
  color: #1d4ed8;
  cursor: pointer;
  white-space: nowrap;
}

.shop-items button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.rules-block {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #e5e5e5;
}

.rules-block h2 {
  font-size: 1.05rem;
  margin: 0 0 10px;
}

.rules-block ul {
  margin: 0 0 16px;
  padding-left: 1.25rem;
  line-height: 1.6;
  font-size: 14px;
  color: #333333;
}

.game-description {
  font-size: 14px;
  line-height: 1.65;
  color: #333333;
}

.game-description h2 {
  font-size: 1.05rem;
  margin: 20px 0 10px;
}

.game-description p {
  margin: 0 0 12px;
}

.site-footer {
  max-width: 720px;
  margin: 28px auto 24px;
  padding: 16px;
  border-top: 1px solid #e5e5e5;
  text-align: center;
  font-size: 14px;
}

.site-footer a {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.zh-page-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
  box-sizing: border-box;
}

.zh-page-shell .game-site-nav {
  max-width: none;
}

.zh-main-beside-ad .app {
  margin-left: 0;
  margin-right: 0;
  max-width: 960px;
}

.game-and-leaderboard {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px 20px;
  margin-bottom: 16px;
}

.game-and-leaderboard .game-column {
  flex: 1 1 320px;
  min-width: 0;
}

.game-and-leaderboard .game-screen {
  margin-bottom: 0;
}

.leaderboard-aside {
  flex: 0 0 220px;
  max-width: 100%;
  padding: 14px 16px;
  border: 2px solid #e8e8e8;
  border-radius: 12px;
  background: #fafafa;
}

.leaderboard-heading {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.leaderboard-note {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.45;
  color: #555555;
}

.leaderboard-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: lb;
}

.leaderboard-list .leaderboard-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #eeeeee;
  font-size: 13px;
}

.leaderboard-list .leaderboard-row:last-child {
  border-bottom: none;
}

.leaderboard-list .lb-rank {
  flex: 0 0 1.5rem;
  font-weight: 700;
  color: #b45309;
}

.leaderboard-list .lb-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.leaderboard-list .lb-time {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  color: #333333;
}

.leaderboard-list .leaderboard-empty {
  padding: 10px 0;
  font-size: 13px;
  color: #777777;
  list-style: none;
}

.modal--victory {
  max-width: 420px;
}

.victory-run-time {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: #1d4ed8;
}

.victory-lb-q {
  margin: 0 0 10px;
  font-size: 14px;
  color: #333333;
}

.victory-lb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.victory-lb-actions button {
  flex: 1;
  min-width: 100px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #cccccc;
  background: #f0f0f0;
  cursor: pointer;
}

.victory-lb-actions button.primary {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
}

.victory-lb-form {
  margin-bottom: 8px;
}

.victory-lb-label {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  color: #333333;
}

.victory-lb-label input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  font-size: 15px;
  border-radius: 8px;
  border: 1px solid #cccccc;
  box-sizing: border-box;
}

.victory-lb-err {
  margin: 0 0 8px;
  font-size: 13px;
  color: #dc2626;
}

.victory-lb-thanks {
  margin: 0 0 12px;
  font-size: 14px;
  color: #15803d;
  font-weight: 600;
}

@media (max-width: 640px) {
  .leaderboard-aside {
    flex: 1 1 100%;
  }
}

.game-original-footer {
  max-width: 720px;
  margin: 0 auto 40px;
  padding: 0 16px 8px;
  border-top: 1px solid #e5e5e5;
  padding-top: 20px;
  font-size: 0.85rem;
  color: #555555;
}

.game-original-footer .hub-original {
  margin: 0;
  max-width: 720px;
  line-height: 1.65;
}

.game-original-footer .hub-original > p {
  margin: 0;
}

.game-original-footer .hub-original > p + p {
  margin-top: 0.65em;
}

.game-original-footer .hub-original-title {
  margin-bottom: 0.15em;
}

.game-original-footer .hub-original strong {
  color: #111111;
}

.game-original-footer .site-established {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid #e5e5e5;
  text-align: center;
  font-size: 0.85rem;
  color: #666666;
}

.game-original-footer .site-established-split {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 16px;
  text-align: left;
}

@media (max-width: 520px) {
  .game-original-footer .site-established-split {
    flex-direction: column;
    align-items: flex-start;
  }
}
