.clanker-page {
  background: var(--bg);
}

.clanker-content {
  padding: 18px 18px 56px 0;
}

.clanker-document {
  display: grid;
  width: min(1480px, 100%);
  padding: 0;
  gap: 14px;
}

.clanker-header {
  padding: 16px 18px;
  border: 1px solid var(--hairline);
  background: var(--panel);
}

.clanker-kicker,
.game-topbar__label,
.eyebrow,
.hud__label,
.game-footer,
.stats-strip,
.result-grid,
.bank-line,
.microcopy {
  font-family: "Courier New", Courier, monospace;
}

.clanker-kicker {
  margin: 0 0 8px;
  color: #77736a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.clanker-header__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  align-items: center;
  gap: clamp(16px, 4vw, 44px);
}

.clanker-header h1 {
  max-width: none;
  margin: 0 0 6px;
  color: var(--ink);
  font-size: clamp(42px, 5.2vw, 74px);
  line-height: 0.96;
  letter-spacing: 0;
}

.clanker-subhead {
  max-width: 760px;
  margin: 0;
  color: #5c5a54;
  font-size: clamp(16px, 1.35vw, 21px);
  line-height: 1.32;
}

.clanker-note {
  display: grid;
  padding: 12px;
  border: 1px solid #d7d3c8;
  background: #f4f2ea;
  gap: 7px;
  font-family: "Courier New", Courier, monospace;
}

.clanker-note strong {
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.clanker-note span {
  color: #68645c;
  font-size: 12px;
  line-height: 1.35;
}

.game-module {
  --game-bg: #08090b;
  --game-panel: rgba(16, 18, 22, 0.93);
  --game-panel-strong: rgba(20, 22, 28, 0.97);
  --game-line: rgba(255, 255, 255, 0.13);
  --game-line-strong: rgba(255, 255, 255, 0.24);
  --game-text: #f6f7f8;
  --game-muted: #a1a7b3;
  --game-muted-2: #727a87;
  --game-green: #35f59f;
  --game-yellow: #f7c948;
  --game-red: #ff4d5d;
  --game-cyan: #64d9ff;
  --game-violet: #a78bfa;
  overflow: hidden;
  border: 1px solid #11100d;
  background: #10100f;
  box-shadow: 1px 1px 0 #11100d;
}

.game-topbar {
  display: flex;
  min-height: 48px;
  padding: 7px 10px 7px 14px;
  border-bottom: 1px solid #11100d;
  color: var(--ink);
  background: #f6efd9;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.game-topbar > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.game-topbar__label {
  color: #77736a;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-topbar strong {
  overflow: hidden;
  color: #292928;
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-frame {
  position: relative;
  width: 100%;
  height: clamp(500px, 43vw, 650px);
  min-height: 0;
  overflow: hidden;
  background: #07080b;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
  touch-action: manipulation;
}

.game-module :focus-visible {
  outline: 2px solid var(--game-green);
  outline-offset: 3px;
}

.hud {
  position: absolute;
  z-index: 5;
  top: 14px;
  left: 14px;
  right: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  pointer-events: none;
}

.hud__cluster {
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 9, 11, 0.64);
  backdrop-filter: blur(14px);
}

.hud__label {
  display: block;
  margin-bottom: 3px;
  color: var(--game-muted);
  font-size: clamp(9px, 1.5vw, 11px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-transform: uppercase;
}

.hud strong {
  display: block;
  overflow: hidden;
  color: var(--game-text);
  font-variant-numeric: tabular-nums;
  font-size: clamp(16px, 2.5vw, 23px);
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.incident-feed {
  position: absolute;
  z-index: 7;
  top: 92px;
  left: 16px;
  max-width: min(420px, calc(100% - 32px));
  color: var(--game-red);
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(255, 77, 93, 0.45);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.incident-feed.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.overlay {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--game-text);
  background: rgba(5, 6, 8, 0.58);
  backdrop-filter: blur(10px);
}

.overlay--active {
  display: flex;
}

.panel {
  width: min(520px, 100%);
  padding: clamp(18px, 2.4vw, 26px);
  border: 1px solid var(--game-line-strong);
  background: var(--game-panel-strong);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

.panel--intro {
  width: min(620px, 100%);
}

.panel--upgrades {
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 70px));
  overflow-y: auto;
}

.panel__header,
.button-row,
.upgrade-row,
.upgrade-row__controls,
.stats-strip,
.game-footer {
  display: flex;
  align-items: center;
}

.panel__header {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--game-green);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.panel h2,
.panel h3,
.panel p {
  margin-top: 0;
}

.panel h2 {
  margin-bottom: 14px;
  font-size: clamp(32px, 4.2vw, 52px);
  line-height: 0.95;
  letter-spacing: 0;
}

.panel h3 {
  margin-bottom: 6px;
  font-size: 16px;
  line-height: 1.2;
}

.lede {
  max-width: 46rem;
  margin-bottom: 18px;
  color: #d8dbe1;
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.45;
}

.microcopy,
.bank-line,
.upgrade-row p {
  color: var(--game-muted);
  line-height: 1.45;
}

.microcopy {
  margin: 16px 0 0;
  font-size: 13px;
}

.stats-strip {
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.stats-strip span,
.result-grid span {
  border: 1px solid var(--game-line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--game-muted);
}

.stats-strip span {
  padding: 9px 11px;
  font-size: 13px;
}

.stats-strip b,
.result-grid b,
.bank-line span {
  color: var(--game-text);
  font-variant-numeric: tabular-nums;
}

.button-row {
  flex-wrap: wrap;
  gap: 10px;
}

.primary-action,
.secondary-action,
.buy-button,
.icon-action,
.pause-action {
  min-height: var(--touch-target);
  border: 1px solid transparent;
  border-radius: 0;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.primary-action,
.secondary-action,
.buy-button,
.pause-action {
  padding: 0 14px;
}

.primary-action {
  background: var(--game-text);
  color: #07080a;
}

.secondary-action,
.icon-action {
  border-color: var(--game-line-strong);
  color: var(--game-text);
  background: rgba(255, 255, 255, 0.05);
}

.pause-action {
  flex: 0 0 auto;
  border-color: #11100d;
  color: #11100d;
  background: #fff;
}

.pause-action:disabled {
  display: none;
  cursor: not-allowed;
  color: #9c988c;
  background: #ebe7d9;
}

.buy-button {
  min-width: 84px;
  border-color: rgba(53, 245, 159, 0.34);
  color: var(--game-green);
  background: rgba(53, 245, 159, 0.13);
}

.buy-button:disabled {
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.09);
  color: var(--game-muted-2);
  background: rgba(255, 255, 255, 0.04);
}

.primary-action:hover,
.secondary-action:hover,
.buy-button:not(:disabled):hover,
.icon-action:hover,
.pause-action:not(:disabled):hover {
  transform: translate(1px, 1px);
  border-color: rgba(255, 255, 255, 0.34);
}

.icon-action {
  display: grid;
  width: var(--touch-target);
  min-width: var(--touch-target);
  padding: 0;
  place-items: center;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.result-grid span {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  font-size: 12px;
}

.result-grid b {
  overflow: hidden;
  font-size: 22px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upgrade-list {
  display: grid;
  gap: 10px;
}

.upgrade-row {
  justify-content: space-between;
  gap: 18px;
  padding: 14px;
  border: 1px solid var(--game-line);
  background: rgba(255, 255, 255, 0.035);
}

.upgrade-row p {
  margin-bottom: 0;
  font-size: 13px;
}

.upgrade-row__controls {
  flex: 0 0 auto;
  gap: 10px;
}

.upgrade-row__controls span {
  min-width: 48px;
  color: var(--game-cyan);
  font-family: "Courier New", Courier, monospace;
  font-weight: 700;
  text-align: right;
}

.game-footer {
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  padding: 8px 14px;
  border-top: 1px solid #11100d;
  color: #5e5c57;
  background: #f7f7f4;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 1023px) {
  .clanker-content {
    padding: 14px 8px 40px;
  }

  .clanker-document {
    width: 100%;
  }
}

@media (max-width: 820px) {
  .clanker-header__grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .clanker-header h1 {
    font-size: clamp(36px, 10vw, 52px);
  }

  .clanker-subhead {
    font-size: 16px;
  }

  .game-frame {
    height: min(620px, calc(100vh - 260px));
    min-height: 500px;
  }

  .hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    top: 10px;
    left: 10px;
    right: 10px;
  }

  .incident-feed {
    top: 126px;
    left: 12px;
    font-size: 11px;
  }

  .overlay {
    padding: 12px;
  }

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

  .upgrade-row {
    display: grid;
  }

  .upgrade-row__controls {
    justify-content: space-between;
  }
}

@media (max-width: 520px) {
  .clanker-header {
    padding: 12px 14px;
  }

  .clanker-kicker {
    margin-bottom: 6px;
    font-size: 10px;
  }

  .clanker-header h1 {
    margin-bottom: 5px;
    font-size: clamp(32px, 9.4vw, 42px);
  }

  .clanker-subhead {
    font-size: 15px;
    line-height: 1.28;
  }

  .clanker-note {
    padding: 9px 10px;
  }

  .clanker-note span {
    display: none;
  }

  .game-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .game-frame {
    height: 580px;
    min-height: 580px;
  }

  .panel {
    padding: 18px;
  }

  .panel h2 {
    font-size: 34px;
  }

  .pause-action {
    width: 100%;
  }

  .game-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}
