/* Landing, about, lobby, and in-game guide overlay */

/* Fixed host so the guide stacks above landing hero (z-index: 1) and header menus */
#how-to-play-host {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
}

.how-to-play-site-layer {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  pointer-events: auto;
}

.how-to-play-site-layer[hidden] {
  display: none !important;
}

.how-to-play-site-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: oklch(8% 0.02 260 / 62%);
  backdrop-filter: blur(4px);
}

/* Full guide chrome — overrides game-modals .board-modal (420px setup dialogs) */
.how-to-play-site-layer dialog.board-modal.board-modal--guide {
  position: relative;
  z-index: 2;
  width: min(96vw, 1280px);
  max-width: min(96vw, 1280px);
  max-height: min(92vh, 860px);
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: none;
  border-radius: 16px;
  background: var(--panel);
  box-shadow:
    inset 0 0 0 1px oklch(100% 0 0 / 10%),
    0 24px 48px oklch(4% 0.02 260 / 55%);
  color: var(--text);
}

.how-to-play-site-layer dialog.board-modal.board-modal--guide:not([open]) {
  display: none;
}

/* Guide controls — same chrome as game sidebar buttons */
#how-to-play-host .mode-select {
  width: auto;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--glass-line);
  border-radius: 10px;
  background: oklch(24% 0.02 260 / 80%);
  color: var(--text);
  font: inherit;
  outline: none;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

#how-to-play-host .mode-select:hover:not(:disabled) {
  background: oklch(32% 0.03 260 / 90%);
  border-color: oklch(58% 0.06 260 / 45%);
  color: oklch(96% 0.02 260);
}

#how-to-play-host .mode-select:focus-visible {
  outline: 2px solid oklch(68% 0.12 250);
  outline-offset: 2px;
}

#how-to-play-host .mode-select--accent {
  font-weight: 600;
  border-color: oklch(72% 0.14 82);
  background: oklch(32% 0.08 82);
  color: oklch(94% 0.04 82);
}

#how-to-play-host .mode-select--accent:hover:not(:disabled) {
  border-color: oklch(78% 0.16 82);
  background: oklch(36% 0.1 82);
  color: oklch(98% 0.03 82);
}

#how-to-play-host .board-modal__table,
#how-to-play-host .how-to-play__table {
  color: var(--text);
}

/* Lock guide shell width and column ratio (avoids subgrid / game-page bleed) */
#how-to-play-host .how-to-play-shell,
#how-to-play-host .how-to-play-layout {
  width: 100%;
  min-width: 0;
}

#how-to-play-host .how-to-play__content,
#how-to-play-host .how-to-play__chapter {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
}

/* board.css .board-shell must not shrink the demo column on play/g pages */
#how-to-play-host .how-to-play-demo.board-shell {
  height: auto;
  padding: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

body.game-page #how-to-play-host,
body.game-page #how-to-play-host * {
  -webkit-user-select: text;
  user-select: text;
}
