.game-screen[hidden] { display: none !important; }

.game-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #fff5da;
  background: #101b19;
  font-family: Arial, sans-serif;
}

.game-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: max(14px, env(safe-area-inset-top)) 18px 12px;
  background: linear-gradient(180deg, #192e28, #101b19);
  border-bottom: 1px solid #a98547;
}

.game-title {
  color: #e7c47c;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1px;
}

.game-round {
  color: #f3dfac;
  font-size: 13px;
}

.game-table-frame {
  flex: 1;
  min-height: 0;
  padding: 9px;
  background: linear-gradient(135deg, #63391e, #bb8747 35%, #593018 75%, #a7743e);
}

.game-table-felt {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  border: 3px solid #c6a066;
  border-radius: 24px;
  background:
    radial-gradient(ellipse at 50% 45%, #21734d 0%, #155437 48%, #092b21 100%);
  box-shadow: inset 0 0 35px #001b15, 0 0 0 3px #492b19;
}

.game-opponent {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
}

.game-player-avatar {
  display: inline-flex;
  width: 35px;
  height: 35px;
  flex-shrink: 0;
  justify-content: center;
  align-items: center;
  border: 2px solid #d7b56e;
  border-radius: 50%;
  color: #f6d68b;
  background: #19392d;
  font-size: 19px;
}

.game-player-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13px;
}

.game-player-info span,
.game-my-info span:last-child {
  color: #d3e3d6;
  font-size: 11px;
}

.game-opponent-cards {
  display: flex;
  margin-left: auto;
  padding-right: 12px;
}

.game-opponent-cards .playing-card {
  margin-right: -25px;
  transform: scale(.76);
  transform-origin: center;
}

.game-center {
  display: flex;
  flex: 1;
  min-height: 0;
  align-items: center;
  padding: 12px;
}

.game-deck-area {
  position: relative;
  display: flex;
  width: 75px;
  flex-shrink: 0;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.game-deck-count {
  font-size: 12px;
  font-weight: bold;
}

.game-table-cards {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 9px;
  min-height: 120px;
}

.game-card-pair {
  position: relative;
  width: 77px;
  height: 112px;
}

.game-card-pair .playing-card:last-child:not(:first-child) {
  position: absolute;
  top: 21px;
  left: 22px;
  transform: rotate(12deg);
}

.playing-card {
  position: relative;
  display: flex;
  width: 67px;
  height: 96px;
  flex-shrink: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid #e8dfce;
  border-radius: 8px;
  background: linear-gradient(145deg, #fffefa, #e8e3d7);
  box-shadow: 2px 4px 9px #0006;
  color: #161c22;
  font-size: 34px;
  user-select: none;
  -webkit-user-select: none;
}

.playing-card.red { color: #c52d36; }

.playing-card .card-rank {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 16px;
  font-weight: bold;
}

.playing-card .card-corner-suit {
  position: absolute;
  top: 23px;
  left: 6px;
  font-size: 13px;
}

.playing-card.back {
  border: 3px solid #eee2c5;
  background: repeating-linear-gradient(45deg, #263d77, #263d77 5px, #405e9c 5px, #405e9c 10px);
  box-shadow: inset 0 0 0 4px #263d77, inset 0 0 0 6px #c9a66e, 2px 4px 9px #0006;
}

.game-message {
  padding: 12px;
  text-align: center;
  color: #f3dca5;
  font-size: 13px;
  font-weight: 700;
}

.game-bottom {
  display: flex;
  flex-direction: column;
  padding: 10px 8px max(15px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #182c25, #0e1916);
}

.game-my-info {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 8px 10px;
  font-size: 13px;
}

.game-my-cards {
  display: flex;
  min-height: 112px;
  justify-content: center;
  align-items: center;
  padding: 4px 12px 8px;
  overflow: visible;
}

.game-my-cards .playing-card {
  margin-left: -13px;
  touch-action: none;
  cursor: grab;
  transition: transform .15s ease;
}

.game-my-cards .playing-card:first-child { margin-left: 0; }

.game-my-cards .playing-card.selected {
  transform: translateY(-17px);
  box-shadow: 0 0 0 3px #e8c46e, 2px 5px 15px #0009;
}

.game-actions {
  display: flex;
  gap: 12px;
  padding: 5px 10px;
}

.game-actions button {
  flex: 1;
  min-height: 43px;
  border: 1px solid #e0bd78;
  border-radius: 11px;
  color: #211a0f;
  background: linear-gradient(#f5d899, #c99b4e);
  font-size: 15px;
  font-weight: 800;
}

.game-actions button:disabled {
  opacity: .38;
}

@media (max-width: 380px) {
  .playing-card { width: 58px; height: 86px; font-size: 29px; }
  .game-card-pair { width: 68px; height: 102px; }
  .game-my-cards .playing-card { margin-left: -16px; }
  .game-center { padding: 5px; }
  .game-deck-area { width: 62px; }
}

/* Карты игрока: адаптация под любые экраны */
.game-my-cards {
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  justify-content: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 22px 12px 12px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.game-my-cards .playing-card {
  flex: 0 0 auto;
  touch-action: pan-x;
}

.game-my-cards .playing-card.selected {
  transform: translateY(-12px);
}

/* Таймер хода и состояние соединения */
.game-turn-timer {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  padding: 5px 8px;
}

.game-connection-status {
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 8px;
  padding: 7px 10px;
  margin: 4px 8px;
}

.game-connection-status[hidden] {
  display: none !important;
}


/* Королевская рубашка карт */
.playing-card.back {
  position: relative;
  box-sizing: border-box;
  border: 3px solid #d5ad62;
  border-radius: 8px;
  background:
    repeating-linear-gradient(
      45deg,
      transparent 0 11px,
      rgba(210, 165, 75, .18) 11px 12px,
      transparent 12px 23px
    ),
    repeating-linear-gradient(
      -45deg,
      transparent 0 11px,
      rgba(210, 165, 75, .18) 11px 12px,
      transparent 12px 23px
    ),
    linear-gradient(145deg, #242020, #08090d 70%);
  box-shadow:
    inset 0 0 0 3px #101010,
    inset 0 0 0 5px #c59b4e,
    2px 4px 9px #0008;
}

.playing-card.back::before {
  content: '♛';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e5b85e;
  font-size: 35px;
  text-shadow: 0 2px 5px #000;
}

.playing-card.back::after {
  content: '❦';
  position: absolute;
  top: 8px;
  right: 9px;
  color: #d8ab58;
  font-size: 13px;
}

/* Индикатор отключения игрока */
.game-offline-indicator {
  display: inline-block;
  width: fit-content;
  color: #ff7777 !important;
  background: rgba(110, 0, 0, 0.55);
  border: 1px solid rgba(255, 100, 100, 0.5);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.game-offline-indicator[hidden] {
  display: none !important;
}

.game-opponent{position:relative}.game-chat-bubble:not([hidden]){position:absolute;top:45px;left:58px;z-index:15;max-width:min(230px,65vw);padding:9px 12px;background:#10232e;border:1px solid #b89448;border-radius:10px;color:#f5edda;font-size:13px;line-height:1.4;overflow-wrap:anywhere;box-shadow:0 4px 16px #0008}.game-chat-bubble:not([hidden])::before{content:"";position:absolute;left:-6px;top:12px;width:10px;height:10px;background:#10232e;border-left:1px solid #b89448;border-bottom:1px solid #b89448;transform:rotate(45deg)}

.game-my-info{position:relative}.game-my-info .game-chat-bubble:not([hidden]){position:absolute;top:auto;bottom:calc(100% + 8px);left:58px;z-index:15;max-width:min(230px,65vw);padding:9px 12px;background:#10232e;border:1px solid #b89448;border-radius:10px;color:#f5edda;font-size:13px;line-height:1.4;overflow-wrap:anywhere;box-shadow:0 4px 16px #0008}.game-my-info .game-chat-bubble:not([hidden])::before{content:"";position:absolute;left:-6px;top:auto;bottom:12px;width:10px;height:10px;background:#10232e;border-left:1px solid #b89448;border-bottom:1px solid #b89448;transform:rotate(45deg)}

#gameBottomActions:not([hidden]){display:flex;position:relative;z-index:5;margin:8px 12px 12px;padding:9px;background:#07141e;border:1px solid #9c7830;border-radius:12px;gap:8px}#gameBottomActions button{flex:1;min-width:0;padding:12px 6px;border:1px solid #365060;border-radius:8px;background:#10232e;color:#e7edf0;font-size:13px;font-weight:600}#gameExitButton{border-color:#66343b!important;color:#f2dfe1!important}
