/* ParkerSyndication — world-class mobile kit (all games)
   Loaded after each game's own CSS. Safe, additive, non-destructive. */
:root {
  --ps-safe-top: env(safe-area-inset-top, 0px);
  --ps-safe-right: env(safe-area-inset-right, 0px);
  --ps-safe-bottom: env(safe-area-inset-bottom, 0px);
  --ps-safe-left: env(safe-area-inset-left, 0px);
  --ps-tap: 44px;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  padding-left: var(--ps-safe-left);
  padding-right: var(--ps-safe-right);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Prefer dynamic viewport on modern mobile browsers */
@supports (height: 100dvh) {
  body { min-height: 100dvh; }
}

img, svg, video, canvas {
  max-width: 100%;
  height: auto;
}

/* Comfortable touch targets without breaking dense icon rows */
button,
.actBtn,
.goldBtn,
.miniBtn,
.pill,
.iconBtn,
.btn,
.btn-sm,
.splash-start,
.options button,
.opt,
.choice,
.numpad button,
.keypad button,
.keyboard button,
.letter,
.key {
  min-height: var(--ps-tap);
  touch-action: manipulation;
}

.iconBtn,
.btn-sm {
  min-width: var(--ps-tap);
  min-height: var(--ps-tap);
}

/* Inputs: prevent iOS auto-zoom (requires ≥16px) */
input, select, textarea {
  font-size: 16px;
}

/* Common Parker chrome: stack masthead + shrink brand on phones */
@media (max-width: 720px) {
  .masthead {
    flex-wrap: wrap !important;
    gap: 10px !important;
    padding: 12px 12px 8px !important;
    padding-top: max(12px, var(--ps-safe-top)) !important;
  }
  .brand h1 {
    font-size: clamp(1.05rem, 5.2vw, 1.45rem) !important;
    letter-spacing: 0.08em !important;
    line-height: 1.15 !important;
  }
  .brand .byline,
  .byline {
    font-size: 0.72rem !important;
  }
  .hud {
    width: 100%;
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .stage {
    padding-left: 12px !important;
    padding-right: 12px !important;
    padding-bottom: max(16px, var(--ps-safe-bottom)) !important;
  }
  .panel {
    margin-bottom: max(12px, var(--ps-safe-bottom));
  }
  /* Grid boards: never exceed viewport */
  .boardFrame,
  .board-wrap,
  .boardWrap,
  #board,
  .board {
    max-width: 100% !important;
  }
  .scoreRow {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .actionRow {
    flex-wrap: wrap !important;
  }
}

@media (max-width: 420px) {
  .masthead {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
  .chip.small .chipLabel {
    font-size: 0.62rem !important;
  }
  .actBtn span,
  .actBtn em {
    font-size: 0.72rem !important;
  }
}

/* Landscape phones: keep controls reachable */
@media (max-height: 480px) and (orientation: landscape) {
  .masthead {
    padding-top: 6px !important;
    padding-bottom: 4px !important;
  }
  .brand .byline { display: none !important; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Embed shells (iframe full-bleed) */
html.ps-embed, html.ps-embed body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}
html.ps-embed iframe#game {
  width: 100%;
  height: 100%;
  height: 100dvh;
  border: 0;
  display: block;
}

/* Loading chip used while async banks fetch */
.ps-loading-chip {
  position: fixed;
  left: 50%;
  bottom: max(16px, var(--ps-safe-bottom));
  transform: translateX(-50%);
  z-index: 99998;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(10, 22, 40, 0.92);
  border: 1px solid rgba(201, 162, 39, 0.45);
  color: #e8d9a0;
  font: 700 0.82rem/1.2 system-ui, -apple-system, sans-serif;
  letter-spacing: 0.04em;
  pointer-events: none;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.ps-loading-chip[hidden] { display: none !important; }
