/*
  Pocket Planet (造个星球): the planet floats in a soft night sky under the site bar;
  a glass tool dock sits at the bottom, small stats at the top right.
*/

html,
body {
  height: 100%;
}

body.pp-body {
  margin: 0;
  overflow: hidden;
  color: var(--gh-ink);
  background:
    radial-gradient(ellipse 60% 55% at 50% 46%, rgba(76, 120, 190, 0.28), transparent 70%),
    radial-gradient(ellipse at 50% 50%, #142039 0%, #0b1324 50%, #050912 100%);
  font-family: var(--gh-font-body);
  overscroll-behavior: none;
}

.pp-stage {
  position: fixed;
  inset: 56px 0 0;
}

#ppCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
  opacity: 0;
  transition: opacity 900ms ease;
}

.pp-stage.is-ready #ppCanvas {
  opacity: 1;
}

/* ---------- Glass parts ---------- */

.pp-stats div,
.pp-hint,
.pp-dock {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(9, 16, 23, 0.62);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
  backdrop-filter: blur(10px) saturate(1.3);
}

.pp-stats {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  pointer-events: none;
}

.pp-stats div {
  display: grid;
  min-width: 64px;
  padding: 7px 12px 6px;
  border-radius: 10px;
}

.pp-stats span {
  color: var(--gh-steel);
  font-size: 0.72rem;
  font-weight: 600;
}

.pp-stats b {
  color: var(--gh-bone, #f4f1e8);
  font-family: var(--gh-font-display);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1.1;
}

.pp-hint {
  position: absolute;
  left: 50%;
  bottom: calc(108px + env(safe-area-inset-bottom));
  max-width: min(560px, calc(100% - 32px));
  margin: 0;
  padding: 10px 18px;
  border-radius: 999px;
  color: var(--gh-bone, #f4f1e8);
  font-size: 0.9rem;
  text-align: center;
  transform: translateX(-50%);
  transition: opacity 500ms ease, transform 500ms ease;
  pointer-events: none;
}

.pp-hint.is-gone {
  opacity: 0;
  transform: translate(-50%, 10px);
}

.pp-touch {
  display: none;
}

@media (pointer: coarse) {
  .pp-fine {
    display: none;
  }

  .pp-touch {
    display: inline;
  }
}

/* ---------- Tool dock ---------- */

.pp-dock {
  position: absolute;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 20px);
  padding: 7px;
  overflow-x: auto;
  border-radius: 18px;
  transform: translateX(-50%);
  scrollbar-width: none;
}

.pp-dock::-webkit-scrollbar {
  display: none;
}

.pp-group {
  display: flex;
  flex: none;
  gap: 3px;
  padding-right: 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.09);
}

.pp-group:last-child {
  padding-right: 0;
  border-right: 0;
}

.pp-dock button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 54px;
  height: 58px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--gh-steel);
  background: transparent;
  font: 600 0.75rem/1.1 var(--gh-font-body);
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, transform 140ms var(--gh-ease, ease);
}

.pp-dock button svg {
  width: 26px;
  height: 26px;
  transition: transform 220ms var(--gh-ease, ease);
}

.pp-dock button:hover {
  color: var(--gh-bone, #f4f1e8);
  background: rgba(255, 255, 255, 0.06);
}

.pp-dock button:hover svg {
  transform: translateY(-2px);
}

.pp-dock button:active {
  transform: scale(0.96);
}

.pp-dock [data-tool][aria-pressed="true"],
.pp-dock [data-brush][aria-pressed="true"] {
  border-color: var(--gh-signal);
  color: var(--gh-bone, #f4f1e8);
  background: rgba(255, 190, 11, 0.14);
  box-shadow: 0 0 18px -6px rgba(255, 190, 11, 0.6);
}

.pp-dock [data-tool][aria-pressed="true"] svg {
  transform: translateY(-2px) scale(1.06);
}

.pp-actions button {
  min-width: 44px;
}

.pp-actions button svg {
  width: 22px;
  height: 22px;
}

.pp-actions [aria-pressed="false"] {
  opacity: 0.55;
}

.pp-actions [data-act="sound"][aria-pressed="false"] .pp-wave {
  display: none;
}

.pp-dot {
  display: block;
  border-radius: 50%;
  border: 2px solid currentColor;
}

.pp-dot.is-small {
  width: 10px;
  height: 10px;
  margin: 8px 0;
}

.pp-dot.is-big {
  width: 22px;
  height: 22px;
  margin: 2px 0;
}

.pp-stage[data-mode="lower"] #ppCanvas {
  cursor: s-resize;
}

/* ---------- Fallback ---------- */

.pp-fallback {
  position: absolute;
  inset: 50% auto auto 50%;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100% - 40px));
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(9, 16, 23, 0.85);
  text-align: center;
  transform: translate(-50%, -50%);
}

.pp-fallback[hidden] {
  display: none;
}

.pp-fallback strong {
  font-family: var(--gh-font-display);
  font-size: 1.5rem;
  font-weight: 400;
}

.pp-fallback span {
  color: var(--gh-steel);
}

/* ---------- Small screens ---------- */

@media (max-width: 720px) {
  .pp-stats {
    top: 10px;
    right: 10px;
    left: 10px;
    justify-content: center;
    gap: 6px;
  }

  .pp-stats div {
    min-width: 0;
    flex: 1;
    max-width: 90px;
    padding: 5px 8px;
  }

  .pp-stats b {
    font-size: 1.1rem;
  }

  .pp-dock {
    left: 10px;
    right: 10px;
    max-width: none;
    transform: none;
  }

  .pp-dock button {
    min-width: 48px;
    height: 54px;
  }

  .pp-actions [data-act="help"] {
    display: none;
  }

  .pp-hint {
    bottom: calc(100px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  #ppCanvas,
  .pp-hint,
  .pp-dock button,
  .pp-dock button svg {
    transition: none;
  }
}

/* =========================================================
   Planet Gods (星球神战): blue tribe vs red tribe.
   Blue is the player, red the rival god, gold is mana.
   ========================================================= */

/* The site has no global reset; panels here size with their padding included. */
.pg-stage *,
.pg-stage *::before,
.pg-stage *::after {
  box-sizing: border-box;
}

.pg-stage {
  --pg-blue: #4aa3ff;
  --pg-red: #ff6b57;
  --pg-mana: #ffbe0b;
  --pg-glass: rgba(9, 16, 23, 0.66);
}

.pg-balance,
.pg-acts,
.pg-orders,
.pg-feed-item,
.pg-tip,
.pg-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--pg-glass);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
  backdrop-filter: blur(10px) saturate(1.3);
}

.pg-stage.is-paused #ppCanvas {
  filter: saturate(0.45) brightness(0.75);
  transition: filter 300ms ease;
}

/* ---------- Balance of the two tribes ---------- */

.pg-balance {
  position: absolute;
  top: 14px;
  left: 50%;
  display: grid;
  grid-template-columns: 1fr minmax(160px, 260px) 1fr;
  align-items: center;
  gap: 14px;
  width: min(620px, calc(100% - 300px));
  padding: 8px 16px;
  border-radius: 16px;
  transform: translateX(-50%);
  pointer-events: none;
}

.pg-side {
  display: grid;
  line-height: 1.1;
}

.pg-side.is-blue {
  justify-items: end;
  text-align: right;
}

.pg-side b {
  font-family: var(--gh-font-display);
  font-size: 1.7rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.pg-side.is-blue b {
  color: var(--pg-blue);
}

.pg-side.is-red b {
  color: var(--pg-red);
}

.pg-side span {
  color: var(--gh-bone, #f4f1e8);
  font-size: 0.78rem;
  font-weight: 600;
}

.pg-side small {
  color: var(--gh-steel);
  font-size: 0.7rem;
}

.pg-meter {
  --share: 0.5;
  position: relative;
  display: flex;
  height: 12px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.pg-meter i {
  display: block;
  height: 100%;
  transition: flex-grow 600ms var(--gh-ease, ease);
}

.pg-meter-blue {
  flex: var(--share) 1 0;
  border-radius: 999px 0 0 999px;
  background: linear-gradient(90deg, #1f5fa8, var(--pg-blue));
  box-shadow: 0 0 14px -2px rgba(74, 163, 255, 0.7);
}

.pg-meter-red {
  flex: calc(1 - var(--share)) 1 0;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(90deg, var(--pg-red), #a8302a);
  box-shadow: 0 0 14px -2px rgba(255, 107, 87, 0.7);
}

/* The front line between them. */
.pg-meter-red::before {
  content: "";
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 3px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
}

.pg-meter time {
  position: absolute;
  top: 16px;
  left: 50%;
  color: var(--gh-steel);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  transform: translateX(-50%);
}

/* ---------- Game actions (top right) ---------- */

.pg-acts {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: 12px;
}

.pg-acts button,
.pg-orders button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  color: var(--gh-steel);
  background: transparent;
  font: 600 0.75rem/1.1 var(--gh-font-body);
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.pg-acts button {
  width: 38px;
  height: 38px;
  border-radius: 9px;
}

.pg-acts svg {
  width: 21px;
  height: 21px;
}

.pg-acts button:hover,
.pg-orders button:hover {
  color: var(--gh-bone, #f4f1e8);
  background: rgba(255, 255, 255, 0.07);
}

.pg-acts [data-act="speed"] span {
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pg-acts [data-act="speed"][aria-pressed="true"] {
  color: var(--pg-mana);
}

.pg-icon-play,
.pg-acts [data-act="pause"][aria-pressed="true"] .pg-icon-pause {
  display: none;
}

.pg-acts [data-act="pause"][aria-pressed="true"] .pg-icon-play {
  display: inline;
}

.pg-acts [data-act="pause"][aria-pressed="true"] {
  color: var(--pg-mana);
  background: rgba(255, 190, 11, 0.12);
}

.pg-acts [data-act="sound"][aria-pressed="false"] {
  opacity: 0.55;
}

.pg-acts [data-act="sound"][aria-pressed="false"] .pp-wave {
  display: none;
}

.pg-acts [data-act="music"] .pg-mute-line {
  display: none;
}

.pg-acts [data-act="music"][aria-pressed="false"] {
  opacity: 0.55;
}

.pg-acts [data-act="music"][aria-pressed="false"] .pg-mute-line {
  display: inline;
}

/* ---------- What happened ---------- */

.pg-feed {
  position: absolute;
  top: 14px;
  left: 14px;
  display: grid;
  gap: 6px;
  width: min(300px, calc(50% - 330px));
  min-width: 200px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pg-feed-item {
  padding: 7px 12px;
  border-left: 3px solid var(--gh-steel);
  border-radius: 10px;
  color: var(--gh-bone, #f4f1e8);
  font-size: 0.82rem;
  line-height: 1.35;
  animation: pg-in 260ms var(--gh-ease, ease) both;
  transition: opacity 700ms ease;
}

.pg-feed-item button {
  padding: 0;
  border: 0;
  color: inherit;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pg-feed-item button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pg-feed-item.is-good {
  border-left-color: var(--pg-blue);
}

.pg-feed-item.is-bad {
  border-left-color: var(--pg-red);
}

.pg-feed-item.is-warn {
  border-left-color: #ff9f43;
}

.pg-feed-item.is-mana {
  border-left-color: var(--pg-mana);
}

.pg-feed-item.is-old {
  opacity: 0;
}

@keyframes pg-in {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
}

/* ---------- Orders for followers (left) ---------- */

.pg-orders {
  position: absolute;
  top: 50%;
  left: 14px;
  display: grid;
  gap: 3px;
  padding: 5px;
  border-radius: 14px;
  transform: translateY(-50%);
}

.pg-orders button {
  flex-direction: column;
  gap: 3px;
  width: 58px;
  height: 58px;
  border-radius: 10px;
}

.pg-orders svg {
  width: 24px;
  height: 24px;
}

.pg-orders [aria-pressed="true"] {
  border-color: var(--pg-blue);
  color: var(--gh-bone, #f4f1e8);
  background: rgba(74, 163, 255, 0.16);
  box-shadow: 0 0 18px -6px rgba(74, 163, 255, 0.7);
}

/* ---------- Tooltip over buildings ---------- */

.pg-tip {
  position: absolute;
  top: 0;
  left: 0;
  padding: 5px 10px;
  border-radius: 8px;
  color: var(--gh-bone, #f4f1e8);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}

.pg-tip[data-tribe="0"] {
  border-color: rgba(74, 163, 255, 0.6);
}

.pg-tip[data-tribe="1"] {
  border-color: rgba(255, 107, 87, 0.6);
}

.pg-tip[hidden] {
  display: none;
}

/* ---------- Dock: mana and powers ---------- */

.pg-dock {
  align-items: stretch;
}

.pg-mana {
  --fill: 0;
  display: grid;
  flex: none;
  align-content: center;
  gap: 7px;
  width: 104px;
  padding: 0 10px 0 6px;
  border-right: 1px solid rgba(255, 255, 255, 0.09);
}

.pg-mana b {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--pg-mana);
  font-family: var(--gh-font-display);
  font-size: 1.55rem;
  font-weight: 400;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.pg-mana small {
  color: var(--gh-steel);
  font-family: var(--gh-font-body);
  font-size: 0.7rem;
  font-weight: 600;
}

.pg-mana-track {
  position: relative;
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.pg-mana-track i {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #c98a00, var(--pg-mana) 70%, #fff3c4);
  box-shadow: 0 0 10px rgba(255, 190, 11, 0.7);
  transform: scaleX(var(--fill));
  transform-origin: left;
  transition: transform 300ms linear;
}

.pg-dock button {
  position: relative;
  overflow: hidden;
}

.pg-dock button em {
  color: var(--gh-steel);
  font-size: 0.66rem;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.pg-powers button {
  --charge: 0;
  height: 64px;
}

/* A power charges up from the bottom as mana flows in. */
.pg-powers button::before {
  content: "";
  position: absolute;
  inset: auto 6px 3px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 190, 11, 0.85);
  transform: scaleX(var(--charge));
  transform-origin: left;
  transition: transform 300ms linear;
}

.pg-powers button svg {
  opacity: 0.45;
  filter: saturate(0.4);
  transition: opacity 200ms ease, filter 200ms ease, transform 220ms var(--gh-ease, ease);
}

.pg-powers button.is-ready svg {
  opacity: 1;
  filter: none;
}

.pg-powers button.is-ready {
  color: var(--gh-bone, #f4f1e8);
}

.pg-powers button.is-ready em {
  color: var(--pg-mana);
}

.pg-powers button.is-ready::before {
  opacity: 0;
}

.pg-dock [data-tool][aria-pressed="true"] {
  border-color: var(--gh-signal);
  color: var(--gh-bone, #f4f1e8);
  background: rgba(255, 190, 11, 0.14);
  box-shadow: 0 0 18px -6px rgba(255, 190, 11, 0.6);
}

.pg-dock button.is-armed {
  border-color: var(--pg-red);
  background: rgba(255, 107, 87, 0.18);
  animation: pg-armed 700ms ease-in-out infinite alternate;
}

@keyframes pg-armed {
  to {
    box-shadow: 0 0 22px -4px rgba(255, 107, 87, 0.9);
  }
}

.pg-stage[data-mode="lower"] #ppCanvas {
  cursor: s-resize;
}

.pg-stage[data-mode="swamp"] #ppCanvas,
.pg-stage[data-mode="quake"] #ppCanvas,
.pg-stage[data-mode="volcano"] #ppCanvas,
.pg-stage[data-mode="flag"] #ppCanvas {
  cursor: cell;
}

/* ---------- Menu and result cards ---------- */

.pg-card {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  gap: 16px;
  width: min(540px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 28px 30px 24px;
  overflow-y: auto;
  border-radius: 20px;
  background: rgba(8, 13, 22, 0.8);
  transform: translate(-50%, -50%);
  animation: pg-card-in 420ms var(--gh-ease, ease) both;
}

.pg-card[hidden] {
  display: none;
}

@keyframes pg-card-in {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 14px));
  }
}

.pg-card h1,
.pg-card h2 {
  justify-self: start;
  margin: 0;
  font-family: var(--gh-font-display);
  font-size: clamp(2.4rem, 7vw, 3.4rem);
  font-weight: 400;
  line-height: 1;
  /* Blue fades into red across the title: the two tribes. */
  background: linear-gradient(100deg, #8cc8ff 0%, var(--pg-blue) 38%, #ffd2c9 52%, var(--pg-red) 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.pg-end.is-won h2 {
  background: linear-gradient(100deg, #fff3c4, var(--pg-mana) 45%, var(--pg-blue));
  -webkit-background-clip: text;
  background-clip: text;
}

.pg-end:not(.is-won) h2 {
  background: linear-gradient(100deg, #ffd2c9, var(--pg-red) 60%, #8a2a22);
  -webkit-background-clip: text;
  background-clip: text;
}

.pg-lede {
  margin: 0;
  color: var(--gh-bone, #f4f1e8);
  font-size: 0.98rem;
  line-height: 1.65;
}

.pg-howto {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pg-howto li {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.pg-howto b {
  color: var(--pg-mana);
  font-family: var(--gh-font-display);
  font-size: 1.1rem;
  font-weight: 400;
}

.pg-howto span {
  color: var(--gh-steel);
  font-size: 0.8rem;
  line-height: 1.45;
}

.pg-levels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
}

.pg-levels button {
  display: grid;
  gap: 2px;
  padding: 9px 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--gh-steel);
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.pg-levels b {
  color: var(--gh-bone, #f4f1e8);
  font-size: 0.95rem;
}

.pg-levels span {
  font-size: 0.74rem;
}

.pg-levels button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.pg-levels [aria-pressed="true"] {
  border-color: var(--pg-mana);
  background: rgba(255, 190, 11, 0.12);
}

.pg-go {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pg-primary,
.pg-secondary {
  display: inline-grid;
  flex: 1 1 180px;
  align-content: center;
  justify-items: center;
  gap: 2px;
  min-height: 50px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font: 700 1rem/1.2 var(--gh-font-body);
  cursor: pointer;
  transition: transform 140ms var(--gh-ease, ease), box-shadow 140ms ease, background-color 140ms ease;
}

.pg-primary {
  color: #1a1204;
  background: var(--pg-mana);
  box-shadow: 0 10px 26px -12px rgba(255, 190, 11, 0.9);
}

.pg-primary small {
  color: rgba(26, 18, 4, 0.72);
  font-size: 0.74rem;
  font-weight: 600;
}

.pg-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px -12px rgba(255, 190, 11, 1);
}

.pg-primary.is-secondary,
.pg-secondary {
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--gh-bone, #f4f1e8);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: none;
}

.pg-primary.is-secondary:hover,
.pg-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.pg-primary[hidden] {
  display: none;
}

.pg-aside {
  margin: 0;
  font-size: 0.85rem;
  text-align: center;
}

.pg-aside a {
  color: var(--gh-steel);
  text-underline-offset: 3px;
}

.pg-aside a:hover {
  color: var(--gh-bone, #f4f1e8);
}

/* ---------- In-game help ---------- */

.pg-card.pg-help {
  width: min(820px, calc(100% - 32px));
  gap: 12px;
}

.pg-help-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 24px;
}

.pg-help h3 {
  margin: 10px 0 6px;
  color: var(--pg-mana);
  font-size: 0.86rem;
  font-weight: 800;
}

.pg-help ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 1.1em;
  color: var(--gh-bone, #f4f1e8);
  font-size: 0.86rem;
  line-height: 1.5;
}

.pg-help-powers {
  display: grid;
  gap: 6px;
  margin: 0;
}

.pg-help-powers div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.pg-help-powers dt {
  font-weight: 800;
}

.pg-help-powers dd {
  margin: 0;
  color: var(--pg-mana);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.pg-help-powers p {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  color: var(--gh-steel);
  font-size: 0.8rem;
  line-height: 1.45;
}

.pg-help-keys {
  margin: 0;
  color: var(--gh-steel);
  font-size: 0.82rem;
  line-height: 1.6;
}

a.pg-help-more {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

@media (max-width: 700px) {
  .pg-help-cols {
    grid-template-columns: 1fr;
  }
}

.pg-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0;
}

.pg-stats div {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.pg-stats dt {
  color: var(--gh-steel);
  font-size: 0.74rem;
}

.pg-stats dd {
  margin: 2px 0 0;
  color: var(--gh-bone, #f4f1e8);
  font-family: var(--gh-font-display);
  font-size: 1.45rem;
  font-variant-numeric: tabular-nums;
}

.pg-card :focus-visible,
.pg-stage button:focus-visible {
  outline: 2px solid var(--gh-signal);
  outline-offset: 2px;
}

/* While a card is up the planet plays itself; only the balance stays. */
.pg-stage.has-card .pg-acts,
.pg-stage.has-card .pg-orders,
.pg-stage.has-card .pg-dock,
.pg-stage.has-card .pg-feed,
.pg-stage.has-card .pp-hint,
.pg-stage.has-card .pg-tip {
  visibility: hidden;
  opacity: 0;
}

.pg-stage .pg-acts,
.pg-stage .pg-orders,
.pg-stage .pg-dock,
.pg-stage .pg-feed {
  transition: opacity 300ms ease, visibility 300ms;
}

.pg-stage .pp-hint {
  bottom: calc(112px + env(safe-area-inset-bottom));
}

/* ---------- Narrow screens ---------- */

@media (max-width: 960px) {
  .pg-balance {
    width: calc(100% - 210px);
    left: 14px;
    grid-template-columns: minmax(0, 1fr) minmax(90px, 1.4fr) minmax(0, 1fr);
    gap: 10px;
    transform: none;
  }

  .pg-feed {
    top: 92px;
    width: min(320px, calc(100% - 28px));
  }
}

@media (max-width: 720px) {
  .pg-balance {
    top: 8px;
    left: 8px;
    width: calc(100% - 16px);
    padding: 6px 10px;
    border-radius: 12px;
  }

  .pg-side b {
    font-size: 1.3rem;
  }

  .pg-side small {
    display: none;
  }

  .pg-acts {
    top: 74px;
    right: 8px;
    padding: 3px;
  }

  .pg-acts button {
    width: 34px;
    height: 34px;
  }

  .pg-acts [data-act="help"] {
    display: none;
  }

  .pg-feed {
    top: 74px;
    left: 8px;
    width: calc(100% - 190px);
    min-width: 0;
  }

  .pg-feed-item {
    font-size: 0.76rem;
  }

  .pg-orders {
    top: auto;
    bottom: calc(96px + env(safe-area-inset-bottom));
    left: 10px;
    grid-auto-flow: column;
    transform: none;
  }

  .pg-orders button {
    width: 52px;
    height: 46px;
  }

  .pg-orders svg {
    width: 20px;
    height: 20px;
  }

  .pg-mana {
    width: 84px;
  }

  .pg-mana b {
    font-size: 1.25rem;
  }

  .pg-powers button {
    height: 58px;
  }

  .pg-stage .pp-hint {
    bottom: calc(160px + env(safe-area-inset-bottom));
    font-size: 0.8rem;
  }

  .pg-card {
    gap: 12px;
    padding: 22px 18px 18px;
  }

  .pg-howto {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .pg-howto li {
    grid-template-columns: 3.2em 1fr;
    align-items: baseline;
    padding: 8px 10px;
  }

  .pg-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pg-feed-item,
  .pg-card,
  .pg-meter i,
  .pg-mana-track i,
  .pg-powers button::before {
    animation: none;
    transition: none;
  }
}

/* ---------- Menu: tutorial button and volume ---------- */

.pg-primary.is-secondary small {
  color: var(--gh-steel, #9fb0c2);
}

.pg-volume {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: center;
  color: var(--gh-steel, #9fb0c2);
  font-size: 0.8rem;
}

.pg-volume label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pg-volume input {
  width: 120px;
  accent-color: var(--pg-mana);
}

/* ---------- Tutorial: a spotlight and a bubble ---------- */

.pg-tour-spot {
  position: absolute;
  z-index: 20;
  border: 2px solid var(--pg-mana);
  border-radius: 12px;
  box-shadow: 0 0 0 200vmax rgba(4, 8, 14, 0.42), 0 0 24px rgba(255, 190, 11, 0.55);
  pointer-events: none;
  transition: left 160ms ease, top 160ms ease, width 160ms ease, height 160ms ease;
}

.pg-tour-spot[hidden] {
  display: none;
}

.pg-tour-spot.is-round {
  border-radius: 50%;
  animation: pg-tour-pulse 1.4s ease-in-out infinite;
}

@keyframes pg-tour-pulse {
  50% { box-shadow: 0 0 0 200vmax rgba(4, 8, 14, 0.42), 0 0 38px rgba(255, 190, 11, 0.95); }
}

.pg-tour-bubble {
  position: absolute;
  z-index: 21;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100% - 24px));
  padding: 14px 16px 12px;
  border: 1px solid rgba(255, 190, 11, 0.45);
  border-radius: 14px;
  background: rgba(9, 16, 23, 0.94);
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.9);
  color: var(--gh-bone, #f4f1e8);
}

.pg-tour-count {
  margin: 0;
  color: var(--pg-mana);
  font-size: 0.74rem;
  font-weight: 700;
}

.pg-tour-text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.65;
}

.pg-tour-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pg-tour-actions button {
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
}

.pg-tour-actions .pg-tour-next {
  border-color: transparent;
  background: var(--pg-mana);
  color: #1a1204;
  font-weight: 700;
}

.pg-tour-actions .pg-tour-quit {
  margin-left: auto;
  color: var(--gh-steel, #9fb0c2);
}

.pg-stage.has-card .pg-tour-spot,
.pg-stage.has-card .pg-tour-bubble {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .pg-tour-spot,
  .pg-tour-spot.is-round {
    transition: none;
    animation: none;
  }
}

/* ---------- ?gallery: the models on a turntable, nothing else ---------- */

body.pg-gallery .pp-stage > :not(canvas) {
  display: none !important;
}
