/* SAIF-2026-10-14 — رايات المعرفة: hand-painted 90s Arabian-nights cartoon look, light theme */
:root {
  --paper: #FBF4E6;
  --paper-2: #F4E6CB;
  --sand: #E9D1A3;
  --ink: #3B2718;
  --ink-2: #6E5038;
  --ink-3: #9A7B5F;
  --turq: #168C93;
  --turq-2: #0E6B71;
  --saffron: #EBA33A;
  --saffron-2: #C9821C;
  --ok: #3E9B4A;
  --bad: #C9403A;
  --gold: #E9B949;
  --r: 18px;
  --edge: 2.5px solid var(--ink);
  --lift: 0 4px 0 var(--ink);
  --deep: 0 6px 0 var(--ink), 0 18px 40px rgba(59, 39, 24, .22);
  --ui: 'Baloo Bhaijaan 2', 'Segoe UI', Tahoma, sans-serif;
  --title: 'Aref Ruqaa', 'Amiri', serif;
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23B08A5C' stroke-opacity='.16' stroke-width='1.2'%3E%3Cpath d='M32 14l5.3 12.7L50 32l-12.7 5.3L32 50l-5.3-12.7L14 32l12.7-5.3z'/%3E%3Cpath d='M19.3 19.3h25.4v25.4H19.3z' transform='rotate(45 32 32)'/%3E%3C/g%3E%3C/svg%3E");
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--ui);
  color: var(--ink);
  background: var(--paper) var(--star);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--turq); outline-offset: 2px; }

/* ---------- shared pieces ---------- */
.panel {
  position: relative;
  background: var(--paper);
  border: var(--edge);
  border-radius: 24px;
  box-shadow: var(--deep);
}
.panel::before {
  content: ""; position: absolute; inset: 7px; pointer-events: none;
  border: 1.5px solid rgba(59, 39, 24, .22); border-radius: 17px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  font-weight: 700; font-size: 1.05rem; line-height: 1.1;
  padding: .72em 1.3em;
  background: var(--paper);
  border: var(--edge); border-radius: 14px;
  box-shadow: var(--lift);
  transition: transform .08s, box-shadow .08s, background .15s;
  user-select: none;
}
.btn:hover { background: #fff8ea; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.primary { background: var(--saffron); }
.btn.primary:hover { background: #f2b14e; }
.btn.danger { background: #f6d9cf; }
.btn.big { font-size: 1.35rem; padding: .7em 1.6em; border-radius: 16px; }
.btn.small { font-size: .92rem; padding: .55em 1em; }
.menu { display: grid; gap: 12px; }
.menu-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.menu-row .btn { flex: 1 1 auto; }

.screen { position: fixed; inset: 0; display: none; }
.screen.active { display: block; }

/* ---------- home ---------- */
.home { background: #cfe8f1; }
.home-art { position: absolute; inset: 0; }
.home-art img { width: 100%; height: 100%; object-fit: cover; object-position: 20% 50%; }
.home-panel {
  position: absolute; inset-block: 0; inset-inline-start: 0;
  width: min(50%, 620px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 40px; text-align: center;
}
.emblem { width: 112px; height: 112px; filter: drop-shadow(0 6px 10px rgba(59, 39, 24, .25)); animation: bob 5s ease-in-out infinite; }
.logo {
  font-family: var(--title); font-weight: 700;
  font-size: clamp(3.2rem, 7.5vw, 6.4rem); line-height: 1.1; margin: .05em 0 .1em;
  color: var(--ink);
  text-shadow: 3px 3px 0 var(--saffron), 6px 6px 0 rgba(59, 39, 24, .18);
}
.tag { font-size: clamp(1.05rem, 1.7vw, 1.3rem); font-weight: 600; color: var(--ink-2); margin: 0 0 26px; line-height: 1.6; }
.home .menu { width: min(100%, 380px); }
.stats { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; justify-content: center; }
.stats div {
  background: rgba(251, 244, 230, .88); border: 2px solid var(--ink); border-radius: 12px; padding: 6px 12px;
  display: flex; flex-direction: column; min-width: 80px;
}
.stats b { font-size: 1.25rem; line-height: 1.1; }
.stats span { font-size: .78rem; color: var(--ink-2); }

@keyframes bob { 50% { transform: translateY(-6px) rotate(-2deg); } }

/* ---------- setup ---------- */
.setup {
  background: linear-gradient(rgba(251, 244, 230, .55), rgba(251, 244, 230, .75)), url("../img/hall.webp?v=1") center/cover;
  overflow-y: auto; padding: 24px 16px;
}
.setup.active { display: flex; }
/* profile & daily challenge: the same hall as setup */
.profile, .daily {
  background: linear-gradient(rgba(251, 244, 230, .55), rgba(251, 244, 230, .75)), url("../img/hall.webp?v=1") center/cover;
  overflow-y: auto; padding: 24px 16px;
}
.profile.active, .daily.active { display: flex; }
.profile .sheet, .daily .sheet { width: min(760px, 100%); }
.sheet-h h2 small { font-family: var(--body, inherit); font-size: 1rem; color: var(--ink-2); margin-inline-start: 8px; }

/* the player in the home screen's corner (opposite the «i»): portrait with the level, the name, the level bar; a mark for the
   account — turquoise when the progress is saved in one, a saffron dot when not yet */
.me-chip { position: absolute; z-index: 5; top: calc(env(safe-area-inset-top, 0px) + 12px); inset-inline-start: 12px;
  display: flex; align-items: center; gap: 10px; padding: 5px 16px 5px 5px; max-width: min(280px, calc(100% - 90px));
  background: var(--paper); border: var(--edge); border-radius: 99px; box-shadow: var(--lift); cursor: pointer; font: inherit; color: var(--ink); text-align: start; }
.me-chip:empty { display: none; }
.me-chip:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.me-chip:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.mc-av { position: relative; flex: none; width: 44px; height: 44px; }
.mc-av img { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--ink); object-fit: cover; display: block; background: #fff; }
.mc-lv { position: absolute; bottom: -4px; inset-inline-end: -6px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 99px;
  background: var(--saffron); border: 2px solid var(--ink); font-size: .75rem; font-weight: 800; line-height: 18px; text-align: center; }
.mc-acc { position: absolute; top: -3px; inset-inline-end: -4px; width: 13px; height: 13px; border-radius: 50%; background: var(--saffron); border: 2px solid var(--paper); }
.mc-acc.on { width: 16px; height: 16px; background: var(--turq) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.3l2.6 2.5L12 5.4' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100% no-repeat; }
.mc-txt { display: grid; gap: 2px; min-width: 0; flex: 1; }
.mc-txt b { font-size: 1rem; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-txt span { font-size: .78rem; color: var(--ink-2); font-weight: 700; line-height: 1.1; }
.mc-txt i.xp { height: 6px; width: 110px; max-width: 100%; }
i.xp { display: block; height: 8px; border-radius: 99px; background: rgba(59, 39, 24, .14); overflow: hidden; }
i.xp > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--saffron), var(--gold)); transition: width 1.1s cubic-bezier(.2, .8, .3, 1); }
.daily-btn span { font-size: .78rem; font-weight: 800; padding: 1px 8px; border-radius: 99px; margin-inline-start: 4px; }
.daily-btn span.new { background: var(--saffron); }
.daily-btn span.done { background: #d9f0d5; color: var(--ok); }
.install-btn { width: 100%; border-style: dashed; }
.invite { margin: 4px 0 14px; padding: 10px 14px; background: #fff3cf; border: 2px solid var(--ink); border-radius: 14px; animation: okpop .4s; }
.invite p { margin: 0 0 8px; font-weight: 800; }
.inst-steps { margin: 0 0 10px; padding-inline-start: 22px; display: grid; gap: 8px; font-size: 1.05rem; }
.inst-note { margin: 0; color: var(--ink-2); }

/* profile */
.pf-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.pf-head img { width: 84px; height: 84px; border-radius: 50%; border: 3px solid var(--ink); object-fit: cover; background: #fff; }
.pf-head div { display: grid; gap: 4px; flex: 1; }
.pf-head b { font-size: 1.5rem; }
.pf-head .lv { font-weight: 800; color: var(--ink-2); }
.pf-head small { color: var(--ink-2); }
.pf-head i.xp { height: 12px; }
.profile .res-stats { grid-template-columns: repeat(4, 1fr); }
.pf-h { font-family: var(--title); font-size: 1.4rem; margin: 18px 0 10px; }
.pf-h small { font-family: inherit; font-size: .9rem; color: var(--ink-2); }
.pf-cats { display: grid; gap: 6px; }
.pf-cat { display: grid; grid-template-columns: 30px 110px 1fr 46px; align-items: center; gap: 10px; }
.pf-cat img { width: 30px; height: 30px; }
.pf-cat span { font-weight: 700; }
.pf-cat i.bar { height: 10px; border-radius: 99px; background: rgba(59, 39, 24, .12); overflow: hidden; display: block; }
.pf-cat i.bar > i { display: block; height: 100%; background: var(--ok); border-radius: inherit; }
.pf-cat b { text-align: end; }
.pf-ach { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ach { display: grid; justify-items: center; text-align: center; gap: 2px; padding: 10px 8px; background: #fff; border: 2px dashed var(--ink-3); border-radius: 14px; opacity: .55; filter: grayscale(1); }
.ach.on { opacity: 1; filter: none; border: 2px solid var(--ink); background: #fff8e4; }
.ach i { font-style: normal; font-size: 1.7rem; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--paper-2); border: 2px solid var(--ink); }
.ach.on i { background: var(--gold); }
.ach b { font-size: .95rem; }
.ach span { font-size: .78rem; color: var(--ink-2); }

/* experience after a match or a daily challenge */
.res-xp { display: grid; gap: 8px; margin: 0 0 14px; padding: 10px 14px; background: #fff8e4; border: 2px solid var(--ink); border-radius: 14px; }
.res-xp:empty { display: none; }
.xp-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.xp-top b { font-size: 1.35rem; color: #b06d00; }
.xp-top span { font-size: .82rem; color: var(--ink-2); }
.xp-lv { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; font-weight: 800; }
.xp-lv i.xp { height: 12px; }
.xp-lv em { font-style: normal; color: #fff; background: var(--ok); padding: 1px 10px; border-radius: 99px; animation: okpop .5s; }
.xp-ach { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.xp-ach small { font-weight: 800; color: var(--ink-2); }
.xp-ach .ach { grid-auto-flow: column; padding: 4px 10px 4px 6px; gap: 6px; }
.xp-ach .ach i { width: 30px; height: 30px; font-size: 1.05rem; }

/* daily challenge */
.dl-intro { margin: 0 0 12px; color: var(--ink-2); }
.dl-dots { display: flex; justify-content: center; gap: 8px; margin: 6px 0 18px; }
.dl-dots i { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--ink); background: #fff; }
.dl-dots i.cur { background: var(--saffron); }
.dl-dots i.ok { background: var(--ok); }
.dl-dots i.bad { background: #d9534f; }
.dl-body { display: grid; gap: 12px; justify-items: stretch; }
.dl-score { display: flex; align-items: baseline; justify-content: center; gap: 12px; }
.dl-score b { font-family: var(--title); font-size: 3.2rem; line-height: 1; }
.dl-score span { font-size: 1.3rem; font-weight: 800; }
.dl-streak, .dl-next { text-align: center; margin: 0; font-weight: 700; color: var(--ink-2); }
.dl-next b { font-variant-numeric: tabular-nums; direction: ltr; display: inline-block; }
.sheet { width: min(980px, 100%); margin: auto; padding: 22px 26px 26px; }
.sheet-h { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sheet-h h2 { font-family: var(--title); font-size: 2.2rem; margin: 0; }
.back { width: 44px; height: 44px; border: var(--edge); border-radius: 12px; background: var(--paper-2); box-shadow: var(--lift); font-size: 1.3rem; font-weight: 800; }
.chars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.char {
  background: var(--paper-2); border: var(--edge); border-radius: 16px; padding: 8px 6px 10px;
  box-shadow: var(--lift); display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: transform .15s, background .15s;
}
.char .pic { width: 100%; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: #f4ebd6; }
.char .pic img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.char b { font-size: 1.1rem; margin-top: 4px; }
.char small { font-size: .74rem; color: var(--ink-2); line-height: 1.3; min-height: 2.6em; text-align: center; }
.char:hover .pic img { transform: scale(1.05); }
.char[aria-pressed="true"] { background: var(--saffron); transform: translateY(-4px); box-shadow: 0 8px 0 var(--ink); }
.char[aria-pressed="true"] small { color: var(--ink); }
.opts { display: grid; grid-template-columns: 1.25fr .95fr 1fr 1fr; gap: 16px; margin-top: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.field > span { font-size: .95rem; color: var(--ink-2); }
.field input {
  font: inherit; font-size: 1.1rem; padding: .55em .8em; border: var(--edge); border-radius: 12px; background: #fff;
  box-shadow: inset 0 2px 0 rgba(59, 39, 24, .08);
}
.seg { display: flex; border: var(--edge); border-radius: 12px; overflow: hidden; background: #fff; }
.seg button { flex: 1; border: 0; padding: .6em .4em; font-weight: 700; background: transparent; }
.seg button + button { border-inline-start: 2px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--turq); color: #fff; }
.note { text-align: center; color: var(--ink-2); margin: 16px 0 12px; }
.go { display: flex; margin: 0 auto; min-width: 260px; }

/* «عن اللعبة»: the round «i» at the home screen's corner, the about window, «Powered by ONYX»; the suggestion form */
.about-btn {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 14px); inset-inline-end: 14px; z-index: 5;
  width: 44px; height: 44px; border-radius: 99px; border: var(--edge); background: var(--paper); box-shadow: var(--lift);
  font: 800 1.4rem/1 Georgia, 'Times New Roman', serif; font-style: italic; color: var(--ink); cursor: pointer;
}
.powered { direction: ltr; unicode-bidi: isolate; display: inline-block; margin-top: 18px; color: var(--ink-2); text-decoration: none; font-size: .9rem; letter-spacing: .06em; }
.powered b { color: var(--ink); font-weight: 800; }
.about { width: min(480px, 100%); display: grid; gap: 12px; text-align: center; }
.about header { margin-bottom: 0; }
.about p { margin: 0; line-height: 1.7; color: var(--ink-2); }
.about-head { display: flex; align-items: center; justify-content: center; gap: 12px; }
.about-head img { width: 64px; height: 64px; }
.about-head div { display: grid; text-align: start; }
.about-head b { font-family: var(--title); font-size: 1.6rem; line-height: 1.3; }
.about-head small { color: var(--ink-3); }
.about .menu-row .btn { flex: 1; text-decoration: none; text-align: center; color: var(--ink); white-space: nowrap; font-size: .95rem; padding-inline: .6em; }
.about .powered { margin-top: 4px; justify-self: center; }
.about-mail span { font-weight: 700; color: var(--ink); user-select: all; }
.about .social { justify-self: center; display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 700; text-decoration: none; padding: 4px 10px; border-radius: 99px; }
.about .social svg { width: 22px; height: 22px; }
.about .social:focus-visible { outline: 3px solid var(--turq); outline-offset: 2px; }
.suggest { width: min(520px, 100%); display: grid; gap: 12px; }
.suggest header { margin-bottom: 0; }
.suggest .note { margin: 0; font-size: .9rem; line-height: 1.6; }
.sg-box textarea { width: 100%; resize: vertical; min-height: 140px; padding: 12px 14px; border: var(--edge); border-radius: 14px; background: #fff; font: inherit; color: var(--ink); line-height: 1.7; }
.sg-box textarea:focus-visible { outline: 3px solid var(--turq); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* the hero screen: the heroes, the name, «متابعة» */
#s-setup .opts { grid-template-columns: 1fr; width: min(440px, 100%); margin-inline: auto; }
.name-note { color: var(--bad); font-weight: 800; margin: 10px 0 0; }
/* the new-game modal: who plays, public or private, how many; a code to join with (private); an invitation */
.start { width: min(520px, 100%); display: grid; gap: 14px; }
.start header { margin-bottom: 0; }
.start .note { margin: 0; line-height: 1.6; }
.start .go { margin: 0 auto; }
.start .join-row { margin-top: 0; }
.start .join-banner { margin: 0; }
.who { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 14px 6px 8px; border: 2px solid var(--ink); border-radius: 16px; background: #fff; font: inherit; color: inherit; text-align: start; cursor: pointer; }
.who img { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--ink); object-fit: cover; background: #f4ebd6; flex: none; }
.who div { display: grid; flex: 1; gap: 1px; min-width: 0; }
.who b { font-size: 1.05rem; line-height: 1.2; }
.who small { color: var(--ink-2); font-weight: 600; }
.who em { font-style: normal; font-weight: 800; color: var(--turq-2); flex: none; }
#m-start[data-mode="join"] .no-join, #m-start:not([data-mode="join"]) .only-join,
#m-start:not([data-kind="private"]) .only-private, #m-start[data-mode="join"] .only-private { display: none !important; }
.btn.online { background: var(--turq); color: #fff; }
.btn.online:hover { background: #1c9ea6; }
.join-banner { text-align: center; background: #e1f2f1; border: 2px dashed var(--turq); border-radius: 14px; padding: 8px 14px; margin: 0 0 12px; font-weight: 600; }
.join-banner b { font-size: 1.15em; letter-spacing: .12em; direction: ltr; display: inline-block; }
.online-actions { display: grid; gap: 10px; }
.online-actions .note { margin: 14px 0 0; }
.join-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; font-weight: 600; color: var(--ink-2); }
.join-row input { font: inherit; font-size: 1.2rem; font-weight: 800; letter-spacing: .2em; text-align: center; width: 9ch; padding: .45em .6em; border: var(--edge); border-radius: 12px; background: #fff; }

/* ---------- a public game: the wait ---------- */
.big-row .btn { flex: 1 1 220px; }
.queue { background: linear-gradient(rgba(251, 244, 230, .55), rgba(251, 244, 230, .78)), url("../img/hall.webp?v=1") center/cover; overflow-y: auto; padding: 24px 16px; }
.queue.active { display: flex; }
.search { width: min(720px, 100%); margin: auto; padding: 26px 24px; text-align: center; }
.search h2 { font-family: var(--title); font-size: 2.2rem; margin: 6px 0 0; }
.search .seats { margin: 14px 0 18px; }
.emblem.spin { margin: 0 auto; width: 104px; height: 104px; animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.seat.seeking .av { animation: pulse 1.4s ease-in-out infinite; }

/* ---------- lobby ---------- */
.lobby { background: linear-gradient(rgba(251, 244, 230, .55), rgba(251, 244, 230, .78)), url("../img/hall.webp?v=1") center/cover; overflow-y: auto; padding: 24px 16px; }
.lobby.active { display: flex; }
.lobby .sheet { width: min(860px, 100%); }
.code-box { display: grid; justify-items: center; gap: 8px; background: var(--paper-2); border: 2px solid var(--ink); border-radius: 18px; padding: 12px 16px 14px; margin-bottom: 14px; }
.code-box > span { font-weight: 700; color: var(--ink-2); }
.code-box b { font-size: clamp(2.2rem, 7vw, 3.2rem); letter-spacing: .25em; line-height: 1; padding-inline-start: .25em; color: var(--turq-2); }
.btn.wa { background: #dff3e4; text-decoration: none; color: var(--ink); }
.seats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.seats[data-n="2"] { grid-template-columns: repeat(2, 1fr); }
.seats[data-n="4"] { grid-template-columns: repeat(4, 1fr); }
.seats[data-n="5"] { grid-template-columns: repeat(5, 1fr); gap: 8px; }
.seats[data-n="5"] .seat .av { width: 66px; height: 66px; }
.seat { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; background: #fff; border: var(--edge); border-radius: 18px; padding: 12px 8px; box-shadow: var(--lift); animation: pop .4s; }
.seat .av { width: 84px; height: 84px; border-radius: 50%; overflow: hidden; border: 3px solid var(--ink); background: #f4ebd6; }
.seat .av img { width: 100%; height: 100%; object-fit: cover; }
.seat b { font-size: 1.1rem; }
.seat b small { font-weight: 500; color: var(--ink-2); }
.seat small { color: var(--ink-2); font-size: .82rem; }
.seat .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); vertical-align: middle; }
.seat.off { opacity: .6; }
.seat.empty { background: transparent; border-style: dashed; box-shadow: none; }
.seat.empty .av { border-style: dashed; background: rgba(255, 255, 255, .5); }
.lobby-opts { grid-template-columns: .9fr 1fr 1fr; }
.lobby:not(.is-host) .host-only { display: none !important; }
.seg button:disabled { cursor: default; }
.seg button:disabled:not([aria-pressed="true"]) { color: var(--ink-3); }
.net {
  position: fixed; z-index: 80; top: 10px; left: 50%; transform: translateX(-50%);
  background: #fde6b8; border: 2px solid var(--ink); border-radius: 99px; padding: 4px 16px; font-weight: 700; box-shadow: 0 3px 0 var(--ink);
}

/* ---------- game ---------- */
.game { background: var(--paper-2) var(--star); }
.game.active { display: grid; grid-template-rows: auto 1fr auto; }
.g-top { display: flex; align-items: center; gap: 12px; padding: 10px 14px 8px; }
.hud { display: flex; gap: 10px; flex: 1; min-width: 0; }
.pc {
  --pc: #888;
  position: relative; flex: 1 1 0; min-width: 0;
  display: flex; align-items: center; gap: 10px;
  background: var(--paper); border: var(--edge); border-radius: 16px; padding: 6px 10px 6px 12px;
  box-shadow: 0 3px 0 var(--ink);
  transition: transform .2s, box-shadow .2s, background .2s;
}
.pc .av { flex: none; width: 50px; height: 50px; border-radius: 50%; overflow: hidden; border: 3px solid var(--pc); box-shadow: 0 0 0 2px var(--ink); background: #f4ebd6; }
.pc .av img { width: 100%; height: 100%; object-fit: cover; }
.pc .info { min-width: 0; }
.pc .nm { font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.pc .nm small { font-weight: 500; color: var(--ink-2); font-size: .78em; }
.pc .meta { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--ink-2); }
.pc .sc { font-size: 1.3rem; color: var(--pc); font-variant-numeric: tabular-nums; min-width: 2.6em; }
.pc .tw { display: inline-flex; gap: 2px; }
.pc .tw i { width: 9px; height: 13px; background: var(--pc); border: 1.5px solid var(--ink); border-radius: 2px 2px 0 0; }
.pc .tw:empty::after { content: "—"; color: var(--ink-3); }
.pc .ct { white-space: nowrap; }
/* 4–5 players: slimmer cards */
.hud.many { gap: 8px; }
.hud.many .pc { gap: 7px; padding: 5px 8px 5px 9px; }
.hud.many .pc .av { width: 42px; height: 42px; }
@media (max-width: 1500px) { .hud.many .pc .ct { display: none; } }
.pc .turn {
  position: absolute; top: -10px; inset-inline-end: 10px; font-size: .72rem; font-weight: 800;
  background: var(--pc); color: #fff; border: 2px solid var(--ink); border-radius: 8px; padding: 0 8px; line-height: 1.5;
  opacity: 0; transform: translateY(4px); transition: .2s;
}
.pc.active { transform: translateY(-3px); box-shadow: 0 6px 0 var(--ink), 0 0 0 4px color-mix(in srgb, var(--pc) 35%, transparent); background: #fffaf0; }
.pc.active .turn { opacity: 1; transform: none; }
.pc.out { filter: grayscale(1); opacity: .55; }
.pc.away .av { opacity: .5; }
.pc.away .turn { opacity: 1; transform: none; background: #8a7a66; }
.pc.out .turn { opacity: 1; transform: none; background: #777; }
/* truces: the leader's tag, and on both cards of a truce its rounds left with a dot in the other's colour */
.pc .lead-tag { position: absolute; top: -10px; inset-inline-start: 10px; display: none; font-size: .68rem; font-weight: 800; line-height: 1.5;
  background: #94600F; color: #fff; border: 2px solid var(--ink); border-radius: 8px; padding: 0 7px; }
.pc.lead .lead-tag { display: block; }
.pc .pact { position: absolute; bottom: -10px; inset-inline-start: 10px; display: inline-flex; align-items: center; gap: 3px; font-size: .68rem; font-weight: 800;
  line-height: 1.5; background: var(--turq-2); color: #fff; border: 2px solid var(--ink); border-radius: 99px; padding: 0 7px 0 6px; }
.pc .pact[hidden] { display: none; }
.pc .pact i { width: .62em; height: .62em; border-radius: 50%; background: var(--ac); box-shadow: 0 0 0 1.5px #fff; }
.floater {
  position: absolute; inset-inline-start: 56px; top: 0; font-weight: 800; font-size: 1.2rem; color: var(--pc);
  text-shadow: 0 2px 0 #fff, 0 0 6px #fff; pointer-events: none; animation: floatUp 1.4s ease-out forwards;
}
@keyframes floatUp { from { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } to { transform: translateY(-34px); opacity: 0; } }

.g-bar { display: flex; align-items: center; gap: 10px; }
.phase {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--turq); color: #fff; border: var(--edge); border-radius: 14px; padding: 4px 16px; min-width: 150px;
  box-shadow: 0 3px 0 var(--ink); line-height: 1.25;
}
.phase b { font-size: 1.02rem; }
.start .cities { display: flex; align-items: center; gap: 10px; }
.start .cities small { font-size: .8rem; color: var(--ink2, #6b5440); white-space: nowrap; }
.start .cities input { flex: 1; accent-color: #c98a12; height: 28px; }
.start .cities-n { margin: 2px 0 0; text-align: center; font-weight: 700; font-size: .95rem; }
/* a city out of play on a smaller map: a ruin — greyed, its land hatched, its routes faded */
.city.off { filter: grayscale(1) brightness(.85); opacity: .38; pointer-events: none; }
.city.off .lbl { text-decoration: line-through; }
.reg.off { fill: #8b7d6b; fill-opacity: .16; stroke-opacity: .15; }
.r.off { opacity: .12; }
/* a city joined into a province (a smaller map — core/engine.js provinces()): only its land shows, in its head's colours */
.city.joined, .flags .flag.joined, .r.joined { display: none; }
/* a cutscene over the match (sceneplayer.js): full screen, a tap skips it */
.scene { position: fixed; inset: 0; z-index: 60; background: #2a1d14; opacity: 0; transition: opacity .3s; cursor: pointer; }
.scene.show { opacity: 1; }
.scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scene-skip { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); inset-inline-end: 12px; font: 700 1rem var(--ui); color: var(--paper);
  background: rgba(59, 39, 24, .7); border: 2px solid rgba(251, 244, 230, .6); border-radius: 999px; padding: 4px 14px; }
.room-tag { background: var(--paper); border: var(--edge); border-radius: 12px; padding: 4px 10px; font-size: .85rem; white-space: nowrap; box-shadow: 0 3px 0 var(--ink); }
.room-tag b { font-size: 1rem; letter-spacing: .04em; }
.phase span { font-size: .8rem; opacity: .9; }
.icon-btn {
  width: 48px; height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  background: var(--paper); border: var(--edge); border-radius: 14px; box-shadow: 0 3px 0 var(--ink);
}
.icon-btn span { width: 5px; height: 18px; background: var(--ink); border-radius: 2px; }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

.board-wrap {
  position: relative; min-height: 0; overflow: auto; overscroll-behavior: contain;
  display: grid; place-content: safe center; padding: 4px 12px 8px;
  scrollbar-width: thin; scrollbar-color: var(--ink-3) transparent;
}
.board {
  position: relative; aspect-ratio: 2752 / 1536; width: 900px;
  container-type: inline-size;
  border: 3px solid var(--ink); border-radius: 20px; overflow: hidden;
  box-shadow: 0 6px 0 var(--ink), 0 20px 40px rgba(59, 39, 24, .25);
  background: #f2e3c4; user-select: none;
}
.board .map { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.board svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* territories: every city holds the land around it, tinted (lightly) with its owner's colour */
.reg {
  --pc: transparent;
  fill: var(--pc); fill-opacity: 0; stroke: #7a5532; stroke-width: .11; stroke-dasharray: .45 .35; stroke-opacity: .32; stroke-linejoin: round;
  transition: fill .5s, fill-opacity .5s, stroke .5s, stroke-opacity .5s;
}
.reg.own { fill-opacity: .3; stroke: var(--pc); stroke-opacity: .8; stroke-width: .16; stroke-dasharray: none; }
.reg.own.castle { fill-opacity: .4; }
.board.picking .reg.own:not(.sel):not(.atk) { fill-opacity: .2; }
.reg.sel, .reg.atk { pointer-events: auto; cursor: pointer; }
.reg.sel { fill: #ffcf4d; fill-opacity: .4; stroke: #a8740f; stroke-opacity: 1; stroke-width: .34; stroke-dasharray: none; animation: regpulse 1.1s ease-in-out infinite; }
.reg.atk { stroke: #b2382f; stroke-opacity: 1; stroke-width: .3; stroke-dasharray: .55 .3; animation: regpulse 1s ease-in-out infinite; }
.reg.sel:hover, .reg.atk:hover { fill-opacity: .55; animation: none; }
.reg.target { stroke: #b2382f; stroke-opacity: 1; stroke-width: .4; stroke-dasharray: none; animation: regpulse .7s ease-in-out infinite; }
.reg.capture, .reg.rise { animation: regflash .9s ease-out; }
.reg.fall { animation: regflash .6s 2; }
@keyframes regpulse { 50% { fill-opacity: .6; } }
@keyframes regflash { 25% { fill-opacity: .75; } }
.r { fill: none; stroke-linecap: round; }
.r.land { stroke: #7a5532; stroke-width: .3; stroke-dasharray: .02 .62; opacity: .8; }
.r.sea { stroke: #0b5d63; stroke-width: .2; stroke-dasharray: .7 .55; opacity: .55; }
.r.front { stroke: #b2382f; opacity: .85; }
.arrow { fill: none; stroke: var(--ac); stroke-width: .7; stroke-linecap: round; filter: drop-shadow(0 .15px 0 #3B2718) drop-shadow(0 0 .4px #fff); }

.city {
  --pc: transparent;
  position: absolute; width: calc(4.9cqw * var(--lm, 1)); height: calc(4.9cqw * var(--lm, 1)); padding: 0; border: 0; background: none;
  transform: translate(-50%, -60%); /* physical left/top = the city's anchor point */
  touch-action: manipulation;
}
.city .spr { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 .25cqw .2cqw rgba(59, 39, 24, .35)); transition: transform .2s; }
.city.castle { width: calc(5.9cqw * var(--lm, 1)); height: calc(5.9cqw * var(--lm, 1)); z-index: 2; }
/* a castle keeps its landmark and gets a small keep beside it */
.city .keep { position: absolute; width: 50%; height: 50%; left: -22%; top: 34%; object-fit: contain; display: none; pointer-events: none;
  filter: drop-shadow(0 .15cqw .1cqw rgba(59, 39, 24, .4)); }
.city.castle .keep { display: block; }
.city .halo { position: absolute; inset: -18%; border-radius: 50%; pointer-events: none; }
.city.own .halo { background: radial-gradient(closest-side, color-mix(in srgb, var(--pc) 45%, transparent), transparent); }
/* the flags' own layer, under the cities: placed from the city's anchor as they stood on its box (4.9cqw, a castle's 5.9cqw, shifted
   −50% −60%): a city's at 62% across and −26% up, a castle's at the middle and −34% up — all × the world's landmark size (--lm) */
.board .flags { position: absolute; inset: 0; pointer-events: none; }
.flags .flag { position: absolute; margin: calc(-4.21cqw * var(--lm, 1)) 0 0 calc(.59cqw * var(--lm, 1)); width: .22cqw; height: 2.2cqw; background: var(--ink); border-radius: 2px; display: none; }
.flags .flag i {
  position: absolute; top: 0; left: .22cqw; width: 1.7cqw; height: 1.15cqw; background: var(--pc);
  clip-path: polygon(0 0, 100% 50%, 0 100%); outline: none; transform-origin: left center; animation: wave 2.4s ease-in-out infinite;
  filter: drop-shadow(0 0 .1cqw var(--ink));
}
.flags .flag.own { display: block; }
.flags .flag.castle { margin: calc(-5.55cqw * var(--lm, 1)) 0 0 calc(-.11cqw * var(--lm, 1)); }
@keyframes wave { 50% { transform: scaleX(.82) skewY(4deg); } }
.city .lbl {
  position: absolute; top: 92%; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: baseline; gap: .35em; white-space: nowrap;
  font-size: max(10px, 1.05cqw); font-weight: 700; line-height: 1.35;
  padding: 0 .55em; border-radius: 99px; border: max(1.5px, .14cqw) solid var(--ink);
  background: rgba(251, 244, 230, .94); color: var(--ink);
}
.city.own .lbl { background: var(--pc); color: #fff; }
.city .val { font-weight: 800; font-size: .85em; opacity: .9; }
.city .val:empty { display: none; }
/* strength bars inside the label: a city 1–3, a castle up to 7 */
.city .bars { display: inline-flex; gap: max(1px, .12cqw); align-self: center; margin-inline-end: .1em; }
.city .bars:empty { display: none; }
.city .bars i { width: .34em; height: .78em; background: #fff; border-radius: 1.5px; opacity: .95; box-shadow: 0 0 0 .5px rgba(59, 39, 24, .35); }
.city.castle .bars i { width: .38em; height: .9em; }

/* picking — SAIF-2026-10-17 (the owner): the cities one may choose glow (a pulsing ring, a lit label), the rest step back */
.board.picking .city:not(.sel):not(.atk) { filter: saturate(.4) brightness(.8); }
.board.picking .city:not(.sel):not(.atk) .lbl { opacity: .6; }
.city.sel, .city.atk { cursor: pointer; z-index: 3; }
.city.sel .halo, .city.atk .halo { inset: -40%; }
.city.sel .halo { background: radial-gradient(closest-side, rgba(255, 210, 80, .95), rgba(255, 210, 80, 0)); animation: pulse 1.1s ease-in-out infinite; }
.city.atk .halo { background: radial-gradient(closest-side, rgba(225, 65, 55, .85), rgba(225, 65, 55, 0)); animation: pulse .9s ease-in-out infinite; }
.city.sel::before, .city.atk::before {
  content: ''; position: absolute; inset: -26%; border-radius: 50%; pointer-events: none;
  border: .3cqw solid #ffcf4d; box-shadow: 0 0 1.1cqw .3cqw rgba(255, 196, 40, .85), inset 0 0 .7cqw rgba(255, 196, 40, .55);
  animation: ring 1.1s ease-in-out infinite;
}
.city.atk::before { border-color: #e0483e; box-shadow: 0 0 1.1cqw .3cqw rgba(224, 72, 62, .8), inset 0 0 .7cqw rgba(224, 72, 62, .5); animation-duration: .9s; }
.city.sel .lbl { background: #ffcf4d; color: var(--ink); box-shadow: 0 0 0 .16cqw #a8740f, 0 0 1cqw .25cqw rgba(255, 196, 40, .9); }
.city.atk .lbl { box-shadow: 0 0 0 .16cqw #b2382f, 0 0 1cqw .25cqw rgba(224, 72, 62, .85); }
.city.sel:hover .spr, .city.atk:hover .spr { transform: translateY(-6%) scale(1.08); }
@keyframes pulse { 50% { transform: scale(1.25); opacity: .65; } }
@keyframes ring { 50% { transform: scale(1.16); opacity: .55; } }
.city.target { z-index: 4; }
.city.target .halo { background: radial-gradient(closest-side, rgba(220, 60, 50, .85), transparent); animation: pulse .7s ease-in-out infinite; }
.city.source .spr { transform: scale(1.08); }

/* event animations */
.city.rise .spr { animation: rise .8s cubic-bezier(.2, 1.6, .4, 1); }
.city.capture .spr { animation: pop .7s cubic-bezier(.2, 1.6, .4, 1); }
.city.hit .spr, .city.hit .keep { animation: shake .6s; }
.city.fall .spr { animation: shake .5s 2, fallflash 1.2s; }
.city.hold::after {
  content: ""; position: absolute; inset: -22%; border-radius: 50%; pointer-events: none;
  border: .35cqw solid rgba(255, 255, 255, .95); box-shadow: 0 0 1cqw #fff, inset 0 0 1cqw rgba(22, 140, 147, .6);
  animation: shield .9s ease-out forwards;
}
@keyframes rise { from { transform: translateY(40%) scale(.2); opacity: 0; } }
@keyframes pop { 35% { transform: scale(1.3) translateY(-8%); } }
@keyframes shake { 20%, 60% { transform: translateX(-6%) rotate(-3deg); } 40%, 80% { transform: translateX(6%) rotate(3deg); } }
@keyframes fallflash { 30% { filter: grayscale(1) brightness(.7); } }
@keyframes shield { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.25); opacity: 0; } }

.prompt {
  /* as tall as the countdown makes it (34px ring + padding + border): the bar keeps one height with the clock or
     without, so the board above it does not resize by a few pixels with each message (SAIF-2026-10-25) */
  justify-self: center; margin: 0 12px 12px; min-height: calc(34px + 12px + 5px);
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-weight: 700; font-size: 1.1rem; padding: 6px 22px;
  background: var(--paper); border: var(--edge); border-radius: 14px; box-shadow: 0 3px 0 var(--ink);
  max-width: min(760px, calc(100% - 24px));
}
.prompt.blank { visibility: hidden; }
/* the countdown of the choice being made: a ring that empties, red in the last five seconds */
.prompt .clk { --p: 1; flex: none; display: grid; place-items: center; width: 34px; height: 34px; margin-inline-start: 12px; border-radius: 50%;
  background: conic-gradient(var(--turq) calc(var(--p) * 360deg), rgba(59, 39, 24, .14) 0); }
.prompt .clk b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--paper); font-size: .95rem; font-variant-numeric: tabular-nums; }
.prompt .clk.low { background: conic-gradient(var(--bad) calc(var(--p) * 360deg), rgba(59, 39, 24, .14) 0); }
.prompt .clk.low b { color: var(--bad); }
.prompt.me { background: var(--saffron); animation: nudge 1.6s ease-in-out infinite; }
/* the truce buttons while choosing a target: quiet, above the prompt (ui.deal sets `bottom`) */
.deal { position: absolute; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  width: max-content; max-width: calc(100% - 24px); }
.deal[hidden] { display: none; }
.deal .btn { background: var(--paper); box-shadow: 0 2px 0 var(--ink); }
/* the cities of the player's ally: a dashed teal ring around the label */
.city.ally .lbl { outline: max(2px, .17cqw) dashed var(--turq-2); outline-offset: max(2px, .14cqw); }
.prompt.warn { background: #f6cfc5; }
@keyframes nudge { 50% { transform: translateY(-2px); } }

/* ---------- quiz overlay ---------- */
.quiz {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px;
  background: linear-gradient(rgba(59, 39, 24, .35), rgba(59, 39, 24, .55)), url("../img/hall.webp?v=1") center/cover;
  opacity: 0; transition: opacity .25s;
}
.quiz.show { opacity: 1; }
.quiz.spectate { background: rgba(59, 39, 24, .45); }
.q-card {
  position: relative; width: min(780px, 100%); max-height: 100%; overflow-y: auto;
  background: var(--paper) var(--star); border: var(--edge); border-radius: 26px; box-shadow: var(--deep);
  padding: 18px 22px 20px;
  transform: translateY(14px) scale(.97); transition: transform .3s cubic-bezier(.2, 1.4, .4, 1);
}
.quiz.show .q-card { transform: none; }
.q-top { display: flex; align-items: center; gap: 12px; }
.q-cat { display: flex; align-items: center; gap: 6px; background: var(--paper-2); border: 2px solid var(--ink); border-radius: 99px; padding: 2px 12px 2px 4px; font-weight: 700; }
.q-cat img { width: 36px; height: 36px; }
.q-title { flex: 1; text-align: center; font-weight: 800; font-size: 1.1rem; color: var(--turq-2); }
.q-note { margin: 8px auto 0; width: fit-content; max-width: 100%; padding: 3px 14px; border-radius: 99px; background: #fbe7bf; border: 1.5px solid var(--saffron-2); color: var(--ink); font-weight: 800; font-size: .95rem; text-align: center; }
.q-timer { position: relative; width: 56px; height: 56px; flex: none; }
.q-timer svg { width: 100%; height: 100%; transform: rotate(-90deg) scaleY(-1); }
.q-timer circle { fill: none; stroke-width: 5; }
.q-timer .bg { stroke: #e9d8b6; fill: #fff; }
.q-timer .fg { stroke: var(--turq); stroke-linecap: round; transition: stroke .3s; }
.q-timer b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.q-timer.low .fg { stroke: var(--bad); }
.q-timer.low b { color: var(--bad); animation: beat .5s ease-in-out infinite; }
@keyframes beat { 50% { transform: scale(1.15); } }
.q-who { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 12px 0 4px; flex-wrap: wrap; }
.q-who .vs { font-family: var(--title); font-size: 1.4rem; color: var(--bad); }
.chip {
  display: flex; align-items: center; gap: 8px; padding: 3px 12px 3px 4px; border-radius: 99px;
  background: #fff; border: 2px solid var(--ink); font-weight: 700; transition: background .2s;
}
.chip img { width: 34px; height: 34px; border-radius: 50%; border: 2.5px solid var(--pc); object-fit: cover; }
.chip .st { font-size: .8rem; color: var(--ink-2); font-weight: 600; }
.chip.done .st { color: var(--turq-2); }
.chip.ok { background: #dff1dc; }
.chip.ok .st { color: var(--ok); font-weight: 800; }
.chip.bad .st { color: var(--bad); font-weight: 800; }
.q-who[data-n="4"], .q-who[data-n="5"] { gap: 6px; }
.q-who[data-n="4"] .chip, .q-who[data-n="5"] .chip { gap: 5px; padding: 2px 9px 2px 3px; font-size: .9rem; }
.q-who[data-n="4"] .chip img, .q-who[data-n="5"] .chip img { width: 28px; height: 28px; }
.rank .aw { font-style: normal; font-size: .78rem; font-weight: 800; color: #fff; background: var(--pc); border-radius: 99px; padding: 0 7px; margin-inline-start: 6px; vertical-align: 1px; }
.rank .aw.fast { background: var(--ink); }
.q-text { font-size: clamp(1.3rem, 2.6vw, 1.75rem); line-height: 1.55; text-align: center; margin: 12px 4px 16px; font-weight: 700; }
.q-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt {
  position: relative; display: flex; align-items: center; gap: 10px; text-align: start;
  min-height: 62px; padding: 8px 12px; font-size: 1.15rem; font-weight: 700;
  background: #fff; border: var(--edge); border-radius: 16px; box-shadow: 0 4px 0 var(--ink);
  transition: transform .1s, background .15s, box-shadow .1s, opacity .25s;
}
.opt .k { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--paper-2); border: 2px solid var(--ink); font-weight: 800; font-size: 1.1rem; }
.opt .t { flex: 1; }
.opt:not(:disabled):hover { background: #fff7e3; transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.opt:not(:disabled):active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.opt.mine { background: #fde6b8; }
.opt.mine .k { background: var(--saffron); }
.opt.gone { opacity: .25; text-decoration: line-through; }
.opt.ok { background: #d9f0d5; border-color: var(--ok); box-shadow: 0 4px 0 #2b6b33; animation: okpop .45s; }
.opt.ok .k { background: var(--ok); color: #fff; }
.opt.bad { background: #f8d6d1; }
.opt.bad .k { background: var(--bad); color: #fff; }
.opt .marks { display: flex; gap: 2px; }
.opt .marks i { display: block; width: 30px; height: 30px; border-radius: 50%; overflow: hidden; border: 2.5px solid var(--pc); box-shadow: 0 0 0 1.5px var(--ink); animation: pop .4s; }
.opt .marks img { width: 100%; height: 100%; object-fit: cover; }
@keyframes okpop { 40% { transform: scale(1.04); } }
.quiz.spectate .opt { cursor: default; }
.q-foot { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; min-height: 8px; }
.help {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 700;
  background: var(--paper-2); border: 2px solid var(--ink); border-radius: 99px; padding: 5px 14px 5px 6px; box-shadow: 0 3px 0 var(--ink);
}
.help .ico { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--turq); color: #fff; font-weight: 800; }
.help b { background: var(--ink); color: #fff; border-radius: 99px; padding: 0 7px; font-size: .85rem; }
.help:disabled { opacity: .45; }
.hint { font-weight: 800; color: var(--turq-2); background: #e1f2f1; border: 2px dashed var(--turq); border-radius: 12px; padding: 4px 14px; animation: pop .4s; }
.q-tap { position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; font-size: .78rem; color: var(--ink-3); opacity: 0; transition: opacity .3s; pointer-events: none; }
.q-card.tappable { cursor: pointer; }
.q-card.tappable .q-tap { opacity: 1; }
.q-card.revealed .q-foot .help { display: none; }
/* SAIF-2026-10-23 «الثقة»: «أنا متأكّد» before answering, in saffron; once said, on — and every screen marks the chip */
.help.sure .ico { background: #C9822B; }
.help.sure.on { background: #fde6b8; border-color: #b8741f; opacity: 1; }
.sure-tip { flex-basis: 100%; text-align: center; font-size: .78rem; color: var(--ink-3); order: 9; }
.q-card.revealed .sure-tip { display: none; }
.chip.sure { box-shadow: 0 0 0 3px #e7a33c; }
.chip.sure .nm::after { content: ' · متأكّد'; color: #b8741f; font-weight: 800; font-size: .8em; }
/* «السلّم»: the three stakes, one under another */
.stake-opts { display: grid; gap: 10px; }
.stake-b { display: grid; gap: 2px; text-align: center; padding: 10px 14px; }
.stake-b b { font-size: 1.1rem; }
.stake-b small { font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.stake-b[data-k="1"] { background: #fdf0cf; }
.stake-b[data-k="2"] { background: #f8d6d1; }

/* numeric */
.q-num { display: grid; justify-items: center; gap: 12px; }
.q-num .disp {
  direction: ltr; display: flex; align-items: baseline; justify-content: center; gap: 10px;
  min-width: min(360px, 100%); padding: 8px 18px; min-height: 66px;
  background: #fff; border: var(--edge); border-radius: 16px; box-shadow: inset 0 3px 0 rgba(59, 39, 24, .08);
}
.q-num .v { font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .02em; min-width: 1ch; }
.q-num .v:empty::after { content: "؟"; color: var(--ink-3); }
.q-num .u { font-size: 1.05rem; color: var(--ink-2); font-weight: 700; direction: rtl; }
.q-num .pad { direction: ltr; display: grid; grid-template-columns: repeat(3, 84px); gap: 8px; }
.q-num .pad button {
  height: 54px; font-size: 1.55rem; font-weight: 800; background: #fff; border: var(--edge); border-radius: 14px; box-shadow: 0 3px 0 var(--ink);
}
.q-num .pad button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.q-num .pad .enter { background: var(--saffron); font-size: 1.1rem; }
.q-num .pad .enter { grid-column: 1 / -1; height: 48px; }
.q-num .pad .dot { font-size: 1.9rem; line-height: 1; }
.q-num .pad .del { background: var(--paper-2); }
.q-num.sent .pad { opacity: .4; pointer-events: none; }
.q-num.sent .disp { background: #fdebc4; }
.q-numres { display: grid; gap: 14px; justify-items: center; }
.truth { display: flex; align-items: baseline; gap: 10px; background: #d9f0d5; border: 2.5px solid var(--ok); border-radius: 16px; padding: 6px 22px; animation: okpop .5s; }
.truth small { font-weight: 700; color: var(--ink-2); }
.truth b { font-size: 2.2rem; font-variant-numeric: tabular-nums; direction: ltr; }
.truth span { font-weight: 700; }
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; width: min(560px, 100%); }
.rank li {
  display: grid; grid-template-columns: 30px 40px 1fr auto auto auto; align-items: center; gap: 10px;
  background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 4px 12px 4px 8px; animation: slideIn .4s backwards;
}
.rank li:nth-child(2) { animation-delay: .12s; } .rank li:nth-child(3) { animation-delay: .24s; }
.rank li.win { background: #fff3cf; border-width: 2.5px; box-shadow: 0 3px 0 var(--ink); }
.rank .pos { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--paper-2); border: 2px solid var(--ink); font-weight: 800; }
.rank li.win .pos { background: var(--gold); }
.rank img { width: 38px; height: 38px; border-radius: 50%; border: 2.5px solid var(--pc); object-fit: cover; }
.rank .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .g { font-weight: 800; font-size: 1.2rem; font-variant-numeric: tabular-nums; direction: ltr; }
.rank .d { font-size: .85rem; color: var(--ink-2); font-weight: 700; direction: ltr; unicode-bidi: plaintext; }
.rank li.win .d { color: var(--ok); }
.rank .tm { font-size: .78rem; color: var(--ink-3); }
@keyframes slideIn { from { transform: translateX(-20px); opacity: 0; } }

/* ---------- banner / toasts ---------- */
.banner { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; pointer-events: none; }
.banner .rib {
  display: flex; align-items: center; gap: 16px; padding: 14px 34px 14px 26px;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 22px; box-shadow: var(--deep);
  transform: scale(.6) rotate(-3deg); opacity: 0; transition: transform .35s cubic-bezier(.2, 1.5, .4, 1), opacity .25s;
  max-width: calc(100% - 32px);
}
.banner.war .rib { background: #fbe3d8; }
.banner.truce .rib { background: #ddf0ee; }
.banner.show .rib { transform: none; opacity: 1; }
.banner img { width: 74px; height: 74px; flex: none; }
.banner b { display: block; font-family: var(--title); font-size: clamp(1.9rem, 4.5vw, 2.8rem); line-height: 1.2; }
.banner span { display: block; font-weight: 700; color: var(--ink-2); font-size: 1.05rem; }
.toasts { position: fixed; z-index: 45; top: 86px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; width: min(560px, calc(100% - 24px)); }
.toast {
  font-weight: 700; padding: 8px 18px; border-radius: 14px; border: 2.5px solid var(--ink);
  background: var(--paper); box-shadow: 0 3px 0 var(--ink); animation: toastIn .3s cubic-bezier(.2, 1.4, .4, 1); transition: opacity .4s, transform .4s; text-align: center;
}
.toast.good { background: #d9f0d5; }
.toast.bad { background: #f8d6d1; }
.toast.gold { background: #fde6b8; }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes toastIn { from { transform: translateY(-14px) scale(.9); opacity: 0; } }

/* ---------- modals ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(59, 39, 24, .45); opacity: 0; transition: opacity .2s; }
#m-settings { z-index: 62; }
.modal.show { opacity: 1; }
.dlg { width: min(560px, 100%); max-height: calc(100svh - 32px); overflow-y: auto; padding: 20px 24px 22px; transform: scale(.95); transition: transform .25s cubic-bezier(.2, 1.4, .4, 1); }
.modal.show .dlg { transform: none; }
.dlg header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dlg h2 { font-family: var(--title); font-size: 2rem; margin: 0; }
.x { width: 40px; height: 40px; border: 2px solid var(--ink); border-radius: 12px; background: var(--paper-2); font-size: 1.5rem; line-height: 1; }
.how { width: min(720px, 100%); }
.steps { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 10px; }
.steps li { display: flex; gap: 14px; align-items: center; background: #fff; border: 2px solid var(--ink); border-radius: 16px; padding: 8px 14px 8px 8px; }
.steps img { width: 62px; height: 62px; flex: none; object-fit: contain; }
.steps b { font-size: 1.1rem; }
.steps p { margin: 2px 0 0; color: var(--ink-2); line-height: 1.6; font-size: .97rem; }
.tip { background: var(--paper-2); border-radius: 14px; padding: 10px 14px; line-height: 1.7; margin: 0 0 14px; }
.how > .btn { display: flex; margin: 0 auto; min-width: 200px; }
/* two heroes side by side for the truce */
.steps .duo { flex: none; width: 62px; height: 62px; position: relative; }
.steps .duo img { position: absolute; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--ink); background: #f4ebd6; }
.steps .duo img:first-child { top: 2px; inset-inline-start: 0; }
.steps .duo img:last-child { bottom: 2px; inset-inline-end: 0; }
/* a truce offered: who leads and by how much, two answers, and the ten seconds */
.offer { width: min(440px, 100%); text-align: center; display: grid; gap: 12px; }
.offer p { margin: 0; line-height: 1.7; color: var(--ink-2); }
.offer p b { color: var(--ink); }
.offer .menu-row .btn { flex: 1; }
.offer-clk { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; }
.offer-clk .clk { --p: 1; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: conic-gradient(var(--turq) calc(var(--p) * 360deg), rgba(59, 39, 24, .14) 0); }
.offer-clk .clk b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--paper); font-size: .95rem; font-variant-numeric: tabular-nums; }
.offer-clk .clk.low { background: conic-gradient(var(--bad) calc(var(--p) * 360deg), rgba(59, 39, 24, .14) 0); }
.offer-clk .clk.low b { color: var(--bad); }
.set-list { display: grid; gap: 8px; margin: 8px 0 16px; }
.tog { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 10px 14px; font-weight: 700; cursor: pointer; }
.tog input { position: absolute; opacity: 0; pointer-events: none; }
.tog i { position: relative; width: 52px; height: 30px; flex: none; border-radius: 99px; background: #d8c7a6; border: 2px solid var(--ink); transition: background .2s; }
.tog i::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); transition: inset-inline-start .2s; }
.tog input:checked + i { background: var(--turq); }
.tog input:checked + i::after { inset-inline-start: 24px; }
.tog input:focus-visible + i { outline: 3px solid var(--turq); outline-offset: 2px; }
.pause { text-align: center; }
.pause .emblem { margin: 0 auto; width: 96px; height: 96px; }
.pause p { color: var(--ink-2); margin: 4px 0 16px; }

/* ---------- results ---------- */
.result { background: var(--paper-2); overflow-y: auto; }
.result.active { display: block; }
.res-art { height: 36svh; min-height: 220px; border-bottom: 3px solid var(--ink); overflow: hidden; }
.res-art img { width: 100%; height: 100%; object-fit: cover; animation: kenburns 14s ease-out both; }
@keyframes kenburns { from { transform: scale(1.08); } }
.res-panel { width: min(820px, calc(100% - 32px)); margin: -70px auto 32px; padding: 18px 24px 22px; text-align: center; }
.res-panel h2 { font-family: var(--title); font-size: clamp(2.2rem, 5vw, 3.2rem); margin: 0; line-height: 1.25; }
.res-panel > p { color: var(--ink-2); font-size: 1.1rem; margin: 4px 0 14px; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 6px 0 16px; }
.pod { display: flex; flex-direction: column; align-items: center; width: 150px; animation: rise .7s cubic-bezier(.2, 1.4, .4, 1) backwards; }
.pod.r1 { animation-delay: .25s; } .pod.r3 { animation-delay: .1s; }
.pod .av { width: 76px; height: 76px; border-radius: 50%; overflow: hidden; border: 4px solid var(--pc); box-shadow: 0 0 0 2.5px var(--ink); background: #f4ebd6; }
.pod.r1 .av { width: 96px; height: 96px; }
.pod .av img { width: 100%; height: 100%; object-fit: cover; }
.pod .nm { margin-top: 6px; font-size: 1.05rem; }
.pod .sc { font-weight: 800; color: var(--pc); font-size: 1.25rem; }
.pod .step { width: 100%; margin-top: 6px; background: var(--pc); border: 2.5px solid var(--ink); border-bottom: 0; border-radius: 12px 12px 0 0; display: grid; place-items: center; color: #fff; font-family: var(--title); font-size: 2rem; }
.pod.r1 .step { height: 92px; } .pod.r2 .step { height: 64px; } .pod.r3 .step { height: 44px; }
.pod.me .nm::after { content: " (أنت)"; font-weight: 500; font-size: .85em; color: var(--ink-2); }
.podium { flex-wrap: wrap; }
.rest { flex-basis: 100%; list-style: none; margin: 10px 0 0; padding: 0; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.rest li { display: flex; align-items: center; gap: 6px; background: #fff; border: 2px solid var(--ink); border-radius: 99px; padding: 2px 12px 2px 4px; font-weight: 700; }
.rest li.me { background: #fff3cf; }
.rest i { font-style: normal; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--paper-2); border: 2px solid var(--ink); font-size: .85rem; }
.rest img { width: 30px; height: 30px; border-radius: 50%; border: 2.5px solid var(--pc); object-fit: cover; }
.rest span { color: var(--pc); font-weight: 800; }
.res-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.res-stats div { background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 8px; display: flex; flex-direction: column; }
.res-stats b { font-size: 1.5rem; }
.res-stats span { font-size: .82rem; color: var(--ink-2); }

/* flag a doubtful question (answer card and results) */
.flag { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; font-size: .88rem; }
.flag button { font: inherit; font-weight: 700; padding: 3px 11px; border: 1.5px solid var(--ink-3); border-radius: 99px; background: #fff; color: var(--ink-2); cursor: pointer; }
.flag button:hover { border-color: var(--ink); color: var(--ink); }
.flag .flag-btn { border-style: dashed; background: transparent; }
.flag .ask { font-weight: 700; color: var(--ink-2); }
.flag .ok { font-weight: 700; color: var(--ok); }
.res-qs { margin: 0 0 16px; background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 8px 14px; text-align: start; }
.res-qs summary { cursor: pointer; font-weight: 800; }
.res-qs ol { margin: 10px 0 4px; padding-inline-start: 22px; display: grid; gap: 10px; max-height: 46vh; overflow-y: auto; }
.res-qs li .q { margin: 0; font-weight: 700; }
.res-qs li .a { margin: 2px 0 4px; color: var(--ok); font-weight: 800; }
.res-log { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; margin: 0 0 16px; font-weight: 600; }
.res-log[hidden] { display: none; }
.res-qs li .flag { justify-content: flex-start; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 70; pointer-events: none; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .chars { grid-template-columns: repeat(3, 1fr); }
  .opts { grid-template-columns: 1fr 1fr; }
  .opts .name { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  /* the home screen in one screen, no scroll: the picture takes what the title and the menu leave */
  .home { background: var(--paper) var(--star); }
  .home.active { display: flex; flex-direction: column; overflow: hidden; }
  .home-art { position: relative; inset: auto; flex: 1 1 0; min-height: 120px; }
  .home-art img { object-position: 15% 38%; }
  .home-panel { position: relative; inset: auto; width: auto; flex: none; margin-top: -46px; padding: 0 16px calc(env(safe-area-inset-bottom, 0px) + 8px); justify-content: flex-start; }
  .home-panel .emblem { width: 84px; height: 84px; }
  .home .logo { font-size: clamp(2.5rem, 12vw, 3.3rem); margin: 0; }
  .tag { font-size: 1rem; margin: 2px 0 14px; line-height: 1.5; }
  .home .menu { display: grid; gap: 10px; }
  .home .menu .menu-row { gap: 10px; }
  .home .btn.big { padding: .55em 1em; font-size: 1.3rem; }
  .home .menu .btn { padding-block: .6em; }
  .powered { margin-top: 10px; font-size: .8rem; }
  .me-chip { padding-inline-end: 12px; }
  .sheet { padding: 16px 14px 18px; }
  .sheet-h h2 { font-size: 1.8rem; }
  .chars { gap: 8px; }
  .char small { display: none; }
  .opts { grid-template-columns: 1fr; }
  .g-top { flex-wrap: wrap; padding: 8px 8px 6px; gap: 8px; }
  .hud { order: 2; flex-basis: 100%; gap: 6px; }
  .g-bar { order: 1; width: 100%; justify-content: space-between; }
  .phase { flex-direction: row; gap: 8px; padding: 3px 12px; min-width: 0; }
  .icon-btn { width: 40px; height: 40px; }
  .pc { gap: 6px; padding: 4px 6px; border-radius: 12px; }
  .pc .av { width: 34px; height: 34px; border-width: 2.5px; }
  .pc .nm { font-size: .82rem; }
  .pc .nm small { display: none; }
  /* the score above the towers from the start: wrapping only once the score grew to four digits made the bar taller
     mid-match, and the board under it shrank (SAIF-2026-10-25) */
  .pc .meta { gap: 0; font-size: .72rem; flex-direction: column; align-items: flex-start; }
  .pc .sc { font-size: 1.05rem; min-width: 0; }
  .pc .ct { display: none; }
  .pc .tw i { width: 7px; height: 10px; }
  .hud.many { gap: 4px; }
  .hud.many .pc { flex-direction: column; gap: 1px; padding: 4px 2px 3px; text-align: center; }
  .hud.many .pc .av { width: 30px; height: 30px; border-width: 2px; }
  .hud.many .pc .info { width: 100%; }
  .hud.many .pc .nm { font-size: .68rem; }
  .hud.many .pc .meta { justify-content: center; align-items: center; gap: 3px; }
  .hud.many .pc .sc { font-size: .9rem; }
  .hud.many .pc .tw { display: none; }
  .hud.many .pc .turn { font-size: .6rem; padding: 0 5px; top: -9px; inset-inline-end: 4px; }
  .pc .lead-tag, .pc .pact { font-size: .6rem; padding: 0 5px; }
  .hud.many .pc .lead-tag { top: -9px; inset-inline-start: 4px; }
  .hud.many .pc .pact { bottom: -9px; inset-inline-start: 4px; }
  .hud.many .floater { inset-inline-start: 30%; }
  .seats[data-n="4"] { grid-template-columns: repeat(2, 1fr); }
  .seats[data-n="5"] { grid-template-columns: repeat(3, 1fr); }
  .board-wrap { padding: 4px 8px 6px; place-content: safe center start; }
  /* a phone's long messages take two lines: room for two, so the board keeps its size between short and long ones */
  .prompt { font-size: .98rem; margin: 0 8px 8px; padding: 6px 14px; min-height: 70px; min-height: calc(2lh + 12px + 5px); }
  .quiz { padding: 0; }
  .q-card { border-radius: 0; min-height: 100%; border-width: 0; padding: 14px 14px 22px; display: flex; flex-direction: column; }
  .q-text { margin: 8px 0 12px; }
  .q-opts { grid-template-columns: 1fr; gap: 9px; }
  .opt { min-height: 58px; font-size: 1.08rem; }
  /* SAIF-2026-10-28 (the owner: «تنسيق شاشات الأسئلة يحتاج الى صقل») — a phone's card: the field, the menu and the timer on one
     line and the title on its own under them (squeezed between them it stood five lines high); two players side by side with
     «ضدّ» between them (the name over its state); the question in the middle of the free space, the answers low, under the thumb */
  .q-top { flex-wrap: wrap; gap: 6px 8px; }
  .q-cat { min-width: 0; margin-inline-end: auto; padding: 2px 11px 2px 3px; font-size: .95rem; }
  .q-cat img { width: 30px; height: 30px; }
  .q-cat span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .q-title { order: 9; flex-basis: 100%; font-size: 1.05rem; line-height: 1.35; text-wrap: balance; }
  .q-timer { width: 50px; height: 50px; }
  .q-who { gap: 8px; margin: 10px 0 0; }
  .q-who[data-n="2"] { flex-wrap: nowrap; }
  .q-who .chip { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 7px; min-width: 0; padding: 3px 13px 3px 4px; }
  .q-who .chip img { grid-row: span 2; }
  .q-who .chip .nm { max-width: 7em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .q-who .chip .st { line-height: 1.15; font-size: .74rem; white-space: nowrap; }
  .q-who .vs { font-size: 1.15rem; }
  .q-card > .q-text { margin-block: auto; padding: 18px 14px; font-size: 1.42rem; border-radius: 20px; }
  .q-card:not(.dark) > .q-text { background: rgba(255, 255, 255, .62); box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .07); }
  .q-num .pad { grid-template-columns: repeat(3, minmax(70px, 1fr)); width: min(100%, 320px); }
  .profile .res-stats { grid-template-columns: repeat(2, 1fr); }
  .pf-cat { grid-template-columns: 26px 90px 1fr 40px; gap: 8px; }
  .pf-head img { width: 64px; height: 64px; }
  .dl-dots { gap: 5px; } .dl-dots i { width: 18px; height: 18px; }
  .rank li { grid-template-columns: 26px 34px 1fr auto auto; }
  .rank .tm { display: none; }
  .toasts { top: 120px; }
  .banner .rib { padding: 12px 18px; gap: 10px; }
  .banner img { width: 54px; height: 54px; }
  .res-art { height: 34svh; }
  .res-stats { grid-template-columns: 1fr 1fr; }
  .seats { gap: 8px; }
  .seat .av { width: 60px; height: 60px; }
  .seat b { font-size: .95rem; }
  .lobby-opts { grid-template-columns: 1fr; }
  .pod { width: 104px; }
  .pod .av { width: 58px; height: 58px; } .pod.r1 .av { width: 72px; height: 72px; }
}
/* shorter phones: a smaller title block, so the picture keeps a share of the screen */
@media (max-width: 760px) and (max-height: 720px) {
  .home-panel { margin-top: -38px; }
  .home-panel .emblem { width: 68px; height: 68px; }
  .home .logo { font-size: clamp(2.2rem, 10.5vw, 2.8rem); }
  .tag { font-size: .92rem; margin-bottom: 10px; }
  .home .menu { gap: 8px; }
  .home .btn.big { font-size: 1.2rem; padding-block: .45em; }
  .home .menu .btn { padding-block: .5em; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .g-top { padding: 4px 8px; }
  .pc .av { width: 34px; height: 34px; }
  .prompt { margin-bottom: 4px; font-size: .95rem; }
  .quiz { padding: 0; }
  .q-card { border-radius: 0; min-height: 100%; }
  .q-opts { gap: 8px; }
  .opt { min-height: 46px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- a raid (js/raid.js, core/raid.js): another world over the match — dark, violet; its map laid out like the board ---------- */
.raid {
  --r-bg: #1B1724; --r-bar: #2B2338; --r-ink: #F3ECF8; --r-dim: #BDB0CC; --r-lav: #E7DEF1; --r-lav-2: #F5F0FA; --r-violet: #5E4380;
  position: fixed; inset: 0; z-index: 30; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr);
  background: radial-gradient(ellipse at 50% 40%, #2A2236, var(--r-bg) 70%); color: var(--r-ink); opacity: 0; transition: opacity .4s;
}
.raid.show { opacity: 1; }
.raid-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: calc(env(safe-area-inset-top, 0px) + 8px) 14px 8px; background: var(--r-bar); border-bottom: 3px solid #120F18; }
.raid-name { font-family: var(--title); font-size: 1.45rem; line-height: 1.2; color: #F2D58A; }
.raid-at { font-weight: 700; color: var(--r-dim); font-size: .95rem; }
.raid-lives { margin-inline-start: auto; display: inline-flex; gap: 3px; }
.raid-lives svg { width: 21px; height: 21px; }
.raid-lives svg.on { fill: #E0524B; }
.raid-lives svg.off { fill: none; stroke: #7C6F8C; stroke-width: 2; }
.raid-top .raid-menu { flex: none; background: var(--r-lav); }
/* the map: the board's frame and size rule (js/raid.js fit), panned sideways when it is wider than the screen */
.raid-wrap { position: relative; min-height: 0; overflow: auto; overscroll-behavior: contain; display: grid; place-content: safe center; padding: 8px 12px; scrollbar-width: thin; scrollbar-color: #6B5C80 transparent; }
.raid-board { position: relative; aspect-ratio: 2752 / 1536; width: 900px; border: 3px solid #0F0C14; border-radius: 20px; overflow: hidden; box-shadow: 0 6px 0 #0F0C14, 0 24px 50px rgba(0, 0, 0, .5); background: #2A2C38; user-select: none; }
.raid-map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; max-width: none; pointer-events: none; }
.raid-board canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.raid.show .raid-board { animation: raidin 1.2s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes raidin { from { transform: scale(1.06); filter: brightness(.4); } }
/* the line at the bottom: the game's prompt, in the raid's colours */
.raid-prompt { justify-self: center; margin: 0 12px calc(env(safe-area-inset-bottom, 0px) + 12px); min-height: 44px; max-width: min(820px, calc(100% - 24px));
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; text-align: center; font-weight: 700; font-size: 1.05rem; padding: 6px 20px;
  background: var(--r-lav); color: var(--ink); border: 2px solid #120F18; border-radius: 14px; box-shadow: 0 3px 0 #120F18; }
.raid-prompt:empty { visibility: hidden; }
.r-team { display: inline-flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.r-chip { display: inline-flex; align-items: center; gap: 5px; font-size: .82rem; font-weight: 700; border: 1.5px solid var(--pc); border-radius: 99px; padding: 0 8px; background: var(--r-lav-2); }
.r-chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--pc); }
.r-pips { display: inline-flex; gap: 4px; }
.r-pips i { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--ink); background: var(--r-lav-2); }
.r-pips i.on { background: var(--ok); }
/* the way in and the way back: dark, the dragon, the title */
/* over the whole grid (an absolute child with no grid area of its own got one cell's size in Chrome) */
.raid-curtain { position: absolute; inset: 0; grid-row: 1 / -1; grid-column: 1 / -1; z-index: 2; display: grid; place-content: center; justify-items: center; gap: 4px; text-align: center; padding: 24px;
  background: radial-gradient(ellipse at 50% 45%, #2C2140 0%, #0D0A12 75%); opacity: 0; transition: opacity .8s; pointer-events: none; }
.raid-curtain.in { opacity: 1; pointer-events: auto; }
.raid-curtain.out { opacity: 0; }
.rc-pic { width: min(220px, 42vw); filter: drop-shadow(0 0 30px rgba(233, 140, 60, .45)); }
.raid-curtain.in .rc-pic { animation: rcpic 4.4s ease-out both; }
@keyframes rcpic { from { transform: scale(.7) translateY(20px); opacity: 0; } 25% { opacity: 1; } to { transform: scale(1.04); } }
.rc-kicker { font-weight: 800; letter-spacing: .3em; color: #E0524B; font-size: 1.05rem; }
.rc-title { margin: 0; font-family: var(--title); font-size: clamp(2.6rem, 9vw, 4.6rem); line-height: 1.15; color: #F2D58A; text-shadow: 0 4px 24px rgba(233, 140, 60, .4); }
.raid-curtain.in .rc-kicker, .raid-curtain.in .rc-title, .raid-curtain.in .rc-sub { animation: rctext .9s .5s ease-out both; }
@keyframes rctext { from { opacity: 0; transform: translateY(10px); letter-spacing: .5em; } }
.rc-sub { margin: 0; color: var(--r-dim); font-weight: 700; font-size: 1.1rem; }
.raid-curtain.r-back .rc-pic { display: none; }
.raid-curtain.r-back .rc-title { font-size: clamp(2rem, 7vw, 3.4rem); color: var(--r-ink); }
/* SAIF-2026-10-21 — a guardian's scene: dark over the map, the guardian beside a framed box written letter by letter */
.raid-talk { position: absolute; inset: 0; grid-row: 1 / -1; grid-column: 1 / -1; z-index: 3; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at 50% 55%, rgba(30, 21, 46, .9) 0%, rgba(8, 6, 12, .96) 80%); opacity: 0; transition: opacity .45s; cursor: pointer; }
.raid-talk.in { opacity: 1; }
.rt-stage { display: flex; flex-direction: row-reverse; align-items: flex-end; gap: clamp(8px, 2vw, 28px); width: min(1040px, 100%); }
.rt-pic { width: clamp(150px, 30vw, 360px); max-height: 62vh; object-fit: contain; filter: drop-shadow(0 0 28px rgba(150, 110, 220, .35)); transform: translateX(-40px); opacity: 0; transition: transform .7s cubic-bezier(.2, .8, .2, 1), opacity .7s; }
.raid-talk.in .rt-pic { transform: none; opacity: 1; animation: rtbreathe 4s 0.8s ease-in-out infinite; }
@keyframes rtbreathe { 50% { transform: translateY(-6px) scale(1.01); } }
.rt-box { flex: 1; min-height: 300px; display: grid; align-content: start; gap: 8px; padding: 18px 22px 14px; color: #EDE6F5; background: #120D19;
  border: 3px solid #E9C877; border-radius: 6px; outline: 3px solid #120D19; box-shadow: 0 0 0 6px #6B5390, 0 0 0 9px #120D19, 0 18px 50px rgba(0, 0, 0, .6); }
.rt-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; border-bottom: 2px dotted #6B5390; padding-bottom: 6px; }
.rt-name { font-family: var(--title); font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.2; color: #F2D58A; }
.rt-title { color: #B9A6D6; font-weight: 700; }
.rt-who { font-weight: 800; font-size: .85rem; letter-spacing: .08em; color: #B9A6D6; }
.raid-talk[data-who="guard"] .rt-who { color: #E98C3C; }
.rt-text { margin: 0; font-size: clamp(1.1rem, 2.4vw, 1.4rem); line-height: 1.75; font-weight: 600; min-height: 5.25em; }
/* the box keeps its size from line to line (the text grows inside it, the frame does not jump) */
.raid-talk.name .rt-text { font-family: var(--title); font-size: clamp(2rem, 6vw, 3.2rem); color: #F2D58A; text-align: center; line-height: 1.4; }
.raid-talk.rule .rt-text { color: #F2D58A; font-weight: 800; border: 2px solid #6B5390; border-radius: 10px; padding: 8px 12px; background: #1E1528; }
.rt-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: #8C7AA8; font-size: .85rem; font-weight: 700; }
.rt-tap { animation: rttap 1.6s ease-in-out infinite; }
@keyframes rttap { 50% { opacity: .35; } }
.rt-skip { font: inherit; font-weight: 800; color: #EDE6F5; background: #2C2140; border: 2px solid #6B5390; border-radius: 99px; padding: 2px 14px; cursor: pointer; }
@media (max-width: 760px) {
  .rt-stage { flex-direction: column-reverse; align-items: center; justify-content: flex-end; height: 100%; }
  .rt-pic { width: auto; height: 30vh; max-height: 30vh; transform: translateY(-20px); }
  .rt-box { flex: none; width: 100%; min-height: 260px; padding: 14px 16px 12px; }
}
@media (prefers-reduced-motion: reduce) { .rt-pic, .raid-talk.in .rt-pic { transition: none; animation: none; transform: none; } .rt-tap { animation: none; } }
/* what a guardian says as the team goes by, the narrator's word when a life is lost: a line at the foot of the map */
.raid-say { position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 64px); transform: translateX(-50%); z-index: 2; width: max-content; max-width: min(720px, 92%);
  display: grid; gap: 2px; padding: 8px 16px; border-radius: 14px; background: rgba(18, 13, 25, .92); border: 2px solid #E9C877; color: #EDE6F5; font-weight: 600; text-align: center; transition: opacity .5s; }
.raid-say b { color: #F2D58A; font-size: .85rem; }
.raid-say.out { opacity: 0; }
/* the team's choice (a toll, the dragon's deal): a framed box over the map, two buttons, its time running out under them */
.raid-choice { position: absolute; inset: 0; grid-row: 1 / -1; grid-column: 1 / -1; z-index: 3; display: grid; place-items: center; padding: 16px;
  background: rgba(8, 6, 12, .72); opacity: 0; transition: opacity .3s; }
.raid-choice.in { opacity: 1; }
.rch-box { width: min(560px, 100%); display: grid; gap: 10px; padding: 18px 20px 14px; color: #EDE6F5; background: #120D19; text-align: center;
  border: 3px solid #E9C877; border-radius: 6px; outline: 3px solid #120D19; box-shadow: 0 0 0 6px #6B5390, 0 0 0 9px #120D19, 0 18px 50px rgba(0, 0, 0, .6); }
.rch-title { font-family: var(--title); font-size: clamp(1.4rem, 4vw, 1.9rem); color: #F2D58A; }
.rch-text { margin: 0; font-size: 1.15rem; line-height: 1.7; font-weight: 600; }
.rch-note { margin: 0; min-height: 1.3em; color: #B9A6D6; font-weight: 700; font-size: .9rem; }
.rch-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rch-btns .btn { min-height: 52px; font-weight: 800; font-size: 1.05rem; border-radius: 12px; border: 2px solid #6B5390; color: #EDE6F5; background: #2C2140; cursor: pointer; }
.rch-btns .rch-yes { border-color: #E9C877; }
.rch-btns .btn:disabled { opacity: .45; cursor: default; }
.rch-btns .btn.mine { opacity: 1; background: #E9C877; color: #120D19; }
.rch-bar { height: 6px; border-radius: 99px; background: #2C2140; overflow: hidden; }
.rch-bar i { display: block; height: 100%; width: 100%; background: #E9C877; }
/* a life given back */
.raid-lives.gain { animation: rgain 1.4s ease-out; }
@keyframes rgain { 0%, 60% { filter: drop-shadow(0 0 8px #7CE07C) brightness(1.4); transform: scale(1.12); } 100% { filter: none; transform: none; } }
.hint.gift { color: #5E4380; background: #F2ECFA; border-color: #8A6CB0; }
@media (prefers-reduced-motion: reduce) { .raid-lives.gain { animation: none; } }
/* the brass raid (SAIF-2026-10-21): the palm's three fields, يَمْليخا's answers to remember, the storm over the map, the roc's feather,
   the city's clock in the bar */
.rch-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.rch-opts:empty, .rch-btns .btn[hidden] { display: none; }
.rch-btns:has(.btn[hidden]) { display: none; }
.rch-opt { min-height: 52px; font-weight: 800; font-size: 1.05rem; border-radius: 12px; border: 2px solid #E9C877; color: #EDE6F5; background: #2C2140; cursor: pointer; }
.rch-opt:disabled { opacity: .45; cursor: default; }
.rch-opt.mine { opacity: 1; background: #E9C877; color: #120D19; }
@media (max-width: 520px) { .rch-opts { grid-template-columns: 1fr; } }
.raid-memo { position: absolute; inset: 0; grid-row: 1 / -1; grid-column: 1 / -1; z-index: 3; display: grid; place-items: center; padding: 16px;
  background: rgba(8, 6, 12, .72); opacity: 0; transition: opacity .3s; }
.raid-memo.in { opacity: 1; }
.rm-box { width: min(620px, 100%); display: grid; gap: 12px; padding: 18px 20px 14px; color: #EDE6F5; background: #120D19; border: 2px solid #8FC9A8; border-radius: 16px; box-shadow: 0 18px 50px rgba(0, 0, 0, .55); }
.rm-title { font-family: var(--title); font-size: clamp(1.3rem, 4vw, 1.7rem); color: #BFE9CF; text-align: center; }
.rm-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; counter-reset: rm; }
.rm-list li { display: grid; gap: 3px; padding: 9px 12px; border-radius: 12px; background: #1E1729; border: 1px solid #3A2E4E; }
.rm-list span { font-weight: 600; line-height: 1.6; }
.rm-list b { color: #F2D58A; font-size: 1.1rem; }
.raid-memo .rch-bar i { background: #8FC9A8; }
.raid.stormy .raid-board::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(100deg, rgba(222, 186, 120, .0) 0 40px, rgba(222, 186, 120, .22) 40px 46px, rgba(222, 186, 120, 0) 46px 90px); background-size: 400px 100%; animation: rsand .6s linear infinite; }
@keyframes rsand { to { background-position: -400px 0; } }
.raid-feather svg { width: 24px; height: 24px; fill: #F4EEDF; stroke: #8C7A5A; stroke-width: 1.4; }
.raid-feather { display: inline-flex; filter: drop-shadow(0 0 6px rgba(244, 238, 223, .6)); }
.raid-feather[hidden] { display: none; }
.raid-feather.used { animation: rfeather 1.3s ease-out forwards; }
@keyframes rfeather { to { transform: translateY(-26px) rotate(-30deg); opacity: 0; } }
.raid-clock { display: inline-flex; }
.raid-clock[hidden] { display: none; }
.raid-clock svg { width: 34px; height: 34px; }
.raid-clock circle:first-child { fill: #3B2F1C; stroke: #D7A94B; stroke-width: 2.5; }
.raid-clock .rk-ticks line { stroke: #D7A94B; stroke-width: 1.6; }
.raid-clock .rk-h, .raid-clock .rk-m { stroke: #F4E3B5; stroke-linecap: round; transition: transform .8s cubic-bezier(.4, 1.6, .5, 1); }
.raid-clock .rk-h { stroke-width: 3; } .raid-clock .rk-m { stroke-width: 2; }
.raid-clock circle:last-child { fill: #F4E3B5; }
.raid-clock.midnight { animation: rgain 1.6s ease-out 2; }
.q-opts.mixed .opt .k { visibility: hidden; }
/* the sea raid (SAIF-2026-10-21): the swordfish's strike on the card's ring, the jellyfish's fading words, the ape's and the compass's
   marks on an answer, the compass in the bar (its needle wavers less with each right answer), the captain's compass kept */
.q-timer.strike .fg { stroke: #D9A93B; }
.q-timer.struck .fg { stroke: #C9403A; }
.q-timer.struck::after { content: 'ضربة!'; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 2px; white-space: nowrap; font-weight: 800; font-size: .8rem; color: #C9403A; animation: rstruck .5s ease-out; }
@keyframes rstruck { from { transform: translateX(-50%) scale(1.6); opacity: 0; } }
.q-text.faded { opacity: .04; transition: opacity .8s; }
.opt .badge { position: absolute; inset-block-start: -10px; inset-inline-end: 10px; padding: 1px 9px; border-radius: 99px; font-size: .75rem; font-weight: 800; pointer-events: none; }
.opt .badge.ape { background: #8A5A2B; color: #FFF3DE; }
.opt .badge.point { background: #2E7D6B; color: #E9FFF6; box-shadow: 0 0 10px rgba(46, 125, 107, .6); }
.raid-dial { display: inline-flex; }
.raid-dial[hidden], .raid-compass[hidden] { display: none; }
.raid-dial svg { width: 34px; height: 34px; }
.raid-dial circle:first-child { fill: #13303A; stroke: #8FC9C2; stroke-width: 2.5; }
.raid-dial text { fill: #BFE9E2; font-size: 7px; font-weight: 800; text-anchor: middle; }
.raid-dial .n { fill: #E0524B; } .raid-dial .s { fill: #E6EEF0; }
.raid-dial circle:last-child { fill: #E6EEF0; }
.raid-dial .rd-needle { transform-origin: 20px 20px; transform: rotate(-35deg); animation: rwob 1.7s ease-in-out infinite alternate; }
@keyframes rwob { from { transform: rotate(calc(-35deg - var(--wob, 60deg))); } to { transform: rotate(calc(-35deg + var(--wob, 60deg))); } }
.raid-dial.home .rd-needle { animation: none; transform: rotate(-35deg); }
.raid-dial.home { animation: rgain 1.6s ease-out 2; }
.raid-compass { display: inline-flex; filter: drop-shadow(0 0 6px rgba(143, 201, 194, .7)); }
.raid-compass svg { width: 24px; height: 24px; } .raid-compass circle { fill: #13303A; stroke: #8FC9C2; stroke-width: 1.6; } .raid-compass path { fill: #E0524B; }
.raid-compass.used { animation: rfeather 1.3s ease-out forwards; }
@media (prefers-reduced-motion: reduce) { .raid-dial .rd-needle { animation: none; } .q-timer.struck::after { animation: none; } }
@media (prefers-reduced-motion: reduce) { .raid.stormy .raid-board::after { animation: none; } .raid-feather.used, .raid-clock.midnight { animation: none; } .raid-clock .rk-h, .raid-clock .rk-m { transition: none; } }
/* the Waq-Waq raid (SAIF-2026-10-21): the fog over the words, the mermaids' song (one answer at a time), the nasnas's half answers,
   «two lies and a truth» (long answers, one under another), the purse in the bar, نَبّاح's rope under the map */
/* the fog (quiz.js runs its clearing) */
.q-opts .opt.sung { transition: opacity .25s, transform .25s; }
.q-opts .opt.sung:not(.on) { opacity: .1; pointer-events: none; }
.q-opts .opt.sung.on { transform: scale(1.03); box-shadow: 0 0 0 3px #4FC7C0, 0 0 18px rgba(79, 199, 192, .65); }
.q-opts.half .opt .t { clip-path: inset(0 0 50% 0); }
.q-opts.lies { grid-template-columns: 1fr; }
.q-opts.lies .opt .t { font-size: .95rem; line-height: 1.45; text-align: start; }
.raid-purse { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; color: #F7D774; position: relative; }
.raid-purse[hidden] { display: none; }
.raid-purse svg { width: 28px; height: 28px; filter: drop-shadow(0 0 5px rgba(247, 215, 116, .45)); }
.raid-purse .bag { fill: #C98A3F; stroke: #3B2414; stroke-width: 1.4; } .raid-purse .tie { fill: none; stroke: #F7D774; stroke-width: 1.8; } .raid-purse .coin { fill: #F2C14E; stroke: #8A5A2B; stroke-width: 1.2; }
.raid-purse b { min-width: 1.2em; text-align: center; font-size: 1.05rem; }
.raid-purse .pd { position: absolute; inset-block-start: 100%; inset-inline-start: 50%; transform: translateX(-50%); font-size: .85rem; white-space: nowrap; pointer-events: none; animation: rpd 1.4s ease-out forwards; }
.raid-purse .pd.up { color: #9BE58F; } .raid-purse .pd.down { color: #FF8F7A; }
@keyframes rpd { from { opacity: 1; transform: translate(-50%, -6px); } to { opacity: 0; transform: translate(-50%, 14px); } }
.r-side { font-size: .8rem; font-weight: 700; opacity: .8; }
.r-rope { display: inline-block; position: relative; width: 150px; height: 12px; border-radius: 99px; border: 2px solid var(--ink); background: linear-gradient(90deg, #DCCDEB 50%, #F2D7B5 50%); }
.r-rope i { position: absolute; top: 50%; inset-inline-start: calc(var(--p, .5) * 100%); width: 16px; height: 16px; margin-inline-start: -8px; margin-top: -8px; border-radius: 50%; background: #C9403A; border: 2px solid var(--ink); transition: inset-inline-start .5s cubic-bezier(.4, 1.6, .5, 1); }
@media (prefers-reduced-motion: reduce) { .raid-purse .pd { animation: none; opacity: 0; } }
/* «صدقٌ أم سراب؟»: the answer the trickster claims, then two wide buttons */
.q-claim { margin: 0 0 10px; text-align: center; font-size: 1.25rem; font-weight: 800; color: #5E4380; background: #F7F2FB; border: 2px dashed #8A6CB0; border-radius: 12px; padding: 8px 10px; }
.q-opts.tf { grid-template-columns: 1fr 1fr; }
/* SAIF-2026-10-23 «خطّ الزمن»: the three events that bound the four periods, on a line under the options (core/cards.js) */
.q-line { display: flex; justify-content: space-between; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 2px dashed rgba(60, 40, 20, .25); position: relative; }
.q-ev { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; font-size: .82rem; line-height: 1.3; color: #5a4632; }
.q-ev b { font-size: .95rem; color: var(--ink); }
.q-ev::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: #C08A3E; border: 2px solid var(--ink); margin-bottom: 4px; }
/* a raid's question: the card in faded violet, the raid's map behind it */
.quiz.raidq { background: rgba(20, 14, 30, .62); }
.quiz.raidq .q-card { background-color: #EAE1F2; border-color: #1E1528; box-shadow: 0 6px 0 #1E1528, 0 18px 40px rgba(0, 0, 0, .45); }
.quiz.raidq .q-title { color: #5E4380; }
.quiz.raidq .q-note { background: #DCCDEB; border-color: #8A6CB0; }
.quiz.raidq .q-cat, .quiz.raidq .opt .k { background: #DCCDEB; }
.quiz.raidq .opt { background: #F7F2FB; }
/* the sea dragon on the map: tapping it proposes a raid; it glows while one can be */
/* hidden unless this screen shows the raids (body.raids-on: js/main.js) */
body:not(.raids-on) .board .lair { display: none; }
.board .lair { position: absolute; left: 41.8%; top: 34.5%; width: 6.5%; height: 5.6%; border: 0; padding: 0; background: none; border-radius: 40%; z-index: 2; pointer-events: none; }
.board .lair-tag { position: absolute; left: 50%; top: -1.7cqw; transform: translateX(-50%); font-size: 1.1cqw; font-weight: 800; padding: 0 .7cqw; border-radius: 99px; background: var(--paper); border: 2px solid var(--ink); color: var(--ink); opacity: 0; transition: opacity .3s; pointer-events: none; white-space: nowrap; }
.board .lair.can { animation: lairglow 2.4s ease-in-out infinite; }
.board .lair.try { pointer-events: auto; cursor: pointer; }   /* the test server's lit raids (js/flags.js RAIDS_ALL) */
.board .lair.can .lair-tag { opacity: 1; }
@keyframes lairglow { 50% { box-shadow: 0 0 0 .5cqw rgba(233, 185, 73, .55), 0 0 2cqw rgba(233, 185, 73, .6); } }
.board .lair:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
/* the raid's dialogs */
.raid-ask-pic { width: 96px; height: 96px; object-fit: contain; justify-self: center; }
.raid-cats { width: min(560px, 100%); display: grid; gap: 10px; }
.raid-cats h2 { margin: 0; text-align: center; }
.raidcats-sub { margin: 0; text-align: center; color: var(--ink-2); }
.raidcats-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; max-height: min(52vh, 420px); overflow: auto; padding: 2px; }
.rc { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 2px solid var(--sand); border-radius: 12px; background: var(--paper); font: inherit; font-weight: 700; color: var(--ink); cursor: pointer; text-align: start; }
.rc img { width: 28px; height: 28px; object-fit: contain; flex: none; }
.rc[aria-pressed="true"] { border-color: var(--ink); background: var(--saffron); }
.rc:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.raidcats-list.full .rc[aria-pressed="false"] { opacity: .5; }
.raid-cats .menu-row { align-items: center; justify-content: space-between; }
.raid-cats .offer-clk { margin: 0; }
@media (prefers-reduced-motion: reduce) { .board .lair.can { animation: none; box-shadow: 0 0 0 .4cqw rgba(233, 185, 73, .7); } .raid, .raid-curtain { transition: none; } .raid.show .raid-board, .raid-curtain.in .rc-pic, .raid-curtain.in .rc-kicker, .raid-curtain.in .rc-title, .raid-curtain.in .rc-sub { animation: none; } }
/* the vote while a question card of mine is open: a slim bar at the top, the card's answers free */
#m-raid.compact { place-items: start center; background: none; pointer-events: none; padding-top: calc(env(safe-area-inset-top, 0px) + 8px); }
#m-raid.compact .panel { pointer-events: auto; width: min(560px, 100%); gap: 6px; padding: 10px 14px; }
#m-raid.compact .raid-ask-pic, #m-raid.compact #raid-p { display: none; }
#m-raid.compact h2 { font-size: 1.15rem; margin: 0; }
/* the flying carpet over the Sahara (img/map.webp): the City of Brass's raid */
.board .lair.carpet { left: 13.3%; top: 43.9%; width: 10%; height: 7.8%; }
/* the ship in the Arabian Sea (img/map.webp): the voyages of Sindbad */
.board .lair.ship { left: 81.2%; top: 63.8%; width: 4.7%; height: 7.8%; }
/* the merchants' boat south of Arabia: the islands of Waq-Waq */
.board .lair.ship2 { left: 73.6%; top: 78%; width: 5%; height: 8.4%; }

/* the whale in the Arabian Sea, by the compass rose: the kingdom of the deep */
.board .lair.whale { left: 79.7%; top: 84.3%; width: 6.3%; height: 6.9%; }
/* the deep-sea raid's breath: bubbles in the bar, going out while a card runs */
.raid-breath { display: inline-flex; align-items: center; gap: 2px; padding: 2px 6px; border-radius: 99px; background: rgba(10, 40, 60, .55); }
.raid-breath[hidden] { display: none; }
.raid-breath i { width: 11px; height: 11px; border-radius: 50%; border: 1.6px solid rgba(200, 240, 255, .35); transition: background .3s, border-color .3s, transform .3s; }
.raid-breath i.on { background: radial-gradient(circle at 35% 35%, #fff 0 18%, #9BE3F5 30%, #3FA9C9 100%); border-color: #DFF7FF; }
.raid-breath i.half { background: radial-gradient(circle at 35% 35%, #fff 0 14%, rgba(155, 227, 245, .5) 30%, rgba(63, 169, 201, .35) 100%); border-color: #9BE3F5; transform: scale(.82); }
.raid-breath.low i.on, .raid-breath.low i.half { border-color: #FF9B8A; box-shadow: 0 0 6px rgba(255, 120, 100, .7); }
.raid-breath.refill { animation: rbreath .9s ease-out; }
@keyframes rbreath { 0% { box-shadow: 0 0 0 0 rgba(155, 227, 245, .9); } 100% { box-shadow: 0 0 0 14px rgba(155, 227, 245, 0); } }
@media (max-width: 560px) { .raid-breath i { width: 8px; height: 8px; } .raid-breath { gap: 1px; padding: 2px 4px; } }
/* the lantern's dark: only a circle of light under the finger */
.q-card.dark, .quiz.raidq .q-card.dark { background: #0B1424 none; }
.q-card.dark .q-text, .q-card.dark .q-body { -webkit-mask-image: radial-gradient(circle 95px at var(--lx, 50%) var(--ly, 50%), #000 60%, rgba(0, 0, 0, 0) 100%); mask-image: radial-gradient(circle 95px at var(--lx, 50%) var(--ly, 50%), #000 60%, rgba(0, 0, 0, 0) 100%); }
.q-card.dark .q-text { color: #F3EBD8; }
.q-card.dark .q-text, .q-card.dark .q-body { touch-action: none; }
/* the squid's ink: blots to tap away */
.q-ink { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.q-ink .blot { position: absolute; pointer-events: auto; border: 0; padding: 0; cursor: pointer; background: radial-gradient(ellipse at 40% 40%, #2A1838 0 55%, #1A0F24 75%, rgba(26, 15, 36, .92) 100%); box-shadow: 0 0 0 6px rgba(26, 15, 36, .55), 4px 6px 0 rgba(26, 15, 36, .7); transition: opacity .35s, transform .35s; }
.q-ink .blot.wiped { opacity: 0; transform: scale(.6) rotate(-8deg); }
/* the pearl mother's: the answer shown, four questions in one column */
.q-text small { font-size: .7em; color: #5E4380; font-weight: 700; }
.q-opts.seek { grid-template-columns: 1fr; }
.q-opts.seek .opt .t { font-size: .95rem; line-height: 1.45; }
/* the ray's pulse: an answer dark for a moment; one touched while dark shocks the card */
.q-opts.pulse .opt { transition: opacity .18s, filter .18s; }
.q-opts .opt.dim { opacity: .12; filter: saturate(0); }
.q-card.zapped { animation: qzap .35s linear 2; }
.q-card.zapped .opt { pointer-events: none; outline: 2px solid #7FE7FF; outline-offset: -2px; }
@keyframes qzap { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
/* the mirror */
.q-text.mirror { transform: scaleX(-1); }
/* the current: the answers swim from side to side */
.q-opts.drift { grid-template-columns: 1fr; overflow: hidden; }
.q-opts.drift .opt { width: 72%; }
/* the grouper's pressure: the card closes in, the water darkens */

/* the dolphin's race: her track over the card, the rock at its end */
.q-race { position: relative; height: 34px; margin: 6px 4px 2px; border-radius: 99px; background: linear-gradient(90deg, #1D4E6B, #5FB7CF); }
.q-race .rock { position: absolute; left: 4px; top: 5px; width: 26px; height: 24px; border-radius: 40% 50% 30% 30%; background: #6E6A63; border: 2px solid #3A3631; }
.q-race img { position: absolute; top: -4px; height: 40px; right: 0; }
/* the breath on the card itself (the deep-sea raid; on a phone the card covers the bar) */
.q-breath { display: flex; justify-content: center; gap: 4px; margin: 6px 0 0; }
.q-breath i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(30, 90, 120, .3); transition: background .3s, border-color .3s, transform .3s; }
.q-breath i.on { background: radial-gradient(circle at 35% 35%, #fff 0 18%, #8FDCF0 32%, #2D93B6 100%); border-color: #1E6F8C; }
.q-breath i.half { background: radial-gradient(circle at 35% 35%, #fff 0 14%, rgba(143, 220, 240, .55) 32%, rgba(45, 147, 182, .4) 100%); border-color: #2D93B6; transform: scale(.82); }
.q-breath.low i.on, .q-breath.low i.half { border-color: #D9473A; box-shadow: 0 0 6px rgba(217, 71, 58, .6); }
@media (prefers-reduced-motion: reduce) { .q-card.zapped { animation: none; } }

/* the compass rose in the Arabian Sea: the voyage to the stars */
.board .lair.rose { left: 86%; top: 75.5%; width: 7.4%; height: 13.5%; border-radius: 50%; }
/* the space raid's moon: its light (the cards' time) in the bar and on the card */
.raid-moon { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; color: #F4ECCB; }
.raid-moon[hidden] { display: none; }
.raid-moon svg, .q-moon svg { width: 26px; height: 26px; }
.raid-moon .lit, .q-moon .lit { fill: #F8F1D2; } .raid-moon .dark, .q-moon .dark { fill: #1A1E3D; }
.raid-moon .rim, .q-moon .rim { fill: none; stroke: #C9BE8F; stroke-width: 1.2; }
.raid-moon svg { filter: drop-shadow(0 0 6px rgba(248, 241, 210, .55)); }
.raid-moon b { font-size: .9rem; min-width: 2.6em; }
.raid-moon.low b, .q-moon.low b { color: #FF9B8A; }
.raid-moon.up svg, .q-moon.up svg { animation: rmoonup .9s ease-out; } .raid-moon.down svg, .q-moon.down svg { animation: rmoondown .6s ease-out; }
@keyframes rmoonup { 40% { filter: drop-shadow(0 0 14px rgba(255, 245, 200, 1)); transform: scale(1.2); } }
@keyframes rmoondown { 30% { transform: scale(.85); filter: brightness(.6); } }
.q-moon { display: flex; justify-content: center; align-items: center; gap: 6px; margin: 6px 0 0; font-weight: 800; color: #4A3E7A; }
.q-moon svg { filter: drop-shadow(0 0 4px rgba(120, 100, 40, .4)); }
/* the meteors: the answers fall, each in its lane, and burn out at the bottom */
.q-opts.rain { display: block; position: relative; height: 300px; overflow: hidden; border-radius: 14px; background: linear-gradient(#1C1B44, #2C2560); }
.q-opts.rain .opt { position: absolute; width: 46%; top: 0; }
/* Saturn: the answers on a turning ring, each upright */
.q-opts.orbit { display: block; position: relative; height: 330px; }
.q-opts.orbit::before { content: ''; position: absolute; left: 14%; right: 14%; top: 20%; bottom: 20%; border: 3px dashed rgba(201, 170, 90, .55); border-radius: 50%; }
.q-opts.orbit .opt { position: absolute; width: 34%; transform: translate(-50%, -50%); }
/* the Great Bear's ordering and the twins: taps marked, the twin's second question */
.q-hint { margin: 0 0 8px; text-align: center; font-weight: 700; color: #5E4380; }
.q-opts.order { grid-template-columns: 1fr 1fr; }
.q-opts .opt.picked { box-shadow: 0 0 0 3px #E9B949, 0 4px 0 var(--ink); }
.q-opts.order .opt .k:empty { visibility: hidden; }
.q-opts.twin { grid-template-columns: 1fr 1fr 1fr; }
.q-text.q-text2 { margin-top: 14px; font-size: 1.15rem; }
@media (max-width: 560px) { .q-opts.twin { grid-template-columns: 1fr; } .q-opts.rain { height: 340px; } .q-opts.rain .opt { width: 48%; } .q-opts.orbit { height: 380px; margin-bottom: 8px; } .q-opts.orbit .opt { width: 44%; } }

/* ---------- the account (core/account.js): a box in «ملفّي», and its dialog ---------- */
.pf-acc { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: -4px 0 16px; padding: 12px 14px; border: 2px dashed var(--sand); border-radius: 14px; background: var(--paper); }
.pf-acc.in { border-style: solid; border-color: var(--turq); }
.pf-acc .ac-txt { flex: 1 1 260px; min-width: 0; display: grid; gap: 2px; }
.pf-acc .ac-txt b { font-size: 1.05rem; overflow-wrap: anywhere; }
.pf-acc .ac-txt small { color: var(--ink-2); }
.pf-acc .ac-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-acc .btn { padding: .45em 1em; font-size: .95rem; }
.account { display: grid; gap: 4px; }
.ac-step { display: grid; gap: 12px; }
.ac-p { margin: 0; color: var(--ink-2); line-height: 1.7; }
.ac-p b { color: var(--ink); overflow-wrap: anywhere; }
.ac-check { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; font-size: .95rem; cursor: pointer; }
.ac-check input { width: 20px; height: 20px; margin-top: 3px; flex: none; accent-color: var(--turq); }
#ac-otp { font-size: 1.6rem; letter-spacing: .4em; text-align: center; }
.ac-err { margin: 0; min-height: 1.4em; color: var(--bad); font-weight: 700; }
.ac-err:empty { min-height: 0; }
.ac-fine { margin: 0; text-align: center; font-size: .85rem; color: var(--ink-3); }
.ac-row { display: flex; justify-content: space-between; gap: 10px; }
.ac-link { border: 0; background: none; padding: 4px 2px; font: inherit; font-weight: 700; color: var(--turq-2); text-decoration: underline; cursor: pointer; }
.ac-link:disabled { color: var(--ink-3); text-decoration: none; cursor: default; }

/* ---------- «ملفّي» in tabs; «كيف ألعب؟» one step at a time ---------- */
.pf-tabs { display: flex; border: var(--edge); border-radius: 14px; overflow: hidden; background: #fff; margin: 0 0 14px; }
.pf-tabs button { flex: 1; border: 0; background: none; padding: .55em .3em; font: inherit; font-weight: 800; color: var(--ink-2); cursor: pointer; }
.pf-tabs button + button { border-inline-start: 2px solid var(--ink); }
.pf-tabs button[aria-selected="true"] { background: var(--turq); color: #fff; }
.pf-tabs button small { font-weight: 700; opacity: .85; }
.pf-tabs button:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
.pf-sub { margin: 0 0 10px; color: var(--ink-2); font-weight: 700; text-align: center; }
#pf-ach-d { margin: 12px 0 0; min-height: 1.5em; }
.ach { font: inherit; color: inherit; cursor: pointer; }
.ach.sel { outline: 3px solid var(--turq); outline-offset: 1px; }
.how-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.how-nav .btn { min-width: 110px; }
.how-nav .btn:disabled { opacity: .4; }
.how-dots { display: flex; gap: 6px; }
.how-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--sand); border: 1.5px solid var(--ink-3); }
.how-dots i.on { background: var(--turq); border-color: var(--turq-2); transform: scale(1.25); }
.how .steps li { min-height: 230px; }
@media (max-width: 760px) {
  .pf-head { margin-bottom: 12px; gap: 12px; }
  .pf-head b { font-size: 1.25rem; }
  .pf-head i.xp { height: 9px; }
  .pf-acc { margin: 0 0 12px; padding: 10px 12px; }
  .pf-acc .ac-txt small { font-size: .82rem; }
  .profile .res-stats { gap: 8px; margin-bottom: 4px; }
  .profile .res-stats div { padding: 6px 10px; border-radius: 12px; }
  .profile .res-stats b { font-size: 1.2rem; line-height: 1.2; }
  .profile .res-stats span { font-size: .78rem; }
  .pf-cats { gap: 3px; }
  .pf-cat { grid-template-columns: 24px 92px 1fr 38px; gap: 8px; }
  .pf-cat img { width: 24px; height: 24px; }
  .pf-cat span { font-size: .92rem; }
  .pf-ach { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
  .ach { padding: 8px 4px; }
  .ach i { width: 38px; height: 38px; font-size: 1.3rem; }
  .ach b { font-size: .8rem; line-height: 1.25; }
  .ach span { display: none; }
  /* a step: its picture above, the text under it */
  .how .steps li { flex-direction: column; text-align: center; padding: 14px; min-height: 340px; justify-content: flex-start; }
  .how .steps img, .how .steps .duo { width: 92px; height: 92px; }
  .how .steps .duo img { width: 58px; height: 58px; }
  .how .steps p { font-size: 1rem; }
}
/* «ملفّي» on a wide screen: the player and the account side by side, the categories in two columns, more achievements a row */
@media (min-width: 761px) {
  .profile .sheet { width: min(900px, 100%); display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; align-items: start; }
  .profile .sheet > * { grid-column: 1 / -1; }
  .profile .sheet > .pf-head { grid-column: 1; margin: 0 0 14px; }
  .profile .sheet > .pf-acc { grid-column: 2; margin: 0 0 14px; align-self: center; }
  .pf-cats { grid-template-columns: 1fr 1fr; column-gap: 26px; }
  .pf-ach { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
  .ach { padding: 8px 6px; }
  .ach i { width: 40px; height: 40px; font-size: 1.4rem; }
  .ach span { font-size: .74rem; line-height: 1.35; }
}
@media (max-width: 760px) {
  .pf-head img { width: 56px; height: 56px; }
  .pf-head small { font-size: .8rem; }
  .pf-acc .ac-txt small { display: none; }
  .pf-acc .ac-txt b { font-size: .98rem; }
  .pf-tabs button { padding: .5em .2em; font-size: .95rem; }
  .pf-tabs button small { font-size: .78rem; }
  .pf-ach { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .ach { padding: 6px 2px; border-radius: 12px; }
  .ach i { width: 34px; height: 34px; font-size: 1.15rem; }
  .ach b { font-size: .72rem; }
  .pf-cat { min-height: 26px; }
}
@media (max-width: 760px) {
  /* the categories two a row: icon, name, share — the bar under them */
  .pf-cats { grid-template-columns: 1fr 1fr; column-gap: 12px; row-gap: 6px; }
  .pf-cat { grid-template-columns: 22px minmax(0, 1fr) 36px; grid-template-rows: auto 5px; column-gap: 6px; row-gap: 3px; min-height: 0; }
  .pf-cat img { width: 22px; height: 22px; grid-row: 1; }
  .pf-cat span { font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pf-cat b { font-size: .86rem; }
  .pf-cat i.bar { grid-column: 1 / -1; grid-row: 2; height: 5px; }
}
@media (max-width: 760px) and (max-height: 760px) {
  .profile { padding-block: 12px; }
  .profile .sheet-h { margin-bottom: 8px; }
  .profile .sheet-h h2 { font-size: 1.55rem; }
  .profile .sheet-h .back { width: 38px; height: 38px; }
  .pf-head { margin-bottom: 8px; }
  .pf-acc { margin-bottom: 8px; padding-block: 8px; }
  .pf-tabs { margin-bottom: 10px; }
  #pf-ach-d { margin-top: 8px; }
}
.how-nav .btn { flex: 1 1 0; min-width: 0; white-space: nowrap; padding-inline: .6em; }
.how-dots { flex: none; }

/* ---------- the achievements: four tabs, twenty medals each (core/achievements.js) ---------- */
.ach-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin: 0 0 12px; }
.ach-tabs button { display: grid; gap: 0; border: 2px solid var(--ink); border-radius: 12px; background: #fff; padding: .2em .2em; font: inherit; font-weight: 800; font-size: .88rem; line-height: 1.3; color: var(--ink-2); cursor: pointer; white-space: nowrap; min-width: 0; }
.ach-tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.ach-tabs small { font-weight: 700; opacity: .8; }
.pf-ach.fams { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px 6px; }
.fam { display: grid; justify-items: center; gap: 3px; padding: 4px 2px; border: 0; background: none; font: inherit; color: var(--ink); cursor: pointer; border-radius: 12px; min-width: 0; }
.fam.sel { background: rgba(22, 140, 147, .12); }
.fam-ring { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--turq) var(--p), rgba(59, 39, 24, .12) 0); }
.fam-g { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 1.35rem; line-height: 1;
  background: var(--tc); color: #fff; border: 2px solid var(--ink); text-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.fam:not(.on) .fam-g { background: var(--paper-2); color: var(--ink-3); text-shadow: none; }
.fam.max .fam-ring { background: conic-gradient(var(--tc) 100%, transparent 0); box-shadow: 0 0 12px var(--tc); }
.fam b { font-size: .74rem; line-height: 1.25; text-align: center; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.fam small { font-size: .68rem; color: var(--ink-2); font-weight: 700; }
.fam.on small { color: var(--tc); filter: brightness(.75); }
.pf-ach.locked { opacity: .45; pointer-events: none; filter: grayscale(.6); }
#pf-ach-d { line-height: 1.8; }
.tier-dot { display: inline-block; font-size: .78rem; padding: 0 8px; border-radius: 99px; border: 1.5px solid var(--tc); color: var(--ink-2); margin: 2px 1px; }
.tier-dot.on { background: var(--tc); color: #fff; }
@media (max-width: 760px) {
  .pf-ach.fams { grid-template-columns: repeat(5, 1fr); gap: 6px 2px; }
  .fam { gap: 2px; padding: 2px 0; }
  .fam-ring { width: 44px; height: 44px; }
  .fam-g { width: 36px; height: 36px; font-size: 1.05rem; }
  .fam b { font-size: .66rem; -webkit-line-clamp: 1; white-space: nowrap; text-overflow: ellipsis; max-width: 100%; }
  .fam small { font-size: .62rem; }
  .ach-tabs button { font-size: .78rem; }
  .ach-tabs small { font-size: .7rem; }
  #pf-ach-d { font-size: .86rem; }
  .tier-dot { font-size: .7rem; padding: 0 6px; }
}
/* «ملفّي» on a phone: the account box on one line, the count of all achievements only in its sub-tabs */
@media (max-width: 760px) {
  .pf-acc { flex-wrap: nowrap; gap: 8px; }
  .pf-acc .ac-txt { flex: 1 1 auto; }
  .pf-acc .ac-btns .btn { padding: .4em .8em; font-size: .88rem; white-space: nowrap; }
  .pf-acc.in .ac-btns { flex-direction: column; gap: 6px; }
  #pf-t-ach small { display: none; }
}
@media (max-width: 760px) and (max-height: 760px) { .pf-head small { display: none; } }
/* a wide screen: the twenty medals in two rows */
@media (min-width: 761px) { .pf-ach.fams { grid-template-columns: repeat(10, 1fr); } .fam b { font-size: .72rem; } }
@media (max-width: 760px) and (max-height: 760px) { .pf-ach.fams { row-gap: 2px; } .fam-ring { width: 40px; height: 40px; } .fam-g { width: 33px; height: 33px; font-size: .98rem; } .ach-tabs { margin-bottom: 8px; } }
#pf-ach-d .tier-dot { margin: 3px 2px 0; min-width: 34px; text-align: center; font-weight: 800; }

/* ---------- SAIF-2026-10-23 «سؤال البرق» and «المهمّة السرّيّة» ---------- */
.banner.bolt .rib { background: #fff3c4; border-color: #3B2718; box-shadow: 0 6px 0 var(--ink), 0 0 0 6px rgba(233, 185, 73, .45), 0 18px 40px rgba(59, 39, 24, .25); }
.banner.gold .rib { background: #fbeccb; }
.quiz.bolt .q-card { box-shadow: 0 6px 0 var(--ink), 0 0 0 5px rgba(233, 185, 73, .6), 0 18px 40px rgba(59, 39, 24, .22); }
.quiz.bolt .q-title { color: #94600F; }
/* a wax seal: sealed (a mission not yet done), gold once done */
i.seal { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #8E2B22; border: 2px solid var(--ink);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .25); font-style: normal; flex: none; }
i.seal::after { content: "؟"; color: #fbe3d8; font-weight: 800; font-size: .72rem; line-height: 1; }
i.seal.done { background: var(--gold); }
i.seal.done::after { content: "✓"; color: var(--ink); }
.pc i.seal { position: absolute; bottom: -9px; inset-inline-end: 10px; width: 18px; height: 18px; }
.pc i.seal[hidden] { display: none; }
.mission { position: absolute; z-index: 6; inset-inline-end: 12px; bottom: 70px; display: flex; align-items: center; gap: 10px; max-width: min(300px, calc(100% - 24px));
  padding: 8px 14px 8px 12px; background: var(--paper); border: var(--edge); border-radius: 14px; box-shadow: 0 3px 0 var(--ink); text-align: start;
  font: inherit; color: var(--ink); cursor: pointer; }
.mission i.seal { width: 26px; height: 26px; }
.mission span { display: grid; min-width: 0; }
.mission b { font-size: .72rem; color: #8E2B22; font-weight: 800; line-height: 1.3; }
.mission em { font-style: normal; font-weight: 700; font-size: .95rem; line-height: 1.35; }
.mission small { flex: none; font-weight: 800; font-size: .8rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.mission small:empty { display: none; }
.mission.done { background: #fbeccb; }
.mission.done b { color: #94600F; }
.mission.fold { padding: 6px; border-radius: 50%; }
.mission.fold span, .mission.fold small { display: none; }
.res-missions { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 6px; }
.res-missions li { display: flex; align-items: center; gap: 8px; background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 6px 10px; font-size: .9rem; }
.res-missions li.hd { background: none; border: 0; padding: 0; font-weight: 800; color: var(--ink-2); font-size: .85rem; }
.res-missions li b { color: var(--pc); flex: none; }
.res-missions li span { flex: 1; min-width: 0; }
.res-missions li small { flex: none; font-weight: 800; color: var(--ink-3); }
.res-missions li.done small { color: var(--ok); }
.res-missions li.me { box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc) 35%, transparent); }
@media (max-width: 700px) { .mission { bottom: 60px; inset-inline-end: 8px; padding: 6px 10px; } .mission em { font-size: .85rem; } }

/* the match menu from the question card; a paused solo match hides the question meanwhile */
.q-pause { width: 40px; height: 40px; border-radius: 12px; flex: none; }
.q-pause span { height: 15px; }
body.paused .q-text, body.paused .q-body, body.paused .q-claim { filter: blur(12px); pointer-events: none; }

/* SAIF-2026-10-24 — the match's raid invitation: the narrator's call quoted, then what it is */
#raid-p q { display: block; font-style: italic; margin-bottom: .5em; quotes: '«' '»'; }
#raid-p span { display: block; }

/* ---------- «وجوه الإغاظة» (js/faces.js, core/taunts.js; SAIF-2026-10-25) ---------- */
.face-btn { background: var(--saffron); padding: 0; position: relative; }
.face-btn svg { width: 28px; height: 28px; }
.face-btn.cool { background: var(--sand); }
.face-btn .ring { position: absolute; inset: -4px; border-radius: 17px; pointer-events: none; }
.face-btn.cool .ring { background: conic-gradient(var(--turq) var(--p, 0%), transparent 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 0); mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 0); }
.g-top { position: relative; }
.faces { position: absolute; z-index: 20; top: calc(100% + 4px); inset-inline-end: 14px; background: var(--paper); border: var(--edge); border-radius: 20px;
  box-shadow: 0 6px 0 var(--ink), 0 18px 40px rgba(59, 39, 24, .25); padding: 10px; display: grid; grid-template-columns: repeat(4, auto); gap: 6px; }
.faces button { display: grid; justify-items: center; gap: 2px; padding: 6px 4px 4px; border: 2px solid transparent; border-radius: 14px; background: transparent; font: inherit; font-weight: 700; font-size: .85rem; color: var(--ink); cursor: pointer; }
.faces button:hover, .faces button:focus-visible { background: var(--paper-2); border-color: var(--sand); outline: none; }
.faces .face { width: 54px; height: 54px; }
.q-faces-btn { position: fixed; z-index: 41; bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); inset-inline-end: 16px; }
.faces.q { position: fixed; top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 74px); inset-inline-end: 16px; z-index: 42; }

/* the bubble over a card (or by a name on the question card, small) */
.fb { position: absolute; z-index: 21; top: calc(100% + 10px); inset-inline-start: 4px; background: #fff; border: var(--edge); border-radius: 20px; box-shadow: 0 3px 0 var(--ink);
  padding: 6px 6px 4px; display: grid; justify-items: center; pointer-events: none; animation: fb-in .28s cubic-bezier(.3, 1.6, .5, 1) both; }
.fb::before { content: ""; position: absolute; top: -11px; inset-inline-start: 22px; width: 16px; height: 16px; background: #fff; border-top: var(--edge); border-left: var(--edge); transform: rotate(45deg); }
.fb.out { animation: fb-out .3s ease-in forwards; }
.fb .cap { font-weight: 800; font-size: .95rem; line-height: 1.4; }
.fb.small { padding: 3px; border-radius: 14px; }
.fb.small .face { width: 42px; height: 42px; }
#quiz .chip, #quiz .q-card { position: relative; }
/* drawn at the page's level (js/ui.js face()), over the player's card at its picture — or beside their name on a question
   card — so it shows above the toasts that come with the same moment, and above the question card */
.fb.fx { position: fixed; z-index: 46; display: flex; align-items: center; gap: 4px; padding: 4px 12px 4px 4px; border-radius: 99px; }
.fb.fx::before { display: none; }
.fb.fx.small { padding: 3px; }
.fb.fx .face { width: 64px; height: 64px; }
.fb.fx.small .face { width: 40px; height: 40px; }
.fb.fx .cap { position: relative; z-index: 1; margin-inline-start: 8px; }
@keyframes fb-in { from { transform: scale(.3) translateY(-14px); opacity: 0; } }
@keyframes fb-out { to { transform: scale(.6) translateY(-10px); opacity: 0; } }
.pc .muted-tag { position: absolute; top: -9px; inset-inline-start: -6px; background: var(--ink); color: var(--paper); border-radius: 99px; font-size: .7rem; font-weight: 800; padding: 0 7px; line-height: 1.6; }

.face { position: relative; display: block; width: 76px; height: 76px; }
.face .pic { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; border: 3px solid var(--pc, var(--turq)); box-shadow: 0 0 0 2px var(--ink); background: #f4ebd6; }
.face .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.face .tint { position: absolute; inset: 0; border-radius: 50%; opacity: 0; }
.face svg.mark { position: absolute; inset: -14%; width: 128%; height: 128%; overflow: visible; pointer-events: none; }
.face .drop { fill: #4BA3E3; stroke: #1f5f8f; stroke-width: 1.5; animation: fc-fly .9s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.face .drop.r { animation-delay: .2s; }
.face .vein { fill: none; stroke: var(--bad); stroke-width: 5; stroke-linecap: round; animation: fc-throb .35s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.face .tear { fill: none; stroke: #4BA3E3; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: fc-stream 1.4s ease-in forwards; }
.face .tear.r { animation-delay: .25s; }
.face .bang path, .face .bang circle { fill: var(--gold); stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.face .bang { animation: fc-pop .45s .1s cubic-bezier(.3, 1.8, .5, 1) both; transform-box: fill-box; transform-origin: bottom; }
.face .dot { fill: #fff; stroke: var(--ink); stroke-width: 2.5; opacity: 0; animation: fc-dot .3s ease-out forwards; transform-box: fill-box; transform-origin: center; }
.face .dot:nth-of-type(2) { animation-delay: .35s; } .face .dot:nth-of-type(3) { animation-delay: .7s; }
.face .spark { fill: var(--gold); stroke: var(--ink); stroke-width: 2; animation: fc-spark .7s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.face .spark:nth-of-type(2) { animation-delay: .23s; } .face .spark:nth-of-type(3) { animation-delay: .46s; }
.face .ray { fill: var(--bad); } .face .ray.b { fill: var(--saffron); }
.face .rays { animation: fc-spin 2.4s linear infinite; transform-box: fill-box; transform-origin: center; }
.face .twinkle { fill: #fff; stroke: var(--gold); stroke-width: 2.5; animation: fc-twinkle .5s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.f-laugh .pic { animation: fc-laugh .16s ease-in-out 8 alternate; }
.f-angry .pic { animation: fc-shake .07s linear 14 alternate; }
.f-angry .tint { background: radial-gradient(circle at 50% 45%, rgba(201, 64, 58, .15), rgba(201, 64, 58, .55)); animation: fc-flush .6s ease-out forwards; }
.f-cry .pic { animation: fc-droop 1.6s ease-in-out forwards; }
.f-wow .pic { animation: fc-wow .5s cubic-bezier(.3, 1.8, .5, 1); }
.f-think .pic { animation: fc-tilt 1.8s ease-in-out forwards; }
.f-clap .pic { animation: fc-hop .3s ease-out 6 alternate; }
.f-dare .pic { animation: fc-dare .5s cubic-bezier(.3, 1.6, .5, 1); }
.f-wink .pic { animation: fc-wink .6s ease-in-out forwards; }
@keyframes fc-laugh { from { transform: rotate(-6deg) translateY(1px); } to { transform: rotate(6deg) translateY(-2px); } }
@keyframes fc-fly { from { transform: translate(0, 0) scale(.6); opacity: 1; } to { transform: translate(var(--dx), -6px) scale(1.1); opacity: 0; } }
@keyframes fc-shake { from { transform: translateX(-3px); } to { transform: translateX(3px); } }
@keyframes fc-flush { to { opacity: 1; } }
@keyframes fc-throb { to { transform: scale(1.25); } }
@keyframes fc-droop { to { transform: translateY(4px) rotate(-4deg); filter: saturate(.7); } }
@keyframes fc-stream { to { stroke-dashoffset: 0; } }
@keyframes fc-wow { 0% { transform: scale(.85); } 50% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes fc-pop { from { transform: scale(0); } }
@keyframes fc-tilt { 50%, 100% { transform: rotate(-8deg); } }
@keyframes fc-dot { from { opacity: 0; transform: scale(.2); } to { opacity: 1; } }
@keyframes fc-hop { to { transform: translateY(-7px); } }
@keyframes fc-spark { from { transform: scale(0) rotate(0); opacity: 1; } to { transform: scale(1.3) rotate(90deg); opacity: 0; } }
@keyframes fc-dare { from { transform: scale(.7); } }
@keyframes fc-spin { to { transform: rotate(360deg); } }
@keyframes fc-wink { 50%, 100% { transform: rotate(7deg); } }
@keyframes fc-twinkle { from { transform: scale(.4) rotate(0); } to { transform: scale(1.1) rotate(45deg); } }
@media (max-width: 760px) {
  .face { width: 62px; height: 62px; }
  .faces { inset-inline: 8px; justify-content: center; }
  .faces .face { width: 46px; height: 46px; }
}
@media (prefers-reduced-motion: reduce) {
  .face *, .face, .fb { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* ===== SAIF-2026-10-26 — the worlds (js/world.js): the switch on the home screen, and «عالم الأطبّاء»: medical blue with brushed steel ===== */
.worlds { display: flex; gap: 8px; margin: -14px 0 20px; padding: 4px; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); box-shadow: var(--lift); }
.worlds button { display: flex; align-items: center; gap: 8px; padding: 5px 14px 5px 6px; border: 0; border-radius: 999px; background: transparent;
  font: 700 1rem var(--ui); color: var(--ink-2); cursor: pointer; }
.worlds button img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 1.5px solid var(--ink-3); background: var(--paper-2); }
.worlds button[aria-checked="true"] { background: var(--turq); color: #fff; }
.worlds button[aria-checked="true"] img { border-color: #fff; }
.worlds button:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; }
[data-world="medical"] {
  --paper: #F3F8FB; --paper-2: #E1EDF4; --sand: #C9DCE7;
  --ink: #1D3444; --ink-2: #3D5A6C; --ink-3: #6E8899;
  --turq: #1F7EB5; --turq-2: #155F8A;
  --saffron: #9FCBE2; --saffron-2: #6FA6C4;
  --lift: 0 4px 0 var(--ink);
  --deep: 0 6px 0 var(--ink), 0 18px 40px rgba(29, 52, 68, .22);
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%237F9DB0' stroke-opacity='.16' stroke-width='1.2'%3E%3Ccircle cx='32' cy='32' r='14'/%3E%3Ccircle cx='32' cy='32' r='5'/%3E%3C/g%3E%3C/svg%3E");
}
/* its questions are in English: read left to right inside the Arabic card */
[data-world="medical"] .q-text, [data-world="medical"] .opt .t { direction: ltr; unicode-bidi: isolate; }
.q-text.long { font-size: clamp(1.05rem, 2vw, 1.3rem); line-height: 1.5; text-align: start; }
[data-world="medical"] .opt .t { text-align: left; }
/* SAIF-2026-10-27 — the doctors' world's raids: its own (the capsule of «رحلة في جسد إنسان», a picture on its map in the South Atlantic;
   the lantern of «ليلة في البيمارستان» in the Arabian Sea, the balloon of «غابة الدواء» over the Amazon), none of the knights' (painted on
   the knights' map) */
[data-world="medical"] .board .lair:not(.capsule):not(.lantern):not(.balloon), .board .lair.capsule, .board .lair.lantern, .board .lair.balloon { display: none; }
body.raids-on[data-world="medical"] .board .lair.capsule { display: block; left: 40.4%; top: 79%; width: 6.4%; height: 6.2%; border-radius: 30%;
  background: url(../img/raid/body/capsule.webp) center / contain no-repeat; }
body.raids-on[data-world="medical"] .board .lair.lantern { display: block; left: 65.3%; top: 50%; width: 3.4%; height: 11%; border-radius: 30%;
  background: url(../img/raid/bimar/lantern.webp) center / contain no-repeat; }
body.raids-on[data-world="medical"] .board .lair.balloon { display: block; left: 27%; top: 49%; width: 3.8%; height: 10%; border-radius: 30%;
  background: url(../img/raid/jungle/balloon.webp) center / contain no-repeat; }
[data-world="medical"] .setup, [data-world="medical"] .profile, [data-world="medical"] .daily, [data-world="medical"] .queue, [data-world="medical"] .lobby {
  background: linear-gradient(rgba(243, 248, 251, .55), rgba(243, 248, 251, .78)), url("../worlds/medical/img/hall.webp?v=1") center/cover;
}
[data-world="medical"] .quiz { background: linear-gradient(rgba(29, 52, 68, .3), rgba(29, 52, 68, .5)), url("../worlds/medical/img/hall.webp?v=1") center/cover; }
/* SAIF-2026-10-28 — «عالم السيارات» (doc https://claude.ai/artifact/4vhJ4f15YMyWbRYi6KBw5K): asphalt grey and racing red with a
   chrome sheen — a mid grey, not black, so the game reads well by day; its questions are Arabic (right to left, as the knights') */
[data-world="cars"] {
  --paper: #F4F3F1; --paper-2: #E6E4E0; --sand: #D3D0CA;
  --ink: #26292D; --ink-2: #464A50; --ink-3: #5D6269;
  --turq: #B8242B; --turq-2: #8F1B21;
  --saffron: #C9CED4; --saffron-2: #9EA5AD;
  --lift: 0 4px 0 var(--ink);
  --deep: 0 6px 0 var(--ink), 0 18px 40px rgba(38, 41, 45, .22);
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%237A8088' stroke-opacity='.16' stroke-width='1.2'%3E%3Ccircle cx='32' cy='32' r='13'/%3E%3Cpath d='M32 19v26M19 32h26'/%3E%3C/g%3E%3C/svg%3E");
}
[data-world="cars"] .setup, [data-world="cars"] .profile, [data-world="cars"] .daily, [data-world="cars"] .queue, [data-world="cars"] .lobby {
  background: linear-gradient(rgba(244, 243, 241, .55), rgba(244, 243, 241, .8)), url("../worlds/cars/img/hall.webp?v=1") center/cover;
}
[data-world="cars"] .quiz { background: linear-gradient(rgba(38, 41, 45, .3), rgba(38, 41, 45, .5)), url("../worlds/cars/img/hall.webp?v=1") center/cover; }
