:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  background: #10221f;
  color: #fcf4d6;
  --muted: #bbcbb9;
  --gold: #ffe17d;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse at top, #2a4638, #10221f 68%); }
main { width: min(100%, 1060px); margin: auto; padding: 20px clamp(10px, 3vw, 28px); }
header, .under { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { margin: 0 0 10px; font-family: Georgia, serif; font-size: clamp(1.5rem, 4vw, 2.5rem); letter-spacing: -.035em; }
h1 span { color: var(--gold); font-size: .64em; vertical-align: 12%; }
header p { margin: 0 0 8px; color: #e2edc9; text-align: right; font-size: .95rem; font-variant-numeric: tabular-nums; }
.stage { position: relative; overflow: hidden; border: 1px solid #8ca67b; border-radius: 17px; background: #34503a; box-shadow: 0 14px 36px #0a191b99; }
canvas { width: 100%; height: auto; display: block; touch-action: none; }
canvas:focus-visible { outline: 2px solid var(--gold); outline-offset: -3px; }

#overlay { position: absolute; inset: 0; display: grid; place-items: center; background: #10241bab; padding: 12px; }
[hidden] { display: none !important; }
form { display: grid; gap: 12px; width: min(100%, 340px); padding: 22px; border: 1px solid #718e67; border-radius: 14px; background: linear-gradient(150deg, #29463a, #172e28); box-shadow: 0 14px 50px #0a191baa; }
h2 { margin: 0; font: bold 1.6rem Georgia, serif; }
label { display: grid; gap: 5px; color: var(--muted); font-size: .94rem; }
input, button, select { font: inherit; border-radius: 8px; min-height: 44px; }
input, select { border: 1px solid #75937b; padding: 8px 10px; background: #152e25; color: #fff9e8; }
input { width: 100%; }
button { border: 1px solid transparent; background: var(--gold); color: #2e2d1a; font-weight: bold; padding: 7px 16px; cursor: pointer; }
button:disabled { opacity: .65; cursor: wait; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
button:active, button[aria-pressed="true"] { background: #a9edc3; }
#error { color: #ffb99d; font-size: .9rem; margin: 0; }

#banner { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 24px); text-align: center; width: max-content; padding: 6px 13px; border-radius: 10px; background: #152e25ef; font-weight: bold; pointer-events: none; }
#touch { gap: 10px; justify-content: flex-end; margin-block: 8px 2px; }
#touch button { min-width: 0; min-height: 50px; touch-action: none; user-select: none; }
#block { background: #bfdcc4; }
#block[aria-pressed="true"] { background: #fff8ae; }
#throw { background: #9aebe0; }
#throw:disabled { cursor: default; }
#duck { background: #dfc9ff; }
#duck[aria-pressed="true"] { background: #fff8ae; }
#loadout { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; padding: 9px 12px; border: 1px solid #75937b66; border-radius: 12px; background: #142b25; }
#style-description, #pickup-hint { margin: 0; color: var(--muted); font-size: .9rem; }
#ammo { margin-left: auto; color: #9aebe0; font-weight: bold; white-space: nowrap; }
.under { color: var(--muted); font-size: .9rem; }
.under p { margin: 10px 0; }
.under span { margin: 0 .32em; }
kbd { display: inline-block; padding: 1px 4px; margin-right: 2px; border: 1px solid #75937b; border-radius: 4px; color: #fff8df; }
.gesture { display: none; }
#players { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
#players li { border: 1px solid #75937b; border-radius: 14px; padding: 3px 10px; font-size: .88rem; }
body.touch #touch:not([hidden]) { display: flex; }
body.touch .keyboard { display: none; }
body.touch .gesture { display: block; }
@media (max-width: 580px) {
  body.touch #touch:not([hidden]) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(100%, 300px);
    margin-left: auto;
  }
  #style-description { order: 1; width: 100%; }
  .stage:has(#overlay:not([hidden])) { min-height: 345px; }
  .stage:has(#overlay:not([hidden])) canvas { min-height: 345px; object-fit: cover; }
  .under { align-items: flex-start; }
  .keyboard { line-height: 1.8; }
}
