/* 839: two readable rows, then one complete ten-card hand. Original artwork only. */
.nest838-board {
  grid-template-rows: minmax(0, 1.25fr) minmax(0, 0.8fr);
}
.nest838-board.two-rows839 {
  grid-template-rows: minmax(0, 2.2fr) minmax(0, 1fr);
}
.nest838-zone {
  gap: 8px !important;
}
#nest838Hand[data-rows='2'] {
  grid-template-rows: repeat(2, minmax(0, 1fr)) !important;
}
#nest838Hand[data-rows='1'] {
  grid-template-rows: minmax(0, 1fr) !important;
}
@media (orientation: landscape) and (max-height: 320px) {
  .nest838-board.two-rows839 {
    grid-template-areas: 'hand nest';
    grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }
  .two-rows839 #nest838Nest {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(2, minmax(0, 1fr)) !important;
  }
  .two-rows839 .nest838-nest h3 span {
    display: none;
  }
  .nest838-sheet h3 {
    padding: 2px 7px !important;
  }
}
/* Landscape Kitty Received: same separate reveal + Continue as portrait. */
@media (orientation: landscape) {
  body.in-game #discardOverlay.gh-kitty-page:not(.manual-nest838):not(.hidden) {
    position: fixed !important;
    inset: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px !important;
    background: #0005 !important;
    z-index: 2147483510 !important;
  }
  body.in-game #discardOverlay.gh-kitty-page .discard-sheet.gh-kitty-page {
    box-sizing: border-box !important;
    width: min(580px, 90vw) !important;
    height: min(310px, calc(100dvh - 20px)) !important;
    max-height: none !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding: 12px 18px !important;
    border: 2px solid #b59a60 !important;
    border-radius: 12px !important;
    background: #102638 !important;
    overflow: hidden !important;
  }
  #discardOverlay.gh-kitty-page .gh-kitty-head {
    flex: none !important;
    text-align: center !important;
  }
  #discardOverlay.gh-kitty-page .gh-kitty-head h2 {
    margin: 0 !important;
    font: 700 24px Georgia !important;
  }
  #discardOverlay.gh-kitty-page .gh-kitty-head p {
    margin: 4px 0 0 !important;
    font: 13px Arial !important;
  }
  #discardOverlay.gh-kitty-page .gh-kitty-cards {
    min-height: 0 !important;
    flex: 1 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 7px !important;
    overflow: hidden !important;
  }
  #discardOverlay.gh-kitty-page .gh-kitty-cards > .gh-kitty-card {
    flex: 0 1 72px !important;
    width: 72px !important;
    height: auto !important;
    aspect-ratio: 580/840 !important;
    max-height: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
  }
  #discardOverlay.gh-kitty-page #kittyContinueBtn {
    flex: none !important;
    align-self: center !important;
    width: 160px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 5px !important;
    font-size: 18px !important;
  }
  /* Reachable, non-overlapping Menu / Leave / Fullscreen, including bidding. */
  body.in-game.angle-c-runtime .in-game-leave {
    display: grid !important;
    visibility: visible !important;
    pointer-events: auto !important;
    width: 94px !important;
    height: 76px !important;
    grid-template-columns: 44px 44px !important;
    grid-template-rows: 34px 36px !important;
    gap: 4px 6px !important;
    bottom: 8px !important;
    right: 8px !important;
  }
  body.in-game.angle-c-runtime .in-game-leave #tableFullscreen839 {
    grid-column: 1/-1 !important;
    grid-row: 1 !important;
    width: 94px !important;
    height: 34px !important;
    min-height: 34px !important;
    min-width: 0 !important;
    border: 1px solid #c7aa68 !important;
    border-radius: 7px !important;
    background: #101b21ed !important;
    color: #fff1c9 !important;
    font: 22px system-ui !important;
    padding: 0 !important;
    visibility: visible !important;
    display: block !important;
    pointer-events: auto !important;
  }
  body.in-game.angle-c-runtime .in-game-leave #tableFullscreen839::before {
    display: none !important;
  }
  body.in-game.angle-c-runtime #scoreSpeed701 {
    bottom: 92px !important;
  }
  body.in-game.angle-c-runtime .in-game-leave :is(#btnToggleTopOpts, #leaveReplaceBtn) {
    grid-row: 2 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
}
#tableFullscreen839 {
  display: none;
}
/* The old lt-hand-wrap is display:contents and cannot display a cue. Reuse the exact real front-face art. */
#landscapeHolderCue839 {
  display: none;
  pointer-events: none !important;
}
@media (orientation: landscape) {
  body.in-game.angle-c-runtime #landscapeHolderCue839 {
    display: block;
    position: fixed;
    z-index: 5;
    pointer-events: none !important;
  }
  #landscapeHolderCue839 > img {
    display: block;
    width: 100%;
    height: 100%;
    clip-path: inset(55% 5.5% 7% 5.5%);
    filter: brightness(1.65);
    opacity: 0;
    pointer-events: none;
  }
  #landscapeHolderCue839[data-holder-cue='turn'] > img {
    animation: holder793-turn 2200ms ease-in-out infinite !important;
  }
  #landscapeHolderCue839[data-holder-cue='win'] > img {
    animation: holder793-win 800ms ease-in-out 1 !important;
  }
  #landscapeHolderCue839[data-holder-reduced='true'][data-holder-cue] > img {
    animation: none !important;
    opacity: 0.65 !important;
  }
}
/* Finger scroll and Previous/Next share one continuous list; no hidden candidates. */
body .identity-dialog .identity-grid,
body #botPickerModal #botPickerGrid,
body #landingPartners783 .partner-photo-grid {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  touch-action: pan-y !important;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  min-height: 0 !important;
  align-content: start !important;
  -webkit-overflow-scrolling: touch;
}
body .identity-dialog .identity-grid {
  grid-auto-rows: 90px !important;
}
body #botPickerModal #botPickerGrid {
  grid-auto-rows: minmax(100px, max-content) !important;
}
body #landingPartners783 .partner-photo-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  grid-auto-rows: 72px !important;
  gap: 8px !important;
}
body #landingPartners783 .partner-photo-nav {
  display: flex !important;
}
@media (orientation: portrait) {
  body #landingPartners783[open] {
    display: grid !important;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto auto !important;
    height: min(680px, calc(100dvh - 24px)) !important;
    max-height: calc(100dvh - 24px) !important;
    overflow: hidden !important;
    padding: 14px !important;
    gap: 8px !important;
  }
  body #landingPartners783 [data-partner-control] {
    display: none !important;
  }
  body #landingPartners783 .partner-photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-rows: 92px !important;
  }
  body #landingPartners783 .partner-photo {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px !important;
    border: 1px solid #9f8754;
    border-radius: 7px;
    background: #122b40;
    color: #f5e7be;
    text-align: left;
  }
  body #landingPartners783 .partner-photo img,
  .partner-random {
    width: 42px;
    height: 60px;
    object-fit: cover;
  }
  body #landingPartners783 .partner-photo strong {
    font: 700 13px Georgia;
  }
  body #landingPartners783 .partner-photo small {
    display: block;
    font: 11px Arial;
  }
  body #landingPartners783 .partner-photo-nav {
    padding-right: 0;
    justify-content: space-between;
    gap: 5px;
  }
  body #landingPartners783 > [data-done] {
    position: static !important;
  }
}
@media (orientation: landscape) {
  body #landingPartners783[open] {
    grid-template-rows: auto auto auto minmax(0, 1fr) auto !important;
  }
}
@media (orientation: landscape) {
  body.in-game.angle-c-runtime #matchHeader706 #scoreSpeed701 {
    bottom: 92px !important;
  }
}
/* While sixteen remain, reserve the height for both hand rows. Nest sits alongside;
   after six discards the full-width ten-card row and lower Nest return. */
@media (orientation: landscape) and (min-height: 321px) {
  .nest838-board.two-rows839 {
    grid-template-areas: 'hand nest';
    grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }
  .two-rows839 #nest838Nest {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(3, minmax(0, 1fr)) !important;
  }
  .two-rows839 .nest838-nest h3 span {
    display: none;
  }
}
body .identity-dialog[aria-labelledby='identity-title'][open] {
  display: flex !important;
  flex-direction: column !important;
  height: min(680px, calc(100dvh - 20px)) !important;
  gap: 5px !important;
}
body .identity-dialog[aria-labelledby='identity-title'] .identity-grid {
  flex: 1 !important;
  min-height: 0 !important;
}
body
  .identity-dialog[aria-labelledby='identity-title']
  :is(.identity-dialog-head, .identity-pages, .choice-search836) {
  flex: none !important;
}
body .identity-dialog[aria-labelledby='identity-title'] .choice-search836 {
  margin: 0 !important;
}
@media (orientation: landscape) and (max-height: 340px) {
  body #landingPartners783[open] {
    padding: 8px !important;
    gap: 4px !important;
  }
  body #landingPartners783 .choice-search836 {
    margin: 0 !important;
    height: 28px !important;
    min-height: 28px !important;
    padding: 3px 8px !important;
  }
  body #landingPartners783 .partner-selection-status833 {
    margin: 0 !important;
    min-height: 14px !important;
    font: 12px/14px Arial !important;
  }
  body #landingPartners783 .partner-photo-nav {
    min-height: 30px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
  body #landingPartners783 .partner-photo-nav button {
    height: 30px !important;
    min-height: 30px !important;
  }
}

/* 840: stable sixteen-slot choice area. Empty slots keep the original dimensions. */
.nest838-hole840 {
  display: block;
  box-sizing: border-box;
  width: var(--w);
  height: var(--h);
  max-width: 100%;
  max-height: 100%;
  min-width: min(44px, 100%);
  min-height: min(44px, 100%);
  border: 1px dashed #bea56555;
  border-radius: 5px;
  background: #0001;
  pointer-events: none;
}
@media (orientation: landscape) {
  body.in-game.angle-c-runtime .in-game-leave {
    display: flex !important;
    flex-direction: row !important;
    width: 94px !important;
    height: 36px !important;
    gap: 6px !important;
    bottom: 10px !important;
  }
  body.in-game.angle-c-runtime #matchHeader706 #scoreSpeed701 {
    bottom: 54px !important;
  }
}
/* Installed Android fullscreen is provided by the launch window, not requestFullscreen. */
body.installed-fullscreen840 .room-fullscreen831 {
  display: none !important;
}
