/* Room detail modal — large static board preview */

.lobby-room-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  background: rgba(4, 8, 18, 0.88);
  backdrop-filter: blur(8px);
}

.lobby-room-modal[hidden] {
  display: none;
}

.lobby-room-modal__dialog {
  position: relative;
  width: 100%;
  max-width: 1280px;
  height: 100%;
  height: 98vh;
  height: 98dvh;
  max-height: 100vh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 2px solid transparent;
  background:
    linear-gradient(165deg, #1a2848 0%, #0f1828 55%, #0a1020 100%) padding-box,
    linear-gradient(
        135deg,
        #8b6914 0%,
        #ffe566 35%,
        #e8c547 55%,
        #8b6914 100%
      )
      border-box;
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.65),
    0 0 48px rgba(232, 197, 71, 0.12);
  overflow: hidden;
  margin: auto;
}

.lobby-room-modal__close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  width: 36px;
  height: 36px;
  border: 2px solid rgba(232, 197, 71, 0.75);
  border-radius: 50%;
  background: linear-gradient(180deg, #3a4258 0%, #1e2434 100%);
  color: #f5e6a8;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

.lobby-room-modal__title-tab {
  position: relative;
  z-index: 2;
  align-self: center;
  margin: 0;
  padding: 0.35rem 2rem 0.4rem;
  font-size: clamp(0.9rem, 2.2vw, 1.2rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #1a1200;
  background: linear-gradient(180deg, #fff8c8 0%, #e8c547 45%, #a67c00 100%);
  border-radius: 0 0 12px 12px;
  border: 2px solid rgba(139, 105, 20, 0.6);
  border-top: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

.lobby-room-modal__body {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 170px);
  gap: 0;
  padding: 0;
  margin: 0;
  direction: ltr;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.lobby-room-modal__board-wrap {
  position: relative;
  min-height: 0;
  min-width: 0;
  height: 100%;
  display: grid;
  overflow: hidden;
}

.lobby-room-modal__board-stage {
  display: grid;
  place-items: stretch;
  min-height: 0;
  min-width: 0;
  height: 100%;
  padding: 0;
  margin: 0;
  overflow: hidden;
  background: radial-gradient(
    ellipse at 50% 55%,
    #243352 0%,
    #152038 55%,
    #0f1828 100%
  );
}

.lobby-room-modal__play-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.5rem;
  pointer-events: none;
}

.lobby-room-modal__play-overlay .lobby-room-modal__subtitle,
.lobby-room-modal__play-overlay .lobby-room-modal__play {
  pointer-events: auto;
}

.lobby-room-modal__stats {
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0;
  padding: 0.35rem 0.5rem;
  border-radius: 0;
  background: linear-gradient(180deg, rgba(8, 14, 28, 0.92) 0%, rgba(4, 8, 18, 0.98) 100%);
  border: none;
  border-left: 1px solid rgba(232, 197, 71, 0.22);
  box-shadow: none;
  overflow-y: auto;
  max-height: none;
  min-height: 0;
}

.lobby-room-modal__stat-row {
  padding: 0.45rem 0.15rem;
  border-bottom: 1px solid rgba(232, 197, 71, 0.15);
  text-align: center;
}

.lobby-room-modal__stat-row:last-child {
  border-bottom: none;
}

.lobby-room-modal__stat-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #c9a227;
  text-transform: uppercase;
}

.lobby-room-modal__stat-value {
  display: block;
  margin-top: 0.2rem;
  font-size: clamp(1.05rem, 2.4vw, 1.45rem);
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.lobby-room-modal__stat-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0;
  color: rgba(232, 197, 71, 0.45);
  font-size: 0.55rem;
}

.lobby-room-modal__stat-divider::before,
.lobby-room-modal__stat-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232, 197, 71, 0.35), transparent);
}

.lobby-room-modal__subtitle {
  margin: 0;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #f5e6a8;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
  background: rgba(8, 12, 24, 0.55);
  border-radius: 999px;
  border: 1px solid rgba(232, 197, 71, 0.35);
}

.lobby-room-modal__play {
  min-width: min(220px, 55%);
  padding: 0.75rem 2.25rem;
  border: 3px solid #1a1200;
  border-radius: 999px;
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #1a1200;
  cursor: pointer;
  background: linear-gradient(
    180deg,
    #9dffae 0%,
    #3dcc5a 35%,
    #2db84a 55%,
    #1a8a32 100%
  );
  box-shadow:
    0 0 28px rgba(61, 204, 90, 0.55),
    0 6px 0 #145a22,
    0 12px 28px rgba(0, 0, 0, 0.45),
    inset 0 2px 0 rgba(255, 255, 255, 0.45);
}

.lobby-room-modal__play:hover:not(:disabled) {
  filter: brightness(1.05);
}

.lobby-room-modal__play:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

/* ---- Static board: fill stage, keep aspect ratio ---- */
.semi-board {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  perspective: none;
  overflow: hidden;
}

.semi-board__scene,
.semi-board__book,
.semi-board__book-inner {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  transform: none !important;
  animation: none;
  transition: none !important;
  filter: none;
}

.semi-board__glow,
.semi-board__pedestal,
.semi-board__rim-light,
.semi-board::after {
  display: none;
}

.semi-board:hover .semi-board__book-inner,
.semi-board.is-opening .semi-board__book-inner {
  transform: none !important;
  filter: none;
}

.semi-board__board-img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  object-fit: contain;
  object-position: center center;
  pointer-events: none;
  user-select: none;
  border-radius: 0;
  filter: none;
  -webkit-mask-image: none;
  mask-image: none;
}

.semi-board--baluchestan .semi-board__book-inner,
.semi-board--tehran .semi-board__book-inner,
.semi-board--isfahan .semi-board__book-inner {
  filter: none;
}

/* Phones / PWA / short landscape: force true fullscreen */
@media (max-height: 560px), (max-width: 960px) {
  .lobby-room-modal {
    background: #0a1020;
    align-items: stretch;
    justify-content: stretch;
  }

  .lobby-room-modal__dialog {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    max-width: none !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: none !important;
    border-radius: 0 !important;
    border: none !important;
    margin: 0 !important;
    box-shadow: none;
  }

  .lobby-room-modal__title-tab {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
    margin: 0;
    padding: 0.2rem 1.1rem 0.25rem;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
  }

  .lobby-room-modal__body {
    grid-template-columns: minmax(0, 1fr) minmax(88px, 20vw);
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
  }

  .lobby-room-modal__board-wrap,
  .lobby-room-modal__board-stage,
  .semi-board {
    min-height: 0;
    overflow: hidden;
  }

  .semi-board__board-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
  }

  .lobby-room-modal__stats {
    padding: 0.15rem 0.25rem;
  }

  .lobby-room-modal__stat-row {
    padding: 0.22rem 0.05rem;
  }

  .lobby-room-modal__stat-label {
    font-size: 0.52rem;
    letter-spacing: 0.04em;
  }

  .lobby-room-modal__stat-value {
    margin-top: 0.08rem;
    font-size: clamp(0.8rem, 3.2vw, 1rem);
  }

  .lobby-room-modal__play {
    min-width: min(150px, 40%);
    padding: 0.4rem 1.1rem;
    font-size: 0.9rem;
    box-shadow:
      0 0 18px rgba(61, 204, 90, 0.5),
      0 4px 0 #145a22,
      0 8px 18px rgba(0, 0, 0, 0.4),
      inset 0 2px 0 rgba(255, 255, 255, 0.45);
  }

  .lobby-room-modal__subtitle {
    font-size: 0.6rem;
    padding: 0.12rem 0.45rem;
  }

  .lobby-room-modal__close {
    top: max(4px, env(safe-area-inset-top, 0px));
    right: max(4px, env(safe-area-inset-right, 0px));
    width: 30px;
    height: 30px;
    font-size: 1.05rem;
  }
}

@media (max-height: 430px) {
  .lobby-room-modal__body {
    grid-template-columns: minmax(0, 1fr) minmax(84px, 20vw);
  }

  .lobby-room-modal__title-tab {
    padding: 0.12rem 0.85rem 0.18rem;
    font-size: 0.65rem;
  }

  .lobby-room-modal__play {
    min-width: min(140px, 38%);
    padding: 0.35rem 1rem;
    font-size: 0.85rem;
  }

  .lobby-room-modal__subtitle {
    display: none;
  }
}

@media (max-width: 720px) and (orientation: portrait) {
  .lobby-room-modal__dialog {
    width: 100% !important;
    height: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }

  .lobby-room-modal__body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .lobby-room-modal__stats {
    border-left: none;
    border-top: 1px solid rgba(232, 197, 71, 0.22);
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-around;
    max-height: 26vh;
  }

  .lobby-room-modal__stat-row {
    flex: 1 1 40%;
  }

  .lobby-room-modal__stat-divider {
    display: none;
  }
}
