:root {
  color: #172033;
  background: #f6f8ef;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  line-height: 1.6;
  letter-spacing: 0;
  --ink: #172033;
  --muted: #5b6678;
  --panel: #fffdf4;
  --paper: #ffffff;
  --line: #d9e0d2;
  --mint: #12b886;
  --blue: #3b82f6;
  --gold: #f5b84b;
  --coral: #f76767;
  --violet: #7c3aed;
  --shadow: 0 18px 44px rgba(23, 32, 51, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(18, 184, 134, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(59, 130, 246, 0.07) 1px, transparent 1px),
    linear-gradient(135deg, #f6f8ef 0%, #eff7f8 48%, #fff6ea 100%);
  background-size: 34px 34px, 34px 34px, auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

h1,
h2,
h3,
strong,
b {
  font-weight: 600;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  padding: 12px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid rgba(216, 223, 207, 0.9);
  background: rgba(255, 253, 244, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid #172033;
  border-radius: 8px;
  background: var(--mint);
  box-shadow: 4px 4px 0 var(--gold);
}

.brand-mark span {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  background: #fffdf4;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.top-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.top-link {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  background: #fff;
  color: #3f4b5f;
  font-size: 14px;
  font-weight: 600;
}

.layout {
  width: min(1280px, calc(100% - 24px));
  margin: 0 auto;
  padding: 22px 0 44px;
}

.game-hero {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(320px, 1.28fr);
  gap: 16px;
  align-items: stretch;
}

.intro-panel,
.game-panel,
.copy-section {
  border: 1px solid rgba(23, 32, 51, 0.12);
  border-radius: 8px;
  background: rgba(255, 253, 244, 0.9);
  box-shadow: var(--shadow);
}

.intro-panel {
  padding: clamp(16px, 2.4vw, 26px);
}

.hero-title {
  margin: 0;
  color: #172033;
  font-size: clamp(30px, 4.4vw, 54px);
  line-height: 1.06;
}

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

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: #fff;
  color: #3f4b5f;
  font-size: 12px;
  font-weight: 700;
}

.game-panel {
  min-width: 0;
  padding: clamp(12px, 2vw, 18px);
}

.game-root {
  min-height: 560px;
}

.qf-game {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(210px, 0.42fr);
  gap: 14px;
  min-width: 0;
}

.play-zone {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 2px solid #172033;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 6px 6px 0 rgba(245, 184, 75, 0.9);
  touch-action: none;
}

.game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.status-line {
  min-height: 26px;
  color: #3f4b5f;
  font-size: 14px;
  font-weight: 600;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

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

.stat {
  min-height: 66px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stat strong {
  display: block;
  margin-top: 3px;
  font-size: 22px;
  line-height: 1.05;
}

.control-row,
.palette-row,
.pad-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.game-button {
  min-height: 38px;
  border: 1px solid #172033;
  border-radius: 8px;
  padding: 8px 11px;
  background: #fff;
  color: #172033;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 3px 3px 0 rgba(23, 32, 51, 0.12);
}

.game-button.primary {
  background: var(--mint);
  color: #fff;
}

.game-button.active {
  background: var(--gold);
}

.palette-button {
  width: 34px;
  height: 34px;
  border: 2px solid #172033;
  border-radius: 8px;
  box-shadow: 2px 2px 0 rgba(23, 32, 51, 0.12);
}

.pad-grid {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  gap: 7px;
  width: max-content;
}

.pad-grid .game-button {
  width: 42px;
  height: 38px;
  min-height: 38px;
  padding: 0;
}

.pad-grid .blank {
  visibility: hidden;
}

.copy-section {
  margin-top: 16px;
  padding: clamp(18px, 3vw, 30px);
  background: rgba(255, 255, 255, 0.88);
}

.copy-section h2 {
  margin: 0 0 10px;
  font-size: clamp(22px, 3vw, 32px);
}

.copy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.copy-item {
  border-left: 4px solid var(--mint);
  padding: 6px 0 6px 12px;
}

.copy-item h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.copy-item p,
.copy-section p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 940px) {
  .game-hero,
  .qf-game,
  .copy-grid {
    grid-template-columns: 1fr;
  }

  .game-root {
    min-height: auto;
  }

  .side-panel {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .layout {
    width: min(100% - 18px, 1280px);
    padding-top: 14px;
  }

  .hero-title {
    font-size: clamp(28px, 11vw, 42px);
  }

  .game-panel {
    padding: 10px;
  }

  .canvas-wrap {
    box-shadow: 4px 4px 0 rgba(245, 184, 75, 0.9);
  }

  .stat strong {
    font-size: 20px;
  }

  .top-link,
  .game-button {
    font-size: 13px;
  }
}
