.pg-game {
  --pg-ink:#173740;
  --pg-sub:#4d6570;
  --pg-edge:#c8d9da;
  --pg-panel:#eff6f5;
  --pg-paper:#f9fdfb;
  --pg-green:#286d60;
  color:var(--pg-ink);
  background:var(--pg-panel);
  border:1px solid var(--pg-edge);
  border-radius:14px;
  font-family:inherit;
  font-size:14px;
  overflow:hidden;
}
.pg-game *, .pg-game *::before, .pg-game *::after { box-sizing:border-box; }
.pg-game [hidden] { display:none!important; }
.pg-game h2, .pg-game p { margin:0; }
.pg-game h2 { color:inherit; font-size:1rem; line-height:1.25; }
.pg-game button {
  min-height:44px;
  border:1px solid #b0c8c7;
  border-radius:8px;
  background:var(--pg-paper);
  color:var(--pg-ink);
  font:inherit;
  font-weight:650;
  line-height:1.15;
  padding:7px 9px;
  cursor:pointer;
  touch-action:manipulation;
}
.pg-game button:focus-visible { outline:2px solid #447c89; outline-offset:2px; }
.pg-game button:disabled, .pg-game button[aria-disabled=true] { color:#5e747d; background:#e7eff0; cursor:default; }
.pg-game button:active:not(:disabled):not([aria-disabled=true]) { filter:brightness(.9); }
.pg-game bdi { font-variant-numeric:tabular-nums; }

.pg-scene {
  position:relative;
  isolation:isolate;
  height:clamp(147px,24vw,211px);
  color:#f5fbfb;
  background:
    radial-gradient(ellipse at 73% 5%, #59b1aa66, transparent 49%),
    linear-gradient(160deg,#17364a 12%,#28617a 76%,#417b87 100%);
}
.pg-scene[data-weather=dawn] { background:radial-gradient(ellipse at 74% 5%,#e0ab806b,transparent 56%),linear-gradient(160deg,#23384c,#507d86 76%,#7299a0); }
.pg-scene[data-weather=gale] { background:radial-gradient(ellipse at 67% 13%,#8dc0c678,transparent 53%),linear-gradient(155deg,#243a52,#456d87 82%,#6f95a2); }
.pg-scene[data-weather=night] { background:radial-gradient(ellipse at 73% 7%,#3b8c8078,transparent 51%),linear-gradient(157deg,#101f3d,#1b5267 82%,#417d8b); }
.pg-snow {
  position:absolute;
  inset:auto 0 0;
  height:43%;
  background:linear-gradient(167deg,#b8d4dc,#dcebed 79%);
  clip-path:polygon(0 58%,24% 38%,43% 50%,71% 25%,100% 55%,100% 100%,0 100%);
  z-index:-1;
}
.pg-models { direction:ltr; position:absolute; inset:4px 0 4px; pointer-events:none; }
.pg-model { position:absolute; height:auto; object-fit:contain; filter:drop-shadow(0 6px 5px #162c4288); }
.pg-turbine { bottom:3%; left:17%; width:clamp(54px,10vw,95px); }
.pg-snow, .pg-turbine { transition:filter .2s ease; }
.pg-scene[data-wind=false] .pg-turbine { filter:drop-shadow(0 6px 5px #162c4266) saturate(.58); }
.pg-station { bottom:1%; left:43%; width:clamp(90px,14vw,140px); }
.pg-scene[data-running=true] .pg-station { filter:drop-shadow(0 0 8px #fcc48355) drop-shadow(0 6px 5px #162c4288); }
.pg-cell { bottom:4%; left:72%; width:clamp(59px,10vw,100px); }
.pg-scene[data-charged=true] .pg-cell { filter:drop-shadow(0 0 6px #7fe2ba8c) drop-shadow(0 6px 5px #162c4288); }
.pg-scene-ledger { position:relative; display:flex; justify-content:space-between; align-items:flex-start; gap:7px; padding:10px; }
.pg-scene-ledger div {
  display:grid;
  gap:1px;
  padding:6px 8px;
  background:#112b3ee8;
  border:1px solid #c1e8e550;
  border-radius:8px;
  max-width:65%;
  min-width:0;
}
.pg-scene-ledger span, .pg-scene-ledger small { color:#d7e9ed; font-size:11px; line-height:1.2; }
.pg-scene-ledger bdi { font-size:1.45rem; line-height:1.1; font-weight:760; }

.pg-readings {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:1px;
  background:#bed1d2;
  border-bottom:1px solid #bed1d2;
}
.pg-readings div { min-width:0; display:grid; align-content:start; gap:3px; padding:7px 8px; background:#f3faf8; }
.pg-readings span { font-size:11px; line-height:1.1; color:var(--pg-sub); }
.pg-readings bdi { justify-self:start; white-space:nowrap; line-height:1.1; font-weight:710; font-size:13px; }
.pg-game progress {
  appearance:none;
  display:block;
  width:100%;
  height:5px;
  border:0;
  border-radius:5px;
  background:#d9e8e7;
  color:#378a77;
  accent-color:#378a77;
}
.pg-game progress::-webkit-progress-bar { background:#d9e8e7; border-radius:5px; }
.pg-game progress::-webkit-progress-value { background:#378a77; border-radius:5px; }
.pg-game progress::-moz-progress-bar { background:#378a77; border-radius:5px; }

.pg-layout { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(0,1fr); gap:12px; padding:12px; }
.pg-dispatch, .pg-equipment { min-width:0; }
.pg-equipment, .pg-contract, .pg-result { border:1px solid var(--pg-edge); border-radius:10px; background:var(--pg-paper); padding:10px; }
.pg-heading, .pg-manual { display:flex; justify-content:space-between; align-items:center; gap:9px; }
.pg-heading { margin:10px 0 6px; }
.pg-heading span, .pg-manual span, .pg-contract-meter span, .pg-upgrade span, .pg-upgrade small {
  color:var(--pg-sub);
  line-height:1.2;
  font-size:11px;
}
.pg-manual span { min-width:0; }
.pg-manual button, .pg-contract button { background:var(--pg-green); border-color:#226459; color:#fff; }
.pg-manual button { min-width:55%; min-height:48px; font-size:.97rem; }
.pg-contract button { width:100%; margin-top:8px; }
.pg-strategies { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px; }
.pg-strategies button { display:grid; align-content:start; text-align:start; gap:5px; padding:7px; min-width:0; min-height:105px; }
.pg-strategies button > strong { font-size:12px; min-block-size:2.2em; line-height:1.1; }
.pg-strategies button span { display:flex; flex-wrap:wrap; gap:1px 3px; align-items:baseline; justify-content:space-between; font-size:10px; color:var(--pg-sub); font-weight:500; }
.pg-strategies bdi { font-size:11px; color:var(--pg-ink); font-weight:740; white-space:nowrap; }
.pg-strategies button[aria-pressed=true] { color:#145044; background:#d8ece3; border:2px solid #387b6b; padding:6px; }
.pg-strategies button[aria-pressed=true]:disabled { color:#4a6761; border-color:#8fa9a3; }

.pg-contract, .pg-result { margin-top:10px; }
.pg-contract .pg-heading { margin:0 0 7px; align-items:baseline; }
.pg-contract .pg-heading strong { color:#255649; font-size:12px; text-align:end; }
.pg-contract-meter { display:grid; grid-template-columns:1fr auto; align-items:center; gap:3px 8px; margin-top:6px; min-width:0; }
.pg-contract-meter bdi { font-size:12px; white-space:nowrap; font-weight:720; }
.pg-contract-meter progress { grid-column:1/-1; }
.pg-result { padding:14px; background:#dff1e6; border-color:#9bc5ae; }
.pg-result p { color:#386655; margin-top:6px; }
.pg-equipment h2 { margin:1px 0 5px; }
.pg-upgrade { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 8px; align-items:center; padding:6px 0; border-top:1px solid #e2eeed; }
.pg-upgrade strong { font-size:13px; line-height:1.15; }
.pg-upgrade span { margin-inline-start:5px; }
.pg-upgrade small { display:block; margin-top:2px; }
.pg-upgrade button { font-size:11px; max-width:10rem; min-height:44px; min-width:74px; white-space:normal; }
.pg-footer {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  border-top:1px solid var(--pg-edge);
  color:var(--pg-sub);
  padding:6px 12px;
  font-size:11px;
}
.pg-footer div { display:grid; gap:1px; }
.pg-footer span:empty { display:none; }
.pg-footer button { font-size:11px; }
.pg-game[data-save-state=invalid] .pg-footer, .pg-game[data-save-state=conflict] .pg-footer { background:#fff4dd; color:#745024; }
.pg-reset { border:1px solid var(--pg-edge); border-radius:13px; background:var(--pg-paper); color:var(--pg-ink); width:min(360px,calc(100vw - 26px)); padding:15px; }
.pg-reset::backdrop { background:#14404c99; }
.pg-reset p { margin:8px 0 12px; }
.pg-reset form > div { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:7px; }
.pg-reset button[value=restart] { background:var(--pg-green); color:#fff; }

@media (max-width:610px) {
  .pg-layout { grid-template-columns:minmax(0,1fr); padding:8px; gap:8px; }
  .pg-readings div { padding-inline:5px; }
  .pg-readings span { font-size:10px; min-block-size:2.2em; }
  .pg-readings bdi { font-size:11px; }
  .pg-upgrade button { max-width:8rem; }
  .pg-footer { padding-inline:8px; }
}
@media (prefers-reduced-motion:reduce) {
  .pg-game * { transition:none!important; }
}
