@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #1d0f1e;
  --bg2: #2a0f1c;
  --carpet: #8a1c2b;
  --carpet-dark: #5e1020;
  --navy: #1c2346;
  --gold: #f4c25b;
  --gold2: #d98e2b;
  --cream: #f6ecd4;
  --ink: #241626;
  --us: #19b8a6;
  --them: #ff8a3d;
  --red: #c8102e;
  --txt: #fff8ec;
  --muted: #d9c7b0;
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Vazirmatn', Tahoma, 'Segoe UI', sans-serif;
  background: radial-gradient(ellipse at top, #3b1527 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--txt);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
input, textarea { user-select: text; -webkit-user-select: text; font: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---------- buttons ---------- */
.btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 700;
  font-size: 16px;
  background: rgba(255, 255, 255, .12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15);
  transition: transform .12s, filter .12s;
}
.btn:active { transform: scale(.96); }
.btn.gold {
  background: linear-gradient(180deg, var(--gold), var(--gold2));
  color: #3a1d06;
  box-shadow: 0 4px 0 #8f5410, 0 8px 18px rgba(0, 0, 0, .35);
}
.btn.gold:active { box-shadow: 0 1px 0 #8f5410; transform: translateY(3px); }
.btn.big { font-size: 20px; padding: 14px 22px; font-weight: 900; }
.btn.ghost { background: transparent; box-shadow: none; color: var(--muted); font-weight: 500; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 10px; }
.btn.on { background: var(--gold); color: #3a1d06; }
.btn:disabled { opacity: .45; }
.icon-btn {
  border: 0; background: rgba(255, 255, 255, .1); border-radius: 12px;
  width: 38px; height: 38px; font-size: 18px; display: grid; place-items: center;
}

/* ---------- home ---------- */
#home { overflow-y: auto; align-items: center; justify-content: flex-start; padding: calc(16px + var(--safe-t)) 16px calc(24px + var(--safe-b)); }
.home-card {
  width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 14px;
  background: linear-gradient(180deg, rgba(138, 28, 43, .55), rgba(40, 14, 30, .75));
  border: 2px solid rgba(244, 194, 91, .35);
  border-radius: 24px; padding: 22px 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .45), inset 0 0 0 6px rgba(244, 194, 91, .06);
}
.logo { text-align: center; }
.logo h1 {
  margin: 0; font-size: 44px; font-weight: 900; line-height: 1.2;
  background: linear-gradient(180deg, #ffe7a6, var(--gold) 50%, var(--gold2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #5e1020);
}
.logo-slipper { display: inline-block; font-size: 64px; animation: slipperSpin 3s ease-in-out infinite; }
@keyframes slipperSpin {
  0%, 100% { transform: rotate(-18deg) translateY(0); }
  50% { transform: rotate(14deg) translateY(-8px); }
}
.tag { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.field { display: flex; flex-direction: column; gap: 8px; font-weight: 700; }
.field input, .join-row input {
  border: 2px solid rgba(244, 194, 91, .35); background: rgba(0, 0, 0, .3); color: var(--txt);
  border-radius: 12px; padding: 12px 14px; font-size: 17px; outline: none; width: 100%;
}
.field input:focus, .join-row input:focus { border-color: var(--gold); }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }
.avatar-opt {
  border: 2px solid transparent; background: rgba(255, 255, 255, .07); border-radius: 14px;
  padding: 6px 2px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.avatar-opt b { font-size: 30px; line-height: 1.1; }
.avatar-opt small { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.avatar-opt.sel { border-color: var(--gold); background: rgba(244, 194, 91, .18); }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; text-align: center; letter-spacing: 4px; direction: ltr; }
.conn { text-align: center; color: var(--muted); font-size: 12px; margin: 0; }
.conn.ok { color: #7fe0b0; }

/* ---------- toast & banner ---------- */
.toast {
  position: fixed; left: 50%; top: calc(64px + var(--safe-t)); transform: translateX(-50%);
  z-index: 60; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none;
  width: min(92vw, 460px);
}
.toast > div {
  background: rgba(20, 8, 20, .92); border: 1px solid rgba(244, 194, 91, .4); color: var(--txt);
  padding: 8px 14px; border-radius: 12px; font-weight: 700; font-size: 14.5px; text-align: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .4); animation: toastIn .25s ease-out;
}
.toast > div.bad { border-color: #ff6b6b; }
.toast > div.out { animation: toastOut .3s ease-in forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }

/* ---------- sheets (bottom drawers) ---------- */
.sheet { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-end; justify-content: center; }
.sheet-card {
  position: relative; width: 100%; max-width: 560px; max-height: 82vh; overflow-y: auto;
  background: linear-gradient(180deg, #3a1426, #22101f); border-top: 3px solid var(--gold);
  border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + var(--safe-b));
  animation: sheetUp .22s ease-out;
}
@keyframes sheetUp { from { transform: translateY(40%); opacity: 0; } }
.sheet-x { position: absolute; left: 12px; top: 10px; border: 0; background: rgba(255, 255, 255, .1); border-radius: 50%; width: 34px; height: 34px; }
.sheet h3 { margin: 0 0 12px; font-size: 19px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 0; border-radius: 12px; padding: 9px 12px; background: rgba(255, 255, 255, .1);
  font-size: 14.5px; font-weight: 600; text-align: right;
}
.chip:active { background: var(--gold); color: #3a1d06; }
.chat-row { display: flex; gap: 8px; margin-top: 14px; }
.chat-row input {
  flex: 1; border: 2px solid rgba(244, 194, 91, .35); background: rgba(0, 0, 0, .3); color: var(--txt);
  border-radius: 12px; padding: 10px 12px; font-size: 16px; outline: none;
}
.help p, .help li { line-height: 1.9; font-size: 15px; color: #f3e6d2; }
.help h4 { margin: 14px 0 4px; color: var(--gold); }
.help ul { padding-inline-start: 20px; margin: 0; }
.seat-menu { display: flex; flex-direction: column; gap: 8px; }
