/* Public playtest shell. The full internal demo remains available without ?playtest=1. */
body.playtest-mode:not(.high-contrast) {
  --bg: #0c1211;
  --panel: #17201e;
  --panel-deep: #202b28;
  --ink: #f5f7f2;
  --ink-soft: #f8e4aa;
  --muted: #aebcb6;
  --line: rgba(221, 235, 228, 0.2);
  --surface-faint: rgba(236, 245, 240, 0.07);
  --neon: #78d8cb;
  --cyan: #78d8cb;
  --neon-blue: #4c9f96;
  --magenta: #e17468;
  --hot: #f0c45d;
  --gold-light: #f0c45d;
  --gold-dark: #dc8a45;
  background: #0c1211;
}

body.playtest-mode {
  --ad-banner-space: 0px !important;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

body.playtest-mode .skip-links {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: var(--z-skip);
  white-space: nowrap;
}

body.playtest-mode .skip-link {
  top: -80px;
  white-space: nowrap;
}

body.playtest-mode .skip-link:focus {
  top: 8px;
}

body.playtest-mode .skip-link[aria-disabled="true"] {
  display: none !important;
}

body.playtest-mode [hidden] {
  display: none !important;
}

body.playtest-mode::before {
  opacity: 0.12;
  background-size: 56px 56px;
}

body.playtest-mode .app {
  width: min(1120px, 100%);
  padding: 16px;
}

body.playtest-mode header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 18, 17, 0.9);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
}

body.playtest-mode .title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

body.playtest-mode h1 {
  font-size: 25px;
  line-height: 1.1;
  text-shadow: none;
}

body.playtest-mode .sub {
  margin-top: 3px;
  font-size: 12px;
}

body.playtest-mode .playtest-build-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid rgba(240, 196, 93, 0.52);
  border-radius: 999px;
  background: rgba(240, 196, 93, 0.1);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
}

body.playtest-mode .header-actions,
body.playtest-mode .header-core,
body.playtest-mode .header-secondary {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

body.playtest-mode .header-actions {
  flex-wrap: nowrap;
}

body.playtest-mode button:not(.secondary) {
  border-color: rgba(248, 228, 170, 0.72);
  background: #e3b44f;
  color: #17140d;
  box-shadow: 0 8px 20px rgba(227, 180, 79, 0.18);
}

body.playtest-mode button.secondary {
  border-color: var(--line);
  background: rgba(236, 245, 240, 0.07);
  color: var(--ink);
  box-shadow: none;
}

body.playtest-mode button:not(:disabled):hover {
  border-color: rgba(248, 228, 170, 0.9);
  filter: brightness(1.08);
}

body.playtest-mode .header-core select,
body.playtest-mode .header-secondary button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 7px;
  overflow: hidden;
}

body.playtest-mode #langSelect {
  width: auto;
  min-width: 74px;
  padding: 0 9px;
}

body.playtest-mode #restartBtn {
  width: auto;
  min-width: 66px;
  padding: 0 10px;
}

body.playtest-mode #playtestFeedbackOpenBtn {
  width: auto;
  min-width: 68px;
  padding: 0 10px;
}

body.playtest-mode #achToast {
  display: none !important;
}

body.playtest-mode .layout {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

body.playtest-mode .card {
  border-radius: 8px;
  background: rgba(23, 32, 30, 0.94);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  backdrop-filter: none;
}

body.playtest-mode .layout > .card {
  padding: 14px;
}

body.playtest-mode .side {
  display: none !important;
}

body.playtest-mode .playtest-status-hud {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(130px, 0.8fr);
  gap: 8px;
  margin: 0 0 10px;
}

body.playtest-mode .playtest-progress {
  display: grid;
  gap: 6px;
  min-width: 0;
}

body.playtest-mode .playtest-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

body.playtest-mode .playtest-progress-meta strong {
  color: var(--ink-soft);
}

body.playtest-mode .playtest-progress-track {
  display: grid;
  grid-template-columns: repeat(15, minmax(0, 1fr));
  gap: 3px;
  height: 7px;
}

body.playtest-mode .playtest-progress-segment {
  min-width: 0;
  border-radius: 2px;
  background: rgba(236, 245, 240, 0.1);
}

body.playtest-mode .playtest-progress-segment.is-complete {
  background: #78d8cb;
}

body.playtest-mode .playtest-progress-segment.is-current {
  background: #f0c45d;
  box-shadow: 0 0 0 1px rgba(240, 196, 93, 0.28);
  animation: playtestProgressPulse 1.2s ease-in-out infinite alternate;
}

@keyframes playtestProgressPulse {
  from { opacity: 0.72; }
  to { opacity: 1; }
}

body.playtest-mode .playtest-hud-group {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-faint);
}

body.playtest-mode .playtest-hud-group .section-title {
  margin: 0 0 5px !important;
  color: var(--muted);
  font-size: 11px;
}

body.playtest-mode .playtest-truck-hud {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1.2fr);
  align-items: center;
  column-gap: 10px;
}

body.playtest-mode .playtest-truck-hud .section-title:first-child,
body.playtest-mode .playtest-truck-hud .truck {
  grid-column: 1;
}

body.playtest-mode .playtest-truck-hud .section-title:nth-of-type(2),
body.playtest-mode .playtest-truck-hud .queue {
  grid-column: 2;
}

body.playtest-mode .playtest-truck-hud .section-title:nth-of-type(2) {
  grid-row: 1;
}

body.playtest-mode .playtest-truck-hud .queue {
  grid-row: 2;
}

body.playtest-mode .playtest-truck-hud.queue-empty {
  grid-template-columns: minmax(0, 1fr);
}

body.playtest-mode .playtest-truck-hud.queue-empty .section-title:nth-of-type(2),
body.playtest-mode .playtest-truck-hud.queue-empty .queue {
  display: none;
}

body.playtest-mode .playtest-truck-hud.queue-empty .section-title:first-child,
body.playtest-mode .playtest-truck-hud.queue-empty .truck {
  grid-column: 1 / -1;
}

body.playtest-mode .playtest-hud-group .truck {
  min-height: 44px;
  gap: 6px;
  padding: 6px;
}

body.playtest-mode .playtest-status-hud .truck-color {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
}

body.playtest-mode .playtest-status-hud #truckText {
  font-size: 12px;
  white-space: nowrap;
}

body.playtest-mode .playtest-hud-group .queue {
  min-height: 38px;
}

body.playtest-mode .topbar {
  margin-bottom: 10px;
}

body.playtest-mode .status-pill {
  min-height: 32px;
  padding: 6px 9px;
  border-radius: 7px;
  background: var(--surface-faint);
  font-size: 12px;
}

body.playtest-mode .mechanics {
  margin-bottom: 8px;
}

body.playtest-mode .mechanics:empty {
  display: none;
}

body.playtest-mode .tag {
  border-radius: 6px;
}

body.playtest-mode .board-wrap {
  min-width: 0;
  justify-content: center;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(120, 216, 203, 0.18);
  border-radius: 8px;
  background: rgba(7, 12, 11, 0.36);
}

body.playtest-mode .board {
  border-radius: 8px;
  background: #111a18;
  border-color: rgba(120, 216, 203, 0.32);
  box-shadow: inset 0 0 34px rgba(120, 216, 203, 0.06);
}

body.playtest-mode .board::after,
body.playtest-mode .cell {
  border-radius: 6px;
}

body.playtest-mode .cell {
  background: rgba(235, 245, 240, 0.055);
}

body.playtest-mode .package {
  border-radius: 7px;
}

body.playtest-mode .risk-readout {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--muted);
  line-height: 1.45;
}

body.playtest-mode #toast {
  display: flex;
  align-items: center;
  min-height: 40px;
  margin: 0;
  padding: 8px 10px;
  border-color: rgba(120, 216, 203, 0.24);
  border-radius: 7px;
  background: rgba(7, 12, 11, 0.38);
  box-shadow: none;
  line-height: 1.4;
}

body.playtest-mode .playtest-feedback {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  text-align: left;
}

body.playtest-mode .playtest-feedback label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

body.playtest-mode .playtest-feedback input,
body.playtest-mode .playtest-feedback textarea,
body.playtest-mode .playtest-feedback select {
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111a18;
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

body.playtest-mode .playtest-feedback-status {
  min-height: 18px;
  color: var(--ink-soft);
  font-size: 12px;
}

body.playtest-mode .truck,
body.playtest-mode .objective-row,
body.playtest-mode .item-button {
  border-radius: 7px;
}

body.playtest-mode .objective-row {
  padding: 7px 9px;
}

body.playtest-mode .items {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.playtest-mode .item-button {
  min-height: 44px;
}

body.playtest-mode #pwaInstallBtn,
body.playtest-mode .ad-banner,
body.playtest-mode .ad-interstitial,
body.playtest-mode .keyhelp-fab,
body.playtest-mode #iapToast,
body.playtest-mode #monthlyPassToast {
  display: none !important;
}

body.playtest-mode #modal .modal-box {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  background: var(--panel);
  border-color: rgba(120, 216, 203, 0.42);
  box-shadow: 0 20px 64px rgba(0, 0, 0, 0.56);
  overflow: hidden;
}

body.playtest-mode #modalTitle {
  letter-spacing: 0;
}

body.playtest-mode #modalText {
  flex: 0 0 auto;
}

body.playtest-mode #modal .playtest-feedback:not([hidden]) {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

body.playtest-mode #modal .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 1;
  flex: 0 0 auto;
  margin-top: 8px;
  padding-top: 10px;
  background: var(--panel);
}

body.playtest-mode #modal .modal-actions button {
  min-height: 44px;
  border-radius: 7px;
}

body.playtest-mode .legal-footer {
  margin-top: 12px;
  color: var(--muted);
}

@media (min-width: 861px) {
  body.playtest-mode .layout > .card {
    display: grid;
    grid-template-columns: minmax(390px, 1fr) minmax(320px, 360px);
    grid-template-areas:
      "topbar topbar"
      "progress progress"
      "board hud"
      "board risk"
      "board toast";
    grid-template-rows: auto auto auto auto 1fr;
    column-gap: 14px;
    row-gap: 10px;
    align-items: start;
  }

  body.playtest-mode .topbar {
    grid-area: topbar;
    margin: 0;
  }

  body.playtest-mode .playtest-progress {
    grid-area: progress;
  }

  body.playtest-mode .board-wrap {
    grid-area: board;
    min-height: 430px;
    height: 100%;
  }

  body.playtest-mode .playtest-status-hud {
    grid-area: hud;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin: 0;
  }

  body.playtest-mode .risk-readout {
    grid-area: risk;
  }

  body.playtest-mode #toast {
    grid-area: toast;
    align-self: start;
  }
}

@media (max-width: 860px) {
  body.playtest-mode .app {
    padding: 10px;
  }

  body.playtest-mode header {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: 10px;
  }

  body.playtest-mode .header-actions {
    width: auto;
  }

  body.playtest-mode .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  body.playtest-mode .layout > .card {
    display: flex;
    flex-direction: column;
  }

  body.playtest-mode .layout > .card > .topbar {
    order: 1 !important;
  }

  body.playtest-mode .layout > .card > .playtest-progress {
    order: 2 !important;
    margin-bottom: 10px;
  }

  body.playtest-mode .layout > .card > .playtest-status-hud {
    order: 3 !important;
  }

  body.playtest-mode .layout > .card > .board-wrap {
    order: 4 !important;
  }

  body.playtest-mode .layout > .card > #riskReadout {
    order: 5 !important;
    margin-top: 8px;
  }

  body.playtest-mode .layout > .card > #toast {
    order: 6 !important;
    margin-top: 8px;
  }
}

@media (max-width: 600px), (max-width: 860px) and (max-height: 520px) {
  body.playtest-mode #playtestFeedbackOpenBtn::before {
    content: "\270E";
  }

  body.playtest-mode #motionBtn[aria-pressed="true"]::before {
    content: "\25B6";
  }

  body.playtest-mode #restartBtn,
  body.playtest-mode #playtestFeedbackOpenBtn {
    width: 44px;
    min-width: 44px;
    padding: 0;
  }
}

@media (max-width: 520px) {
  body.playtest-mode header {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  body.playtest-mode .header-actions,
  body.playtest-mode .header-core,
  body.playtest-mode .header-secondary {
    justify-content: flex-start !important;
  }

  body.playtest-mode .header-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
    gap: 8px;
  }

  body.playtest-mode .header-core {
    width: 100%;
  }

  body.playtest-mode .header-secondary {
    width: auto;
  }

  body.playtest-mode #langSelect {
    width: 100%;
  }

  body.playtest-mode h1 {
    font-size: 22px;
  }

  body.playtest-mode .playtest-build-badge {
    font-size: 10px;
  }

  body.playtest-mode .layout > .card {
    padding: 10px;
  }

  body.playtest-mode .playtest-status-hud {
    grid-template-columns: minmax(0, 1.6fr) minmax(88px, 0.75fr);
    gap: 6px;
  }

  body.playtest-mode .playtest-hud-group {
    padding: 7px;
  }

  body.playtest-mode .playtest-shelf-hud .slot {
    width: 38px;
    height: 38px;
    border-radius: 6px;
  }

  body.playtest-mode .playtest-truck-hud {
    grid-template-columns: minmax(112px, 1.25fr) minmax(0, 0.75fr);
    column-gap: 6px;
  }

  body.playtest-mode .playtest-hud-group .truck {
    padding: 6px;
  }

  body.playtest-mode .playtest-hud-group .queue {
    gap: 4px;
  }

  body.playtest-mode .playtest-hud-group .mini {
    min-width: 26px;
    padding: 4px;
    font-size: 10px;
  }

  body.playtest-mode .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }

  body.playtest-mode #goalInfo {
    flex: 1 1 100%;
  }
}

@media (max-width: 360px) {
  body.playtest-mode header .sub {
    display: none;
  }

  body.playtest-mode .playtest-progress {
    gap: 3px;
    margin-bottom: 6px;
  }

  body.playtest-mode .playtest-progress-meta {
    display: none;
  }

  body.playtest-mode .playtest-progress-track {
    height: 5px;
    gap: 2px;
  }

  body.playtest-mode .playtest-status-hud {
    grid-template-columns: minmax(0, 1fr) 68px;
  }

  body.playtest-mode .playtest-shelf-hud .slot {
    width: 32px;
    height: 32px;
  }

  body.playtest-mode .playtest-truck-hud {
    grid-template-columns: minmax(92px, 1.2fr) minmax(58px, 0.8fr);
  }

  body.playtest-mode .playtest-hud-group .section-title {
    white-space: nowrap;
    font-size: 10px;
  }

  body.playtest-mode .playtest-hud-group .mini {
    min-width: 24px;
  }

  body.playtest-mode .topbar {
    margin-bottom: 6px;
  }

  body.playtest-mode .status-pill {
    min-height: 28px;
    padding: 5px 7px;
    font-size: 11px;
  }

  body.playtest-mode .board-wrap {
    padding: 4px;
  }

  body.playtest-mode .risk-readout {
    min-height: 32px;
    padding: 6px 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (min-width: 600px) and (max-height: 520px) {
  body.playtest-mode .app {
    padding: 8px;
  }

  body.playtest-mode header {
    grid-template-columns: minmax(0, 1fr) auto;
    margin-bottom: 8px;
    padding: 7px 10px;
  }

  body.playtest-mode .sub {
    display: none;
  }

  body.playtest-mode .header-actions {
    width: 238px;
    min-width: 238px;
  }

  body.playtest-mode #langSelect {
    width: 88px;
    min-width: 88px;
    padding: 0 7px;
  }

  body.playtest-mode .header-secondary {
    flex: 0 0 auto;
  }

  body.playtest-mode .layout > .card {
    padding: 8px;
  }

  body.playtest-mode .playtest-status-hud {
    gap: 6px;
  }

  body.playtest-mode .playtest-progress-meta {
    display: none;
  }

  body.playtest-mode .playtest-progress {
    gap: 3px;
    margin-bottom: 6px;
  }

  body.playtest-mode #modal .modal-box {
    padding: 12px;
  }

  body.playtest-mode #modalTitle {
    margin: 0 0 4px;
    font-size: 20px;
  }

  body.playtest-mode #modalText {
    max-height: 48px;
    margin: 4px 0;
    overflow-y: auto;
    font-size: 12px;
  }

  body.playtest-mode #modal .playtest-feedback:not([hidden]) {
    min-height: 72px;
    margin: 4px 0;
    gap: 6px;
  }

  body.playtest-mode #modal .modal-actions {
    margin-top: 4px;
    padding-top: 6px;
  }
}
