/* Mau Mau — mobil öncelikli modern arayüz */

:root {
  --gold: #fbbf24;
  --gold-strong: #f59e0b;
  --danger: #f87171;
  --text: #f2f7f4;
  --text-dim: rgba(242, 247, 244, 0.62);
  --panel: rgba(255, 255, 255, 0.07);
  --panel-strong: rgba(255, 255, 255, 0.12);
  --panel-border: rgba(255, 255, 255, 0.14);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --card-ratio: 1.528; /* 691x1056 görsellerin oranı */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(45, 212, 191, 0.14) 0%, transparent 55%),
    radial-gradient(130% 100% at 50% 45%, #0e4a36 0%, #0a3527 45%, #06231a 78%, #041710 100%);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
}

img {
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

/* ── Yerleşim ─────────────────────────────────────────────── */

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + 8px) 12px calc(var(--safe-bottom) + 10px);
  gap: 6px;
}

/* ── Üst bar ──────────────────────────────────────────────── */

/* Oyun ekranı üst barı: butonlar sağda (eski yerinde), coin barı ORTADA;
   çıkış (yalnız uygulama içinde) solda sabit */
#topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  min-height: 40px;
}

#btn-exit {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

#btn-exit:active {
  transform: translateY(-50%) scale(0.94);
}

/* Üst barın ortası bilerek boştur: Flutter'ın coin/paywall overlay'i
   (uygulama WebView'in üstüne Positioned ile bindirir) oraya ortalanır */

.logo {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--text);
}

.logo span {
  color: var(--gold);
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  display: grid;
  place-items: center;
  transition: background 0.15s, transform 0.1s;
}

.icon-btn:active {
  background: var(--panel-strong);
  transform: scale(0.94);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: var(--text-dim);
}

/* ── Rakipler ─────────────────────────────────────────────── */

#opponents {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  gap: clamp(10px, 4vw, 28px);
  padding: 6px 0 2px;
  min-height: 96px;
}

.opponent {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  width: 88px;
}

.opp-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 26px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05));
  border: 2px solid var(--panel-border);
  position: relative;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}

.opponent.active .opp-avatar {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.25), 0 0 24px rgba(251, 191, 36, 0.35);
  transform: scale(1.06);
}

.opp-count {
  position: absolute;
  right: -6px;
  bottom: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 11px;
  background: var(--gold);
  color: #26200a;
  font-size: 12px;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.opp-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}

.opponent.active .opp-name {
  color: var(--gold);
}

.opp-cards {
  display: flex;
  height: 26px;
  margin-top: 1px;
}

.opp-cards img {
  width: 17px;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.opp-cards img + img {
  margin-left: -11px;
}

/* Konuşma balonu (Mau!) */
.bubble {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  color: #1c1917;
  font-size: 13px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
  box-shadow: var(--shadow);
  animation: bubble-pop 0.25s ease-out;
  z-index: 30;
}

.bubble::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #fff;
  border-bottom: 0;
}

@keyframes bubble-pop {
  from {
    transform: translateX(-50%) scale(0.5);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) scale(1);
    opacity: 1;
  }
}

/* ── Masa ─────────────────────────────────────────────────── */

#table {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 0;
}

#status-row {
  display: flex;
  gap: 8px;
  min-height: 30px;
  align-items: center;
}

.chip {
  padding: 5px 12px;
  border-radius: 15px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  font-size: 14px;
  font-weight: 700;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: chip-in 0.25s ease-out;
}

@keyframes chip-in {
  from {
    transform: translateY(-6px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.chip-danger {
  background: rgba(248, 113, 113, 0.18);
  border-color: rgba(248, 113, 113, 0.45);
  color: var(--danger);
}

.chip .red {
  color: #ff6b6b;
}

#piles {
  display: flex;
  gap: clamp(18px, 7vw, 44px);
  align-items: center;
}

.pile {
  position: relative;
  width: clamp(84px, 24vw, 108px);
  aspect-ratio: 1 / var(--card-ratio);
  border-radius: 12px;
}

.pile img {
  position: absolute;
  inset: 0;
  width: 100%;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

#draw-pile {
  transition: transform 0.12s;
}

#draw-pile:active {
  transform: scale(0.96);
}

#draw-pile.pulse {
  animation: draw-pulse 1.2s ease-in-out infinite;
}

@keyframes draw-pulse {
  0%,
  100% {
    filter: none;
    transform: none;
  }
  50% {
    filter: drop-shadow(0 0 14px rgba(251, 191, 36, 0.7));
    transform: scale(1.03);
  }
}

#draw-pile.empty {
  border: 2px dashed var(--panel-border);
}

.pile-stack img:nth-child(1) {
  transform: translate(4px, 4px) rotate(2deg);
}

.pile-stack img:nth-child(2) {
  transform: translate(2px, 2px) rotate(-1deg);
}

.pile-count {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 12px;
  background: var(--panel-strong);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 800;
  display: grid;
  place-items: center;
  z-index: 5;
}

#discard-pile img {
  transition: transform 0.2s;
}

/* Desteden çekmesi gerektiğinde zıplayan işaret */
.tap-hint {
  position: absolute;
  top: -40px;
  left: 50%;
  font-size: 27px;
  z-index: 6;
  pointer-events: none;
  animation: tap-bob 0.85s ease-in-out infinite;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
}

@keyframes tap-bob {
  0%,
  100% {
    transform: translate(-50%, 0);
  }
  50% {
    transform: translate(-50%, 9px);
  }
}

/* ── Oyuncu eli ───────────────────────────────────────────── */

#me {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#turn-banner {
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: var(--gold);
  animation: banner-pulse 1.4s ease-in-out infinite;
  transition: color 0.2s;
}

#turn-banner.dim {
  color: var(--text-dim);
  font-weight: 600;
  animation: none;
}

#turn-banner.warn {
  color: var(--danger);
}

@keyframes banner-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

#hand {
  position: relative;
  height: clamp(128px, 20vh, 172px);
}

.hand-card {
  position: absolute;
  bottom: 0;
  transition: left 0.25s ease, transform 0.25s ease;
  transform: rotate(var(--rot, 0deg)) translateY(var(--arc, 0px));
  transform-origin: 50% 110%;
}

.hand-card img {
  display: block;
  width: 100%;
  border-radius: 9px;
  box-shadow: -4px 4px 14px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.hand-card.playable img {
  transform: translateY(-16px);
  box-shadow: -4px 8px 18px rgba(0, 0, 0, 0.55), 0 0 0 2.5px var(--gold),
    0 0 22px rgba(251, 191, 36, 0.55);
}

.hand-card.locked img {
  filter: brightness(0.55) saturate(0.7);
}

.hand-card:active img {
  transform: translateY(-22px) scale(1.04);
}

/* ── Aksiyon butonları ────────────────────────────────────── */

#actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
  align-items: center;
}

.action-btn {
  padding: 13px 30px;
  border-radius: 26px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
  transition: transform 0.1s, filter 0.15s;
}

.action-btn:active {
  transform: scale(0.95);
}

.action-btn.draw {
  background: var(--panel-strong);
  border: 1.5px solid var(--panel-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.action-btn.draw.primary {
  background: linear-gradient(160deg, var(--gold), var(--gold-strong));
  color: #26200a;
  border: none;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.action-btn.mau {
  background: linear-gradient(160deg, #f87171, #dc2626);
  color: #fff;
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.45);
}

.action-btn.mau.armed {
  background: linear-gradient(160deg, #34d399, #059669);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.45);
}

.action-btn.mau.urgent {
  animation: mau-urgent 0.5s ease-in-out infinite;
}

@keyframes mau-urgent {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
  }
}

/* ── Bildirimler ──────────────────────────────────────────── */

#toasts {
  position: fixed;
  top: calc(var(--safe-top) + 58px);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 80;
  pointer-events: none;
}

.toast {
  background: rgba(12, 24, 20, 0.88);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 9px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease-out;
  max-width: 86vw;
  text-align: center;
}

.toast.out {
  transition: opacity 0.3s, transform 0.3s;
  opacity: 0;
  transform: translateY(-8px);
}

@keyframes toast-in {
  from {
    transform: translateY(-12px) scale(0.9);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

/* ── Uçan kart / efekt katmanı ───────────────────────────── */

#fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 70;
}

.fly-card {
  position: fixed;
  border-radius: 9px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5);
  will-change: transform;
  z-index: 71;
}

.confetti {
  position: fixed;
  top: -14px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
  z-index: 72;
}

@keyframes confetti-fall {
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0.7;
  }
}

/* ── Overlay & sheet'ler ──────────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 14, 10, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  animation: overlay-in 0.2s ease-out;
}

@keyframes overlay-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.sheet {
  width: 100%;
  max-width: 440px;
  max-height: 82dvh;
  overflow-y: auto;
  background: linear-gradient(180deg, #0e3427 0%, #082018 100%);
  border: 1px solid var(--panel-border);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 20px 20px calc(var(--safe-bottom) + 24px);
  animation: sheet-up 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes sheet-up {
  from {
    transform: translateY(60px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.sheet h3 {
  font-size: 18px;
  font-weight: 800;
}

.close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  font-size: 14px;
  color: var(--text-dim);
}

/* Ayarlar */

.setting-group {
  margin-bottom: 18px;
}

.setting-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.setting-title small {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 600;
}

.segmented {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 11px;
  padding: 3px;
  gap: 2px;
}

.segmented button {
  padding: 6px 15px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dim);
  transition: background 0.15s, color 0.15s;
}

.segmented button.on {
  background: var(--gold);
  color: #26200a;
}

.toggle-row input {
  display: none;
}

.toggle {
  width: 48px;
  height: 28px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--panel-border);
  position: relative;
  transition: background 0.2s;
  flex: 0 0 auto;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.toggle-row input:checked + .toggle {
  background: var(--gold-strong);
}

.toggle-row input:checked + .toggle::after {
  transform: translateX(20px);
}

/* Renk seçici */

.suit-sheet h3 {
  text-align: center;
  margin-bottom: 16px;
}

.suit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.suit-btn {
  aspect-ratio: 1.5;
  border-radius: 18px;
  background: #fff;
  color: #111;
  font-size: 44px;
  line-height: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: transform 0.1s;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.suit-btn:active {
  transform: scale(0.94);
}

.suit-btn.red {
  color: #dc2626;
}

.suit-btn small {
  font-size: 13px;
  font-weight: 700;
  color: #666;
}

/* Lobi */

#lobby-overlay {
  align-items: center;
}

.lobby {
  width: min(100%, 400px);
  max-height: 100dvh;
  overflow-y: auto;
  padding: calc(var(--safe-top) + 16px) 22px calc(var(--safe-bottom) + 20px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
}

/* Lobi başlığı: logo solda, profil sağda (eski düzen); coin ORTADA */
.lobby-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.start-logo {
  font-size: 58px;
  font-weight: 900;
  letter-spacing: 8px;
  line-height: 1.05;
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.5);
}

.start-logo.small {
  font-size: 24px;
  letter-spacing: 3px;
}

.start-logo span {
  color: var(--gold);
}

.lobby-me {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  font-size: 14px;
  font-weight: 700;
}

.lobby-face {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 17px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.lobby-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.lobby-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lobby-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
}

.segmented.big {
  width: 100%;
}

.segmented.big button {
  flex: 1;
  padding: 11px 0;
  font-size: 15px;
}

#lobby-overlay .cta {
  width: 100%;
  padding: 17px 0;
}

.lobby-links {
  display: flex;
  justify-content: center;
  gap: 8px;
}

/* Açık masalar */

.tables-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: -8px;
}

.lobby-online {
  font-size: 12px;
  font-weight: 700;
  color: #34d399;
}

.tables-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 30dvh;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

/* Dar ekranda taşma yok: buton küçülmez, etiket gerekirse kırpılır */
.table-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 9px 10px;
  animation: chip-in 0.25s ease-out;
}

.table-seats {
  display: flex;
  flex-shrink: 0;
}

.tseat {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 16px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05));
  border: 2px solid var(--panel-border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

/* Çok dar ekran: her şey bir tık daha kompakt */
@media (max-width: 360px) {
  .tseat {
    width: 26px;
    height: 26px;
    font-size: 14px;
  }

  .tseat + .tseat {
    margin-left: -12px;
  }

  .table-meta {
    font-size: 11px;
  }

  .table-join {
    padding: 7px 10px;
    font-size: 11px;
  }
}

.tseat + .tseat {
  margin-left: -11px;
}

.tseat.empty {
  background: transparent;
  border-style: dashed;
  box-shadow: none;
}

.tseat.bot {
  border-color: #60a5fa;
}

.tseat img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.tables-offline {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}

.opp-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.opponent.off {
  opacity: 0.45;
}

.table-meta {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  white-space: nowrap;
}

.table-join {
  flex-shrink: 0;
  padding: 8px 12px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.3px;
  background: linear-gradient(160deg, var(--gold), var(--gold-strong));
  color: #26200a;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
  transition: transform 0.1s;
}

.table-join:active {
  transform: scale(0.93);
}

/* Eşleşme ekranı */

#match-overlay {
  align-items: center;
}

.match-panel {
  width: min(100%, 380px);
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.match-panel h3 {
  font-size: 20px;
  font-weight: 800;
}

.match-seats {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.match-seat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 72px;
  position: relative;
}

.match-face {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 28px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05));
  border: 2px solid var(--panel-border);
  overflow: hidden;
}

.match-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.match-seat.filled .match-face {
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.3);
  animation: praise-pop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

.match-seat.bot .match-face {
  border-color: #60a5fa;
  box-shadow: 0 0 14px rgba(96, 165, 250, 0.3);
}

.match-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-bot-badge {
  position: absolute;
  top: -4px;
  right: 2px;
  background: #60a5fa;
  color: #0b1c33;
  font-size: 9px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 8px;
  letter-spacing: 0.5px;
}

.match-spin {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--gold);
  animation: match-spin 0.9s linear infinite;
}

@keyframes match-spin {
  to {
    transform: rotate(360deg);
  }
}

.match-status {
  font-size: 13px;
  color: var(--text-dim);
}

.match-count {
  font-size: 30px;
  font-weight: 900;
  color: var(--gold);
  min-height: 38px;
}

.cta {
  padding: 16px 58px;
  border-radius: 30px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(160deg, var(--gold), var(--gold-strong));
  color: #26200a;
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.45);
  transition: transform 0.1s;
}

.cta:active {
  transform: scale(0.95);
}

.ghost-btn {
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 600;
  padding: 8px 20px;
}

/* Oyun sonu */

#gameover-modal {
  align-items: center;
}

.gameover-sheet {
  border-radius: 24px;
  border-bottom: 1px solid var(--panel-border);
  max-width: 360px;
  margin: 0 16px;
  text-align: center;
  animation: sheet-pop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes sheet-pop {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.go-title {
  font-size: 26px;
  font-weight: 900;
  margin-bottom: 16px;
}

.go-title .crown {
  font-size: 46px;
  display: block;
  margin-bottom: 6px;
}

.go-scores {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
}

.go-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 15px;
  font-weight: 600;
}

.go-row.winner {
  border-color: var(--gold);
  background: rgba(251, 191, 36, 0.12);
}

.go-row .pts {
  font-weight: 800;
  color: var(--text-dim);
}

.go-stats {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.go-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: -6px;
  border: 1px solid var(--panel-border);
}

.exit-note {
  font-size: 14px;
  color: var(--text-dim);
  margin: -6px 0 16px;
}

/* ── Nasıl oynanır — etkileşimli tur ─────────────────────── */

#tutorial-overlay {
  align-items: flex-end;
}

.tut-panel {
  width: 100%;
  max-width: 460px;
  max-height: 94dvh;
  overflow-y: auto;
  background: linear-gradient(180deg, #0e3427 0%, #082018 100%);
  border: 1px solid var(--panel-border);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 14px 18px calc(var(--safe-bottom) + 18px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: sheet-up 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.tut-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tut-dots {
  display: flex;
  gap: 6px;
}

.tut-dots span {
  width: 7px;
  height: 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
  transition: width 0.25s, background 0.25s;
  cursor: pointer;
}

.tut-dots span.on {
  width: 20px;
  background: var(--gold);
}

.tut-skip {
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
}

.tut-stage-wrap {
  position: relative;
}

.tut-stage {
  position: relative;
  height: clamp(210px, 32dvh, 268px);
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(90% 80% at 50% 40%, rgba(45, 212, 191, 0.1) 0%, transparent 60%),
    radial-gradient(120% 100% at 50% 45%, #11553e 0%, #0a3527 60%, #072418 100%);
  border: 1px solid var(--panel-border);
}

.tut-try {
  position: absolute;
  top: 10px;
  left: 12px;
  background: var(--gold);
  color: #26200a;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 11px;
  border-radius: 13px;
  animation: banner-pulse 1.4s ease-in-out infinite;
  z-index: 8;
}

.tut-card {
  width: clamp(54px, 15vw, 66px);
  flex: 0 0 auto;
}

.tut-card img {
  display: block;
  width: 100%;
  border-radius: 7px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

.tut-card.tappable {
  cursor: pointer;
}

.tut-card.tappable:active {
  transform: scale(1.06);
}

.tut-card.dim img {
  filter: brightness(0.55) saturate(0.7);
}

.glow-img {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45), 0 0 0 2.5px var(--gold),
    0 0 18px rgba(251, 191, 36, 0.6) !important;
}

.tut-pile {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  width: clamp(54px, 15vw, 66px);
}

.tut-pile .tut-card {
  width: 100%;
}

.tut-deck {
  position: absolute;
  left: 17%;
  top: 40%;
  transform: translate(-50%, -50%);
  width: clamp(54px, 15vw, 66px);
}

.tut-deck .tut-card {
  width: 100%;
}

.tut-hand {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.tut-opp {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 46px;
  height: 46px;
  transition: opacity 0.3s;
}

.tut-opp.p1 {
  left: 36%;
}

.tut-opp.p2 {
  left: 64%;
}

.tut-opp-face {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 24px;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05));
  border: 2px solid var(--panel-border);
}

.tut-opp.skipped {
  opacity: 0.4;
}

.tut-opp.lit .tut-opp-face {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.25), 0 0 20px rgba(251, 191, 36, 0.4);
}

.tut-skip-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  font-size: 18px;
  animation: bubble-pop 0.25s ease-out;
}

.tut-chip {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 12px;
  border-radius: 14px;
  background: var(--panel-strong);
  border: 1px solid var(--panel-border);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  animation: chip-in 0.25s ease-out;
  z-index: 7;
}

.tut-chip.danger {
  background: rgba(248, 113, 113, 0.2);
  border-color: rgba(248, 113, 113, 0.5);
  color: var(--danger);
}

.tut-chip .red {
  color: #ff6b6b;
}

.tut-praise {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  padding: 7px 15px;
  border-radius: 15px;
  font-size: 14px;
  font-weight: 800;
  color: #06231a;
  background: #34d399;
  box-shadow: var(--shadow);
  white-space: nowrap;
  animation: praise-pop 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.4);
  z-index: 9;
}

.tut-praise.bad {
  background: #f87171;
  color: #fff;
}

@keyframes praise-pop {
  from {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.tut-trophy {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  font-size: 46px;
  animation: praise-pop 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.4);
  z-index: 8;
}

.tut-trophy.big {
  top: 26%;
  font-size: 56px;
}

.tut-suits {
  position: absolute;
  left: 50%;
  bottom: 100px;
  transform: translateX(-50%);
  display: flex;
  gap: 9px;
  animation: chip-in 0.25s ease-out;
  z-index: 8;
}

.tut-suit-btn {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: #fff;
  color: #111;
  font-size: 24px;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: transform 0.1s;
}

.tut-suit-btn:active {
  transform: scale(0.92);
}

.tut-suit-btn.red {
  color: #dc2626;
}

.tut-mau {
  position: absolute;
  right: 12px;
  bottom: 18px;
  padding: 11px 20px;
  border-radius: 22px;
  font-size: 15px;
  font-weight: 800;
  background: linear-gradient(160deg, #f87171, #dc2626);
  color: #fff;
  box-shadow: 0 5px 16px rgba(220, 38, 38, 0.45);
  animation: banner-pulse 1.4s ease-in-out infinite;
  z-index: 8;
}

.tut-mau.armed {
  background: linear-gradient(160deg, #34d399, #059669);
  box-shadow: 0 5px 16px rgba(5, 150, 105, 0.45);
  animation: none;
}

.tut-scores {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(78%, 250px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tut-score-row {
  display: flex;
  justify-content: space-between;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 11px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
}

.tut-score-row.win {
  border-color: var(--gold);
  background: rgba(251, 191, 36, 0.12);
}

.tut-confetti {
  position: absolute;
  top: -12px;
  width: 7px;
  height: 11px;
  border-radius: 2px;
  animation: tut-confetti-fall linear forwards;
  z-index: 6;
}

@keyframes tut-confetti-fall {
  to {
    transform: translateY(300px) rotate(540deg);
    opacity: 0.6;
  }
}

.tut-text {
  min-height: 84px;
}

.tut-text h3 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
}

.shake {
  animation: shake 0.4s;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

.tut-text p {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-dim);
}

.tut-nav {
  display: flex;
  gap: 10px;
}

.tut-btn {
  flex: 1;
  padding: 13px;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 800;
  transition: transform 0.1s;
}

.tut-btn:active {
  transform: scale(0.96);
}

.tut-btn.ghost {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
}

.tut-btn.ghost:disabled {
  opacity: 0.35;
}

.tut-btn.primary {
  flex: 2;
  background: linear-gradient(160deg, var(--gold), var(--gold-strong));
  color: #26200a;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.35);
}

.tut-btn.primary.pulse {
  animation: next-pulse 1.1s ease-in-out infinite;
}

@keyframes next-pulse {
  0%,
  100% {
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.35);
  }
  50% {
    box-shadow: 0 6px 26px rgba(245, 158, 11, 0.75);
  }
}

/* ── Yatay ekran ──────────────────────────────────────────── */

@media (orientation: landscape) and (max-height: 500px) {
  #app {
    padding-top: calc(var(--safe-top) + 4px);
    gap: 2px;
  }

  #opponents {
    min-height: 68px;
    padding: 0;
  }

  .opp-avatar {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .opp-cards {
    display: none;
  }

  .pile {
    width: clamp(60px, 11vh, 84px);
  }

  #hand {
    height: clamp(96px, 30vh, 128px);
  }

  #actions {
    position: fixed;
    right: calc(env(safe-area-inset-right, 0px) + 14px);
    bottom: calc(var(--safe-bottom) + 14px);
    min-height: 0;
  }

  #turn-banner {
    font-size: 12px;
  }
}

/* ═══ Arkadaş daveti ═══════════════════════════════════════ */

.invite-open {
  padding: 11px 22px;
  border-radius: 24px;
  border: 1px solid rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.1);
  color: var(--gold);
  font-size: 15px;
  font-weight: 800;
  align-self: center;
  transition: transform 0.1s;
}

.invite-open:active {
  transform: scale(0.95);
}

#invite-modal {
  z-index: 120;
}

.invite-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
}

.invite-status {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  padding: 28px 8px;
}

.invite-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
}

.invite-avatar {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f6b4a;
  font-weight: 800;
  font-size: 17px;
}

.invite-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.invite-name {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invite-btn {
  flex: none;
  min-width: 96px;
  height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  background: linear-gradient(160deg, var(--gold), var(--gold-strong));
  color: #26200a;
  font-size: 13px;
  font-weight: 800;
}

.invite-btn.pending {
  background: var(--panel-strong);
  color: var(--text-dim);
}

.invite-btn:disabled {
  opacity: 0.6;
}

:is(#invite-banner, #fr-banner) {
  position: fixed;
  top: calc(var(--safe-top) + 12px);
  left: 12px;
  right: 12px;
  max-width: 440px;
  margin: 0 auto;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, #0e3427 0%, #082018 100%);
  border: 1px solid rgba(251, 191, 36, 0.55);
  box-shadow: var(--shadow);
  animation: sheet-up 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}

:is(#invite-banner, #fr-banner) .ib-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

:is(#invite-banner, #fr-banner) .ib-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--text-dim);
}

:is(#invite-banner, #fr-banner) .ib-text b {
  color: var(--text);
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:is(#invite-banner, #fr-banner) .ib-text em {
  font-style: normal;
  color: var(--gold);
  font-size: 12px;
}

:is(#invite-banner, #fr-banner) .ib-actions {
  display: flex;
  gap: 10px;
}

:is(#invite-banner, #fr-banner) .ib-actions button {
  flex: 1;
  height: 40px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
}

:is(#invite-banner, #fr-banner) .ib-no {
  background: var(--panel-strong);
  color: var(--text-dim);
}

:is(#invite-banner, #fr-banner) .ib-yes {
  background: linear-gradient(160deg, var(--gold), var(--gold-strong));
  color: #26200a;
}

/* ── Rakip profil kartı, çerçeve, bot "+" rozeti ─────────── */

.opp-avatar.tappable {
  cursor: pointer;
}

/* Kozmetik çerçeve: uygulamadaki FramedUserAvatar gibi avatarın 1/0.82 katı */
.av-frame {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 122%;
  height: 122%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1;
}

.opp-avatar.framed {
  border-color: transparent;
}

.opp-plus {
  position: absolute;
  left: -6px;
  bottom: -4px;
  z-index: 2;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #22c55e;
  border: 2px solid var(--felt-deep, #082018);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.opp-count,
.opp-mute {
  z-index: 2;
}

.invite-game-btn svg {
  fill: currentColor;
}

.profile-sheet {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.profile-sheet .sheet-head {
  align-self: stretch;
  margin-bottom: 0;
}

.pc-face {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.18), rgba(4, 28, 20, 0.7));
  font-size: 42px;
}

.pc-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.pc-name {
  margin-top: 12px;
  font-size: 19px;
  font-weight: 800;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pc-sub {
  min-height: 16px;
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-dim);
}

.pc-actions {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.pc-btn {
  height: 46px;
  border-radius: 14px;
  background: var(--panel-strong);
  border: 1px solid var(--panel-border);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.pc-btn.primary {
  background: linear-gradient(160deg, var(--gold), var(--gold-strong));
  border-color: transparent;
  color: #26200a;
}

.pc-btn.danger {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.4);
}

.pc-btn.danger.armed {
  background: #b91c1c;
  border-color: #fecaca;
  color: #fff;
}

.pc-btn:disabled {
  opacity: 0.6;
}
