/* پاتوق - shared tokens and components (screen + controller) */

@font-face {
  font-family: 'Vazirmatn';
  src: url('/vendor/fonts/vazirmatn/Vazirmatn%5Bwght%5D.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Lalezar';
  src: url('/vendor/fonts/lalezar/lalezar-arabic-400-normal.woff2') format('woff2');
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC;
}
@font-face {
  font-family: 'Lalezar';
  src: url('/vendor/fonts/lalezar/lalezar-latin-400-normal.woff2') format('woff2');
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F;
}

:root {
  --bg: #0c0a1d;
  --bg-2: #14112b;
  --card: #1a1636;
  --card-2: #231e47;
  --line: rgba(255, 255, 255, 0.09);
  --ink: #f7f4ff;
  --mute: #aaa3cf;
  --turq: #19c3b1;
  --saffron: #ffb020;
  --rose: #ff5d73;
  --violet: #7c5cff;
  --blue: #3d8bff;
  --green: #2fc56d;
  --red: #f0454c;
  /* answer option colours, in order */
  --o0: #ff5d73;
  --o1: #3d8bff;
  --o2: #ffb020;
  --o3: #2fc56d;
  /* theme (overridden per game) */
  --t1: #5b2be0;
  --t2: #19c3b1;
  --accent: #ffd23f;
  --font: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  --display: 'Lalezar', 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  --ease: cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

[data-theme='friends'] { --t1: #6d28d9; --t2: #db2777; --accent: #ffd23f; }
[data-theme='trivia'] { --t1: #047857; --t2: #0e7490; --accent: #ffe14d; }
[data-theme='doodle'] { --t1: #f97316; --t2: #e11d48; --accent: #fff3c4; }
[data-theme='who'] { --t1: #1d4ed8; --t2: #4f46e5; --accent: #ffd23f; }
[data-theme='bombs'] { --t1: #b91c1c; --t2: #7c2d12; --accent: #fde047; }
[data-theme='runner'] { --t1: #c2410c; --t2: #581c87; --accent: #fde68a; }
[data-theme='closest'] { --t1: #b45309; --t2: #4d7c0f; --accent: #fde68a; }

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-feature-settings: 'ss01';
  direction: rtl;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
button, input { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
.display { font-family: var(--display); font-weight: 400; line-height: 1.15; }
.ltr { direction: ltr; unicode-bidi: isolate; font-feature-settings: normal; }
.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.name-hl { color: var(--accent); font-weight: inherit; }

/* --- avatar ---------------------------------------------------------------- */
.avatar {
  --s: 3em;
  position: relative;
  display: inline-block;
  width: var(--s);
  height: var(--s);
  flex: none;
  transition: transform 0.3s var(--ease), filter 0.3s, opacity 0.3s;
}
.avatar-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--c);
  overflow: hidden;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 calc(var(--s) * 0.055) rgba(255, 255, 255, 0.92), 0 calc(var(--s) * 0.07) 0 rgba(0, 0, 0, 0.28);
}
.avatar-emoji { font-size: calc(var(--s) * 0.52); line-height: 1; }
.avatar-face img {
  position: absolute;
  inset: calc(var(--s) * 0.055);
  width: calc(100% - var(--s) * 0.11);
  height: calc(100% - var(--s) * 0.11);
  border-radius: 50%;
  object-fit: cover;
}
.avatar.is-away { filter: grayscale(1); opacity: 0.45; }
.avatar-crown {
  position: absolute;
  top: calc(var(--s) * -0.3);
  left: 50%;
  font-size: calc(var(--s) * 0.38);
  transform: translateX(-50%) rotate(-8deg);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.4));
}
.avatar-badge {
  position: absolute;
  bottom: calc(var(--s) * -0.08);
  left: calc(var(--s) * -0.08);
  min-width: calc(var(--s) * 0.42);
  height: calc(var(--s) * 0.42);
  padding: 0 calc(var(--s) * 0.08);
  border-radius: 99px;
  background: #fff;
  color: #14112b;
  font-size: calc(var(--s) * 0.24);
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
  animation: pop 0.35s var(--ease);
}

/* --- timer bar ------------------------------------------------------------- */
.timerbar {
  height: 0.6em;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
  direction: ltr;
}
.timerbar i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #fff, var(--accent));
  transform-origin: left center;
  animation: timer-shrink linear both;
}
@keyframes timer-shrink {
  0% { transform: scaleX(1); }
  75% { background: linear-gradient(90deg, #fff, var(--accent)); }
  100% { transform: scaleX(0); background: var(--rose); }
}

/* --- shared keyframes ------------------------------------------------------ */
@keyframes pop {
  0% { transform: scale(0.3); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes rise {
  0% { transform: translateY(1.2em); opacity: 0; }
  100% { transform: none; opacity: 1; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6%); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-0.4em); }
  40%, 80% { transform: translateX(0.4em); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* Timers and reveals carry game information, so only decorative loops are stopped. */
@media (prefers-reduced-motion: reduce) {
  .decor, .decor * { animation: none !important; }
}
