:root{
  --bg0:#060a14;
  --bg1:#0b1220;
  --glass: rgba(255,255,255,.08);
  --glass2: rgba(255,255,255,.12);
  --border: rgba(255,255,255,.14);
  --text:#eaf0ff;
  --muted: rgba(234,240,255,.75);
  --muted2: rgba(234,240,255,.55);
  --accent:#7c3aed;
  --accent2:#22c55e;
  --danger:#ef4444;
  --shadow: 0 18px 50px rgba(0,0,0,.55);
  --radius: 18px;
  --radius2: 22px;
}

[data-theme="light"]{
  --bg0:#f5f7ff;
  --bg1:#ffffff;
  --glass: rgba(15,23,42,.06);
  --glass2: rgba(15,23,42,.09);
  --border: rgba(15,23,42,.12);
  --text:#0b1220;
  --muted: rgba(11,18,32,.75);
  --muted2: rgba(11,18,32,.55);
  --shadow: 0 18px 50px rgba(2,6,23,.12);
}

/* ========= BYekan (put files here)
   app/static/fonts/BYekan.woff2
   app/static/fonts/BYekan.woff
   ========= */
@font-face{
  font-family: "BYekan";
  src: url("/static/fonts/BYekan.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Base */
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% 10%, rgba(124,58,237,.25), transparent 50%),
    radial-gradient(900px 540px at 90% 20%, rgba(34,197,94,.18), transparent 50%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  overflow-x:hidden;
}

/* Persian font rule */
html[lang="fa"] body,
html[lang="fa"] button,
html[lang="fa"] input,
html[lang="fa"] textarea,
html[lang="fa"] .btn,
html[lang="fa"] .chip{
  font-family: "BYekan", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

.app{ min-height:100%; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

.glass{
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
}

/* Top bar */
.topbar{
  position: sticky;
  top: 0;
  z-index: 20;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 12px 12px;
  margin: 12px;
}


/* HERO header stack (fix logo spacing reliably) */
.hero{
  padding: 14px;
}

.hero-head{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;              /* ✅ فاصله واقعی بین لوگو و متن‌ها */
  margin: 0 0 14px;      /* فاصله کل هدر از دکمه‌ها */
  text-align: center;
}

.hero-logo{
  width: 184px;
  height: 184px;
  display: block;
  object-fit: contain;
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  margin: 0;            /* ✅ دیگه با margin کنترل نمی‌کنیم */
}

.hero-name{
  font-size: 28px;
  font-weight: 950;
  letter-spacing: .3px;
  margin: 0;
}

.hero-title{
  font-size: 18px;
  font-weight: 900;
  line-height: 1.25;
  margin: 0;
}

.hero-sub{
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
  font-weight: 800;
  margin: 0;
}

.iconbtn{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.08);
  color: var(--text);
  display:grid;
  place-items:center;
  cursor:pointer;
  transition: transform .12s ease, background .2s ease;
  font-weight: 950;
}
[data-theme="light"] .iconbtn{ background: rgba(255,255,255,.5); }
.iconbtn:active{ transform: scale(.98); }

.exitIcon{
  width: 22px; height: 22px; display:block; position:relative;
}
.exitIcon::before{
  content:"";
  position:absolute; inset: 0;
  background:
    linear-gradient(var(--text),var(--text)) 6px 6px/2px 10px no-repeat,
    linear-gradient(var(--text),var(--text)) 6px 6px/12px 2px no-repeat,
    linear-gradient(var(--text),var(--text)) 6px 14px/12px 2px no-repeat,
    linear-gradient(var(--text),var(--text)) 14px 8px/2px 8px no-repeat;
  opacity: .92;
  border-radius: 6px;
}
.exitIcon::after{
  content:"";
  position:absolute;
  left: 2px; top: 9px;
  width: 0; height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-right: 6px solid var(--text);
  opacity: .92;
}

.hamburger{
  width: 18px; height: 12px; position: relative; display:block;
}
.hamburger::before{
  content:"";
  position:absolute;
  left:0; right:0;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  top:0;
  box-shadow: 0 5px 0 var(--text), 0 10px 0 var(--text);
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  user-select:none;
}
.brand-dot{
  width:10px; height:10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), rgba(34,197,94,.9));
  box-shadow: 0 0 0 6px rgba(124,58,237,.15);
}
.brand-title{
  font-weight: 800;
  letter-spacing: .2px;
}
.badge{
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--glass2);
  font-weight: 700;
  font-size: 12px;
  opacity: .95;
}

.top-actions{ display:flex; gap:10px; }
.flag{ font-size:18px; }
.themeIcon{ font-size:18px; }

/* Layout */
.container{
  padding: 12px;
  max-width: 900px;
  margin: 0 auto;
}
.hero{ padding: 18px; margin: 12px 0; }
.hero-title{ font-size: 22px; font-weight: 900; line-height: 1.15; }
.hero-sub{ margin-top: 10px; color: var(--muted); line-height: 1.45; }
.grid2{ display:grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }

.btn{
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 14px;
  font-weight: 800;
  cursor:pointer;
  color: var(--text);
  background: rgba(0,0,0,.08);
  transition: transform .12s ease, filter .2s ease, background .2s ease;
  text-decoration:none;
  display:inline-grid;
  place-items:center;
}
[data-theme="light"] .btn{ background: rgba(255,255,255,.55); }
.btn:active{ transform: scale(.99); }
.btn.primary{
  background: linear-gradient(135deg, rgba(124,58,237,.92), rgba(34,197,94,.82));
  border-color: rgba(255,255,255,.18);
}
.btn.ghost{ background: transparent; }
.btn.full{ width: 100%; }
.btn.mini{ padding: 10px 12px; border-radius: 14px; font-weight: 900; }

.slidebox, .createbox{
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--glass2);
  display:none;
}
.slidebox.show, .createbox.show{ display:block; }

.label{ display:block; font-size: 13px; color: var(--muted); margin-bottom: 8px; font-weight: 800; }
.row{ display:flex; gap:10px; align-items:center; margin-top: 10px; }
.input{
  width: 100%;
  padding: 14px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.10);
  color: var(--text);
  outline:none;
  font-weight: 900;
  letter-spacing: .6px;
  text-transform: uppercase;
}
[data-theme="light"] .input{ background: rgba(255,255,255,.7); }
.input::placeholder{ color: var(--muted2); letter-spacing: .3px; text-transform:none; }

.codepill{
  width: 100%;
  padding: 14px 14px;
  border-radius: 999px;
  border: 1px dashed rgba(255,255,255,.35);
  background: rgba(0,0,0,.10);
  color: var(--text);
  font-weight: 950;
  letter-spacing: 1px;
  cursor:pointer;
}
[data-theme="light"] .codepill{ border-color: rgba(11,18,32,.28); background: rgba(255,255,255,.7); }
.hint{ margin-top: 8px; font-size: 12px; color: var(--muted2); text-align:center; }

.foot{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 14px;
  margin: 12px 0 18px;
}
.tiny{ font-size: 12px; color: var(--muted2); line-height: 1.35; }

/* Drawer */
.drawer{ position: fixed; inset: 0; background: rgba(0,0,0,.55); display:none; z-index: 60; }
.drawer.show{ display:block; }
.drawer > .drawer-top, .drawer > .drawer-body{
  position:absolute;
  left: 12px; right: 12px;
  max-width: 520px;
  margin: 0 auto;
}
.drawer-top{
  top: 12px;
  display:flex; align-items:center; justify-content:space-between;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(16px);
}
.drawer-title{ font-weight: 950; }
.drawer-body{
  top: 74px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(16px);
}
.drawer-item{ padding: 10px 6px; }
.drawer-label{ font-weight: 950; }
.drawer-sub{ margin-top: 6px; color: var(--muted); line-height: 1.4; font-size: 13px; }
.divider{ height:1px; background: var(--border); margin: 10px 0; }

/* Modal */
.modal{ position: fixed; inset: 0; background: rgba(0,0,0,.55); display:none; z-index: 80; padding: 18px; }
.modal.show{ display:grid; place-items:center; }
.modal-card{ width: min(520px, 92vw); padding: 16px; }
.modal-title{ font-weight: 950; font-size: 16px; }
.modal-text{ margin-top: 10px; color: var(--muted); line-height: 1.5; font-weight: 800; }

/* Room */
.room{
  padding: 12px;
  max-width: 980px;
  margin: 0 auto;
  display:grid;
  gap: 12px;
}
.stage{ padding: 16px; }
.stage-title{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight: 950;
}
.dotlive{
  width:10px; height:10px; border-radius:999px;
  background: var(--danger);
  box-shadow: 0 0 0 7px rgba(239,68,68,.18);
}
.dotlive.live{
  background: var(--accent2);
  box-shadow: 0 0 0 7px rgba(34,197,94,.16);
  animation: livePulse 1s infinite;
}
@keyframes livePulse{
  0%{ transform: scale(1); opacity:1; }
  50%{ transform: scale(1.15); opacity:.65; }
  100%{ transform: scale(1); opacity:1; }
}

/* Admin center */
.adminCenter{
  margin-top: 14px;
  display:flex;
  flex-direction: column;
  align-items:center;
  justify-content:center;
  gap: 14px;
}

.ring{
  width: 92px;
  height: 92px;
  border-radius: 999px;
  background: conic-gradient(from 120deg, rgba(124,58,237,.95), rgba(34,197,94,.75), rgba(124,58,237,.95));
  padding: 4px;
  flex: 0 0 auto;
}
.ringBig{
  width: 150px;
  height: 150px;
  padding: 6px;
}
.ring video{
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: rgba(0,0,0,.25);
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.12);
}

.controls{
  display:flex;
  flex-wrap: wrap;
  gap: 10px;
}
.controls.center{ justify-content: center; }

.chip{
  border: 1px solid var(--border);
  background: rgba(0,0,0,.08);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 12px;
  font-weight: 950;
  cursor:pointer;
}
[data-theme="light"] .chip{ background: rgba(255,255,255,.55); }
.chip:active{ transform: scale(.99); }

.assetsStrip{
  width: 100%;
  max-width: 720px;
  display:none;
  gap: 10px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 6px 0;
}
.assetsStrip.show{ display:flex; }

.assetThumb{
  width: 66px;
  height: 66px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.12);
  position: relative;
  overflow:hidden;
  cursor: pointer;
  display:grid;
  place-items:center;
}
[data-theme="light"] .assetThumb{ background: rgba(255,255,255,.55); }
.assetThumb img, .assetThumb video{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
}
.assetLabel{
  font-weight: 950;
  font-size: 11px;
  color: var(--text);
  opacity: .9;
  padding: 0 6px;
  text-align:center;
}
.assetX{
  position:absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(239,68,68,.92);
  color: #fff;
  font-weight: 950;
  display:grid;
  place-items:center;
  font-size: 12px;
}

/* Participants */
.participants{ padding: 14px; }
.participants-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.participants-title{ font-weight: 950; }
.participants-count{
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--glass2);
  font-weight: 950;
  font-size: 12px;
}

.pgrid{ display:grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 460px){ .pgrid{ grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 820px){ .pgrid{ grid-template-columns: repeat(4, 1fr); } }

.pcard{
  position: relative;
  border-radius: 999px;
  overflow:hidden;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.10);
  aspect-ratio: 1 / 1;
  min-height: 120px;
  cursor: pointer;
}
[data-theme="light"] .pcard{ background: rgba(255,255,255,.55); }
.pcard video{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
}
.ptag{
  position:absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.35);
  color: #fff;
  font-weight: 950;
  font-size: 12px;
}
[data-theme="light"] .ptag{ background: rgba(11,18,32,.45); }

.hidden{ display:none !important; }

/* Stream Spotlight */
.spotlight{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.88);
  z-index: 200;
  display:grid;
  place-items:center;
  padding: 10px;
}
.spotlight video{
  width: min(980px, 96vw);
  height: min(92vh, 900px);
  border-radius: 22px;
  object-fit: cover;
  background: #000;
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 25px 70px rgba(0,0,0,.6);
}
.spotlightBadge{
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 950;
}
.spotlightHint{
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: #fff;
  font-weight: 900;
}

/* Asset Presenter */
.presenter{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 220;
  display:flex;
  flex-direction: column;
}
.presenterBar{
  margin: 12px;
  padding: 10px 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}
.presenterTitle{ font-weight: 950; }
.presenterBtns{ display:flex; gap: 10px; align-items:center; flex-wrap: wrap; }

.presenterBody{
  flex: 1;
  display:grid;
  place-items:center;
  padding: 10px 10px 18px;
}
.presentMedia{
  width: min(980px, 96vw);
  max-height: calc(100vh - 130px);
  border-radius: 22px;
  object-fit: contain;
  background: #000;
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 25px 70px rgba(0,0,0,.6);
}
.presentTextWrap{
  width: min(980px, 96vw);
  max-height: calc(100vh - 130px);
  padding: 14px;
  overflow:auto;
}
.presentText{
  color: #fff;
  font-weight: 800;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* Editor */
.editor{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.86);
  z-index: 240;
  display:flex;
  flex-direction: column;
}
.editorTop{
  margin: 12px;
  padding: 10px 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}
.editorTitle{ font-weight: 950; }
.editorBtns{ display:flex; gap: 10px; flex-wrap: wrap; }
.editorBody{
  flex: 1;
  display:grid;
  place-items:center;
  padding: 10px 10px 18px;
}
.editorPaper{
  width: min(980px, 96vw);
  height: calc(100vh - 140px);
  padding: 16px;
  overflow:auto;
  outline:none;
  color: var(--text);
  font-weight: 800;
  line-height: 1.7;
  background: rgba(255,255,255,.06);
}
html[lang="fa"] .editorPaper{ direction: rtl; }

/* Tools sheet */
.sheet{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 260;
  display:grid;
  place-items:end center;
  padding: 14px;
}
.sheetCard{
  width: min(520px, 96vw);
  padding: 14px;
  border-radius: 22px;
}
.sheetTitle{ font-weight: 950; margin-bottom: 12px; }
.sheetGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 420px){
  .sheetGrid{ grid-template-columns: 1fr; }
}

/* RTL tweaks */
[data-dir="rtl"] body{ direction: rtl; }
[data-dir="rtl"] .brand{ direction: rtl; }
