:root {
  color-scheme: dark;
  font: 15px/1.35 system-ui, sans-serif;
  color: #f0eee1;
  background: #101711;
}
* { box-sizing: border-box; }
body { margin: 0; }
.game {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100dvh;
  min-height: 420px;
  width: min(100%, 840px);
  margin: auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.header, .dock { background: #1b261e; padding: 9px 12px; }
.header, .match-controls, .command-row, .commands { display: flex; align-items: center; gap: 6px; }
.header { justify-content: space-between; gap: 12px; }
h1, h2, p { margin: 0; }
h1 { font: 700 clamp(21px, 4.2vw, 29px)/1.15 Georgia, serif; }
.eyebrow { color: #f0cc89; font-size: 12px; font-weight: 700; }
.eyebrow span { margin-left: 5px; color: #c4d5c5; font-weight: 500; }
button {
  min-height: 36px;
  border: 1px solid #526355;
  border-radius: 6px;
  background: #28382c;
  color: inherit;
  font: 600 12px/1.15 system-ui, sans-serif;
  padding: 5px 8px;
  touch-action: manipulation;
  cursor: pointer;
}
button:disabled { opacity: .55; cursor: default; }
button[aria-pressed="true"] { background: #3d4e36; border-color: #f0cc89; box-shadow: inset 0 0 0 1px #f0cc89; }
button:focus-visible { outline: 2px solid #fff2ca; outline-offset: 2px; }
.battle { position: relative; min-height: 0; background: #334734; overflow: hidden; }
canvas { display: block; width: 100%; height: 100%; touch-action: manipulation; }
.match-hud { position: absolute; top: 8px; inset-inline: 10px; display: flex; justify-content: space-between; pointer-events: none; }
.match-hud > * { border-radius: 4px; padding: 4px 7px; background: #101710e8; font-size: 12px; font-variant-numeric: tabular-nums; }
.intro {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(calc(100% - 30px), 320px);
  padding: 18px;
  border: 1px solid #a78755;
  border-radius: 10px;
  background: #19231beF;
  box-shadow: 0 8px 32px #0009;
  text-align: center;
}
.intro h2 { font: 700 24px/1.15 Georgia, serif; }
.intro p { margin: 8px 0 12px; color: #d5ddce; }
.intro button { color: #1f2318; background: #ebc780; border-color: #f5dba4; padding-inline: 16px; }
.dock { display: grid; gap: 6px; }
.command-row { flex-wrap: wrap; }
.resource {
  color: #f0cc89;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.command-row .commands { margin-left: auto; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.card {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 41px) auto;
  min-height: 64px;
  align-items: center;
  justify-items: center;
  padding: 0 2px 3px;
  overflow: hidden;
}
.card img { height: 100%; max-width: 100%; object-fit: contain; pointer-events: none; }
.card .price { position: absolute; left: 4px; top: 4px; padding: 2px 4px; border-radius: 4px; background: #142d46; }
.card .timer { position: absolute; top: 4px; right: 4px; color: #ffdda0; }
.card span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
#status { min-height: 1.35em; color: #c8d6c8; font-size: 12px; }
[hidden] { display: none !important; }
@media (max-width: 370px) {
  .header, .dock { padding-inline: 7px; }
  .command-row, .commands { gap: 4px; }
  .command-row button { padding-inline: 5px; }
}
