/* Olympus Ops play page — Presence chrome (header, hint, tray, settings sheet) v3 — + Towers|Town tray + plot sheet */
html { height: 100%; }
body.play-page {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  height: 100%;
  height: 100dvh;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0);
  padding-right: env(safe-area-inset-right, 0);
  padding-left: env(safe-area-inset-left, 0);
  padding-bottom: 0; /* tray owns bottom safe-area */
  background: #0b1f3a;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
}
body.play-page *,
body.play-page *::before,
body.play-page *::after { box-sizing: border-box; }

/* Shared focus ring */
body.play-page a:focus-visible,
body.play-page button:focus-visible,
body.play-page input:focus-visible,
body.play-page summary:focus-visible {
  outline: 3px solid #f5d76e;
  outline-offset: 2px;
}

/* ——— Header (44px) ——— */
.play-bar {
  flex: 0 0 auto;
  width: 100%;
  max-width: 960px;
  height: 44px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 0 10px;
  gap: 8px;
}
.play-bar .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  color: #f7f9fc;
  overflow: visible;
}
.play-bar .brand-mark {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  object-fit: contain;
  object-position: center;
  border-radius: 50%;
  border: 2px solid #f5d76e;
  background: #fff;
}
.play-bar .brand-text {
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 14px;
  line-height: 1.2;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}
.play-bar .bar-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
.play-bar a.back {
  flex: 0 0 auto;
  color: #f5d76e;
  font-weight: 700;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 8px;
}
.menu-btn {
  appearance: none;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 2px solid #f5d76e;
  border-radius: 12px;
  background: #0b1f3a;
  color: #f5d76e;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.menu-btn:hover { background: #12305a; }

/* ——— Hint: one line, hidden after first placement ——— */
.hint {
  flex: 0 0 auto;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 10px;
  height: 20px;
  color: #CBD5E1;
  font-size: 13px;
  line-height: 20px;
  text-align: center;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}
.hint-long { display: none; }
.hint-short { display: block; }
.hint[hidden], body.hint-dismissed .hint { display: none !important; }
/* First-run hint skip (✕, 44×44): the line grows to 44px only while the tip shows. */
.hint:has(.hint-skip) { height: 44px; line-height: 44px; }
.hint-skip {
  width: 44px; height: 44px; margin: 0 0 0 4px; padding: 0; vertical-align: middle;
  border: 0; border-radius: 12px; background: transparent; color: #CBD5E1;
  font: 700 16px/44px system-ui, sans-serif; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.hint-skip:hover, .hint-skip:focus-visible { color: #f5d76e; outline: 2px solid #f5d76e; outline-offset: -6px; }

/* ——— Game host ——— */
#game-host {
  /* Block (not flex-centred): Phaser Scale.CENTER_BOTH centres the canvas itself. */
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0;
  display: block;
  background: #0b1f3a;
  position: relative;
}
#game-host canvas {
  display: block;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 0 2px #f5d76e;
  touch-action: none;
}

/* ——— Tray: one row, 3 towers + Start (70px + safe area) ——— */
#play-tray {
  flex: 0 0 auto;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(7, 18, 36, 0.96);
  border-top: 2px solid rgba(245, 215, 110, 0.75);
}
.tray-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 6px;
  width: 100%;
  height: 52px;
}
.tray-towers {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}
.tray-tower {
  appearance: none;
  margin: 0;
  border: 3px solid #f5d76e;
  background: #1e4d8c;
  color: #f7f9fc;
  border-radius: 12px;
  width: 60px;
  min-width: 48px;
  height: 52px;
  padding: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  overflow: visible;
}
.tray-tower .tray-icon {
  font-size: 20px;
  line-height: 1;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,0.35));
}
.tray-tower .tray-cost {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.02em;
  color: #f7f9fc;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}
.tray-tower.is-selected {
  border-width: 5px;
  background: #2a6bb5;
  box-shadow: 0 0 0 1px #d4a017;
}
.tray-tower.is-locked { opacity: 0.4; border-color: #556677; }
.tray-tower.is-locked .tray-cost { color: #8899aa; }
.tray-tower.is-unaffordable:not(.is-locked) { opacity: 0.55; }
.tray-tower.is-unaffordable:not(.is-locked) .tray-cost { color: #ff5a4a; }
.tray-tower:disabled { cursor: default; }

.tray-start {
  appearance: none;
  margin: 0;
  flex: 1 1 auto;
  min-width: 88px;
  height: 52px;
  border: 3px solid #d4a017;
  border-radius: 12px;
  background: #f5d76e;
  color: #0b1f3a;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  padding: 0 12px;
  line-height: 1.15;
}
.tray-start.is-live,
.tray-start.is-countdown,
.tray-start:disabled {
  background: #1a2740;
  color: #f5d76e;
  border-color: #6b7a9a;
  opacity: 0.75;
  cursor: default;
}

@media (min-width: 600px) {
  .hint-short { display: none; }
  .hint-long { display: block; font-size: 14px; }
  .play-bar { padding: 0 8px 0 12px; }
  .play-bar .brand-text { font-size: 15px; letter-spacing: 0.08em; }
  .play-bar a.back { font-size: 15px; }
  .tray-row { gap: 8px; }
  .tray-towers { gap: 8px; }
  .tray-tower { width: 76px; }
  .tray-start { flex: 0 1 260px; margin-left: auto; }
}

/* ——— Settings sheet ——— */
#settings-sheet, #plot-sheet {
  box-sizing: border-box;
  margin: auto;
  width: min(420px, calc(100vw - 32px));
  max-width: none;
  max-height: 85dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(203,213,225,.4) transparent;
  padding: 20px calc(20px + env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left));
  border: 0;
  border-top: 1px solid #f5d76e;
  border-radius: 20px;
  background: #0b1f3a;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 24px 60px rgba(0,0,0,.5);
  color: #F8FAFC;
  font-family: var(--font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
}
#settings-sheet::backdrop, #plot-sheet::backdrop { background: rgba(5,12,28,.62); backdrop-filter: blur(3px); }
#settings-sheet[open], #plot-sheet[open] { animation: sheet-fade 200ms ease-out; }

.sheet-handle { display: none; }

@media (max-width: 599.98px) {
  #settings-sheet, #plot-sheet {
    position: fixed;
    inset: auto 0 0 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    padding-top: 12px;
  }
  #settings-sheet[open], #plot-sheet[open] { animation: sheet-up 240ms cubic-bezier(.2,.8,.2,1); }
  .sheet-handle {
    display: block;
    width: 44px;
    height: 5px;
    margin: 0 auto 10px;
    border-radius: 3px;
    background: rgba(203,213,225,.55);
  }
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes sheet-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  #settings-sheet[open], #plot-sheet[open] { animation: sheet-fade 150ms linear !important; }
}

.sheet-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
#settings-title, #plot-title {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
  color: #F8FAFC;
  letter-spacing: 0.01em;
}
#settings-title .laurel, #plot-title .laurel { color: #f5d76e; margin-right: 6px; }
.sheet-close {
  appearance: none;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(203,213,225,.35);
  border-radius: 12px;
  background: transparent;
  color: #F8FAFC;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.sheet-close:hover { background: rgba(255,255,255,.08); }

.sheet-resume {
  appearance: none;
  display: block;
  width: 100%;
  height: 56px;
  margin: 0 0 20px;
  border: 0;
  border-radius: 14px;
  background: #f5d76e;
  color: #0b1f3a;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}
.sheet-resume:hover { background: #ffe38a; }

.sheet-row { margin: 0 0 18px; }
.sheet-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
}
.sheet-label {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  color: #F8FAFC;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  border: 1px solid rgba(203,213,225,.4);
  border-radius: 14px;
  background: rgba(255,255,255,.04);
}
.segmented button {
  appearance: none;
  min-width: 64px;
  min-height: 48px;
  margin: 0;
  padding: 0 14px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #F8FAFC;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}
.segmented button[aria-checked="true"] { background: #1D4ED8; color: #fff; }

.toggle {
  appearance: none;
  flex: 0 0 auto;
  width: 72px;
  height: 48px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.toggle .track {
  position: relative;
  width: 64px;
  height: 36px;
  border-radius: 18px;
  background: #334155;
  border: 1px solid rgba(203,213,225,.45);
  transition: background 150ms;
}
.toggle .knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #F8FAFC;
  transition: transform 150ms;
}
.toggle[aria-checked="true"] .track { background: #1D4ED8; border-color: #1D4ED8; }
.toggle[aria-checked="true"] .knob { transform: translateX(28px); }
@media (prefers-reduced-motion: reduce) {
  .toggle .track, .toggle .knob { transition: none; }
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}
.slider-row input[type="range"] {
  flex: 1 1 auto;
  min-width: 0;
  height: 48px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  border-radius: 8px;
}
.slider-row input[type="range"]::-webkit-slider-runnable-track {
  height: 8px; border-radius: 4px; background: #334155;
}
.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 44px; height: 44px; margin-top: -18px;
  border-radius: 50%;
  background: #f5d76e;
  border: 3px solid #0b1f3a;
  box-shadow: 0 0 0 1px #f5d76e;
}
.slider-row input[type="range"]::-moz-range-track { height: 8px; border-radius: 4px; background: #334155; }
.slider-row input[type="range"]::-moz-range-progress { height: 8px; border-radius: 4px; background: #1D4ED8; }
.slider-row input[type="range"]::-moz-range-thumb {
  width: 38px; height: 38px; border-radius: 50%;
  background: #f5d76e; border: 3px solid #0b1f3a;
}
.slider-row input[type="range"]:disabled { opacity: .45; }
.slider-value {
  flex: 0 0 auto;
  min-width: 3.4em;
  text-align: right;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  color: #CBD5E1;
  font-variant-numeric: tabular-nums;
}

.sheet-howto {
  margin: 4px 0 16px;
  border: 1px solid rgba(203,213,225,.3);
  border-radius: 14px;
  background: rgba(255,255,255,.03);
}
.sheet-howto summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 14px;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  color: #F8FAFC;
  cursor: pointer;
  list-style: none;
  border-radius: 13px;
}
.sheet-howto summary::-webkit-details-marker { display: none; }
.sheet-howto summary::after { content: "▾"; display: inline-block; color: #f5d76e; font-size: 18px; line-height: 1; transition: transform 150ms; }
.sheet-howto[open] summary::after { transform: rotate(180deg); }
.howto-body { padding: 0 14px 14px; }
.howto-body p, .howto-body li {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.5;
  color: #CBD5E1;
  overflow-wrap: anywhere;
}
.howto-body strong { color: #F8FAFC; }
.howto-stats { list-style: none; margin: 10px 0 0; padding: 0; }
.howto-stats li {
  padding: 8px 0 0;
  border-top: 1px solid rgba(203,213,225,.18);
}

.sheet-footer {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.4;
  color: #94A3B8;
  text-align: center;
}
.sheet-row.is-off .slider-row { opacity: .55; }

/* ——— v3 Town layer: Towers | Town segmented control (in the one-row tray) ——— */
.tray-mode {
  flex: 0 0 auto;
  align-self: center;
  display: inline-flex;
  height: 48px;
  padding: 2px;
  gap: 2px;
  border: 2px solid #f5d76e;
  border-radius: 12px;
  background: #0b1f3a;
}
.tray-mode-btn {
  appearance: none;
  margin: 0;
  flex: 0 0 auto;
  min-width: 46px;
  min-height: 44px;
  height: 100%;
  padding: 0 2px;
  border: 0;
  border-radius: 9px;
  background: #fff;
  color: #0b1f3a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  overflow: visible;
}
.tray-mode-icon { font-size: 15px; line-height: 1; }
.tray-mode-label {
  font-size: 11px; /* baseline: text ≥11px (was 10.5px) */
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}
.tray-mode-btn[aria-checked="true"] {
  background: #1D4ED8;
  color: #fff;
  box-shadow: inset 0 -3px 0 #f5d76e;
}
.tray-mode-btn[aria-disabled="true"] { opacity: 0.55; cursor: default; }
.tray-mode-btn[aria-disabled="true"] .tray-mode-icon { filter: grayscale(1); }

.tray-town-hint {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  align-self: center;
  color: #F8FAFC;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
  overflow: visible;
}
.tray-town-hint[hidden] { display: none; }
.tray-town-hint .gold { color: #f5d76e; }
#play-tray[data-mode="town"] .tray-towers { display: none; }
#play-tray[data-mode="town"] .tray-start { flex: 0 0 auto; min-width: 88px; }

/* Narrow phones (<360): seg 2×46, towers 44, Start fills (≥56) */
@media (max-width: 359.98px) {
  .tray-row { gap: 4px; }
  .tray-towers { gap: 4px; }
  .tray-tower { width: 44px; min-width: 44px; border-width: 2px; padding: 1px; }
  .tray-tower.is-selected { border-width: 4px; }
  .tray-tower .tray-icon { font-size: 18px; }
  .tray-tower .tray-cost { font-size: 12px; letter-spacing: 0; }
  .tray-start { min-width: 56px; padding: 0 3px; font-size: 14px; letter-spacing: 0; }
  #play-tray[data-mode="town"] .tray-start { min-width: 80px; }
}
/* Regular phones (360–599): seg 2×52, towers 52 */
@media (min-width: 360px) and (max-width: 599.98px) {
  .tray-mode-btn { min-width: 52px; }
  .tray-mode-label { font-size: 11.5px; }
  .tray-tower { width: 52px; }
  .tray-start { min-width: 64px; padding: 0 6px; font-size: 16px; letter-spacing: 0.04em; }
}
@media (min-width: 400px) and (max-width: 599.98px) {
  .tray-tower { width: 56px; }
}
/* Tablet / desktop / landscape: inline icon + label */
@media (min-width: 600px) {
  .tray-mode-btn { flex-direction: row; gap: 6px; min-width: 92px; padding: 0 12px; }
  .tray-mode-icon { font-size: 17px; }
  .tray-mode-label { font-size: 15px; }
  .tray-town-hint { font-size: 15px; }
  #play-tray[data-mode="town"] .tray-start { flex: 0 1 260px; }
}

/* ——— v3 Plot bottom sheet (#plot-sheet shares #settings-sheet chrome) ——— */
.plot-sub {
  margin: -8px 0 14px;
  font-size: 15px;
  line-height: 1.4;
  color: #CBD5E1;
  overflow-wrap: anywhere;
}
.plot-sub .gold { color: #f5d76e; font-weight: 800; }
.plot-cards { display: grid; gap: 12px; }
.plot-card {
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(245,215,110,.45);
  border-radius: 14px;
  background: rgba(255,255,255,.04);
}
.plot-card.is-current { border-color: #f5d76e; box-shadow: inset 0 0 0 1px #f5d76e; }
.plot-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.plot-card-icon {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: #fff;
  border: 2px solid #f5d76e;
  font-size: 22px; line-height: 1;
}
.plot-card-name {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  color: #F8FAFC;
  overflow-wrap: anywhere;
}
.plot-card-desc {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.4;
  color: #CBD5E1;
  overflow-wrap: anywhere;
}
.plot-tiers { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 4px; }
.plot-tier {
  display: grid;
  grid-template-columns: 2em 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,.03);
  font-size: 14px;
  line-height: 1.3;
  color: #CBD5E1;
}
.plot-tier-num { font-weight: 800; color: #f5d76e; letter-spacing: 0.02em; }
.plot-tier-desc { overflow-wrap: anywhere; min-width: 0; }
.plot-tier-cost { font-weight: 800; color: #F8FAFC; white-space: nowrap; font-variant-numeric: tabular-nums; }
.plot-tier.is-built { background: rgba(29,78,216,.25); }
.plot-tier.is-built .plot-tier-cost { color: #93C5FD; }
.plot-tier.is-next { background: rgba(245,215,110,.12); box-shadow: inset 0 0 0 1px rgba(245,215,110,.55); color: #F8FAFC; }
.plot-tier.is-next.is-unaffordable .plot-tier-cost { color: #ff7a6b; }
.plot-tier.is-later { opacity: .6; }
.plot-action {
  appearance: none;
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 8px 14px;
  border: 0;
  border-radius: 12px;
  background: #1D4ED8;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 #f5d76e;
  overflow-wrap: anywhere;
}
.plot-action:hover:not(:disabled) { background: #2563EB; }
.plot-action:disabled {
  background: #1a2740;
  color: #94A3B8;
  box-shadow: inset 0 0 0 1px rgba(148,163,184,.4);
  cursor: default;
}
.plot-action-why { display: block; font-size: 13px; font-weight: 700; color: #ff9b8f; margin-top: 2px; }
.plot-maxed {
  margin: 0;
  min-height: 48px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: rgba(245,215,110,.14);
  color: #f5d76e;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}
.plot-empty {
  margin: 0;
  padding: 14px;
  border: 1px dashed rgba(203,213,225,.4);
  border-radius: 14px;
  font-size: 16px;
  line-height: 1.4;
  color: #CBD5E1;
  text-align: center;
  overflow-wrap: anywhere;
}
.plot-note {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.4;
  color: #94A3B8;
  text-align: center;
  overflow-wrap: anywhere;
}
.plot-note[hidden] { display: none; }

/* ——— v5 Restart level (settings sheet only; tray + plot sheet stay Start-only) ——— */
.sheet-restart {
  margin: 8px 0 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(203,213,225,.2);
}
.sheet-restart-btn,
.restart-cancel,
.restart-go {
  appearance: none;
  margin: 0;
  min-height: 48px;
  padding: 8px 16px;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}
.sheet-restart-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: #fff;
  color: #0b1f3a;
  border: 2px solid #0b1f3a;
  box-shadow: 0 0 0 1px rgba(245,215,110,.55);
}
.sheet-restart-btn:hover:not(:disabled) { background: #F1F5F9; }
.sheet-restart-btn:disabled {
  background: #1a2740;
  color: #94A3B8;
  border-color: rgba(148,163,184,.45);
  box-shadow: none;
  cursor: default;
}
.restart-soon { display: block; font-size: 13px; font-weight: 700; color: #CBD5E1; margin-top: 2px; }
.sheet-restart-btn[hidden], .restart-confirm[hidden], .restart-err[hidden] { display: none; }
.restart-confirm {
  padding: 14px;
  border: 1px solid #f5d76e;
  border-radius: 14px;
  background: rgba(245,215,110,.08);
}
.restart-q {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.3;
  color: #F8FAFC;
}
.restart-sub, .restart-err {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.4;
  color: #CBD5E1;
  overflow-wrap: anywhere;
}
.restart-err { color: #ffb4a9; font-weight: 700; }
.restart-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.restart-actions > button { flex: 1 1 120px; }
.restart-cancel {
  background: transparent;
  color: #F8FAFC;
  border: 1px solid rgba(203,213,225,.55);
}
.restart-cancel:hover { background: rgba(255,255,255,.08); }
.restart-go {
  background: #fff;
  color: #0b1f3a;
  border: 2px solid #0b1f3a;
  box-shadow: 0 0 0 1px #f5d76e;
}
.restart-go:hover { background: #F1F5F9; }
body.play-page .sheet-restart-btn:focus-visible,
body.play-page .restart-go:focus-visible,
body.play-page .restart-cancel:focus-visible {
  outline: 3px solid #f5d76e;
  outline-offset: 2px;
}

/* ——— v6 Between-waves build rule: Start/Next wave label, wave count, phase dimming ——— */
.tray-start { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.tray-start-label { display: block; line-height: 1.1; }
.tray-start-wave {
  display: none; /* phones: too narrow for a 2nd line beside Next wave */
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: none;
  line-height: 1.1;
  white-space: nowrap;
}
.tray-start.is-next { white-space: normal; letter-spacing: 0.02em; font-size: 15px; }
.tray-start.is-next .tray-start-label { overflow-wrap: normal; word-break: keep-all; text-align: center; }
@media (max-width: 359.98px) {
  .tray-start.is-next { font-size: 13px; letter-spacing: 0; padding: 0 2px; }
}
@media (min-width: 600px) {
  .tray-start-wave { display: block; }
  .tray-start.is-next { font-size: 17px; white-space: nowrap; }
}
.tray-start:disabled { opacity: 0.6; filter: saturate(0.4); }
.tray-tower.is-phase-locked {
  opacity: 0.45;
  filter: grayscale(0.7);
  cursor: not-allowed;
  border-color: #6b7a9a;
}
.tray-tower.is-phase-locked.is-selected { box-shadow: none; }

/* ——— Back to games picker (top-left, outside canvas) ——— */
.play-bar a.back-games {
  flex: 0 0 auto; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 10px; border: 2px solid #f5d76e; border-radius: 12px; color: #f5d76e; background: #0b1f3a;
  font-weight: 800; font-size: 14px; line-height: 1; text-decoration: none; white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
@media (max-width: 419.98px) { .play-bar .brand-text { display: none; } }

/* ——— Baseline batch 1 (2026-10-03): '← Games' inside modal sheets, tips replay ——— */
/* Pinned over the header link (JS copies its rect); top layer keeps it above ::backdrop. */
.sheet-back-games {
  position: fixed; z-index: 2;
  top: calc(8px + env(safe-area-inset-top)); left: calc(8px + env(safe-area-inset-left));
  box-sizing: border-box; min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 10px; border: 2px solid #f5d76e; border-radius: 12px; color: #f5d76e; background: #0b1f3a;
  font-weight: 800; font-size: 14px; line-height: 1; text-decoration: none; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.sheet-back-games:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.sheet-tips { margin: 12px 0 0; }
.sheet-tips-btn {
  width: 100%; min-height: 44px; border-radius: 12px; border: 2px solid #f5d76e;
  background: transparent; color: #f5d76e; font-weight: 800; font-size: 16px; cursor: pointer;
}
.sheet-tips-btn:hover, .sheet-tips-btn:focus-visible { background: rgba(245,215,110,.12); }
.plot-card-limit { margin: 4px 0 8px; font-size: 13px; font-weight: 700; color: #f5d76e; }
.plot-card.is-at-max { opacity: 0.72; }
