/* Layout: a wide 16:9 court; touch buttons sit under it in portrait and over its corners in landscape. One night-and-gold look, the same world as Zecky Shield Run. */
:root {
  --night: #0d0d12;
  --gold: #d6b062;
  --gold-hi: #f1d79a;
  --ink: #f2eee6;
  --muted: #a39d92;
  --line: #2c2934;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
html, body { height: 100%; margin: 0; }
[hidden] { display: none !important; }
body {
  background: var(--night); color: var(--ink); font-family: var(--ui);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: max(10px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(10px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  box-sizing: border-box; overflow: hidden;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: none;
}
#wrap { position: relative; display: flex; flex-direction: column; align-items: center; gap: 14px; width: min(100%, calc((100vh - 64px) * 16 / 9)); width: min(100%, calc((100dvh - 64px) * 16 / 9)); }
#stage {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  border-radius: 18px; overflow: hidden;
  box-shadow: 0 0 0 1px var(--line), 0 30px 80px rgba(0,0,0,.6);
}
canvas { display: block; width: 100%; height: 100%; }
#pad { display: flex; justify-content: space-between; width: 100%; gap: 12px; }
#pad .grp { display: flex; gap: 12px; }
.key {
  width: 76px; height: 76px; border-radius: 50%; border: 1.5px solid var(--gold);
  background: rgba(214,176,98,.12); color: var(--gold-hi); font: 600 13px/1 var(--ui);
  display: grid; place-items: center; touch-action: none; cursor: pointer; padding: 0;
}
.key.big { background: var(--gold); color: var(--night); }
.key.on { background: var(--gold-hi); color: var(--night); transform: scale(.94); }
.key svg { width: 26px; height: 26px; }
.snd { position: absolute; top: 8px; right: 8px; z-index: 2; font: 600 11px/1 var(--ui); padding: 7px 10px; border-radius: 999px; border: 1px solid var(--line); background: rgba(13,13,18,.72); color: var(--gold-hi); cursor: pointer; touch-action: manipulation; }
.snd[aria-pressed="false"] { color: var(--muted); }
.snd:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.keys { display: none; font-size: 12px; color: var(--muted); margin: 0; text-align: center; }
.keys kbd { font: 600 11px/1 var(--ui); color: var(--gold-hi); border: 1px solid var(--line); border-radius: 5px; padding: 2px 5px; }
@media (orientation: landscape) and (max-height: 540px) {
  #wrap { width: min(100%, calc((100vh - 22px) * 16 / 9)); width: min(100%, calc((100dvh - 22px) * 16 / 9)); }
  #pad { position: absolute; left: 0; right: 0; bottom: 8px; padding: 0 10px; box-sizing: border-box; pointer-events: none; }
  .key { pointer-events: auto; width: 64px; height: 64px; opacity: .78; }
  .caption { display: none; }
}
@media (hover: hover) and (pointer: fine) { #pad { display: none; } .keys { display: block; } }
.panel {
  position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center;
  padding: 22px 18px 16px; box-sizing: border-box; gap: 10px;
  background: rgba(13,13,18,.95); overflow-y: auto; touch-action: pan-y;
}
.panel h1 { font: 600 40px/1 var(--display); margin: 4px 0 0; text-wrap: balance; text-align: center; }
.panel .kicker { font: italic 600 20px/1 var(--display); color: var(--gold); margin: 0; }
.panel p { margin: 0; font-size: 14px; line-height: 1.45; color: var(--muted); text-align: center; max-width: 44ch; }
.panel .sponsor { font-size: 12px; letter-spacing: .04em; margin-top: auto; }
.panel .sponsor b { color: var(--gold); font-weight: 600; }
#teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 8px; width: 100%; max-width: 820px; margin-top: 4px; }
.team {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; text-align: left;
  padding: 9px 12px; border-radius: 14px; border: 1px solid var(--line);
  background: rgba(255,255,255,.03); color: var(--ink); font: inherit; cursor: pointer;
}
.team:hover { border-color: var(--gold); }
.team:focus-visible, .btn:focus-visible, .key:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.team .dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font: 800 15px/1 var(--ui); color: rgba(0,0,0,.6); }
.team .nm { font: 600 15px/1.2 var(--ui); }
.team .ds { font-size: 12px; line-height: 1.35; color: var(--muted); }
.team .won { font-size: 11px; color: var(--gold); white-space: nowrap; }
.levels { display: flex; gap: 6px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; }
.lvl { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 14px; border-radius: 999px; border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; }
.lvl b { font: 600 13px/1 var(--ui); color: var(--ink); }
.lvl span { font-size: 10.5px; line-height: 1; letter-spacing: .04em; }
.lvl[aria-pressed="true"] { background: var(--gold); }
.lvl[aria-pressed="true"] b, .lvl[aria-pressed="true"] span { color: var(--night); }
.lvl:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.btn { font: 600 14px/1 var(--ui); padding: 12px 18px; border-radius: 999px; border: 1px solid var(--gold); color: var(--night); background: var(--gold); cursor: pointer; }
.btn.ghost { background: rgba(13,13,18,.6); color: var(--gold-hi); }
#over { justify-content: center; }
#copyOut { font-size: 13px; color: var(--gold-hi); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; -webkit-user-select: text; user-select: text; }
.caption { font-size: 12px; letter-spacing: .04em; color: var(--muted); text-align: center; margin: 0; }
.caption b { color: var(--gold); font-weight: 600; }
