/* ═══════════════════════════════════════════════════════
   DOMINO WEB — Shared Stylesheet
   Luxury Emerald & Gold theme matching the Android app
═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400&family=Cairo:wght@400;600;700&display=swap');

:root {
  /* ── Felt & Board ── */
  --felt:           #06261D;
  --felt-light:     #0E3A2C;
  --felt-dark:      #031812;
  --felt-edge:      #0F2A20;

  /* ── Leather ── */
  --leather:        #1F1009;
  --leather-light:  #2A1810;
  --leather-dark:   #160B06;
  --leather-deep:   #1A0E08;
  --leather-black:  #0A0805;

  /* ── Gold ── */
  --gold:           #D4AF37;
  --gold-pale:      #FFE89A;
  --gold-light:     #F5D67E;
  --gold-muted:     #A88A4B;
  --gold-deep:      #8B6914;
  --gold-shadow:    #5A4012;

  /* ── Ivory (tiles) ── */
  --ivory:          #F0E4C2;
  --ivory-dark:     #D9C99B;
  --ivory-line:     #8B6914;

  /* ── Walnut (tile backs) ── */
  --walnut:         #2A1810;
  --walnut-dark:    #1F1208;

  /* ── Teams ── */
  --team-a:         #D4AF37;
  --team-a-body:    #3E2410;
  --team-a-name:    #FFE89A;
  --team-b:         #1D9E75;
  --team-b-body:    #142820;
  --team-b-name:    #9FE8CC;

  /* ── Pip colors ── */
  --pip-1: #3D2817;
  --pip-2: #1565C0;
  --pip-3: #A30808;
  --pip-4: #6A1B9A;
  --pip-5: #455A64;
  --pip-6: #1B5E20;

  /* ── Text ── */
  --text-gold:      #FFE89A;
  --text-gold-muted:#A88A4B;
  --text-on-dark:   #FAF3E0;
  --text-subtle:    #8B6914;

  /* ── Radius ── */
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  /* ── Shadows ── */
  --shadow-gold: 0 0 20px rgba(212,175,55,0.15);
  --shadow-dark: 0 4px 24px rgba(0,0,0,0.5);
  --toolbar-bg: rgba(31,16,9,0.95);
  --hand-bg: rgba(31,16,9,0.92);
}

.five-pip-overlay {
  position: fixed;
  inset: 0;
  z-index: 19000;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(2, 12, 9, .76);
  backdrop-filter: blur(5px);
}
.five-pip-overlay.open { display: grid; }
.five-pip-overlay.notice { pointer-events: none; background: rgba(2, 12, 9, .42); }
.five-pip-card {
  width: min(420px, 92vw);
  padding: 24px 20px 20px;
  border: 1px solid var(--gold);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--felt-light), var(--felt-dark));
  box-shadow: 0 18px 60px rgba(0,0,0,.58), 0 0 28px rgba(212,175,55,.18);
  color: var(--text-on-dark);
  text-align: center;
}
.five-pip-icon {
  width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%;
  display: grid; place-items: center; font: 700 34px 'Cairo', sans-serif;
  color: var(--leather-dark); background: var(--gold-light);
  border: 3px solid var(--gold-pale); box-shadow: 0 0 22px rgba(212,175,55,.35);
}
.five-pip-card h2 { margin: 0 0 8px; color: var(--gold-pale); font-size: 22px; }
.five-pip-card p { margin: 0; color: var(--text-on-dark); font-size: 17px; line-height: 1.8; }
.five-pip-actions { display: flex; gap: 10px; margin-top: 20px; }
.five-pip-actions:empty { display: none; }
.five-pip-actions button {
  flex: 1; min-height: 48px; border-radius: 10px; font: 700 16px 'Cairo', sans-serif; cursor: pointer;
}
.five-pip-primary { color: var(--leather-dark); background: var(--gold-light); border: 1px solid var(--gold-pale); }
.five-pip-secondary { color: var(--gold-pale); background: transparent; border: 1px solid var(--gold-muted); }

:root[data-table-theme="royal"] {
  --felt:#3A1020; --felt-light:#5A1B30; --felt-dark:#19070F; --felt-edge:#401425;
  --leather:#281020; --leather-light:#3B1830; --leather-dark:#160912;
  --leather-deep:#200B19; --leather-black:#09040A;
  --gold:#E1B95B; --gold-pale:#FFE6A1; --gold-light:#F4D17B;
  --gold-muted:#B38A45; --gold-deep:#8A5A16; --gold-shadow:#59380F;
  --team-a:#D9A83E; --team-a-body:#5B3514; --team-a-name:#FFE8A8;
  --team-b:#4C83D1; --team-b-body:#142A4A; --team-b-name:#BFD8FF;
  --toolbar-bg:rgba(40,16,32,.96); --hand-bg:rgba(22,9,18,.94);
  --radius-sm:6px; --radius-md:10px; --radius-lg:14px; --radius-xl:20px;
}

:root[data-table-theme="night"] {
  --felt:#101820; --felt-light:#182732; --felt-dark:#060B10; --felt-edge:#14232D;
  --leather:#111822; --leather-light:#1B2633; --leather-dark:#070A0F;
  --leather-deep:#0B1017; --leather-black:#030507;
  --gold:#BCD0DC; --gold-pale:#F2FAFF; --gold-light:#DCEAF2;
  --gold-muted:#8097A5; --gold-deep:#526B79; --gold-shadow:#344650;
  --team-a:#36BDD5; --team-a-body:#10343C; --team-a-name:#D5F8FF;
  --team-b:#F0B84D; --team-b-body:#4A3210; --team-b-name:#FFE5A9;
  --toolbar-bg:rgba(7,10,15,.97); --hand-bg:rgba(7,10,15,.95);
  --radius-sm:4px; --radius-md:6px; --radius-lg:9px; --radius-xl:14px;
}

:root[data-table-theme="wood"] {
  --felt:#174832; --felt-light:#245A3D; --felt-dark:#0B281B; --felt-edge:#1B3C2C;
  --leather:#4A2817; --leather-light:#6B3D22; --leather-dark:#2C170D;
  --leather-deep:#351B10; --leather-black:#130A06;
  --gold:#D7A85B; --gold-pale:#FFDDA0; --gold-light:#EFC77E;
  --gold-muted:#A97B43; --gold-deep:#845522; --gold-shadow:#563416;
  --team-a:#C97845; --team-a-body:#5A2818; --team-a-name:#FFD0A8;
  --team-b:#2FA67A; --team-b-body:#123B2F; --team-b-name:#B9F0DA;
  --toolbar-bg:rgba(44,23,13,.96); --hand-bg:rgba(44,23,13,.94);
  --radius-sm:5px; --radius-md:8px; --radius-lg:12px; --radius-xl:18px;
}

:root[data-table-theme="rose"] {
  --felt:#4B1738; --felt-light:#72234F; --felt-dark:#1E0917; --felt-edge:#5B1D43;
  --leather:#35122C; --leather-light:#542043; --leather-dark:#200B1B;
  --leather-deep:#2A0D23; --leather-black:#10060D;
  --gold:#F2A6C4; --gold-pale:#FFE4EF; --gold-light:#FFC8DC;
  --gold-muted:#C98DA8; --gold-deep:#A84D76; --gold-shadow:#6B294A;
  --team-a:#EF78AA; --team-a-body:#66233F; --team-a-name:#FFD5E5;
  --team-b:#5CC9B0; --team-b-body:#153F3A; --team-b-name:#C7FFF1;
  --team-a-body-light:#873457; --team-a-chip-text:#FFF4F8;
  --toolbar-bg:rgba(42,13,35,.97); --hand-bg:rgba(32,11,27,.95);
  --radius-sm:8px; --radius-md:14px; --radius-lg:20px; --radius-xl:28px;
  --shadow-gold:0 0 22px rgba(242,166,196,.22);
}

/* App-wide appearance picker. It lives in the lobby, while the selected
   palette is shared by every page through the variables above. */
.table-theme-overlay {
  position:fixed; inset:0; z-index:4200; display:none; align-items:flex-end;
  justify-content:center; padding:16px; background:rgba(0,0,0,.68);
}
.table-theme-overlay.open { display:flex; }
.table-theme-dialog {
  width:min(520px,100%); max-height:min(82dvh,680px); overflow:auto;
  padding:16px; border:1px solid var(--gold-deep); border-radius:var(--radius-lg);
  background:var(--leather); color:var(--text-on-dark); box-shadow:var(--shadow-dark);
}
.table-theme-head { display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.table-theme-head h2 { flex:1; color:var(--gold-pale); font:700 1.25rem 'Amiri',serif; }
.table-theme-close {
  width:40px; height:40px; border:1px solid var(--gold-shadow); border-radius:50%;
  background:var(--leather-dark); color:var(--gold-pale); font-size:1.35rem; cursor:pointer;
}
.table-theme-list { display:grid; gap:9px; }
.table-theme-choice {
  width:100%; min-height:70px; display:flex; align-items:center; justify-content:space-between;
  gap:12px; padding:10px 13px; border:1px solid var(--gold-shadow);
  border-radius:var(--radius-sm); background:var(--leather-light); text-align:right;
  font:inherit; cursor:pointer;
}
.table-theme-choice.selected { border:2px solid var(--gold); box-shadow:var(--shadow-gold); }
.table-theme-choice strong,.table-theme-choice small { display:block; }
.table-theme-choice strong { color:var(--gold-pale); font-size:.95rem; }
.table-theme-choice small { margin-top:3px; color:var(--gold-muted); }
.table-theme-swatches { display:flex; direction:ltr; gap:5px; flex:0 0 auto; }
.table-theme-swatches i { width:22px; height:22px; border-radius:50%; border:1px solid rgba(255,255,255,.45); }

@media (min-width:700px) {
  .table-theme-overlay { align-items:center; }
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Cairo', sans-serif;
  background: var(--leather-black);
  color: var(--text-on-dark);
  min-height: 100dvh;
  direction: rtl;
  overflow-x: hidden;
  display: block;
}

/* ── Splash background ── */
.splash-bg {
  background: radial-gradient(ellipse at 50% 42%,
    var(--leather-light) 0%,
    var(--leather-dark) 55%,
    var(--leather-black) 100%);
}

/* ── Felt background ── */
.felt-bg {
  background: var(--felt);
}

/* ── Typography ── */
h1, h2, h3 { font-family: 'Amiri', serif; font-weight: 700; color: var(--gold-pale); }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

/* ── Gold divider ── */
.gold-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0;
}
.gold-divider::before, .gold-divider::after {
  content: ''; flex: 1;
  height: 0.5px; background: var(--gold-shadow);
}
.gold-divider span {
  width: 6px; height: 6px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--gold);
}

/* ── Gold frame border ── */
.gold-frame {
  border: 1.5px solid var(--gold);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-gold), inset 0 0 40px rgba(0,0,0,0.3);
}

/* ── Card ── */
.card {
  background: var(--leather);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gold-shadow);
  padding: 20px;
  box-shadow: var(--shadow-dark);
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  width: 100%; height: 50px;
  border: none; border-radius: var(--radius-md);
  font-family: 'Amiri', serif; font-size: 1rem; font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer; transition: all 0.15s ease;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: linear-gradient(180deg, var(--gold-pale) 0%, #B8941F 100%);
  color: var(--leather);
  border: 1px solid var(--gold-deep);
}
.btn-primary:active { background: var(--gold); transform: scale(0.98); }

.btn-secondary {
  background: var(--leather);
  color: var(--text-gold);
  border: 1.5px solid var(--gold);
}
.btn-secondary:active { background: var(--gold-shadow); transform: scale(0.98); }

.btn-ghost {
  background: transparent;
  color: var(--gold-muted);
  border: 1px solid var(--gold-shadow);
}
.btn-ghost:active { background: rgba(212,175,55,0.08); }

.btn-danger {
  background: #3D0A0A;
  color: #FF8A80;
  border: 1px solid #7A1A1A;
}

.btn:disabled { opacity: 0.4; pointer-events: none; }

/* ── Inputs ── */
.input-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.input-group label { font-size: 0.8rem; color: var(--gold-muted); letter-spacing: 0.08em; }

.input {
  width: 100%; height: 48px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--gold-shadow);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  color: var(--gold-pale);
  font-family: 'Cairo', sans-serif; font-size: 0.95rem;
  transition: border-color 0.2s;
  direction: rtl;
}
.input:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(212,175,55,0.06);
}
.input::placeholder { color: var(--gold-shadow); }

/* ── Toolbar ── */
.toolbar {
  display: flex; align-items: center; gap: 12px;
  height: 56px; padding: 0 16px;
  background: var(--leather);
  border-bottom: 0.5px solid var(--gold-shadow);
  position: sticky; top: 0; z-index: 100;
}
.toolbar-title {
  flex: 1; font-family: 'Amiri', serif; font-size: 1.1rem;
  color: var(--gold-pale); text-align: center;
}
.toolbar-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none;
  color: var(--gold); font-size: 1.2rem; cursor: pointer;
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
}
.toolbar-btn:active { background: rgba(212,175,55,0.1); }

/* ── Avatar ── */
.avatar {
  border-radius: 50%;
  border: 2px solid var(--gold);
  object-fit: cover;
  background: var(--leather-light);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.avatar-initials {
  font-family: 'Amiri', serif; font-weight: 700;
  color: var(--gold-pale);
}

/* ── Score pill (Android-style) ── */
.score-pill {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  height: 34px;
  border-radius: 17px;
  border: 1px solid var(--gold);
  background: var(--leather);
  font-family: 'Amiri', serif;
  overflow: hidden;
  min-width: 200px;
  direction: ltr;
}
.sp-team {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
}
.sp-a {
  background: var(--team-a-body);
  justify-content: flex-end;
}
.sp-b {
  background: var(--team-b-body);
  justify-content: flex-start;
}
.sp-badge {
  width: 22px; height: 22px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}
.sp-badge-a { background: var(--team-a);  color: var(--leather-dark); }
.sp-badge-b { background: var(--team-b);  color: var(--leather-dark); }
.sp-score { font-size: 1rem; font-weight: 700; }
.sp-a .sp-score { color: var(--team-a-name); }
.sp-b .sp-score { color: var(--team-b-name); }
.sp-round {
  align-self: center;
  height: 26px; padding: 0 12px;
  border-radius: 13px;
  background: var(--leather-dark);
  border: 1px solid var(--gold-shadow);
  color: var(--gold-muted);
  font-family: 'Amiri', serif; font-size: 0.78rem; font-weight: 700;
  cursor: default; margin: 0 4px;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s, color 0.2s;
  white-space: nowrap;
}
.sp-round.active {
  border-color: var(--gold);
  color: var(--gold-pale);
  cursor: pointer;
  animation: round-pulse 0.9s ease-in-out infinite;
}
@keyframes round-pulse {
  0%,100% { box-shadow: 0 0 4px rgba(212,175,55,0.3);  transform: scale(1);    }
  50%      { box-shadow: 0 0 14px rgba(212,175,55,0.85); transform: scale(1.1); }
}

/* ── Status badge ── */
.badge-active {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(29,158,117,0.15);
  border: 1px solid var(--team-b);
  color: var(--team-b-name);
  border-radius: 20px; padding: 2px 10px; font-size: 0.75rem;
}
.badge-waiting {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(212,175,55,0.1);
  border: 1px solid var(--gold-shadow);
  color: var(--gold-muted);
  border-radius: 20px; padding: 2px 10px; font-size: 0.75rem;
}
.status-dot {
  width: 6px; height: 6px; border-radius: 50;
}
.badge-active .status-dot { background: var(--team-b); }
.badge-waiting .status-dot { background: var(--gold-muted); }

/* ── Game card ── */
.game-card {
  background: var(--leather);
  border: 1px solid var(--gold-shadow);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-dark);
  transition: border-color 0.2s;
}
.game-card:active { border-color: var(--gold); }
.game-card-title {
  font-family: 'Amiri', serif; font-size: 1rem;
  color: var(--gold-pale); margin-bottom: 8px;
}

/* ── Player chip ── */
.player-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.player-chip.team-a { background: var(--team-a-body); border: 1px solid var(--team-a); }
.player-chip.team-b { background: var(--team-b-body); border: 1px solid var(--team-b); }
.player-chip-name { font-size: 0.85rem; font-weight: 600; }
.player-chip.team-a .player-chip-name { color: var(--team-a-name); }
.player-chip.team-b .player-chip-name { color: var(--team-b-name); }

/* ── Domino tile ── */
.domino-tile {
  background: var(--ivory);
  border: 1px solid var(--ivory-dark);
  border-radius: 4px;
  position: relative;
  display: flex; flex-direction: column;
  box-shadow: 1px 2px 4px rgba(0,0,0,0.4);
}
.domino-tile::after {
  content: '';
  position: absolute;
  inset: 2px; border-radius: 2px;
  border: 0.5px solid var(--gold);
  pointer-events: none;
}
.tile-half {
  flex: 1; display: flex; align-items: center; justify-content: center;
  position: relative;
}
.tile-divider-h {
  height: 1px; background: var(--ivory-line);
  margin: 0 3px;
}
.tile-divider-v {
  width: 1px; background: var(--ivory-line);
  margin: 3px 0;
}
.tile-back {
  background: var(--walnut);
  border: 1px solid var(--gold-shadow);
  border-radius: 4px;
}

/* ── Pass button ── */
.pass-btn {
  background: var(--leather-dark);
  border: 1.5px solid var(--gold-shadow);
  border-radius: var(--radius-md);
  color: var(--gold-muted);
  font-family: 'Amiri', serif; font-size: 1rem;
  padding: 10px 28px;
  cursor: pointer; transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.pass-btn:active { background: var(--gold-shadow); color: var(--gold-pale); }
.pass-btn.active {
  background: rgba(212,175,55,0.12);
  border-color: var(--gold);
  color: var(--gold-pale);
  animation: pulse-pass 1.2s ease-in-out infinite;
}
@keyframes pulse-pass {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212,175,55,0.3); }
  50%       { box-shadow: 0 0 0 6px rgba(212,175,55,0); }
}

/* ── Round badge ── */
.round-badge {
  background: var(--leather-dark);
  border: 1px solid var(--gold-shadow);
  border-radius: var(--radius-sm);
  padding: 2px 10px;
  font-family: 'Amiri', serif; font-size: 0.8rem;
  color: var(--gold-muted);
}
.round-badge.active {
  background: rgba(212,175,55,0.12);
  border-color: var(--gold);
  color: var(--gold-pale);
}

/* ── Loading spinner ── */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--gold-shadow);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(10,8,5,0.8);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}

/* ── Toast ── */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--leather-light);
  border: 1px solid var(--gold-shadow);
  border-radius: var(--radius-md);
  padding: 10px 20px;
  color: var(--text-on-dark); font-size: 0.9rem;
  z-index: 2000; white-space: nowrap;
  box-shadow: var(--shadow-dark);
  animation: toast-in 0.3s ease, toast-out 0.3s ease 2.7s forwards;
}
@keyframes toast-in  { from { opacity:0; transform: translateX(-50%) translateY(10px); } }
@keyframes toast-out { to   { opacity:0; transform: translateX(-50%) translateY(10px); } }

/* ── Compass decoration ── */
.compass-svg {
  position: absolute; pointer-events: none; opacity: 0.12;
}

/* ── Utilities ── */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-gold { color: var(--gold-pale); }
.text-muted { color: var(--gold-muted); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.font-serif { font-family: 'Amiri', serif; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.p-4 { padding: 16px; }
.hidden { display: none !important; }

/* ── Page container ── */
.page {
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  display: flex; flex-direction: column;
}

/* ── Scroll area ── */
.scroll-area {
  flex: 1; overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

/* ── Desktop wrapper ── */
@media (min-width: 600px) {
  .page { box-shadow: 0 0 60px rgba(0,0,0,0.8); max-width: 480px; margin: 0 auto; }
  body:not(.game-body) { display: flex; justify-content: center; }
}
/* Hand tiles rendered by canvas — suppress CSS visual properties */
.tile.tile-canvas-face {
    background: transparent;
    border: none;
}
.tile.tile-canvas-face::after {
    display: none;
}
/* ── Empty seat bot picker ── */
.empty-seat-action {
    outline: 2px dashed rgba(241, 215, 135, 0.72);
    outline-offset: 3px;
}
.add-bot-overlay {
    position: absolute; inset: 0; z-index: 430;
    display: flex; align-items: center; justify-content: center;
    padding: 18px; background: rgba(0,0,0,0.68);
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.add-bot-overlay.open { opacity: 1; pointer-events: all; }
.add-bot-dialog {
    width: min(360px, 100%); padding: 20px;
    background: var(--leather-light); color: var(--cream);
    border: 1px solid var(--gold); border-radius: 8px;
    box-shadow: 0 18px 50px rgba(0,0,0,.48); text-align: right;
}
.add-bot-title { color: var(--gold-pale); font-size: 1.15rem; font-weight: 700; }
.add-bot-subtitle { margin-top: 5px; color: rgba(255,255,255,.72); font-size: .86rem; }
.add-bot-levels { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin: 16px 0; }
.add-bot-levels button, .add-bot-actions button {
    min-height: 42px; border-radius: 6px; border: 1px solid rgba(241,215,135,.36);
    background: rgba(255,255,255,.07); color: var(--cream); font: inherit; cursor: pointer;
}
.add-bot-levels button.selected {
    border-color: var(--gold); background: rgba(198,157,59,.28); color: var(--gold-pale); font-weight: 700;
}
.add-bot-actions { display: flex; gap: 10px; }
.add-bot-actions button { flex: 1; }
.add-bot-actions .add-bot-confirm { background: var(--gold); color: #241607; font-weight: 700; }

/* ── Tile size dialog ── */
.tile-size-overlay {
    position: absolute; inset: 0; z-index: 400;
    background: rgba(0,0,0,0.65);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s;
}
.tile-size-overlay.open { opacity: 1; pointer-events: all; }
.tile-size-dialog {
    background: var(--leather-light);
    border: 1px solid var(--gold);
    border-radius: var(--radius-xl);
    padding: 20px;
    width: min(90vw, 320px);
    display: flex; flex-direction: column; gap: 16px;
}
.tsd-title {
    font-family: 'Amiri', serif; font-size: 1.1rem;
    color: var(--gold-pale); text-align: center;
}
.tsd-row {
    display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.tsd-label {
    display: flex; justify-content: space-between;
    width: 100%; font-size: 0.85rem; color: var(--gold-muted);
}
.tsd-pct { color: var(--gold-pale); font-weight: 700; }
.tsd-slider {
    width: 100%; accent-color: var(--gold);
    height: 4px; border-radius: 2px; cursor: pointer;
}
.tsd-preview {
    border-radius: 4px;
    box-shadow: 1px 2px 6px rgba(0,0,0,0.5);
}
.tsd-divider {
    height: 1px; background: var(--gold-shadow); width: 100%;
}
.tsd-done {
    width: 100%; height: 44px;
    background: linear-gradient(180deg, var(--gold-pale) 0%, #B8941F 100%);
    color: var(--leather); border: none; border-radius: var(--radius-md);
    font-family: 'Amiri', serif; font-size: 1rem; font-weight: 700;
    cursor: pointer;
}
/* ── Animations ── */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fade-in 0.35s ease forwards; }

@keyframes gold-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(212,175,55,0.2); }
  50%       { box-shadow: 0 0 18px rgba(212,175,55,0.5); }
}
.redeal-reason-modal {
  position: fixed;
  inset: 0;
  z-index: 18000;
  display: none;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  background: rgba(0, 8, 6, .82);
  backdrop-filter: blur(5px);
}

.redeal-reason-modal.open { display: grid; }

.redeal-reason-panel {
  direction: rtl;
  width: min(560px, 100%);
  max-height: min(82vh, 720px);
  overflow: auto;
  padding: 20px;
  border: 1px solid rgba(226, 190, 73, .75);
  border-radius: 8px;
  color: #f7ebc7;
  background: #083026;
  box-shadow: 0 22px 70px rgba(0, 0, 0, .62);
}

.redeal-reason-panel header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.redeal-reason-panel h2 {
  margin: 2px 0 0;
  color: #e2be49;
  font-size: 24px;
  letter-spacing: 0;
}

.redeal-reason-kicker { color: #9eb8ad; font-size: 13px; }

.redeal-reason-close {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(226, 190, 73, .55);
  border-radius: 50%;
  color: #e2be49;
  background: #191410;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.redeal-reason-text {
  margin: 0 0 16px;
  padding: 13px 14px;
  border-inline-start: 4px solid #e2be49;
  color: #fff5d7;
  background: rgba(0, 0, 0, .2);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.7;
}

.redeal-reason-hands { display: grid; gap: 10px; }

.redeal-player-card {
  padding: 12px;
  border: 1px solid rgba(226, 190, 73, .35);
  border-radius: 7px;
  background: #191410;
}

.redeal-player-card h3 {
  margin: 0 0 9px;
  color: #e2be49;
  font-size: 17px;
  letter-spacing: 0;
}

.redeal-player-hand {
  display: flex;
  gap: 5px;
  align-items: center;
  overflow-x: auto;
  padding: 3px 1px 7px;
}

.redeal-player-hand .redeal-hand-tile {
  flex: 0 0 30px;
  width: 30px !important;
  height: 56px !important;
  cursor: default;
}

.redeal-reason-note {
  margin: 15px 0 12px;
  color: #b8c9c1;
  text-align: center;
  font-size: 14px;
}

.redeal-reason-done {
  width: 100%;
  min-height: 48px;
  border: 1px solid #f3d774;
  border-radius: 7px;
  color: #241a08;
  background: #e2be49;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

@media (max-width: 520px) {
  .redeal-reason-panel { padding: 16px 13px; }
  .redeal-reason-panel h2 { font-size: 21px; }
  .redeal-reason-text { font-size: 17px; }
}
