/* Shared How to Play guide (Oct 19; play-guide.js). Plain, readable panels using the existing navy/cream/gold palette; no new art. */

/* ---- Phone: Info controls ---- */
/* Header icon, the same round navy control as the sound button. */
#playerContainer .playGuideBtn {
  width: 44px; height: 44px; min-width: 44px; max-width: 44px; padding: 0;
  border: 3px solid transparent !important; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4f86d8, #17418f 60%, #0b2a6b) padding-box, var(--lm-rail, #d9a441) border-box !important;
  box-shadow: 0 3px 0 #6b4712, 0 6px 10px #07182d4d !important;
  color: #fff8ec !important; display: grid; place-items: center; font-size: 20px; font-weight: 900; cursor: pointer;
}
#playerContainer .playerHeader:has(> .playGuideBtn):has(> .mascotMotionToggle) { grid-template-columns: minmax(0, 1fr) 44px 44px 44px; }
/* Below 360 px Leave Game needs the first row's width: How to play moves to the second row, left of the room code. */
@media (max-width: 359px) {
  #playerContainer .playerHeader:has(> .playGuideBtn):has(> .mascotMotionToggle) { grid-template-columns: minmax(0, 1fr) 44px 44px; }
  #playerContainer .playerHeader > .playGuideBtn { grid-row: 2; grid-column: 1; justify-self: start; }
  #playerContainer .playerHeader:has(> .playGuideBtn) > .playerRoomInfo { grid-row: 2; grid-column: 2 / -1; align-self: center; white-space: nowrap; }
}
/* Waiting screens: a text button in the same navy material as Leave Game. */
#playerContainer .waitingGuideBtn {
  display: block; margin: 12px auto 0; min-height: 44px; padding: 8px 18px; font-weight: 800; cursor: pointer;
  border: 4px solid #c08a2a !important; border-image: var(--lm-navy-art, none) 56 76 fill / 20px 27px stretch !important;
  background: #123c8a padding-box !important; color: #fff7e5 !important; border-radius: 999px;
  box-shadow: 0 3px 0 #6b4712, 0 7px 12px #07182d4d !important;
}
#playerContainer :is(.playGuideBtn, .waitingGuideBtn):focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* ---- Phone: the guide panel ---- */
#playerContainer .playGuide {
  position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 16px; box-sizing: border-box;
  background: #07182dcc;
}
#playerContainer .playGuideCard {
  width: min(460px, 100%); max-height: calc(100dvh - 32px); overflow: auto; box-sizing: border-box;
  background: #17418f; color: #fff7e5; border: 3px solid #d9a441; border-radius: 18px; padding: 18px 20px 16px;
  box-shadow: 0 16px 50px #0009;
}
.playGuideContent h2 { margin: 0 0 8px; color: #ffe39b; font-size: 22px; line-height: 1.2; }
.playGuideContent h2:focus { outline: none; }
.playGuideContent h2:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.playGuideContent section { margin: 10px 0 0; }
.playGuideContent h3 { margin: 0 0 4px; color: #ffe39b; font-size: 16px; }
.playGuideContent ul { margin: 0; padding-left: 20px; }
.playGuideContent li { margin: 3px 0; line-height: 1.4; font-size: 15px; }
.playGuidePhone .playGuideSupplies { border-top: 1px solid #ffe39b66; padding-top: 8px; }
#playerContainer .playGuideClose {
  display: block; width: 100%; margin-top: 14px; min-height: 44px; font-weight: 800; font-size: 16px; cursor: pointer;
  background: #f8cf4f !important; color: #172a4f !important; border: 3px solid #c08a2a !important; border-radius: 999px;
}
#playerContainer .playGuideClose:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* ---- TV: the guide beside the join card (host-controlled, before play) ---- */
#screenTVDisplay .tvGuide { display: none; }
/* Left-aligned so the TV's own Fullscreen / Enable sound buttons (top right) stay clear of the guide. */
#screenTVDisplay .tvOverlay.withGuide { gap: 24px; justify-content: flex-start; padding-left: 3vw; }
#screenTVDisplay .tvOverlay.withGuide .tvGuide {
  display: block; width: min(800px, 60vw); box-sizing: border-box; padding: 14px 22px; text-align: left;
  max-height: calc((100vh - 44px) / var(--tv-ui-scale, 1)); overflow: hidden;
  background: rgba(18,34,60,.97); color: #fff7e5; border: 2px solid #d9a441; border-radius: 24px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6); transform: scale(var(--tv-ui-scale, 1)); transform-origin: left center;
}
/* The join card stays complete (logo, room code, QR, status) and the QR keeps its normal size (styles.css: up to 460 px, at most
   44vh), so phones can still scan it from across the room; only the logo is smaller. On a screen too narrow for both, the QR
   shrinks to the card rather than spilling out of it. */
#screenTVDisplay .tvOverlay.withGuide .tvOverlayCard { width: min(540px, 30vw); }
#screenTVDisplay .tvOverlay.withGuide .tvOverlayLogo { max-height: 15vh; }
#screenTVDisplay .tvOverlay.withGuide .tvOverlayQR { max-width: 100%; }
/* Two columns at TV distance; the title and the paper-player list span both. */
.playGuideTV { column-count: 2; column-gap: 26px; }
.playGuideTV h2 { font-size: 30px; margin-bottom: 4px; column-span: all; }
.playGuideTV h3 { font-size: 20px; }
.playGuideTV li { font-size: 17px; line-height: 1.26; margin: 1px 0; }
.playGuideTV section { margin-top: 6px; break-inside: avoid; }
/* Paper players: the supply list stands out (gold panel, larger type). */
.playGuideTV .playGuideSupplies { column-span: all; background: #f8cf4f; color: #172a4f; border-radius: 16px; padding: 10px 16px; margin-top: 12px; }
.playGuideTV .playGuideSupplies h3 { color: #172a4f; font-size: 23px; }
.playGuideTV .playGuideSupplies li { font-size: 21px; font-weight: 800; }
/* The short items share a line (the long first item wraps on its own), so the full list fits at 1280×720 with every rule set. */
.playGuideTV .playGuideSupplies ul { display: flex; flex-wrap: wrap; column-gap: 40px; }
.playGuideTV .playGuideSupplies li { display: list-item; }
.playGuideTV .playGuideSupplies li:first-child { flex-basis: 100%; }
@media (prefers-reduced-motion: reduce) { #screenTVDisplay .tvOverlay.withGuide .tvGuide { transition: none; } }
