/*
 * Mobile table mode v25.
 * A landscape phone receives the complete desktop table at a readable size.
 * The page may scroll in both directions; nothing is scaled into a thumbnail.
 */

/* Chronicle entries keep their content and scroll inside the chronicle. */
.game-log-panel.np-visible-chronicle .game-event-list{
  min-height:0!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
}

.game-log-panel.np-visible-chronicle .game-event{
  display:grid!important;
  flex:0 0 auto!important;
  grid-template-columns:24px minmax(0,1fr)!important;
  grid-auto-rows:auto!important;
  min-height:54px!important;
  height:auto!important;
  overflow:visible!important;
}

.game-log-panel.np-visible-chronicle .game-event p{
  display:block!important;
  min-width:0!important;
  height:auto!important;
  overflow:visible!important;
  visibility:visible!important;
  white-space:normal!important;
  overflow-wrap:anywhere!important;
}

/* Old ring coordinates must never move player three and four out of line. */
.game-page .game-player-header>.table-player-card,
.game-page .game-player-header>.table-player-card:nth-child(n){
  inset:auto!important;
  top:auto!important;
  right:auto!important;
  bottom:auto!important;
  left:auto!important;
  margin:0!important;
  transform:none!important;
}

html.np-mobile-table-mode,
html.np-mobile-table-mode body{
  width:auto!important;
  min-width:100%!important;
  height:auto!important;
  min-height:100%!important;
  overflow:auto!important;
  overscroll-behavior:auto!important;
  scrollbar-gutter:stable both-edges;
}

html.np-mobile-table-mode body>#root{
  width:auto!important;
  min-width:1080px!important;
  height:auto!important;
  min-height:100dvh!important;
  overflow:visible!important;
}

html.np-mobile-table-mode .game-page{
  box-sizing:border-box!important;
  width:1080px!important;
  min-width:1080px!important;
  max-width:none!important;
  min-height:980px!important;
  height:auto!important;
  padding-bottom:82px!important;
  overflow:visible!important;
}

html.np-mobile-table-mode .game-page .game-topbar{
  position:relative!important;
  inset:auto!important;
  z-index:32!important;
  display:grid!important;
  box-sizing:border-box!important;
  width:1040px!important;
  min-width:1040px!important;
  height:164px!important;
  min-height:164px!important;
  margin:0 auto!important;
  grid-template-columns:180px minmax(0,1fr) 220px!important;
  grid-template-rows:64px 92px!important;
  gap:4px 12px!important;
  padding:4px 8px!important;
  align-items:center!important;
  overflow:visible!important;
}

html.np-mobile-table-mode .game-page .game-menu-button{
  position:relative!important;
  inset:auto!important;
  grid-column:1!important;
  grid-row:1!important;
  justify-self:start!important;
  align-self:center!important;
  transform:none!important;
  min-width:116px!important;
  min-height:48px!important;
  padding:10px 16px!important;
  font-size:.72rem!important;
}

html.np-mobile-table-mode .game-page .game-title{
  position:relative!important;
  inset:auto!important;
  display:flex!important;
  grid-column:2!important;
  grid-row:1!important;
  justify-self:center!important;
  align-self:center!important;
  transform:none!important;
}

html.np-mobile-table-mode .game-page .game-title img{
  width:160px!important;
  max-height:62px!important;
  object-fit:contain!important;
}

html.np-mobile-table-mode .game-page .turn-indicator{
  position:relative!important;
  inset:auto!important;
  grid-column:3!important;
  grid-row:1!important;
  justify-self:end!important;
  align-self:center!important;
  transform:none!important;
  min-width:190px!important;
  max-width:260px!important;
  padding-left:12px!important;
}

html.np-mobile-table-mode .game-page .turn-indicator strong{
  max-width:240px!important;
  font-size:.78rem!important;
}

html.np-mobile-table-mode .game-page .game-topbar>.realtime-status{
  position:absolute!important;
  top:46px!important;
  left:50%!important;
  z-index:35!important;
  display:block!important;
  min-width:110px!important;
  padding:3px 8px!important;
  transform:translateX(-50%)!important;
  font-size:.62rem!important;
}

/* Four complete player cards remain visible above the table. */
html.np-mobile-table-mode .game-page .game-player-header.table-player-ring,
html.np-mobile-table-mode .game-page .np-stable-player-header{
  position:relative!important;
  inset:auto!important;
  z-index:28!important;
  display:grid!important;
  box-sizing:border-box!important;
  width:1000px!important;
  min-width:1000px!important;
  height:88px!important;
  min-height:88px!important;
  margin:0 auto!important;
  padding:4px!important;
  grid-column:1 / -1!important;
  grid-row:2!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  align-items:start!important;
  gap:7px!important;
  overflow:hidden!important;
  pointer-events:auto!important;
}

html.np-mobile-table-mode .game-page .game-player-header>.table-player-card,
html.np-mobile-table-mode .game-page .game-player-header>.table-player-card:nth-child(n){
  position:relative!important;
  box-sizing:border-box!important;
  width:100%!important;
  min-width:0!important;
  max-width:none!important;
  height:80px!important;
  min-height:80px!important;
  max-height:80px!important;
  align-self:start!important;
  overflow:hidden!important;
}

html.np-mobile-table-mode .game-page .game-player-header .table-player-card>header{
  display:grid!important;
  grid-template-columns:42px minmax(0,1fr)!important;
  align-items:center!important;
  gap:6px!important;
  overflow:hidden!important;
}

html.np-mobile-table-mode .game-page .game-player-header .table-player-token{
  position:relative!important;
  inset:auto!important;
  width:40px!important;
  min-width:40px!important;
  max-width:40px!important;
  height:40px!important;
  min-height:40px!important;
  max-height:40px!important;
  margin:0!important;
  transform:none!important;
}

html.np-mobile-table-mode .game-page .game-player-header .table-player-card>header>div{
  min-width:0!important;
  overflow:hidden!important;
}

html.np-mobile-table-mode .game-page .game-player-header .table-player-card>header :is(b,small){
  display:block!important;
  max-width:100%!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}

/* Desktop-sized board and sidebar. The viewport scrolls to reveal them. */
html.np-mobile-table-mode .game-page .game-layout{
  display:grid!important;
  box-sizing:border-box!important;
  width:980px!important;
  min-width:980px!important;
  max-width:none!important;
  height:auto!important;
  min-height:620px!important;
  margin:0 auto!important;
  padding:0!important;
  grid-template-columns:620px 346px!important;
  align-items:start!important;
  gap:14px!important;
  overflow:visible!important;
}

html.np-mobile-table-mode .game-page .board-shell{
  display:flex!important;
  box-sizing:border-box!important;
  width:620px!important;
  min-width:620px!important;
  max-width:620px!important;
  min-height:620px!important;
  padding:8px!important;
  align-items:flex-start!important;
  justify-content:center!important;
  overflow:visible!important;
}

html.np-mobile-table-mode .game-page .game-board{
  flex:0 0 600px!important;
  width:600px!important;
  min-width:600px!important;
  max-width:600px!important;
  height:600px!important;
  min-height:600px!important;
  max-height:600px!important;
  aspect-ratio:1!important;
}

html.np-mobile-table-mode .game-page .board-sector{
  min-height:0!important;
  padding:3% 2%!important;
}

html.np-mobile-table-mode .game-page .board-sector>strong{
  display:block!important;
  font-size:.56rem!important;
  line-height:1.05!important;
}

html.np-mobile-table-mode .game-page .board-sector>small{
  display:block!important;
  font-size:.48rem!important;
  line-height:1.05!important;
}

html.np-mobile-table-mode .game-page .sector-number{
  top:2px!important;
  left:3px!important;
  font-size:10px!important;
}

html.np-mobile-table-mode .game-page .game-sidebar{
  display:grid!important;
  box-sizing:border-box!important;
  width:346px!important;
  min-width:346px!important;
  max-width:346px!important;
  min-height:620px!important;
  max-height:none!important;
  grid-template-columns:minmax(0,1fr)!important;
  grid-template-rows:auto 390px auto!important;
  align-content:start!important;
  gap:10px!important;
  overflow:visible!important;
}

html.np-mobile-table-mode .game-page .game-log-panel.np-visible-chronicle{
  box-sizing:border-box!important;
  width:100%!important;
  min-height:390px!important;
  height:390px!important;
  max-height:390px!important;
  overflow:hidden!important;
}

html.np-mobile-table-mode .game-page .game-sidebar>.table-communication.embedded{
  display:flex!important;
  box-sizing:border-box!important;
  width:100%!important;
  min-width:0!important;
  min-height:330px!important;
  height:330px!important;
  max-height:330px!important;
  overflow:hidden!important;
}

/* All seven desktop actions remain fixed at the bottom of the phone. */
html.np-mobile-table-mode .game-page .game-action-dock{
  position:fixed!important;
  right:auto!important;
  bottom:max(5px,env(safe-area-inset-bottom))!important;
  left:50vw!important;
  z-index:60!important;
  display:grid!important;
  box-sizing:border-box!important;
  width:min(820px,calc(100vw - 10px))!important;
  min-width:0!important;
  max-width:820px!important;
  height:62px!important;
  grid-template-columns:repeat(7,minmax(0,1fr))!important;
  transform:translateX(-50%)!important;
  overflow:hidden!important;
  border:1px solid #a87335!important;
  border-radius:6px!important;
  background:#0b0705fa!important;
  box-shadow:0 10px 30px #000f,inset 0 0 0 1px #e0aa5140!important;
  opacity:1!important;
  isolation:isolate!important;
}

html.np-mobile-table-mode .game-page .game-action-dock button{
  min-width:0!important;
  min-height:58px!important;
  padding:4px 2px!important;
  border-right:1px solid #704820!important;
  color:#f2d79d!important;
  background:linear-gradient(180deg,#392317 0%,#160d09 56%,#090504 100%)!important;
  box-shadow:inset 0 1px #d09a4a29!important;
  opacity:1!important;
  text-shadow:0 1px 2px #000!important;
  font-size:.48rem!important;
}

html.np-mobile-table-mode .game-page .game-action-dock button:last-child{
  border-right:0!important;
}

html.np-mobile-table-mode .game-page .game-action-dock button:active{
  background:linear-gradient(180deg,#71451f,#27130a)!important;
}

html.np-mobile-table-mode .game-page .game-action-dock button>span{
  color:#f2bd55!important;
  opacity:1!important;
}

html.np-mobile-table-mode .game-page .trade-launcher{
  display:none!important;
  visibility:hidden!important;
  pointer-events:none!important;
}

/* Portrait remains an orientation prompt: gameplay is designed for landscape. */
@media (orientation:portrait) and (any-pointer:coarse){
  body:has(.game-page)::before{
    display:grid!important;
    content:"⟳\A Поверните телефон горизонтально\A для полноценного игрового стола"!important;
  }
}
