@font-face {
  font-family: Vazirmatn;
  src: url("/fonts/vazirmatn-arabic.woff2") format("woff2");
  font-weight: 100 900;
  unicode-range: U+0600-06FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC;
}

@font-face {
  font-family: Vazirmatn;
  src: url("/fonts/vazirmatn-latin.woff2") format("woff2");
  font-weight: 100 900;
  unicode-range: U+0000-00FF, U+2000-206F;
}

:root {
  color-scheme: dark;
  font-family: Vazirmatn, sans-serif;
  color: #fff7e7;
  background: #211d32;
}

* {
  box-sizing: border-box;
}

html,
body,
#stage {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

/* Dusk sky from STYLE.md: lilac zenith to apricot horizon, like the films. */
body {
  background: linear-gradient(180deg, #6a6aa6 0%, #a98aa8 42%, #ffb48a 100%);
}

#stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.title-card,
.hud,
.connection-status,
.world-label,
.character-label {
  position: fixed;
  z-index: 2;
  pointer-events: none;
}

.title-card,
.hud {
  z-index: 4;
}

.title-card {
  top: 28px;
  right: 32px;
  text-shadow: 0 2px 12px #17121e;
}

.eyebrow {
  /* Cream instead of gold: gold on the lilac sky fell below AA contrast. */
  color: #fff0c8;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
}

h1 {
  margin: 1px 0 0;
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1.1;
}

.hud {
  top: 28px;
  left: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
  max-width: calc(100% - 280px);
}

.hud-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border-radius: 16px;
  background: rgb(23 18 36 / 42%);
}

.mission-group {
  border: 1px solid rgb(243 199 90 / 55%);
}

.camp-group {
  border: 1px solid rgb(255 255 255 / 12%);
}

.group-label {
  flex: 1 0 100%;
  margin: 0 4px;
  color: #fff0c8;
  font-size: 12px;
  font-weight: 800;
}

.hud-card {
  min-width: 132px;
  padding: 8px 12px;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 12px;
  background: rgb(33 29 50 / 82%);
  box-shadow: 0 8px 24px rgb(25 16 27 / 20%);
}

.growth-prompt {
  display: inline-block;
  margin: 8px 0 0;
  padding: 4px 10px;
  border-radius: 8px;
  color: #f3c75a;
  background: rgb(33 29 50 / 88%);
  font-size: 15px;
  font-weight: 800;
}

body.growing .event-feed {
  top: 148px;
}

.hud span {
  display: block;
  color: #d9cde7;
  font-size: 12px;
}

.hud strong {
  display: block;
  color: #f3c75a;
  font-size: 22px;
  font-weight: 850;
}

.hud strong b {
  font: inherit;
}

.hud-card.mission {
  min-width: 156px;
  border-color: rgb(243 199 90 / 45%);
}

.hud-card.mission strong {
  font-size: 18px;
}

.world-label.attention {
  color: #2b1d12;
  background: #f3c75a;
}

.world-label,
.character-label {
  top: 0;
  left: 0;
  white-space: nowrap;
  text-align: center;
  will-change: transform;
}

.world-label {
  padding: 4px 10px;
  border-radius: 7px;
  color: #23325b;
  background: rgb(246 238 220 / 90%);
  box-shadow: 0 4px 12px rgb(24 20 34 / 22%);
  font-size: 12px;
  font-weight: 800;
}

/* Name pills as in the Episode 2 camp film: lapis plate, cream name, a thin stem to the head. */
.character-label {
  padding: 3px 9px 4px;
  border-radius: 7px;
  color: #f6eedc;
  background: rgb(35 50 91 / 94%);
  box-shadow: 0 4px 10px rgb(24 20 34 / 26%);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  opacity: 0;
  transition: opacity 200ms linear;
}

.character-label.shown {
  opacity: 1;
}

.character-label.from-telegram {
  color: #23325b;
  background: rgb(232 181 60 / 96%);
}

.character-name {
  display: block;
}

.character-role {
  display: none;
}

.character-label.with-role .character-role {
  display: block;
  color: #f3c75a;
  font-size: 10px;
  font-weight: 700;
}

.character-label.from-telegram.with-role .character-role {
  color: #6b3f12;
}

/* A new member, a new role, or a role change keeps this plate on that person. */
.character-label.spotlight {
  z-index: 5;
  padding: 6px 12px 7px;
  color: #2b1d12;
  background: #f3c75a;
  box-shadow: 0 10px 22px rgb(24 16 30 / 38%);
  font-size: 16px;
  font-weight: 800;
}

.character-label.spotlight .character-role {
  color: #6b3f12;
  font-size: 12px;
}

.character-label.spotlight .label-stem {
  width: 2px;
  margin-left: -1px;
  background: #f3c75a;
}

/* Until the first layout pass a label has no position; keep it out of sight. */
.world-label:not(.placed),
.character-label:not(.placed) {
  visibility: hidden;
}

.label-stem {
  position: absolute;
  top: 100%;
  width: 1.4px;
  margin-left: -0.7px;
  background: #f6e8d8;
  opacity: .9;
}

/* Live event feed, below the title. */
.event-feed {
  position: fixed;
  z-index: 3;
  top: 104px;
  right: 32px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(330px, 42vw);
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
}

.event {
  padding: 7px 12px;
  border-radius: 9px;
  color: #f6eedc;
  background: rgb(33 29 50 / 80%);
  box-shadow: 0 6px 16px rgb(24 16 30 / 24%);
  font-size: 14px;
  font-weight: 700;
  animation: event-in .45s cubic-bezier(.2, 1.4, .4, 1) both;
}

.event.gold {
  color: #2b1d12;
  background: rgb(232 181 60 / 95%);
}

.event.lapis {
  background: rgb(47 90 168 / 94%);
}

.event.leaving {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .6s ease, transform .6s ease;
}

@keyframes event-in {
  from { opacity: 0; transform: translateX(24px) scale(.96); }
  to { opacity: 1; transform: none; }
}

/* Coins fall into the treasury card; numbers pop when they change. */
.coin {
  position: fixed;
  z-index: 4;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff1b0, #e8b53c 55%, #9a6a1a);
  box-shadow: 0 0 10px rgb(255 200 80 / 70%);
  pointer-events: none;
  animation: coin-drop .9s cubic-bezier(.5, 0, .9, .5) both;
}

@keyframes coin-drop {
  from { opacity: 0; transform: translateY(calc(var(--fall) * -1)) rotateY(0); }
  15% { opacity: 1; }
  to { opacity: 0; transform: translateY(-14px) rotateY(720deg); }
}

.pop {
  animation: hud-pop .5s cubic-bezier(.2, 1.6, .4, 1);
}

@keyframes hud-pop {
  40% { transform: scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  .event,
  .pop {
    animation: none;
  }

  .character-label {
    transition: none;
  }
}

.character-label.sample::after {
  content: "نمونه";
  position: absolute;
  top: -7px;
  left: -7px;
  padding: 1px 5px;
  border-radius: 6px;
  color: #243659;
  background: #f0d7a1;
  font-size: 8px;
}

.connection-status {
  bottom: 17px;
  left: 50%;
  margin: 0;
  padding: 6px 12px;
  transform: translateX(-50%);
  border-radius: 9px;
  color: #d9cde7;
  background: rgb(33 29 50 / 74%);
  font-size: 11px;
  transition: opacity .25s ease;
}

.connection-status.connected {
  opacity: 0;
}

.connection-status.error {
  color: #ffd9d0;
  background: rgb(109 45 43 / 88%);
}

.audio-toggle,
.audio-test {
  position: fixed;
  z-index: 6;
  pointer-events: auto;
  font: inherit;
}

.audio-toggle {
  left: 20px;
  bottom: 16px;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 999px;
  color: #fff7e7;
  background: rgb(33 29 50 / 88%);
  box-shadow: 0 6px 16px rgb(24 16 30 / 22%);
  cursor: pointer;
}

.audio-toggle.is-pending {
  border-color: #e8b53c;
}

.audio-toggle.is-live {
  opacity: 0.55;
  min-width: 44px;
}

.audio-toggle.is-muted {
  opacity: 0.8;
}

.audio-toggle:focus {
  outline: none;
}

.audio-toggle:focus-visible,
.audio-test button:focus-visible {
  outline: 2px solid #e8b53c;
  outline-offset: 2px;
}

.audio-test {
  left: 20px;
  bottom: 60px;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 40px);
  padding: 6px;
  border: 1px dashed rgb(232 181 60 / 70%);
  border-radius: 12px;
  color: #fff7e7;
  background: rgb(33 29 50 / 92%);
  direction: ltr;
}

.audio-test span {
  padding-inline: 6px;
  color: #f3c75a;
  font-size: 12px;
  font-weight: 800;
}

.audio-test button {
  min-height: 32px;
  padding: 4px 8px;
  border: 0;
  border-radius: 8px;
  color: #243659;
  background: #efe3c8;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

@media (max-width: 640px) {
  .title-card {
    top: 18px;
    right: 18px;
  }

  .hud {
    top: auto;
    bottom: 18px;
    left: 50%;
    width: calc(100% - 36px);
    transform: translateX(-50%);
  }

  .hud > div {
    flex: 1;
    min-width: 0;
  }

  .connection-status {
    bottom: 105px;
  }

  .audio-toggle {
    top: 18px;
    bottom: auto;
  }

  .audio-test {
    top: 62px;
    bottom: auto;
    flex-wrap: wrap;
  }
}

.preview-banner{position:fixed;z-index:1000;top:0;left:0;right:0;margin:0;padding:7px 12px;text-align:center;background:#4b2b17;color:#fff;font:600 13px sans-serif;pointer-events:none}
