/* نقاب – نسخه وب (PWA) برای آیفون */
@font-face { font-family: "NLatin"; src: url("fonts/texgyretermes_regular.otf") format("opentype"); unicode-range: U+0000-00FF, U+2000-206F; font-display: swap; }
@font-face { font-family: "NFa"; src: url("fonts/b_titr_bold.ttf") format("truetype"); font-display: swap; }

:root {
  --bg: #020B20; --panel: #0A1636; --panel2: #13275A;
  --gold: #FFC21A; --blue: #4A86D9; --red: #FF2D4A; --green: #2EE66B; --purple: #A35CFF;
  --muted: #CAD3E1; --font: "NLatin", "NFa", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: #fff; font-family: var(--font); overscroll-behavior: none; }
body { direction: rtl; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea { font-family: var(--font); -webkit-user-select: text; user-select: text; }
button { font-family: var(--font); }
#app { min-height: 100dvh; }

/* ---------- صفحه‌های طراحی‌شده (تصویری) ---------- */
.dpage { display: flex; flex-direction: column; height: 100dvh; background: var(--bg); overflow: hidden; }
.dpage .edge { height: var(--safe-top); background-size: 100% 100%; flex: none; }
.dpage .strip { position: relative; flex: none; line-height: 0; }
.dpage .strip > img.bg { width: 100%; height: auto; display: block; pointer-events: none; }
.dpage .gap { flex: 1 1 0; background-size: 100% 100%; min-height: 0; }
.dpage .safeb { height: var(--safe-bottom); background: #05070F; flex: none; }
.spot { position: absolute; cursor: pointer; }
.spot:active { background: rgba(255, 255, 255, .08); }
.ov { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; color: #fff; text-align: center; line-height: 1.25; }

/* ---------- صفحه‌های قالب ساده ---------- */
.spage { min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.spage .head { position: relative; padding-top: var(--safe-top); flex: none; }
.spage .head img { width: 100%; display: block; }
.spage .head .back { position: absolute; left: 3.4%; top: calc(var(--safe-top) + 3.6vw); width: 8.5vw; height: 8.5vw; border-radius: 50%; }
.spage .head .logo { position: absolute; left: 57.6%; top: var(--safe-top); width: 35%; height: 18.75vw; }
.title-pill { margin: 0 44px 8px; height: 52px; border-radius: 99px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(#1A1408, #000); border: 2px solid #FFD54A; box-shadow: 0 0 14px rgba(255, 194, 26, .45); font-size: 22px; }
.panel { flex: 1; margin: 0 10px; padding: 12px 10px; border-radius: 26px; display: flex; flex-direction: column;
  background: linear-gradient(#0B1630, #050B1C); border: 1.5px solid rgba(74, 134, 217, .85); box-shadow: 0 0 14px rgba(74, 134, 217, .45); }
.skyline { flex: none; margin-top: 10px; position: relative; line-height: 0; }
.skyline img { width: 100%; display: block; }
.skyline::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 24px; background: linear-gradient(var(--bg), transparent); }
.safe-bottom { height: var(--safe-bottom); background: #05070F; flex: none; }
.grow { flex: 1; }

/* ---------- اجزای مشترک ---------- */
.btn { border: 0; border-radius: 99px; height: 52px; width: 100%; font-size: 18px; color: #1A1200; cursor: pointer;
  background: linear-gradient(#FFE680, #FFC21A 55%, #E09A00); border: 2px solid #FFF1B0; box-shadow: 0 0 14px rgba(255, 194, 26, .55); }
.btn:disabled { opacity: .45; }
.btn.red { color: #fff; background: linear-gradient(#FF5A72, #B0102E); border-color: #FF8A9C; box-shadow: 0 0 10px rgba(255, 45, 74, .4); }
.btn.purple { color: #fff; background: linear-gradient(#8B5CF6, #4C1D95); border-color: #C4B5FD; box-shadow: 0 0 10px rgba(163, 92, 255, .45); }
.btn.ghost { background: transparent; color: #FF8A9A; border: 1px solid rgba(255, 59, 92, .6); box-shadow: none; }
.btn.blue { color: #fff; background: linear-gradient(#1B3A7A, #0A1636); border-color: var(--blue); box-shadow: none; }
.btn.sm { height: 40px; font-size: 14px; }
.row { display: flex; align-items: center; gap: 8px; }
.row > .f1 { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.center { text-align: center; }
.small { font-size: 12px; }
.hint { font-size: 12px; color: rgba(255, 255, 255, .6); }
.sp6 { height: 6px; } .sp10 { height: 10px; } .sp14 { height: 14px; }
.chip { border-radius: 12px; border: 1px solid rgba(74, 134, 217, .5); background: linear-gradient(#13275A, #0A1636); color: #fff;
  height: 40px; display: flex; align-items: center; justify-content: center; padding: 0 8px; font-size: 15px; cursor: pointer; overflow: hidden; white-space: nowrap; }
.chip.on { border-color: var(--gold); background: linear-gradient(#6A4700, #2A1A00); }
.chip.dead { color: #6B7385; border-color: #2E3442; background: #12151C; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.num { color: var(--gold); font-size: 13px; min-width: 18px; }
.card { border-radius: 14px; padding: 8px 10px; background: rgba(0, 0, 0, .25); border: 1px solid rgba(74, 134, 217, .4); }
.input { width: 100%; height: 46px; border-radius: 14px; border: 1.5px solid rgba(74, 134, 217, .7); background: #0A1636; color: #fff; padding: 0 14px; font-size: 16px; outline: none; }
.input:focus { border-color: var(--gold); }
.step { width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .5); background: transparent; color: #fff; font-size: 18px; line-height: 1; cursor: pointer; flex: none; }
.stepv { min-width: 30px; text-align: center; color: var(--gold); font-size: 16px; }
.spinner { width: 22px; height: 22px; border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- اسلایدر تبلیغات ---------- */
.slider { position: absolute; overflow: hidden; background: #0A0F2A; }
.slider img { width: 100%; height: 100%; object-fit: fill; display: block; }
.dots { position: absolute; display: flex; justify-content: center; gap: 1.6vw; }
.dots img { width: 2.6vw; height: 2.6vw; }
.carousel { position: relative; margin: 0 28px; aspect-ratio: 871 / 270; border-radius: 14px; overflow: hidden; background: #0A0F2A; border: 1px solid rgba(255, 194, 26, .4); }
.carousel img { width: 100%; height: 100%; object-fit: fill; display: block; }
.carousel .arr { position: absolute; top: 50%; transform: translateY(-50%); width: 28px; height: 56px; border: 0; background: rgba(0, 0, 0, .35); color: #fff; font-size: 20px; }
.carousel .cdots { position: absolute; bottom: 5px; left: 0; right: 0; display: flex; justify-content: center; gap: 5px; }
.carousel .cdots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, .55); }
.carousel .cdots i.on { width: 7px; height: 7px; background: var(--gold); }

/* ---------- تیم‌ها و نقش‌ها ---------- */
.team { border-radius: 18px; padding: 8px; margin-bottom: 10px; display: flex; gap: 8px; }
.team.mafia { background: linear-gradient(#4A0A16, #1C0308); border: 1.5px solid rgba(255, 45, 74, .7); }
.team.city { background: linear-gradient(#073A1C, #031A0C); border: 1.5px solid rgba(46, 230, 107, .7); }
.team.independent { background: linear-gradient(#2A1050, #120625); border: 1.5px solid rgba(163, 92, 255, .7); }
.team .roles { flex: 1.55; max-height: 172px; overflow-y: auto; border-radius: 14px; background: rgba(0, 0, 0, .25); padding: 2px 8px; }
.team .roles label { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 18px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.team .roles input { width: 22px; height: 22px; accent-color: var(--gold); }
.team .side { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }

/* ---------- بازی ---------- */
.phase { border-radius: 18px; padding: 8px 12px; border: 1.5px solid rgba(255, 194, 26, .55); background: linear-gradient(#0E1A3A, #060C20); margin-bottom: 8px; }
.phase.night { border-color: rgba(163, 92, 255, .6); }
.bar { height: 6px; border-radius: 9px; background: rgba(255, 255, 255, .08); overflow: hidden; display: flex; flex: 1; }
.pcell { border-radius: 12px; min-height: 42px; padding: 4px 8px; display: flex; align-items: center; gap: 6px; cursor: pointer;
  background: linear-gradient(#13275A, #0A1636); border: 1px solid rgba(74, 134, 217, .5); }
.pcell.sel { background: linear-gradient(#4A0C1C, #2A0610); border-color: #FF3B5C; }
.pcell.dead { background: linear-gradient(#181C26, #101319); border-color: #2E3442; color: #6B7385; cursor: default; }
.cb { width: 20px; height: 20px; border-radius: 5px; border: 1.5px solid rgba(255, 255, 255, .7); flex: none; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.pcell.sel .cb { background: #FF3B5C; border-color: #FF8A9A; }
.revcard { aspect-ratio: 1; border-radius: 16px; display: flex; align-items: center; justify-content: center; padding: 8px; text-align: center; font-size: 18px; cursor: pointer;
  background: linear-gradient(135deg, #B3132F, #6E0619 55%, #2A020A); border: 1px solid #FF8A9C; box-shadow: 0 0 12px rgba(255, 45, 79, .45); position: relative; touch-action: none; }
.revcard::after { content: ""; position: absolute; inset: 8px; border: .5px solid rgba(255, 255, 255, .18); border-radius: 11px; }
.revcard.holding { transform: scale(.96); }
.dockbar { position: fixed; left: 10px; right: 10px; bottom: calc(var(--safe-bottom) + 6px); z-index: 20; border-radius: 22px; padding: 8px 0;
  background: linear-gradient(#0E1A3A, #060C20); border: 1.5px solid rgba(255, 194, 26, .6); display: flex; justify-content: space-evenly; }
.dock { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; cursor: pointer; background: none; border: 0; color: #fff; }
.dock .ic { width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; border: 2.5px solid; }
.nrow { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; height: 30px; margin: 1.5px 0; }
.nrow > div { border-radius: 10px; display: flex; align-items: center; padding: 0 8px; font-size: 13px; overflow: hidden; white-space: nowrap; }
.nrow .t { justify-content: center; cursor: pointer; background: #1A1F2C; border: 1px solid #2E3442; color: rgba(255, 255, 255, .75); font-size: 12px; }
.nrow .t.done { background: #0E3A22; border-color: var(--green); color: #fff; }
.nrow .t.part { background: #3A2A06; border-color: #FFC857; color: #fff; }
.nrow .t.off { opacity: .45; cursor: default; }
.result { border-radius: 16px; padding: 8px 10px; background: linear-gradient(#101C40, #080F26); border: 1px solid rgba(255, 194, 26, .4); }
.kill { height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 13px; cursor: pointer; background: rgba(19, 39, 90, .6); border: 1px solid rgba(74, 134, 217, .3); white-space: nowrap; overflow: hidden; }
.kill.on { background: #5A1022; border-color: #FF3B5C; }
.guns { border-radius: 14px; padding: 6px 10px; margin-bottom: 6px; background: linear-gradient(#2A1A08, #140C04); border: 1px solid rgba(255, 194, 26, .55); }
.pill { border-radius: 99px; padding: 2px 8px; font-size: 11px; color: #fff; }

/* ---------- پنجره‌ها ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .65); display: flex; align-items: center; justify-content: center; padding: 16px; }
.mbox { width: 100%; max-width: 480px; max-height: 88dvh; overflow-y: auto; border-radius: 24px; padding: 16px; background: linear-gradient(#0B1630, #050B1C);
  border: 1.5px solid var(--mc, var(--gold)); box-shadow: 0 0 18px color-mix(in srgb, var(--mc, var(--gold)) 50%, transparent); }
.mtitle { font-size: 20px; color: var(--mc, var(--gold)); text-align: center; margin-bottom: 10px; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--safe-bottom) + 96px); z-index: 80; background: rgba(20, 24, 40, .95); border: 1px solid rgba(255, 194, 26, .5);
  border-radius: 14px; padding: 10px 14px; font-size: 14px; text-align: center; animation: fade .2s; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } }
.ring { width: 210px; height: 210px; margin: 0 auto; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring .rt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 46px; }
.install { position: fixed; left: 12px; right: 12px; top: calc(var(--safe-top) + 8px); z-index: 70; background: #0E1A3A; border: 1px solid var(--gold); border-radius: 16px; padding: 10px 12px; font-size: 13px; }
