/* Olympus Ops play page — Presence chrome (header, hint, tray, settings sheet) v1 */
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; }

/* ——— 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 {
  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 { background: rgba(5,12,28,.62); backdrop-filter: blur(3px); }
#settings-sheet[open] { animation: sheet-fade 200ms ease-out; }

.sheet-handle { display: none; }

@media (max-width: 599.98px) {
  #settings-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] { 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] { 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 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
  color: #F8FAFC;
  letter-spacing: 0.01em;
}
#settings-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; }
