/* Tactile American Mahjong Live Parlor Table & 3D Layered Tile Match */

.guide-content,
.guide-section {
  min-width: 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
}

.toc a {
  display: block;
  padding: 4px 0;
}

.pg-shell {
  background: var(--sheet);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 18px;
  margin: 16px 0 26px;
  box-shadow: var(--shadow-card);
  position: relative;
}

.pg-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.pg-tab-btn {
  position: relative;
  appearance: none;
  min-height: 56px;
  padding: 10px 68px 10px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface-hover);
  color: var(--ink-pine);
  font: 700 14.5px/1.25 var(--sans);
  text-align: left;
  cursor: pointer;
  transition: transform 120ms ease;
}

.pg-tab-btn small {
  display: block;
  font: 500 11.5px/1.3 var(--sans);
  opacity: 0.9;
  margin-top: 3px;
}

.pg-tab-btn[aria-selected="true"] {
  background: #164632;
  border: 2px solid #164632;
  color: #ffffff;
  box-shadow: inset 0 -4px 0 #f6d77e;
}

.pg-tab-btn[aria-selected="true"]::after {
  content: 'ACTIVE';
  position: absolute;
  top: 8px;
  right: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f6d77e;
  color: #14281e;
  font: 800 10px/1.2 var(--sans);
  letter-spacing: 0.06em;
}

/* #26: Unmistakable Baize dark-theme active vs inactive tab contrast & non-color indicator */
html[data-salon-theme="baize"] .pg-tab-btn,
[data-theme="baize"] .pg-tab-btn {
  background: #10241c;
  border-color: rgba(255, 255, 255, 0.24);
  color: #e6f2ec;
}

html[data-salon-theme="baize"] .pg-tab-btn[aria-selected="true"],
[data-theme="baize"] .pg-tab-btn[aria-selected="true"] {
  background: #f6d77e;
  border: 2px solid #fff3c4;
  color: #13251c;
  box-shadow: inset 0 -4px 0 #164632;
}

html[data-salon-theme="baize"] .pg-tab-btn[aria-selected="true"]::after,
[data-theme="baize"] .pg-tab-btn[aria-selected="true"]::after {
  background: #164632;
  color: #fffdf8;
}

.pg-felt {
  position: relative;
  border-radius: 13px;
  padding: 16px;
  background:
    radial-gradient(ellipse at 50% 32%, rgba(44, 118, 86, 0.45), transparent 68%),
    linear-gradient(160deg, #174431 0%, #0e2c1f 100%);
  color: #f7f3ea;
  border: 2px solid #295944;
  box-shadow: inset 0 0 36px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

/* #25: Split tabpanel outer focus ring (high contrast on Linen #fffdf8 & Baize dark) from inner button gold focus ring */
.pg-felt:focus-visible {
  outline: 3px solid #164632;
  outline-offset: 2px;
  box-shadow: inset 0 0 0 3px #f6d77e, inset 0 0 36px rgba(0, 0, 0, 0.35);
}

html[data-salon-theme="baize"] .pg-felt:focus-visible,
[data-theme="baize"] .pg-felt:focus-visible {
  outline: 3px solid #f6d77e;
  outline-offset: 2px;
}

.pg-felt :focus-visible {
  outline: 3px solid #f6d77e;
  outline-offset: 2px;
}

.pg-confetti-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}

.pg-hud {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 10px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.pg-stats,
.pg-controls-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.pg-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font: 700 12px/1.2 var(--sans);
  color: #f7f3ea;
}

.pg-stat.gold {
  background: #e8c772;
  color: #15281e;
  border-color: #f4d88a;
}

.pg-mini-btn {
  appearance: none;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: #123627;
  color: #fffdf8;
  font: 700 12.5px/1.2 var(--sans);
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}

.pg-mini-btn:hover:not(:disabled) {
  background: #194a36;
  transform: translateY(-1px);
}

.pg-mini-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pg-mini-btn.primary {
  background: #f5ebd5;
  color: #143225;
  border-color: #f5ebd5;
}

.pg-mini-btn.primary:hover:not(:disabled) {
  background: #ffffff;
}

.pg-mini-btn.gold-cta {
  background: linear-gradient(180deg, #f6d77e 0%, #dfb244 100%);
  color: #12180c;
  border-color: #fff0be;
  box-shadow: 0 4px 16px rgba(235, 194, 88, 0.45);
  font-size: 13.5px;
  padding: 8px 16px;
}

.pg-mini-btn.gold-cta:hover:not(:disabled) {
  background: linear-gradient(180deg, #fce294 0%, #e5bc50 100%);
  color: #12180c;
}

/* Target Hand Strip */
.pg-targets-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.pg-target-card {
  appearance: none;
  text-align: left;
  padding: 9px 10px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #0e2c1f;
  color: #f7f3ea;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.pg-target-card:hover {
  border-color: rgba(246, 215, 126, 0.72);
}

/* #24: Solid dark focused background guarantees >= 10:1 WCAG contrast on 12.5px gold notation everywhere */
.pg-target-card.is-focused {
  border: 2px solid #f6d77e;
  background: #133827;
  box-shadow: 0 0 0 1px rgba(246, 215, 126, 0.35);
}

.pg-target-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.pg-target-name {
  font: 700 12px/1.2 var(--sans);
  color: #fffdf8;
}

.pg-target-away {
  font: 800 10.5px/1.1 var(--sans);
  padding: 2px 6px;
  border-radius: 999px;
  background: #102a1f;
  color: #f7e5a8;
  white-space: nowrap;
}

.pg-target-card.is-dead {
  border: 1px solid rgba(232, 125, 99, 0.6);
  background: #12201b;
}

/* #27: Focused dead hand stays visibly distinct from unfocused dead hands */
.pg-target-card.is-dead.is-focused {
  border: 2px solid #f6d77e;
  background: #1d2f27;
  box-shadow: 0 0 0 1px rgba(246, 215, 126, 0.45);
}

.pg-target-card.is-dead .pg-target-notation,
.pg-target-card.is-dead .pg-target-sub {
  opacity: 0.9;
}

.pg-target-card.is-locked {
  cursor: default;
}

.pg-target-away.is-hot {
  background: #176b40;
  color: #ffffff;
}

.pg-target-away.is-dead {
  background: #992616;
  color: #ffffff;
}

.pg-target-notation {
  font: 700 12.5px/1.3 ui-monospace, SFMono-Regular, monospace;
  letter-spacing: 0.03em;
  color: #fde9a6;
  margin-bottom: 3px;
}

.pg-target-sub {
  font: 500 10.5px/1.28 var(--sans);
  color: #e6f2ec;
}

.pg-progress-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  margin-top: 6px;
  overflow: hidden;
}

.pg-progress-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #5fd396, #e8c772);
  border-radius: 999px;
  transition: width 220ms ease;
}

/* Bot Seats + Discard Floor */
.pg-bots-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.pg-bot-seat {
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: border-color 160ms ease, background 160ms ease;
}

.pg-bot-seat.is-active {
  border-color: #e8c772;
  background: rgba(232, 199, 114, 0.14);
  animation: pgBotPulse 1.6s ease-in-out infinite;
}

.pg-bot-last-action {
  margin-top: 4px;
  font: 600 10.5px/1.2 var(--sans);
  color: #fde9a6;
}

.pg-bot-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font: 700 11.5px/1.2 var(--sans);
  color: #fffdf8;
  margin-bottom: 5px;
}

.pg-bot-head span {
  font-weight: 500;
  color: #d8ebe0;
  font-size: 10.5px;
}

.pg-bot-exposures {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 36px;
  align-items: center;
}

.pg-bot-exposures .tile-face {
  width: 26px;
  height: 36px;
  box-shadow: 0 2px 0 #b7ae98;
}

.pg-bot-exposures .tile-index {
  font-size: 6.5px;
}

.pg-discard-floor {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(7, 24, 17, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 12px;
}

.pg-floor-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 8px;
  font: 700 11px/1.2 var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #d8ebe0;
}

.pg-last-throw {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(246, 215, 126, 0.18);
  border: 1px solid rgba(246, 215, 126, 0.65);
  color: #fde9a6;
  font: 700 11px/1.2 var(--sans);
  letter-spacing: 0.02em;
  text-transform: none;
}

.pg-last-throw[hidden],
.pg-coach-bar[hidden],
.pg-stat[hidden] {
  display: none !important;
}

.pg-coach-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 12px;
  padding: 9px 12px;
  margin-bottom: 10px;
  border-radius: 9px;
  background: #0c271c;
  border: 1px solid rgba(105, 228, 161, 0.45);
  border-left: 4px solid #69e4a1;
  font: 600 12.5px/1.38 var(--sans);
  color: #eef9f2;
}

.pg-coach-bar strong {
  color: #8bf0b8;
}

.pg-coach-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.pg-coach-btn {
  appearance: none;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid rgba(139, 240, 184, 0.55);
  background: #143f2d;
  color: #fffdf8;
  font: 700 11.5px/1.2 var(--sans);
  cursor: pointer;
}

.pg-coach-btn:hover {
  background: #1b543c;
}

.pg-coach-btn.is-ghost {
  border-color: rgba(255, 255, 255, 0.28);
  background: transparent;
  color: #d8ebe0;
}

.pg-coach-btn.is-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

.pg-discards-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 46px;
  max-height: 156px;
  overflow-y: auto;
  align-items: center;
  padding-right: 4px;
}

.pg-discards-list .tile-face {
  width: 32px;
  height: 45px;
  box-shadow: 0 2px 0 #bfb69f;
}

.pg-discards-list .tile-face.is-latest {
  outline: 2.5px solid #f0cf7b;
  outline-offset: 1px;
  transform: scale(1.08);
}

.pg-discards-list .tile-face.is-just-thrown {
  animation: pgTileDrop 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.pg-discards-list .tile-index {
  font-size: 7.5px;
}

/* Action Banner (Call / Swap Joker / Charleston / Mah Jongg) — R5 #22 solid dark emerald guarantees >= 10:1 AA contrast on both themes */
.pg-action-banner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  background: #103224;
  border: 1.5px solid #e8c772;
  margin-bottom: 12px;
  font: 600 13.5px/1.4 var(--sans);
  color: #fffaf0;
}

.pg-action-banner.is-win {
  background: #0d2b1e;
  border: 2px solid #8bf0b8;
  box-shadow: 0 0 0 1px rgba(139, 240, 184, 0.35);
}

/* Wooden Player Rack */
.pg-player-area {
  padding: 12px 14px 14px;
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(105, 68, 36, 0.52) 0%, rgba(71, 44, 21, 0.72) 100%);
  border: 1px solid rgba(226, 188, 134, 0.35);
  box-shadow: inset 0 2px 0 rgba(255, 232, 192, 0.16), 0 8px 20px rgba(0, 0, 0, 0.25);
}

.pg-rack-top-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font: 700 11.5px/1.2 var(--sans);
  color: #f8e9ca;
}

.pg-player-exposures[hidden],
.pg-result-panel[hidden],
.pg-felt[hidden] {
  display: none !important;
}

.pg-player-exposures {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(248, 233, 202, 0.26);
}

.pg-meld-group {
  display: inline-flex;
  gap: 3px;
  padding: 4px 6px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.22);
}

.pg-meld-group .tile-face {
  width: 34px;
  height: 48px;
}

.pg-rack-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-end;
  min-height: 78px;
}

.pg-rack-tile {
  position: relative;
  appearance: none;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  transition: transform 130ms cubic-bezier(0.22, 1, 0.36, 1), border-color 130ms ease;
}

.pg-rack-tile.is-inactive {
  cursor: default;
}

.pg-rack-tile.is-inactive:hover {
  transform: none;
}

.pg-rack-tile:hover {
  transform: translateY(-6px);
}

.pg-rack-tile.is-selected {
  transform: translateY(-13px);
  border-color: #f6d77e;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.36);
}

.pg-rack-tile.is-drawn {
  animation: pgTileDrawIn 240ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.pg-rack-tile.is-drawn::before {
  content: 'NEW';
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 5px;
  border-radius: 999px;
  background: #f6d77e;
  color: #19261b;
  font: 800 9px/1.2 var(--sans);
  letter-spacing: 0.04em;
}

.pg-rack-tile.is-keeper::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #69e4a1;
}

.pg-rack-tile .tile-face {
  width: 48px;
  height: 68px;
  box-shadow: 0 4px 0 #c9bfa9, 0 6px 12px rgba(0, 0, 0, 0.28);
}

/* Win / Wall-Game Modal Card */
.pg-result-panel {
  margin-top: 12px;
  padding: 16px 18px;
  border-radius: 11px;
  background: rgba(12, 37, 26, 0.92);
  border: 1.5px solid #e8c772;
}

.pg-result-panel h3 {
  margin: 0 0 6px;
  font: 700 22px/1.25 var(--serif);
  color: #fffdf8;
}

.pg-result-panel p {
  margin: 0 0 12px;
  color: rgba(247, 243, 234, 0.92);
}

/* Mode 2: 3D Layered American Mahjong Solitaire (compact 464px board + clean mobile scaling) */
.sol-stage-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  overflow: hidden;
  padding: 8px 0 12px;
}

.sol-board {
  position: relative;
  flex: 0 0 452px;
  width: 452px;
  height: 468px;
  margin: 0 auto;
  transform-origin: top center;
}

.sol-tile-btn {
  position: absolute;
  appearance: none;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: transform 130ms ease, filter 130ms ease, opacity 180ms ease;
}

.sol-tile-btn .tile-face {
  width: 52px;
  height: 70px;
  border-radius: 6px;
  border: 1px solid #c9bfaa;
  background: linear-gradient(180deg, #fffef9 0%, #f5efe0 100%);
  box-shadow:
    3px 4px 0 #c5b89a,
    4px 5px 0 #9f8f6f,
    6px 10px 14px rgba(0, 0, 0, 0.36);
}

.sol-tile-btn.is-blocked {
  cursor: default;
  filter: brightness(0.76) saturate(0.82);
}

.sol-tile-btn.is-free:hover {
  transform: translate(-2px, -4px);
}

.sol-tile-btn.is-selected .tile-face {
  outline: 3px solid #f6d77e;
  outline-offset: 1px;
  box-shadow:
    3px 4px 0 #d4af4c,
    0 0 20px rgba(246, 215, 126, 0.72);
}

.sol-tile-btn.is-hint .tile-face {
  outline: 3px solid #69e4a1;
  outline-offset: 2px;
  box-shadow: 0 0 18px rgba(105, 228, 161, 0.78);
  animation: solHintPulse 1.3s ease-in-out infinite;
}

@keyframes pgTileDrop {
  0% {
    opacity: 0;
    transform: translateY(-16px) scale(1.2);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1.08);
  }
}

@keyframes pgTileDrawIn {
  0% {
    opacity: 0.25;
    transform: translateY(-12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pgBotPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(232, 199, 114, 0.22);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(232, 199, 114, 0.32);
  }
}

@keyframes solHintPulse {
  0%, 100% {
    box-shadow: 0 0 14px rgba(105, 228, 161, 0.65);
  }
  50% {
    box-shadow: 0 0 24px rgba(105, 228, 161, 0.95);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pg-bot-seat.is-active,
  .pg-discards-list .tile-face.is-just-thrown,
  .pg-rack-tile.is-drawn,
  .sol-tile-btn.is-hint .tile-face {
    animation: none !important;
  }
}

.sol-callout {
  min-height: 24px;
  margin-top: 4px;
  font: 700 13.5px/1.35 var(--sans);
  color: #f6d77e;
  text-align: center;
}

@media (max-width: 900px) {
  .pg-targets-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .pg-mode-tabs,
  .pg-bots-row {
    grid-template-columns: 1fr;
  }

  .pg-targets-grid {
    grid-template-columns: 1fr;
  }

  .pg-shell {
    padding: 12px;
  }

  .pg-felt {
    padding: 12px;
  }

  .pg-rack-tile .tile-face {
    width: 40px;
    height: 56px;
  }
}

@media (max-width: 560px) {
  .sol-stage-wrap {
    height: 328px;
  }

  .sol-board {
    transform: scale(0.66);
  }
}

@media (max-width: 390px) {
  .sol-stage-wrap {
    height: 256px;
  }

  .sol-board {
    transform: scale(0.5);
  }
}
