:root {
  --bg: #07060c;
  --panel: rgba(24, 18, 32, 0.78);
  --acc: #f0b429;
  --ice: #a78bfa;
  --text: #f7f3ea;
  --muted: #b4a99a;
  --line: rgba(240, 180, 41, 0.16);
  --cabinet: rgba(16, 12, 22, 0.94);
  --ink: #1a1206;
  --acc-rgb: 240, 180, 41;
  --ice-rgb: 167, 139, 250;
  --bg-rgb: 7, 6, 12;
  --wash:
    radial-gradient(ellipse at 12% -10%, rgba(240,180,41,0.18), transparent 42%),
    radial-gradient(ellipse at 92% 88%, rgba(167,139,250,0.16), transparent 44%),
    #07060c;
  --sans: "Vazirmatn", system-ui, sans-serif;
  --disp: "Syne", "Vazirmatn", sans-serif;
}
html[data-theme="gold"] {
  --bg: #120e06; --acc: #fbbf24; --ice: #fdba74; --text: #fffbeb; --muted: #fcd34d;
  --ink: #1c1504; --acc-rgb: 251, 191, 36; --ice-rgb: 253, 186, 116; --bg-rgb: 18, 14, 6;
  --panel: rgba(40,30,10,0.74); --line: rgba(251,191,36,0.16); --cabinet: rgba(28,20,8,0.94);
  --wash: radial-gradient(ellipse at 50% -10%, rgba(250,204,21,0.16), transparent 42%), #120e06;
}
html[data-theme="ion"] {
  --bg: #061016; --acc: #22d3ee; --ice: #a78bfa; --text: #ecfeff; --muted: #67e8f9;
  --ink: #042f2e; --acc-rgb: 34, 211, 238; --ice-rgb: 167, 139, 250; --bg-rgb: 6, 16, 22;
  --panel: rgba(8,28,40,0.74); --line: rgba(34,211,238,0.16); --cabinet: rgba(8,22,32,0.94);
  --wash: radial-gradient(ellipse at 20% 0%, rgba(34,211,238,0.18), transparent 42%),
    radial-gradient(ellipse at 90% 90%, rgba(167,139,250,0.14), transparent 40%), #061016;
}
html[data-theme="paper"] {
  --bg: #f6efe4; --acc: #b45309; --ice: #6d28d9; --text: #1c1917; --muted: #78716c;
  --ink: #fffbeb; --acc-rgb: 180, 83, 9; --ice-rgb: 109, 40, 217; --bg-rgb: 246, 239, 228;
  --panel: rgba(255,251,245,0.84); --line: rgba(120,53,15,0.12); --cabinet: rgba(255,247,237,0.96);
  --wash: radial-gradient(ellipse at 50% -10%, rgba(217,119,6,0.12), transparent 42%), #f6efe4;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  height: 100dvh;
  min-height: 100%;
  min-height: -webkit-fill-available;
  background: var(--wash);
  color: var(--text);
  font-family: var(--sans);
  overflow: hidden;
}
body { display: flex; flex-direction: column; min-height: 100%; min-height: 100dvh; }
button, input, a { font-family: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
svg { display: block; width: 20px; height: 20px; fill: currentColor; }

#fx { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.glow {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 18% 0%, rgba(var(--acc-rgb),0.16), transparent 36%),
    radial-gradient(ellipse at 100% 100%, rgba(var(--ice-rgb),0.12), transparent 40%);
}
.gridfx {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.2;
  background-image:
    linear-gradient(rgba(var(--acc-rgb),0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--acc-rgb),0.09) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse at center, #000 18%, transparent 78%);
}

.top, .slim, .wall, .credit { position: relative; z-index: 2; }
.top, .slim { flex: 0 0 auto; }
.top { display: flex; align-items: center; gap: 12px; padding: 16px 18px 8px; }
.brand {
  display: flex; gap: 10px; align-items: center;
  background: none; border: 0; color: inherit; text-align: start;
}
.brand img { border-radius: 14px; box-shadow: 0 0 18px rgba(var(--acc-rgb),0.28); }
.word { font-family: var(--disp); letter-spacing: 0.28em; font-weight: 800; }
.tag { font-size: 11px; color: var(--muted); }
.search { flex: 1; }
.search input {
  width: 100%; background: var(--panel); border: 1px solid var(--line);
  color: inherit; border-radius: 999px; padding: 11px 16px; outline: none;
  backdrop-filter: blur(16px);
}
.search input:focus { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(var(--acc-rgb),0.16); }
.icon-btn {
  width: 42px; height: 42px; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); color: var(--text);
  display: grid; place-items: center;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.on, .icon-btn.hot { background: var(--acc); color: var(--ink); border-color: var(--acc); }

.slim { padding: 0 18px 8px; }
.rooms {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px;
  scrollbar-width: none;
}
.rooms::-webkit-scrollbar { display: none; }
.rooms button, .chips button {
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  border-radius: 999px; padding: 7px 12px; white-space: nowrap; font-size: 13px;
  backdrop-filter: blur(12px);
}
.rooms button.on, .chips button.on {
  color: var(--ink); background: var(--acc); border-color: var(--acc);
  box-shadow: 0 0 16px rgba(var(--acc-rgb),0.28);
}
.count-line { font-size: 12px; color: var(--muted); }

.wall {
  flex: 1 1 auto; min-height: 180px; overflow: auto; -webkit-overflow-scrolling: touch;
  padding: 0 18px 72px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
  align-content: start;
  perspective: 1200px;
}
.wall.home { display: block; }
.wall.wide { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.card {
  display: flex; flex-direction: column; align-items: stretch;
  width: 100%; min-height: 220px; padding: 0;
  text-align: start; color: inherit;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 20px; overflow: hidden;
  appearance: none; -webkit-appearance: none;
  backdrop-filter: blur(16px);
  transform-style: preserve-3d;
  transition: transform .16s ease, border-color .2s, box-shadow .2s;
}
.card:hover {
  border-color: rgba(var(--acc-rgb),0.5);
  box-shadow: 0 18px 40px rgba(0,0,0,0.28), 0 0 24px rgba(var(--acc-rgb),0.12);
}
.card-art {
  position: relative; width: 100%; height: 0; padding-bottom: 132%;
  min-height: 176px; background: #110e16; overflow: hidden; flex: 0 0 auto;
}
.card-art.wide, .rail .card-art { padding-bottom: 64%; min-height: 112px; }
.rail.codex .card-art { padding-bottom: 132%; min-height: 160px; }
.card-art img, .card-art .ph {
  position: absolute; inset: 0; width: 100%; height: 100%;
  max-width: none; object-fit: cover;
}
.ph {
  display: grid; place-items: center;
  font-family: var(--disp); font-weight: 800; font-size: 42px; color: #fff;
  background:
    radial-gradient(circle at 28% 22%, rgba(var(--ice-rgb),0.55), transparent 46%),
    radial-gradient(circle at 82% 84%, rgba(var(--acc-rgb),0.7), transparent 52%),
    linear-gradient(145deg, var(--acc), var(--bg) 72%);
}
.card-shade {
  position: absolute; inset-inline: 0; bottom: 0;
  padding: 28px 10px 10px;
  background: linear-gradient(180deg, transparent, rgba(7,6,12,0.92) 70%);
  z-index: 1;
}
.badge {
  position: absolute; inset-inline-start: 8px; top: 8px; z-index: 2;
  background: var(--acc); color: var(--ink);
  font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px;
}
.price-pill {
  position: absolute; inset-inline-end: 8px; top: 8px; z-index: 2;
  background: rgba(7,6,12,0.78); color: var(--text);
  font-size: 12px; font-weight: 800; padding: 4px 8px; border-radius: 999px;
}
.price-pill s { color: var(--muted); font-weight: 600; margin-inline-end: 6px; }
.card-body { display: none; }
.nm { font-weight: 800; font-size: 14px; line-height: 1.3; color: #fff; }
.meta { font-size: 12px; color: rgba(247,243,234,0.72); margin-top: 3px; }
.card.empty { grid-column: 1 / -1; padding: 28px; text-align: center; min-height: 0; }

.rail { margin-bottom: 18px; }
.rail-top {
  display: flex; align-items: center; justify-content: space-between;
  margin: 6px 2px 8px;
}
.rail-top h3 { font-size: 16px; font-weight: 800; }
.rail-top button { border: 0; background: none; color: var(--acc); font-weight: 700; font-size: 12px; }
.rail-row { display: flex; gap: 10px; overflow: auto; padding-bottom: 8px; scrollbar-width: none; }
.rail-row::-webkit-scrollbar { display: none; }
.rail .card { flex: 0 0 168px; }
.rail .card-art { aspect-ratio: 16 / 10; }
.rail.codex .card { flex: 0 0 140px; }
.rail.codex .card-art { aspect-ratio: 3 / 4; }

.mcu {
  position: relative; overflow: hidden;
  border-radius: 28px; min-height: 220px; margin-bottom: 14px;
  border: 1px solid rgba(var(--acc-rgb),0.28);
  color: #fff; text-align: start;
  background: #0b0810;
}
.mcu img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; filter: saturate(1.1);
}
.mcu::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(7,6,12,0.92) 8%, rgba(7,6,12,0.35) 62%, rgba(7,6,12,0.7));
}
.mcu-in { position: relative; z-index: 1; padding: 22px 20px; max-width: 70%; }
.mcu-k { color: var(--acc); font-size: 11px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }
.mcu h2 { font-size: clamp(26px, 5vw, 42px); line-height: 1.05; margin: 8px 0 6px; font-family: var(--disp); }
.mcu .days {
  display: inline-block; margin-top: 8px;
  background: var(--acc); color: var(--ink);
  font-weight: 800; border-radius: 999px; padding: 8px 14px;
  box-shadow: 0 0 24px rgba(var(--acc-rgb),0.4);
}

.portals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px; margin: 8px 0 16px;
}
.portal {
  position: relative; overflow: hidden; min-height: 118px;
  border: 1px solid var(--line); border-radius: 22px;
  color: #fff; text-align: start; padding: 16px;
  background:
    linear-gradient(160deg, rgba(var(--acc-rgb),0.22), rgba(var(--ice-rgb),0.08) 50%, #100c16);
  transition: transform .16s ease, box-shadow .2s, border-color .2s;
}
.portal.has-art {
  background-image:
    linear-gradient(160deg, rgba(7,6,12,0.78), rgba(7,6,12,0.28) 55%, rgba(7,6,12,0.72)),
    var(--portal-art);
  background-size: cover;
  background-position: center top;
}
.portal b { display: block; font-size: 18px; font-family: var(--disp); letter-spacing: 0.08em; }
.portal span { color: rgba(247,243,234,0.78); font-size: 12px; }
.portal:hover { box-shadow: 0 0 0 1px var(--acc), 0 16px 30px rgba(var(--acc-rgb),0.18); transform: translateY(-2px); }

.joke {
  width: 100%; text-align: start; color: inherit;
  border: 1px dashed rgba(var(--ice-rgb),0.35);
  background: rgba(var(--ice-rgb),0.08);
  border-radius: 18px; padding: 12px 14px; margin-bottom: 14px;
}
.joke small { display: block; color: var(--ice); font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; font-size: 10px; }
.joke p { margin-top: 4px; font-weight: 700; }

.today-hit {
  width: 100%; display: flex; align-items: center; gap: 16px;
  text-align: start; color: inherit; cursor: pointer;
  background:
    linear-gradient(115deg, rgba(var(--acc-rgb),0.32), rgba(var(--ice-rgb),0.1) 48%, var(--panel));
  border: 1px solid rgba(var(--acc-rgb),0.28);
  border-radius: 26px; padding: 16px; margin-bottom: 14px;
}
.today-hit img, .today-hit .ph {
  width: 92px; height: 92px; border-radius: 22px; object-fit: cover; flex-shrink: 0;
}
.today-k { color: var(--acc); font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.today-hit h2 { font-size: clamp(18px, 3.4vw, 26px); margin: 4px 0 3px; line-height: 1.2; }
.today-go {
  margin-inline-start: auto; background: var(--acc); color: var(--ink);
  border-radius: 999px; padding: 10px 16px; font-weight: 800; flex-shrink: 0;
}

.ghost {
  border: 1px solid var(--line); background: rgba(255,255,255,0.04); color: var(--text);
  border-radius: 999px; width: 42px; height: 42px; display: grid; place-items: center;
}
.ghost.wide { width: auto; height: auto; padding: 10px 16px; }
.fav-btn.on { color: var(--acc); border-color: var(--acc); background: rgba(var(--acc-rgb),0.14); }
.play {
  border: 0; background: var(--acc); color: var(--ink); text-decoration: none;
  border-radius: 999px; padding: 12px 18px; font-weight: 800;
  display: inline-grid; place-items: center;
  box-shadow: 0 8px 24px rgba(var(--acc-rgb),0.35);
}

.drawer {
  position: fixed; inset: 0; z-index: 46;
  background: rgba(var(--bg-rgb),0.58);
  display: flex; align-items: flex-end; justify-content: center;
}
.drawer[hidden] { display: none; }
.drawer-card {
  width: min(740px, 100%);
  max-height: min(88dvh, 860px);
  overflow: auto;
  background: var(--cabinet);
  border: 1px solid var(--line);
  border-radius: 28px 28px 0 0;
  padding: 10px 14px 28px;
}
.drawer-handle {
  width: 42px; height: 4px; border-radius: 99px;
  background: rgba(255,255,255,0.18); margin: 4px auto 12px;
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px; padding: 0 4px;
}
.drawer-head h3 { font-size: 20px; font-weight: 800; }
.drawer-quick { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 4px 10px; }
.set-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 6px; font-weight: 700;
}
.set-item {
  width: 100%; text-align: start;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius: 16px; padding: 14px 16px; font-weight: 800; margin: 8px 0;
}
.filter-lab {
  font-size: 11px; font-weight: 800; letter-spacing: 0.08em;
  color: var(--muted); padding: 8px 6px 2px; text-transform: uppercase;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 4px 10px; }
.lang-switch {
  display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px;
  background: var(--panel);
}
.lang-switch button {
  border: 0; background: none; color: var(--muted); padding: 6px 10px;
  border-radius: 999px; font-weight: 700; font-size: 11px;
}
.lang-switch button.on { background: var(--acc); color: var(--ink); }

.stage {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: stretch; justify-content: center;
  padding: 16px;
  background: rgba(var(--bg-rgb), 0.72);
  backdrop-filter: blur(18px);
  overflow: auto;
}
.stage[hidden] { display: none; }
.cabinet {
  position: relative;
  width: min(560px, 100%);
  margin: auto;
  padding: 18px 20px 22px;
  background: var(--cabinet);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
}
.felt-card {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(34,197,94,0.18), transparent 50%),
    #062012;
  border-color: rgba(34,197,94,0.28);
}
.stage-handle { width: 42px; height: 4px; border-radius: 99px; background: rgba(255,255,255,0.18); margin: 0 auto 12px; }
.stage-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.hero-art {
  width: 100%; border-radius: 20px; overflow: hidden; background: #110e16;
  aspect-ratio: 16 / 10; margin-bottom: 12px;
}
.hero-art.tall { aspect-ratio: 3 / 4; max-height: 46vh; margin-inline: auto; width: min(100%, 320px); }
.hero-art img, .hero-art .ph { width: 100%; height: 100%; object-fit: cover; }
.kicker {
  color: var(--acc); font-size: 11px; letter-spacing: 0.16em; font-weight: 800;
  text-transform: uppercase; margin-bottom: 6px;
}
#d-name, #q-ask { font-size: clamp(22px, 5vw, 32px); line-height: 1.25; margin: 0 0 6px; }
.sub { font-size: 13px; color: var(--muted); }
.about-body { font-size: 14px; line-height: 1.85; color: var(--muted); margin-top: 10px; white-space: pre-wrap; }
.stat-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.stat {
  min-width: 72px; flex: 1;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 8px 10px;
}
.stat b { display: block; font-size: 16px; }
.stat span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.bar { height: 6px; border-radius: 99px; background: rgba(255,255,255,0.08); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--ice), var(--acc)); }
.stage-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.answers { display: grid; gap: 8px; margin-top: 14px; }
.answers button {
  text-align: start; border: 1px solid var(--line); background: var(--panel);
  color: inherit; border-radius: 16px; padding: 14px 16px; font-weight: 700;
}
.answers button.good { background: #166534; border-color: #22c55e; color: #fff; }
.answers button.bad { background: #7f1d1d; border-color: #ef4444; color: #fff; }
.quiz-score { font-family: var(--disp); font-weight: 800; color: var(--acc); }

.hand { display: flex; gap: 8px; flex-wrap: wrap; min-height: 120px; margin-bottom: 10px; }
.pcard {
  width: 78px; height: 110px; border-radius: 10px; overflow: hidden;
  background: #fff; box-shadow: 0 8px 18px rgba(0,0,0,0.28);
}
.pcard img { width: 100%; height: 100%; object-fit: cover; }
.pcard.back {
  background:
    repeating-linear-gradient(45deg, #7f1d1d, #7f1d1d 8px, #450a0a 8px, #450a0a 16px);
}
.bj-msg { font-weight: 800; min-height: 24px; color: var(--acc); }

.about {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(var(--bg-rgb),0.72);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.about[hidden] { display: none; }
.about-card {
  width: min(440px,100%);
  background: var(--cabinet); border: 1px solid var(--line);
  border-radius: 24px; padding: 26px 22px 18px; text-align: center;
}
.about-card img { margin: 0 auto 10px; border-radius: 22px; }
.about-maker { color: var(--acc); margin: 12px 0; font-weight: 800; }
.tg {
  display: flex; flex-direction: column; gap: 4px; align-items: center;
  color: var(--ice); text-decoration: none; border: 1px solid var(--line);
  border-radius: 14px; padding: 12px; margin-bottom: 12px;
}
.about-card button { border: 1px solid var(--line); background: none; color: inherit; border-radius: 999px; padding: 8px 16px; }

.credit {
  position: fixed; bottom: 8px; inset-inline: 0; text-align: center;
  font-size: 11px; color: var(--muted); z-index: 2; pointer-events: none;
}
.credit b { color: var(--acc); }
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 70; background: var(--cabinet); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; font-size: 13px; font-weight: 700;
}
.toast[hidden] { display: none; }

#loader {
  position: fixed; inset: 0; z-index: 80; background: #05040a;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  transition: opacity .5s, visibility .5s;
}
#loader.off { opacity: 0; visibility: hidden; pointer-events: none; }
.vault { position: relative; width: 132px; height: 132px; display: grid; place-items: center; }
.vault img { border-radius: 28px; position: relative; z-index: 1; }
.vault .ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--acc);
  border-left-color: var(--ice);
  animation: spin 1.1s linear infinite;
  box-shadow: 0 0 24px rgba(var(--acc-rgb),0.35);
}
#load-sub { color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .top { padding: 10px 12px 6px; gap: 8px; }
  .brand img { width: 32px; height: 32px; }
  .word { letter-spacing: 0.16em; font-size: 13px; }
  .brand .tag { display: none; }
  .slim, .wall { padding-inline: 12px; }
  .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .today-hit { padding: 12px; gap: 10px; }
  .today-hit img, .today-hit .ph { width: 64px; height: 64px; border-radius: 16px; }
  .today-go { padding: 8px 12px; font-size: 12px; }
  .mcu-in { max-width: 88%; }
  .portals { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 768px) {
  .top, .slim, .wall { width: min(1280px, 100%); margin-inline: auto; }
  .top { padding: 18px 28px 10px; }
  .slim { padding-inline: 28px; }
  .wall { padding-inline: 28px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .drawer { align-items: center; }
  .drawer-card { border-radius: 28px; width: min(720px, calc(100% - 48px)); }
  .portals { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mcu { min-height: 280px; }
}
@media (min-width: 1100px) {
  .wall { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .wall.wide { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}
html[dir="rtl"] .today-go { margin-inline-start: 0; margin-inline-end: auto; }
html[dir="rtl"] .mcu::after {
  background: linear-gradient(270deg, rgba(7,6,12,0.92) 8%, rgba(7,6,12,0.35) 62%, rgba(7,6,12,0.7));
}
