@font-face {
  font-family: "Silkscreen";
  src: url("assets/fonts/Silkscreen-Regular.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Silkscreen";
  src: url("assets/fonts/Silkscreen-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --forest: #173b2b;
  --forest-deep: #0c251a;
  --leaf: #397c45;
  --grass: #6aaa50;
  --sun: #f2c14e;
  --wheat: #e8a63a;
  --soil: #7c4b2b;
  --cream: #fff4d2;
  --paper: #f7edcc;
  --ink: #1e2a21;
  --sky: #83c8d8;
  --line: #243c2b;
  --shadow: #07170f;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  letter-spacing: 0;
}
button, a { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.skip-link {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--sun);
  border: 3px solid var(--line);
}
.skip-link:focus { top: 12px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 8px 24px;
  color: var(--cream);
  background: var(--forest-deep);
  border-bottom: 4px solid var(--sun);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex: none;
}
.brand img { width: 44px; height: 44px; object-fit: cover; border: 2px solid var(--sun); }
.brand span, .footer-brand {
  font-family: "Silkscreen", monospace;
  font-weight: 700;
  color: var(--sun);
}
.main-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.main-nav a {
  padding: 9px 12px;
  color: #d7e6d5;
  font-size: 14px;
  text-decoration: none;
  border: 2px solid transparent;
}
.main-nav a:hover, .main-nav a:focus-visible { color: var(--sun); border-color: #52755d; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.chain-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  color: var(--sun);
  border: 2px solid #52755d;
  font-family: "Silkscreen", monospace;
  font-size: 11px;
  white-space: nowrap;
}
.chain-badge i, .online-dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  background: #6bdc75;
  box-shadow: 0 0 0 2px #1c5432;
}
.wallet-button {
  min-height: 38px;
  padding: 8px 14px;
  color: var(--forest-deep);
  background: var(--sun);
  border: 2px solid #7c5715;
  box-shadow: 3px 3px 0 #050e09;
  font-weight: 800;
  white-space: nowrap;
}
.wallet-button:hover { transform: translate(1px, 1px); box-shadow: 2px 2px 0 #050e09; }
.wallet-button.connected { background: #72cf75; border-color: #2e7a3a; }

.game-section {
  position: relative;
  color: var(--cream);
  background: var(--forest);
  border-bottom: 8px solid var(--sun);
  overflow: hidden;
}
.game-heading {
  position: absolute;
  left: max(24px, calc((100% - 1440px) / 2));
  top: 34px;
  z-index: 8;
  pointer-events: none;
  text-shadow: 3px 3px 0 var(--shadow);
}
.game-kicker {
  display: block;
  margin-bottom: 8px;
  color: #fff0b2;
  font-family: "Silkscreen", monospace;
  font-size: 12px;
}
.game-heading h1 {
  margin: 0;
  color: var(--sun);
  font-family: "Silkscreen", monospace;
  font-size: 72px;
  line-height: .92;
}
.game-heading p { margin: 10px 0 0; font-size: 18px; font-weight: 700; }
.game-stage {
  position: relative;
  width: 100%;
  height: calc(100svh - 68px);
  min-height: 620px;
  max-height: 860px;
  background: #69a84d;
  overflow: hidden;
}
#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  touch-action: none;
  outline: none;
}
#gameCanvas:focus-visible { box-shadow: inset 0 0 0 4px var(--sun); }
.hud {
  position: absolute;
  top: 28px;
  right: 24px;
  z-index: 7;
  display: grid;
  grid-template-columns: repeat(3, minmax(76px, auto));
  gap: 4px;
  color: var(--cream);
  filter: drop-shadow(3px 3px 0 rgba(4, 16, 9, .72));
}
.hud-stat {
  min-height: 52px;
  padding: 7px 11px;
  background: rgba(12, 37, 26, .94);
  border: 2px solid #5e8b64;
  display: flex;
  flex-direction: column;
}
.hud-stat span { color: #a9c8aa; font-size: 10px; }
.hud-stat b { color: var(--sun); font-family: "Silkscreen", monospace; font-size: 14px; }
.hud-wide { grid-column: 1 / -1; }
.hud-wide b { font-family: "Microsoft YaHei", sans-serif; font-size: 12px; color: var(--cream); }
.mission {
  position: absolute;
  left: 24px;
  bottom: 108px;
  z-index: 7;
  max-width: min(480px, calc(100% - 48px));
  padding: 10px 14px;
  color: #fff7d6;
  background: rgba(12, 37, 26, .94);
  border-left: 5px solid var(--sun);
  font-weight: 700;
  box-shadow: 3px 3px 0 rgba(4, 16, 9, .65);
}
.toast {
  position: absolute;
  left: 50%;
  top: 46%;
  z-index: 12;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  color: var(--forest-deep);
  background: var(--cream);
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 var(--shadow);
  font-weight: 800;
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toolbar {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 10;
  display: flex;
  gap: 6px;
  transform: translateX(-50%);
}
.tool, .action-button, .mobile-controls button {
  width: 58px;
  height: 58px;
  position: relative;
  display: grid;
  place-items: center;
  color: var(--cream);
  background: rgba(12, 37, 26, .95);
  border: 3px solid #5e8b64;
  box-shadow: 3px 3px 0 var(--shadow);
}
.tool span { font-size: 26px; line-height: 1; }
.tool small { position: absolute; right: 4px; bottom: 1px; color: #acc7ae; font-family: "Silkscreen", monospace; font-size: 9px; }
.tool:hover, .tool:focus-visible, .tool.active { border-color: var(--sun); color: var(--sun); }
.tool.active { background: #305b36; transform: translateY(-5px); }
.action-button { color: var(--forest-deep); background: var(--sun); border-color: #8a6017; font-family: "Silkscreen", monospace; font-weight: 700; font-size: 20px; }
.mobile-controls { display: none; }
.game-status {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 9px 24px;
  color: #d7e6d5;
  background: var(--forest-deep);
  font-size: 12px;
}
.game-status span { display: flex; align-items: center; gap: 8px; }
.game-status button { color: #b9cab9; background: transparent; border: 0; text-decoration: underline; }

.world-section {
  padding: 88px max(24px, calc((100% - 1180px) / 2));
  background: var(--paper);
}
.section-title { max-width: 780px; margin-bottom: 42px; }
.section-title > span, .bsc-copy > span { color: #7a5a19; font-family: "Silkscreen", monospace; font-size: 12px; }
.section-title h2, .bsc-copy h2 {
  margin: 10px 0 0;
  color: var(--forest);
  font-size: 42px;
  line-height: 1.2;
}
.world-grid { display: grid; grid-template-columns: repeat(3, 1fr); border: 3px solid var(--line); }
.world-grid article { min-width: 0; padding: 30px; background: #fff8df; border-right: 3px solid var(--line); }
.world-grid article:last-child { border-right: 0; }
.world-icon { font-size: 38px; }
.world-grid h3 { margin: 12px 0 8px; font-size: 24px; }
.world-grid p { margin: 0; color: #4f6254; line-height: 1.8; }

.bsc-section {
  display: grid;
  grid-template-columns: minmax(320px, .9fr) minmax(420px, 1.1fr);
  min-height: 580px;
  color: var(--cream);
  background: #21342c;
  border-top: 8px solid var(--wheat);
}
.bsc-art { min-height: 520px; overflow: hidden; background: #367936; }
.bsc-art img { width: 100%; height: 100%; display: block; object-fit: cover; image-rendering: pixelated; }
.bsc-copy { align-self: center; padding: 64px max(28px, calc((100vw - 1180px) / 2)); padding-left: 64px; }
.bsc-copy > span { color: var(--sun); }
.bsc-copy h2 { color: var(--sun); }
.bsc-copy > p { max-width: 650px; color: #d5e5d6; line-height: 1.9; }
.bsc-facts { margin-top: 28px; border-top: 2px solid #52755d; }
.bsc-facts div { display: flex; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 2px solid #52755d; }
.bsc-facts span { color: #9db39f; }
.bsc-facts b { color: var(--cream); text-align: right; }

footer {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 26px max(24px, calc((100% - 1180px) / 2));
  color: #bdd0bf;
  background: #07170f;
  border-top: 3px solid var(--sun);
}
footer a { text-decoration: none; }
footer p { margin: 0; }
footer span:last-child { margin-left: auto; }

@media (max-width: 900px) {
  .site-header { gap: 12px; padding-inline: 14px; }
  .main-nav { display: none; }
  .header-actions { margin-left: auto; }
  .chain-badge { display: none; }
  .game-heading { left: 18px; top: 20px; }
  .game-heading h1 { font-size: 46px; }
  .game-heading p { font-size: 15px; }
  .game-stage { min-height: 680px; height: calc(100svh - 68px); }
  .hud { top: 122px; left: 16px; right: auto; grid-template-columns: repeat(3, minmax(64px, auto)); }
  .hud-stat { min-height: 46px; padding: 5px 8px; }
  .hud-stat b { font-size: 12px; }
  .mission { bottom: 176px; left: 16px; }
  .toolbar { bottom: 18px; gap: 4px; }
  .tool, .action-button { width: 46px; height: 46px; }
  .tool span { font-size: 21px; }
  .mobile-controls {
    position: absolute;
    left: 16px;
    bottom: 76px;
    z-index: 11;
    display: grid;
    grid-template-columns: repeat(3, 42px);
    grid-template-rows: repeat(2, 42px);
    gap: 4px;
  }
  .mobile-controls button { width: 42px; height: 42px; }
  .mobile-controls button:nth-child(1) { grid-column: 2; }
  .mobile-controls button:nth-child(2) { grid-column: 1; grid-row: 2; }
  .mobile-controls button:nth-child(3) { grid-column: 2; grid-row: 2; }
  .mobile-controls button:nth-child(4) { grid-column: 3; grid-row: 2; }
  .world-section { padding-block: 64px; }
  .world-grid { grid-template-columns: 1fr; }
  .world-grid article { border-right: 0; border-bottom: 3px solid var(--line); }
  .world-grid article:last-child { border-bottom: 0; }
  .bsc-section { grid-template-columns: 1fr; }
  .bsc-art { min-height: 420px; max-height: 560px; }
  .bsc-copy { padding: 52px 24px; }
}

@media (max-width: 560px) {
  .brand span { font-size: 14px; }
  .brand img { width: 38px; height: 38px; }
  .wallet-button { padding-inline: 10px; font-size: 13px; }
  .game-heading h1 { font-size: 38px; }
  .game-kicker { font-size: 9px; }
  .game-stage { min-height: 700px; }
  .hud { top: 108px; max-width: calc(100% - 32px); }
  .hud-wide { overflow: hidden; }
  .hud-wide b { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; max-width: 270px; }
  .mission { bottom: 172px; font-size: 13px; }
  .toolbar { left: auto; right: 12px; transform: none; flex-wrap: wrap; width: 150px; justify-content: flex-end; }
  .tool, .action-button { width: 44px; height: 44px; }
  .game-status { justify-content: space-between; gap: 8px; padding-inline: 12px; }
  .game-status span:first-child { display: none; }
  .section-title h2, .bsc-copy h2 { font-size: 32px; }
  .bsc-art { min-height: 360px; }
  footer { align-items: flex-start; flex-direction: column; gap: 8px; }
  footer span:last-child { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
