/* ===== Карточные / Дурак ===== */
.cards-art {
  background: linear-gradient(145deg, #1a2a1a, #0d1810 50%, #1a1520);
  position: relative;
}
.cards-art-suits {
  position: absolute;
  bottom: 10px;
  right: 12px;
  font-size: 14px;
  letter-spacing: 2px;
  opacity: 0.85;
  color: #e8c98a;
}
.cards-badge {
  background: rgba(40, 90, 50, 0.35) !important;
  border-color: rgba(80, 160, 90, 0.4) !important;
}
.durak-art {
  background: linear-gradient(160deg, #2a1810, #120c08);
  display: flex;
  align-items: center;
  justify-content: center;
}
.durak-art-cards { font-size: 42px; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4)); }

.cards-hub, .durak-root {
  padding-bottom: 24px;
}

/* Lobby */
.durak-lobby {
  display: flex;
  justify-content: center;
  padding: 8px 0 24px;
}
.durak-lobby-card {
  width: min(420px, 100%);
  background: linear-gradient(165deg, rgba(24,28,22,0.96), rgba(12,14,12,0.98));
  border: 1px solid rgba(120, 180, 100, 0.25);
  border-radius: 20px;
  padding: 22px 18px 18px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
}
.durak-lobby-title {
  font-size: 1.35rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 4px;
}
.durak-lobby-sub {
  text-align: center;
  color: rgba(255,255,255,0.45);
  font-size: 13px;
  margin: 0 0 18px;
}
.durak-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  color: rgba(255,255,255,0.55);
}
.durak-field input {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.35);
  border-radius: 12px;
  padding: 12px 14px;
  color: #fff;
  font-size: 16px;
  outline: none;
}
.durak-field input:focus {
  border-color: rgba(120, 200, 100, 0.5);
}
.durak-modes {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}
.durak-mode {
  text-align: left;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
  border-radius: 14px;
  padding: 12px 14px;
  color: #fff;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.durak-mode i {
  display: block;
  margin-bottom: 4px;
  color: #9dcea0;
}
.durak-mode strong { display: block; font-size: 15px; margin-bottom: 2px; }
.durak-mode span { font-size: 12px; color: rgba(255,255,255,0.45); }
.durak-mode.is-on {
  border-color: rgba(120, 200, 100, 0.55);
  background: rgba(60, 120, 70, 0.18);
}
.durak-start { margin-top: 4px; min-height: 48px; }
.durak-start:disabled { opacity: 0.45; }

/* Table */
.durak-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 70vh;
}
.durak-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 4px;
  font-size: 13px;
}
.durak-trump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.1);
  font-weight: 700;
}
.durak-status {
  flex: 1;
  text-align: center;
  color: rgba(255,220,160,0.9);
  font-weight: 600;
  font-size: 13px;
}
.durak-deck {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  white-space: nowrap;
}

.durak-opp, .durak-me {
  background: rgba(0,0,0,0.22);
  border-radius: 16px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.06);
}
.durak-opp-meta, .durak-me-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 8px;
}
.durak-opp-hand, .durak-hand {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  min-height: 88px;
}

.durak-field-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 0;
}
.durak-field-table {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  min-height: 110px;
  width: 100%;
  padding: 12px;
  border-radius: 16px;
  background:
    radial-gradient(ellipse at center, rgba(30, 70, 40, 0.35), rgba(8, 16, 10, 0.5));
  border: 1px dashed rgba(120, 180, 100, 0.25);
}
.durak-pair {
  position: relative;
  width: 72px;
  height: 100px;
}
.durak-pair .pc-card:last-child {
  position: absolute;
  left: 14px;
  top: 18px;
  transform: rotate(12deg);
}
.durak-actions {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 360px;
}
.durak-actions .btn {
  flex: 1;
  min-height: 44px;
}

/* Playing card */
.pc-card {
  width: 64px;
  height: 92px;
  border-radius: 8px;
  background: linear-gradient(160deg, #fbfaf6, #e8e4d8);
  border: 1px solid rgba(0,0,0,0.2);
  box-shadow: 0 4px 10px rgba(0,0,0,0.35);
  position: relative;
  flex-shrink: 0;
  user-select: none;
  color: #1a1a1a;
  font-family: "Segoe UI", system-ui, sans-serif;
  transition: transform 0.15s ease, box-shadow 0.15s;
}
.pc-card.red { color: #c41e3a; }
.pc-card.black { color: #1a1a1a; }
.pc-card .pc-r {
  position: absolute;
  top: 4px;
  left: 5px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}
.pc-card .pc-s {
  position: absolute;
  top: 18px;
  left: 5px;
  font-size: 12px;
  line-height: 1;
}
.pc-card .pc-big {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  opacity: 0.92;
}
.pc-card .pc-r2 {
  position: absolute;
  bottom: 4px;
  right: 5px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  transform: rotate(180deg);
}
.pc-card .pc-s2 {
  position: absolute;
  bottom: 18px;
  right: 5px;
  font-size: 12px;
  transform: rotate(180deg);
}
.pc-card.is-back {
  background: linear-gradient(145deg, #1e4a2a 0%, #0f2a18 40%, #163820 100%);
  border-color: rgba(180, 220, 160, 0.25);
  color: transparent;
}
.pc-card.is-back::after {
  content: "♠";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: rgba(200, 230, 180, 0.35);
}
.pc-card.is-playable {
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(80, 200, 100, 0.65), 0 6px 14px rgba(0,0,0,0.4);
  transform: translateY(-6px);
}
.pc-card.is-playable:active { transform: translateY(-2px) scale(0.98); }
.pc-card.is-trump-mark {
  box-shadow: 0 0 0 2px rgba(255, 180, 40, 0.7), 0 4px 10px rgba(0,0,0,0.35);
}
.pc-card.is-disabled {
  opacity: 0.55;
  filter: grayscale(0.2);
}

.durak-hand .pc-card { width: 58px; height: 84px; }
@media (min-width: 480px) {
  .pc-card { width: 70px; height: 100px; }
  .durak-hand .pc-card { width: 66px; height: 94px; }
  .durak-pair { width: 80px; height: 110px; }
}

/* Result */
.durak-result {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
}
.durak-result-card {
  width: min(360px, 100%);
  background: linear-gradient(165deg, #1a2218, #0e120e);
  border: 1px solid rgba(120, 180, 100, 0.3);
  border-radius: 20px;
  padding: 24px 18px;
  text-align: center;
}
.durak-result-emoji { font-size: 48px; margin-bottom: 8px; }
.durak-result-card h2 { margin: 0 0 8px; font-size: 1.4rem; }
.durak-result-card p { color: rgba(255,255,255,0.55); margin: 0 0 16px; font-size: 14px; }
.durak-result-card .btn { margin-bottom: 8px; }

.hidden { display: none !important; }

@media (max-width: 420px) {
  .durak-hand .pc-card { width: 52px; height: 76px; }
  .pc-card .pc-big { font-size: 22px; }
  .durak-status { font-size: 12px; }
}

.durak-wait {
  text-align: center;
  padding: 16px 8px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.08);
}
.durak-wait-spin { font-size: 28px; color: #9dcea0; margin-bottom: 8px; }
.durak-wait-code { font-size: 13px; color: rgba(255,255,255,0.55); }
.durak-wait-code strong {
  font-size: 22px;
  letter-spacing: 0.2em;
  color: #e8c98a;
  display: block;
  margin-top: 6px;
}

/* polish */
.durak-art {
  background-size: cover;
  background-position: center;
  min-height: 120px;
  position: relative;
  overflow: hidden;
}
.durak-art-shade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0.45));
  pointer-events: none;
}
.gp-game-durak, .gp-game-cards, .gp-game {
  cursor: pointer;
}
.durak-art-label {
  position: absolute; right: 10px; bottom: 8px;
  font-weight: 800; letter-spacing: 0.08em;
  color: #f4e2b0; text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
.gp-statline {
  display: block; margin-top: 6px;
  font-size: 12px; color: #e8c98a;
}
.durak-my-rating {
  text-align: center;
  font-size: 13px;
  color: #e8c98a;
  margin: 0 0 14px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(232, 201, 138, 0.08);
  border: 1px solid rgba(232, 201, 138, 0.2);
}
.durak-lobby-card {
  animation: durakIn 0.45s cubic-bezier(.16,1,.3,1);
}
@keyframes durakIn {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.durak-table {
  background:
    radial-gradient(ellipse at 50% 40%, rgba(46, 110, 62, 0.55), rgba(8, 18, 12, 0.2) 70%),
    linear-gradient(180deg, #102016, #0b120e);
  border-radius: 18px;
  padding: 8px;
  animation: durakIn 0.4s ease;
}
.durak-scores {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  color: rgba(255,230,180,0.85);
  padding: 0 4px 6px;
}
.durak-scores span:nth-child(2) { color: rgba(255,255,255,0.4); white-space: nowrap; }
.durak-mute {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.3);
  color: #e8c98a; font-size: 16px; cursor: pointer;
}
.durak-mute.is-off { opacity: 0.45; }
.pc-card.deal-in { animation: cardIn 0.35s cubic-bezier(.16,1,.3,1); }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px) scale(.92); }
  to { opacity: 1; transform: none; }
}
.pc-card.is-playable { animation: cardLift 1.6s ease-in-out infinite; }
@keyframes cardLift {
  0%,100% { transform: translateY(-6px); }
  50% { transform: translateY(-10px); }
}
.durak-field-table { transition: box-shadow 0.3s; }
.durak-chat {
  margin-top: 8px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  overflow: hidden;
}
.durak-chat-log {
  max-height: 120px;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.durak-msg { font-size: 13px; line-height: 1.3; color: rgba(255,255,255,0.82); }
.durak-msg b { display: block; font-size: 11px; color: #e8c98a; font-weight: 700; }
.durak-msg.mine { text-align: right; }
.durak-msg.mine b { color: #9dcea0; }
.durak-msg.sys { opacity: 0.45; text-align: center; }
.durak-chat-form { display: flex; gap: 6px; padding: 8px; }
.durak-chat-form input {
  flex: 1; min-width: 0;
  border-radius: 12px; border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04); color: #fff;
  padding: 10px 12px; font-size: 16px;
}
.durak-chat-form button {
  width: 46px; border-radius: 12px; border: none;
  background: linear-gradient(135deg, #d7b56a, #8d6a2f);
  color: #1a1206; font-weight: 800; font-size: 18px;
}
@media (max-width: 520px) {
  .durak-scores { font-size: 10px; }
  .durak-chat-log { max-height: 96px; }
  .durak-table { min-height: auto; }
}

/* one-screen mobile play */
.durak-root.is-play {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #0a110d;
  display: flex;
  flex-direction: column;
  padding: max(6px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
  overflow: hidden;
}
.durak-root.is-play .gp-back { flex: 0 0 auto; margin: 0 0 4px; }
.durak-root.is-play .durak-table {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  overflow: hidden;
}
.durak-root.is-play .durak-lobby,
.durak-root.is-play .durak-result { /* keep */ }
.durak-timer {
  min-width: 36px;
  height: 32px;
  border-radius: 10px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.12);
  color: #e8c98a;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
}
.durak-timer.urgent {
  color: #ff6b6b;
  border-color: rgba(255,80,80,0.5);
  animation: pulseT 0.8s ease infinite;
}
@keyframes pulseT {
  50% { transform: scale(1.06); }
}
.cards-art-shade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.35));
  pointer-events: none;
}
.gp-game-cards .gp-game-art.cards-art {
  min-height: 110px;
}
.durak-root.is-play .durak-opp { padding: 6px; }
.durak-root.is-play .durak-hand {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  justify-content: flex-start;
  min-height: 72px;
  padding-bottom: 4px;
}
.durak-root.is-play .pc-card {
  width: 52px;
  height: 74px;
}
.durak-root.is-play .durak-opp-hand .pc-card {
  width: 36px;
  height: 50px;
  margin-left: -12px;
}
.durak-root.is-play .durak-opp-hand .pc-card:first-child { margin-left: 0; }
.durak-root.is-play .durak-field-table {
  min-height: 70px;
  padding: 8px;
  flex: 1 1 auto;
}
.durak-root.is-play .durak-chat-log { max-height: 52px; }
.durak-root.is-play .durak-scores { font-size: 10px; }
.durak-root.is-play .durak-actions .btn { min-height: 40px; }
.pc-card.is-playable {
  animation: none !important;
  transform: translateY(-4px);
  box-shadow: 0 0 0 2px rgba(100, 220, 120, 0.7), 0 4px 10px rgba(0,0,0,0.35);
}

/* mobile tap targets */
#games-page .gp-game {
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(255, 150, 50, 0.25);
  touch-action: manipulation;
  position: relative;
  z-index: 1;
}
#games-page .gp-back {
  cursor: pointer;
  touch-action: manipulation;
  position: relative;
  z-index: 2;
  min-height: 44px;
}
#games-page .cards-hub,
#games-page .durak-root,
#games-page .magic-hub {
  position: relative;
  z-index: 1;
}
