/*
  Planet Wars (星球争霸): the planet fills the window under the site bar. Resources and the
  clock sit top right, messages top left, and a console along the bottom holds the minimap,
  the selection and the command card. Cold steel glass with cyan and amber lights.
*/

html,
body {
  height: 100%;
}

body.pw-body {
  margin: 0;
  overflow: hidden;
  background: #05070d;
  color: #e6edf5;
  font-family: var(--gh-font-body);
  overscroll-behavior: none;
}

.pw-stage {
  --pw-glass: rgba(10, 16, 26, 0.82);
  --pw-glass-hi: rgba(22, 34, 52, 0.9);
  --pw-line: rgba(140, 200, 255, 0.18);
  --pw-line-hi: rgba(140, 220, 255, 0.45);
  --pw-cyan: #6fe0ff;
  --pw-amber: #ffbe3b;
  --pw-red: #ff5a4a;
  --pw-green: #5dff9a;
  --pw-dim: #93a4b8;
  position: fixed;
  inset: 56px 0 0;
  user-select: none;
  -webkit-user-select: none;
}

.pw-stage *,
.pw-stage *::before,
.pw-stage *::after {
  box-sizing: border-box;
}

#pwCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
}

.pw-stage.is-paused #pwCanvas {
  filter: saturate(0.55) brightness(0.8);
}

body.pw-gallery .pw-stage {
  inset: 0;
}

body.pw-gallery .gh-bar,
body.pw-gallery .pw-menu,
body.pw-gallery .pw-loading {
  display: none;
}

.pw-gallery-label {
  position: fixed;
  left: 0;
  top: 0;
  font: 600 12px/1.2 system-ui, sans-serif;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  white-space: nowrap;
}

/* ---------- glass ---------- */

.pw-top > *,
.pw-panel,
.pw-tip,
.pw-menu-card,
.pw-sheet-card {
  border: 1px solid var(--pw-line);
  background: var(--pw-glass);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(170, 220, 255, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.pw-box {
  position: absolute;
  left: 0;
  top: 0;
  border: 1px solid var(--pw-green);
  background: rgba(93, 255, 154, 0.08);
  pointer-events: none;
  z-index: 4;
}

.pw-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.pw-hud > * {
  pointer-events: auto;
}

/* ---------- top: resources and time ---------- */

.pw-top {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.pw-res,
.pw-time {
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 10px;
  padding: 4px 6px;
}

.pw-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 5px;
  border-radius: 7px;
  font: 700 15px/1 var(--gh-font-display);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  min-width: 78px;
}

.pw-chip.is-warn b {
  color: var(--pw-red);
  animation: pw-blink 0.8s steps(2) infinite;
}

@keyframes pw-blink {
  50% { opacity: 0.45; }
}

.pw-ico {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: none;
  vertical-align: -3px;
}

.pw-ico-crystal {
  background: linear-gradient(135deg, #e0fbff, #4fd2ff 55%, #1d7fb8);
  clip-path: polygon(50% 0, 92% 32%, 72% 100%, 28% 100%, 8% 32%);
  filter: drop-shadow(0 0 4px rgba(111, 224, 255, 0.8));
}

.pw-ico-gas {
  background: radial-gradient(circle at 40% 35%, #eaffc8, #8eff4a 45%, #2f8a1a);
  border-radius: 50% 50% 46% 46%;
  filter: drop-shadow(0 0 4px rgba(140, 255, 90, 0.7));
}

.pw-ico-supply {
  background: linear-gradient(180deg, #ffe4a0, #ffb02e);
  clip-path: polygon(0 100%, 0 40%, 30% 40%, 30% 0, 70% 0, 70% 40%, 100% 40%, 100% 100%);
}

.pw-time time {
  font: 700 15px/1 var(--gh-font-display);
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: center;
  color: var(--pw-cyan);
}

.pw-tb {
  display: grid;
  place-items: center;
  width: 32px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #dbe7f3;
  font: 700 13px/1 system-ui;
  cursor: pointer;
}

.pw-tb:hover {
  background: rgba(140, 200, 255, 0.14);
}

.pw-tb svg {
  width: 20px;
  height: 20px;
}

.pw-tb .pw-i-play {
  display: none;
}

.pw-tb[aria-pressed="true"] .pw-i-play {
  display: block;
}

.pw-tb[aria-pressed="true"] .pw-i-pause {
  display: none;
}

/* ---------- hints and message feed ---------- */

.pw-left {
  position: absolute;
  top: 10px;
  left: 10px;
  display: grid;
  gap: 8px;
  justify-items: start;
  max-width: min(460px, 60vw);
  pointer-events: none;
}

.pw-objective {
  position: relative;
  width: 300px;
  padding: 10px 34px 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 190, 59, 0.35);
  background: linear-gradient(180deg, rgba(40, 32, 12, 0.85), rgba(14, 12, 8, 0.85));
  box-shadow: 0 12px 30px -16px rgba(0, 0, 0, 0.9);
  pointer-events: auto;
}

.pw-objective[hidden] {
  display: none;
}

.pw-objective small {
  display: block;
  color: var(--pw-amber);
  font: 700 11px/1 var(--gh-font-body);
  letter-spacing: 0.14em;
}

.pw-objective b {
  display: block;
  margin-top: 5px;
  font: 700 17px/1.2 var(--gh-font-display);
}

.pw-objective p {
  margin: 4px 0 0;
  color: #d8cfb8;
  font-size: 13px;
  line-height: 1.45;
}

.pw-objective .pw-x {
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  font-size: 16px;
}

.pw-feed {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
  pointer-events: none;
}

.pw-msg {
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(8, 12, 20, 0.72);
  border-left: 3px solid var(--pw-cyan);
  font-size: 14px;
  line-height: 1.35;
  text-shadow: 0 1px 2px #000;
  transition: opacity 0.9s ease, transform 0.9s ease;
  animation: pw-in 0.25s ease-out;
}

@keyframes pw-in {
  from { opacity: 0; transform: translateX(-12px); }
}

.pw-msg.is-old {
  opacity: 0;
  transform: translateX(-8px);
}

.pw-msg-alert { border-left-color: var(--pw-red); color: #ffd6d0; font-weight: 700; }
.pw-msg-error { border-left-color: var(--pw-amber); color: #ffe6b0; }
.pw-msg-warn { border-left-color: var(--pw-amber); }
.pw-msg-ok { border-left-color: var(--pw-green); }
.pw-msg-tip { border-left-color: #b48cff; color: #e8dcff; }

/* ---------- the console ---------- */

.pw-panel {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  width: min(1180px, calc(100% - 16px));
  height: 196px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  padding: 8px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(30, 46, 68, 0.55), rgba(8, 12, 20, 0.9)),
    var(--pw-glass);
}

.pw-mini {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 6px;
}

#pwMini {
  width: 300px;
  height: 150px;
  border-radius: 8px;
  border: 1px solid var(--pw-line-hi);
  background: #000;
  image-rendering: pixelated;
  cursor: pointer;
}

.pw-mini-tools {
  display: flex;
  gap: 4px;
}

.pw-mt {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 26px;
  border: 1px solid var(--pw-line);
  border-radius: 7px;
  background: rgba(20, 30, 46, 0.8);
  color: #cfe0f0;
  font: 700 12px/1 system-ui;
  cursor: pointer;
}

.pw-mt:hover {
  border-color: var(--pw-line-hi);
  background: rgba(40, 60, 90, 0.8);
}

.pw-mt svg {
  width: 16px;
  height: 16px;
}

.pw-mt.is-hot {
  color: var(--pw-amber);
  border-color: rgba(255, 190, 59, 0.6);
  animation: pw-glow 1.4s ease-in-out infinite;
}

@keyframes pw-glow {
  50% { box-shadow: 0 0 10px rgba(255, 190, 59, 0.5); }
}

.pw-sel {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  border-radius: 10px;
  background: rgba(4, 8, 14, 0.45);
  border: 1px solid rgba(140, 200, 255, 0.08);
  overflow: hidden;
}

.pw-groups {
  display: flex;
  gap: 4px;
  padding: 4px 6px 0;
  min-height: 4px;
}

.pw-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 24px;
  padding: 0 6px 0 2px;
  border: 1px solid var(--pw-line);
  border-radius: 6px;
  background: rgba(20, 30, 46, 0.9);
  color: #dbe7f3;
  font: 700 11px/1 system-ui;
  cursor: pointer;
}

.pw-group img {
  width: 20px;
  height: 20px;
}

.pw-group kbd,
.pw-cmd kbd,
.pw-tip kbd {
  font: 700 10px/1 system-ui;
  color: var(--pw-amber);
}

.pw-sel-body {
  padding: 8px 10px;
  overflow: hidden;
}

.pw-sel-empty b {
  font: 700 18px/1.2 var(--gh-font-display);
  color: var(--pw-cyan);
}

.pw-sel-empty p {
  margin: 6px 0 0;
  color: var(--pw-dim);
  font-size: 13px;
}

.pw-one {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  align-items: start;
}

.pw-portrait {
  width: 112px;
  height: 112px;
  border-radius: 10px;
  border: 1px solid var(--pw-line-hi);
  background:
    radial-gradient(circle at 50% 70%, color-mix(in srgb, var(--c, #3d8bff) 35%, transparent), transparent 70%),
    linear-gradient(180deg, #16243a, #070b12);
  padding: 0;
  cursor: pointer;
}

.pw-portrait img {
  width: 100%;
  height: 100%;
}

.pw-portrait-res.is-crystal {
  background: radial-gradient(circle at 50% 60%, rgba(111, 224, 255, 0.6), transparent 60%), #0a1420;
}

.pw-portrait-res.is-gas {
  background: radial-gradient(circle at 50% 60%, rgba(140, 255, 90, 0.5), transparent 60%), #0a1420;
}

.pw-info h3 {
  margin: 0 0 6px;
  font: 700 18px/1.15 var(--gh-font-display);
  letter-spacing: 0.02em;
}

.pw-info h3 small {
  font: 600 12px/1 var(--gh-font-body);
  color: var(--pw-dim);
  margin-left: 6px;
}

.pw-bar {
  position: relative;
  height: 15px;
  margin-bottom: 3px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  max-width: 360px;
}

.pw-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(180deg, #7dff9a, #22b85a);
}

.pw-bar.is-sh i { background: linear-gradient(180deg, #9fdcff, #2f86d8); }
.pw-bar.is-en i { background: linear-gradient(180deg, #e2b6ff, #8a3fd8); }

.pw-bar span {
  position: relative;
  display: block;
  font: 700 11px/15px system-ui;
  text-align: center;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px #000;
}

.pw-dim {
  margin: 4px 0 0;
  color: var(--pw-dim);
  font-size: 12.5px;
  line-height: 1.45;
}

.pw-dim b {
  color: #e6edf5;
}

.pw-attrs {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: #b8a7d8;
}

.pw-why {
  margin: 4px 0 0;
  color: var(--pw-amber);
  font-size: 12.5px;
}

.pw-prog {
  position: relative;
  height: 16px;
  margin-top: 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  max-width: 360px;
}

.pw-prog i {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, rgba(111, 224, 255, 0.4), rgba(111, 224, 255, 0.85));
}

.pw-prog span {
  position: relative;
  display: block;
  font: 700 11px/16px system-ui;
  padding-left: 6px;
  text-shadow: 0 1px 2px #000;
}

.pw-queue {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-top: 6px;
}

.pw-queue .pw-prog {
  flex: 1 1 100%;
  margin-top: 2px;
}

.pw-qi {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--pw-line);
  border-radius: 6px;
  background: #0b1320;
  cursor: pointer;
}

.pw-qi:first-child {
  border-color: var(--pw-cyan);
}

.pw-qi img {
  width: 100%;
  height: 100%;
}

.pw-multi {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-content: flex-start;
}

.pw-unit {
  position: relative;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--pw-line);
  border-radius: 6px;
  background: #0b1320;
  cursor: pointer;
  overflow: hidden;
}

.pw-unit img {
  width: 100%;
  height: 100%;
}

.pw-unit i {
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 2px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, #4dff8a calc(var(--f) * 100%), rgba(255, 255, 255, 0.12) 0);
}

.pw-unit:hover {
  border-color: var(--pw-line-hi);
}

.pw-more {
  align-self: center;
  color: var(--pw-dim);
  font-weight: 700;
  padding: 0 6px;
}

/* ---------- command card ---------- */

.pw-card {
  display: grid;
  grid-template-columns: repeat(5, 56px);
  grid-template-rows: repeat(3, 56px);
  gap: 5px;
  align-content: center;
}

.pw-slot {
  width: 56px;
  height: 56px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px dashed rgba(140, 200, 255, 0.07);
}

.pw-cmd {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid var(--pw-line);
  border-style: solid;
  background: linear-gradient(180deg, #1c2c44, #0b1220);
  color: #e6edf5;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}

.pw-cmd svg {
  width: 30px;
  height: 30px;
}

.pw-cmd img {
  width: 52px;
  height: 52px;
}

.pw-cmd kbd {
  position: absolute;
  top: 3px;
  left: 4px;
  text-shadow: 0 1px 2px #000;
}

.pw-cmd:hover {
  border-color: var(--pw-cyan);
  box-shadow: 0 0 12px rgba(111, 224, 255, 0.35), inset 0 0 12px rgba(111, 224, 255, 0.15);
}

.pw-cmd:active {
  transform: translateY(1px);
}

.pw-cmd.is-active {
  border-color: var(--pw-amber);
  box-shadow: 0 0 12px rgba(255, 190, 59, 0.45);
}

.pw-cmd.is-off {
  filter: grayscale(1) brightness(0.55);
}

.pw-cmd.is-passive {
  filter: none;
  opacity: 0.75;
  border-style: dashed;
}

.pw-cool {
  position: absolute;
  inset: 0;
  background: conic-gradient(rgba(0, 0, 0, 0.65) calc(var(--k) * 360deg), transparent 0);
}

.pw-tip {
  position: absolute;
  width: 290px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
  pointer-events: none;
  z-index: 8;
}

.pw-tip b {
  font: 700 15px/1.2 var(--gh-font-display);
}

.pw-tip p {
  margin: 6px 0 0;
  color: #c3d0de;
}

.pw-cost {
  display: block;
  margin-top: 5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pw-cost .pw-ico {
  width: 13px;
  height: 13px;
  margin-left: 2px;
}

.pw-stage[data-mode="build"] #pwCanvas,
.pw-stage[data-mode="attack"] #pwCanvas,
.pw-stage[data-mode="ability"] #pwCanvas {
  cursor: crosshair !important;
}

.pw-touch-box {
  position: absolute;
  right: 12px;
  bottom: 214px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--pw-line-hi);
  background: var(--pw-glass);
  color: #e6edf5;
  font-weight: 700;
}

.pw-touch-box.is-on {
  background: rgba(93, 255, 154, 0.25);
  border-color: var(--pw-green);
}

/* ---------- menu ---------- */

.pw-menu {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 10;
  background: radial-gradient(ellipse at 50% 60%, transparent 30%, rgba(3, 5, 10, 0.55) 80%);
  overflow-y: auto;
}

.pw-menu[hidden],
.pw-sheet[hidden] {
  display: none;
}

.pw-menu-card {
  width: min(880px, 100%);
  padding: 26px 28px 22px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(26, 40, 62, 0.75), rgba(6, 10, 18, 0.88));
}

.pw-kicker {
  margin: 0;
  color: var(--pw-cyan);
  font: 700 13px/1 var(--gh-font-body);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.pw-title {
  margin: 8px 0 6px;
  font: 400 clamp(40px, 7vw, 68px)/1 var(--gh-font-display);
  letter-spacing: 0.06em;
  background: linear-gradient(180deg, #ffffff, #9fd8ff 55%, #4a8cff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(80, 160, 255, 0.45));
}

.pw-lede {
  margin: 0 0 18px;
  color: #c3d0de;
  font-size: 15px;
}

.pw-races {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.pw-race {
  display: grid;
  grid-template-rows: 96px auto 1fr;
  justify-items: center;
  gap: 4px;
  padding: 10px 10px 12px;
  border: 1px solid var(--pw-line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(30, 46, 70, 0.6), rgba(8, 12, 20, 0.7));
  color: #e6edf5;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.pw-race img {
  width: 96px;
  height: 96px;
}

.pw-race-q {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  font: 400 54px/1 var(--gh-font-display);
  color: var(--pw-dim);
}

.pw-race b {
  font: 700 19px/1.2 var(--gh-font-display);
}

.pw-race small {
  color: var(--pw-dim);
  font-size: 12px;
  line-height: 1.45;
}

.pw-race:hover {
  transform: translateY(-2px);
  border-color: var(--pw-line-hi);
}

.pw-race[aria-checked="true"] {
  border-color: var(--pw-cyan);
  box-shadow: 0 0 0 1px var(--pw-cyan), 0 0 24px rgba(111, 224, 255, 0.3);
  background: linear-gradient(180deg, rgba(40, 80, 120, 0.6), rgba(8, 16, 28, 0.8));
}

/* Three to a row: the longest options ("2 computers (free for all)") would push six past the card. */
.pw-setup {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.pw-setup label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--pw-dim);
  font-weight: 700;
}

.pw-setup select {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--pw-line);
  background: #0c1626;
  color: #e6edf5;
  font: 600 14px/1 var(--gh-font-body);
}

.pw-menu-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.pw-btn {
  height: 44px;
  padding: 0 20px;
  border: 1px solid var(--pw-line-hi);
  border-radius: 10px;
  background: rgba(30, 50, 80, 0.7);
  color: #e6edf5;
  font: 700 15px/1 var(--gh-font-body);
  cursor: pointer;
}

.pw-btn:hover {
  background: rgba(50, 80, 120, 0.8);
}

.pw-btn-go {
  background: linear-gradient(180deg, #ffd25c, #ff9f1a);
  border-color: #ffd25c;
  color: #1a1000;
  font-size: 17px;
  padding: 0 28px;
  box-shadow: 0 0 22px rgba(255, 170, 40, 0.35);
}

.pw-btn-go:hover {
  background: linear-gradient(180deg, #ffe08a, #ffb02e);
}

.pw-btn-quiet {
  background: transparent;
}

/* ---------- sheets: help and results ---------- */

.pw-sheet {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 12;
  background: rgba(3, 5, 10, 0.6);
  overflow-y: auto;
}

.pw-sheet-card {
  position: relative;
  width: min(860px, 100%);
  padding: 24px 26px;
  border-radius: 16px;
}

.pw-sheet-card h2 {
  margin: 0 0 12px;
  font: 400 30px/1.1 var(--gh-font-display);
}

.pw-sheet-card h3 {
  margin: 14px 0 4px;
  font: 700 15px/1.2 var(--gh-font-display);
  color: var(--pw-cyan);
}

.pw-sheet-card p,
.pw-sheet-card li {
  color: #c3d0de;
  font-size: 14px;
  line-height: 1.55;
}

.pw-sheet-card ul {
  margin: 0;
  padding-left: 18px;
}

.pw-help-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.pw-x {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #e6edf5;
  font-size: 22px;
  cursor: pointer;
}

.pw-result h2 {
  font-size: clamp(42px, 8vw, 72px);
  margin: 6px 0 14px;
}

.pw-result.is-won h2 {
  color: var(--pw-amber);
  text-shadow: 0 0 30px rgba(255, 190, 59, 0.5);
}

.pw-sheet:not(.is-won) .pw-result h2 {
  color: #ff8a7a;
}

.pw-stats table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}

.pw-stats th,
.pw-stats td {
  padding: 7px 8px;
  text-align: right;
  border-bottom: 1px solid rgba(140, 200, 255, 0.1);
}

.pw-stats th:first-child {
  text-align: left;
}

.pw-stats tbody th i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 3px;
  background: var(--c);
}

.pw-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 20;
  background: #05070d;
  color: var(--pw-cyan);
  font: 700 16px/1 var(--gh-font-body);
  letter-spacing: 0.08em;
}

.pw-loading[hidden] {
  display: none;
}

.pw-fallback {
  position: absolute;
  inset: 40% 20px auto;
  text-align: center;
  z-index: 21;
}

/* ---------- small screens ---------- */

@media (max-width: 1100px) {
  .pw-panel {
    height: 172px;
  }

  #pwMini {
    width: 240px;
    height: 120px;
  }

  .pw-card {
    grid-template-columns: repeat(5, 48px);
    grid-template-rows: repeat(3, 48px);
    gap: 4px;
  }

  .pw-slot {
    width: 48px;
    height: 48px;
  }

  .pw-cmd img {
    width: 44px;
    height: 44px;
  }

  .pw-one {
    grid-template-columns: 86px 1fr;
  }

  .pw-portrait {
    width: 86px;
    height: 86px;
  }
}

@media (max-width: 760px) {
  .pw-stage {
    inset: 48px 0 0;
  }

  .pw-panel {
    grid-template-columns: 1fr auto;
    height: auto;
    padding: 6px;
    gap: 6px;
  }

  .pw-mini {
    display: none;
  }

  .pw-sel {
    max-height: 120px;
  }

  .pw-card {
    grid-template-columns: repeat(5, 40px);
    grid-template-rows: repeat(3, 40px);
  }

  .pw-slot {
    width: 40px;
    height: 40px;
  }

  .pw-cmd img {
    width: 36px;
    height: 36px;
  }

  .pw-cmd svg {
    width: 22px;
    height: 22px;
  }

  .pw-races {
    grid-template-columns: repeat(2, 1fr);
  }

  .pw-setup {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pw-help-cols {
    grid-template-columns: 1fr;
  }

  .pw-chip {
    min-width: 0;
    font-size: 13px;
  }

  .pw-top {
    top: 6px;
    right: 6px;
  }

  .pw-left {
    top: 50px;
  }

  .pw-objective {
    width: min(300px, 70vw);
  }
}

.pw-perf {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #9fffb0;
  font: 600 12px/1.3 ui-monospace, monospace;
  z-index: 30;
  pointer-events: none;
}

/* ---------- laptop screens (1280×720 at 150%): smaller portraits so the menu fits ---------- */

@media (max-height: 760px) {
  .pw-race {
    grid-template-rows: 72px auto 1fr;
  }

  .pw-race img,
  .pw-race-q {
    width: 72px;
    height: 72px;
  }

  .pw-race-q {
    font-size: 42px;
  }

  .pw-lede {
    margin-bottom: 14px;
  }
}

/* ---------- short screens (phones held sideways) ---------- */

@media (max-height: 560px) {
  body.pw-body .gh-bar {
    display: none;
  }

  .pw-stage {
    inset: 0;
  }

  .pw-panel {
    height: 118px;
    padding: 5px;
    gap: 6px;
    bottom: 4px;
    grid-template-columns: auto 1fr auto;
  }

  .pw-mini {
    display: grid;
    gap: 4px;
  }

  #pwMini {
    width: 150px;
    height: 75px;
  }

  .pw-mt {
    height: 22px;
  }

  .pw-mt svg {
    width: 13px;
    height: 13px;
  }

  .pw-card {
    grid-template-columns: repeat(5, 34px);
    grid-template-rows: repeat(3, 34px);
    gap: 3px;
  }

  .pw-slot {
    width: 34px;
    height: 34px;
    border-radius: 6px;
  }

  .pw-cmd img {
    width: 32px;
    height: 32px;
  }

  .pw-cmd svg {
    width: 18px;
    height: 18px;
  }

  .pw-cmd kbd {
    display: none;
  }

  .pw-one {
    grid-template-columns: 60px 1fr;
    gap: 8px;
  }

  .pw-portrait {
    width: 60px;
    height: 60px;
  }

  .pw-info h3 {
    font-size: 14px;
    margin-bottom: 3px;
  }

  .pw-bar {
    height: 12px;
  }

  .pw-bar span {
    font-size: 9px;
    line-height: 12px;
  }

  .pw-dim,
  .pw-attrs {
    font-size: 10.5px;
    margin-top: 2px;
  }

  .pw-sel-body {
    padding: 4px 6px;
  }

  .pw-unit {
    width: 30px;
    height: 30px;
  }

  .pw-top {
    top: 4px;
    right: 4px;
  }

  .pw-chip {
    min-width: 0;
    font-size: 13px;
    padding: 2px 6px 2px 4px;
  }

  .pw-tb {
    width: 28px;
    height: 26px;
  }

  .pw-left {
    top: 4px;
    left: 4px;
  }

  .pw-objective {
    width: 230px;
    padding: 6px 28px 6px 9px;
  }

  .pw-objective b {
    font-size: 14px;
  }

  .pw-objective p {
    font-size: 11px;
  }

  .pw-msg {
    font-size: 12px;
    padding: 4px 8px;
  }

  .pw-touch-box {
    bottom: 128px;
  }

  .pw-menu-card {
    padding: 16px;
  }

  .pw-title {
    font-size: 36px;
  }

  .pw-race {
    grid-template-rows: 56px auto;
  }

  .pw-race img,
  .pw-race-q {
    width: 56px;
    height: 56px;
  }

  .pw-race small {
    display: none;
  }
}

/* ---------- sound: the top-bar toggles and the menu's volume sliders ---------- */

.pw-tb .pw-off {
  display: none;
}

.pw-tb[aria-pressed="false"] {
  color: #7d8a99;
}

.pw-tb[aria-pressed="false"] .pw-on {
  display: none;
}

.pw-tb[aria-pressed="false"] .pw-off {
  display: block;
}

.pw-volume {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin-top: 14px;
}

.pw-volume label {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--pw-dim);
}

.pw-volume input {
  width: 100%;
  min-width: 0;
  accent-color: var(--pw-cyan);
}

@media (max-height: 760px) {
  .pw-volume {
    margin-top: 10px;
  }
}

/* Narrow phones: a tighter top bar; music has its slider in the menu, so its toggle steps out. */
@media (max-width: 520px) {
  .pw-top {
    right: 6px;
    gap: 6px;
  }

  .pw-res,
  .pw-time {
    gap: 2px;
    padding: 3px 4px;
  }

  .pw-chip {
    min-width: 0;
    gap: 4px;
    padding: 3px 6px 3px 4px;
    font-size: 14px;
  }

  .pw-time time {
    min-width: 40px;
    font-size: 14px;
  }

  .pw-tb {
    width: 28px;
  }

  .pw-tb[data-act="music"] {
    display: none;
  }
}
