#mj-connection-status {
  position: fixed;
  inset-block-start: calc(env(safe-area-inset-top, 0px) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 99998;
  width: max-content;
  max-width: calc(100vw - 32px);
  color: #eef5fa;
  font-family: "Cairo", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  text-align: start;
}
#mj-connection-status[hidden], #mj-connection-details[hidden] { display: none; }
#mj-connection-status[data-surface="player"] {
  position: relative;
  inset-block-start: auto;
  flex: none;
  align-self: center;
  left: auto;
  transform: none;
  margin-block: calc(env(safe-area-inset-top, 0px) + 8px) 8px;
}
body.mj-connection-visible #app > .screen { min-height: 0; }
#mj-connection-status[data-surface="host"] {
  inset-block-start: auto;
  inset-block-end: calc(env(safe-area-inset-bottom, 0px) + 12px);
  left: calc(env(safe-area-inset-left, 0px) + 14px);
  transform: none;
}
#mj-connection-status button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-shadow: none;
  -webkit-text-stroke: 0;
}
#mj-connection-status .mj-connection-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 16px;
  margin-inline: auto;
  background: #17394d;
  border: 1px solid #52758a;
  border-radius: 24px;
}
#mj-connection-status svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#mj-connection-status .mj-connection-chevron { width: 16px; }
#mj-connection-details {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: min(320px, calc(100vw - 32px));
  box-sizing: border-box;
  padding: 16px;
  margin-block-start: 8px;
  background: #17394d;
  border: 1px solid #52758a;
  border-radius: 16px;
}
#mj-connection-status[data-surface="host"] #mj-connection-details {
  inset-block-end: calc(100% + 8px);
  left: 0;
  transform: none;
}
#mj-connection-details p { margin: 0 0 12px; font-size: 14px; line-height: 1.8; }
#mj-connection-status .mj-connection-retry {
  min-height: 44px;
  width: 100%;
  padding: 8px 16px;
  border: 0;
  border-radius: 12px;
  background: #f0e7d5;
  color: #17394d;
  font-weight: 700;
}
#mj-connection-status button:focus-visible { outline: 3px solid #e9b85c; outline-offset: 3px; }
html[data-appearance="light"] #mj-connection-status { color: #193d50; }
html[data-appearance="light"] #mj-connection-status .mj-connection-toggle,
html[data-appearance="light"] #mj-connection-details { background: #f5f9fb; border-color: #aac0cd; }
html[data-appearance="light"] #mj-connection-status .mj-connection-retry { background: #204f6b; color: #fff; }

.game-start-status {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  margin: 0 auto 16px;
  max-width: 560px;
  font-size: 16px;
  color: var(--color-text);
  text-align: center;
}
.game-start-status[hidden] { display: none; }
.game-start-status button {
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid currentColor;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

    @keyframes blender-shake {
      0%,100% { transform: translateX(0) rotate(0deg); }
      20%      { transform: translateX(-6px) rotate(-4deg); }
      40%      { transform: translateX(6px) rotate(4deg); }
      60%      { transform: translateX(-4px) rotate(-2deg); }
      80%      { transform: translateX(4px) rotate(2deg); }
    }

    /* ── Player base layout (tokens come from /design-tokens.css) ── */
    html {
      width: 100%;
      height: 100%;
      overflow: hidden;
      overscroll-behavior: none;
    }
    body {
      position: fixed;
      top: var(--mj-player-viewport-top, 0px);
      left: 0;
      margin: 0;
      width: 100%;
      max-width: 100%;
      height: var(--mj-player-viewport-height, 100%);
      display: flex;
      flex-direction: column;
      text-align: center;
      overflow: hidden;
      overscroll-behavior: none;
      background-image: var(--mj-art-lobby);
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
    }

    /* ── Waiting / lobby card (between join and gameplay) ─────────────── */
    .waiting-card {
      background: rgba(13,33,55,0.75);
      border: 1px solid rgba(255,255,255,0.10);
      border-radius: var(--rad-xl);
      padding: var(--sp-6) var(--sp-5);
      box-shadow: var(--shadow);
      backdrop-filter: blur(12px);
      display: flex; flex-direction: column; align-items: center;
      gap: var(--sp-2);
    }
    .waiting-emoji {
      font-size: 3rem; line-height: 1;
      filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
      animation: wait-float var(--dur-loop-float) var(--ease-in-out) infinite;
    }
    @keyframes wait-float {
      0%, 100% { transform: translateY(0); }
      50% { transform: translateY(-10px); }
    }
    .game-eyebrow {
      font-size: var(--fs-xs); font-weight: 800; color: var(--color-primary);
      text-transform: uppercase;
    }
    .game-name {
      font-size: 2.1rem !important; font-weight: 900;
      color: #FFFFFF; margin: 2px 0 var(--sp-1);
    }
    .game-tagline {
      font-size: 1.05rem; font-weight: 600;
      color: rgba(255,255,255,0.60);
    }
    .waiting-divider {
      width: 64px; height: 3px; border-radius: var(--rad-sm);
      background: rgba(229,141,0,0.30);
      margin: var(--sp-3) 0 var(--sp-2);
    }
    .waiting-sub {
      font-size: 1.1rem; font-weight: 700; color: rgba(255,255,255,0.60);
    }
    .waiting-count {
      margin-top: var(--sp-1);
      display: inline-block;
      background: rgba(229,141,0,0.15);
      color: var(--color-primary);
      font-size: 0.95rem; font-weight: 800;
      padding: var(--sp-1) var(--sp-4);
      border-radius: var(--rad-pill);
      border: 1px solid rgba(229,141,0,0.25);
    }
    @keyframes wp-bounce {
      0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
      40%           { transform: translateY(-8px); opacity: 1; }
    }
    .waiting-pulse {
      display: inline-flex; gap: var(--sp-2); margin: var(--sp-1) 0;
    }
    .wp-dot {
      width: 10px; height: 10px; border-radius: 50%;
      background: var(--color-primary);
      animation: wp-bounce var(--dur-loop-bounce) var(--ease-in-out) infinite;
    }
    .wp-dot:nth-child(2) { animation-delay: var(--delay-stagger-sm); }
    .wp-dot:nth-child(3) { animation-delay: var(--delay-stagger-md); }

    /* ══════════════════════════════════════════════════════════════════════
       WAITING SCREENS — SELECT + LOBBY phases
       Reuses the join-wrap / join-hero background, adds a frosted sheet
       at the bottom exactly like the join screen's join-sheet.
       ══════════════════════════════════════════════════════════════════════ */

    /* Theme-specific glow blobs when join-wrap is used as waiting BG */
    body[data-theme="faker"]   .join-wrap::before,
    body[data-theme="faker"]   .join-wrap::after   { background: rgba(155,30,30,0.40); }
    body[data-theme="khallat"] .join-wrap::before,
    body[data-theme="khallat"] .join-wrap::after   { background: rgba(0,100,150,0.42); }
    body[data-theme="answers"] .join-wrap::before,
    body[data-theme="answers"] .join-wrap::after   { background: rgba(80,30,180,0.42); }
    body[data-theme="percent"] .join-wrap::before,
    body[data-theme="percent"] .join-wrap::after   { background: rgba(80,30,180,0.42); }
    body[data-theme="mahkama"] .join-wrap::before,
    body[data-theme="mahkama"] .join-wrap::after   { background: rgba(80,20,160,0.48); }
    body[data-theme="khedaa"]  .join-wrap::before,
    body[data-theme="khedaa"]  .join-wrap::after   { background: rgba(120,90,10,0.48); }

    /* Frosted bottom sheet — identical treatment to .join-sheet */
    .wait-sheet {
      flex: 1;
      background: rgba(13, 33, 55, 0.92);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 28px 28px 0 0;
      padding: var(--sp-6) var(--sp-5) calc(var(--sp-7) + var(--safe-bot));
      display: flex; flex-direction: column; align-items: center;
      gap: 14px;
      overflow-y: auto; overflow-x: hidden;
      position: relative; z-index: 1;
      backdrop-filter: blur(16px);
      box-shadow: 0 -4px 40px rgba(0,0,0,0.40);
      width: 100%; box-sizing: border-box;
    }

    /* Game card floating in the hero area (LOBBY) */
    .wait-hero-card {
      width: clamp(130px, 40vw, 170px);
      height: clamp(130px, 40vw, 170px);
      border-radius: 22px; object-fit: cover;
      filter: drop-shadow(0 12px 36px rgba(0,0,0,0.75));
      animation: wait-card-float var(--dur-loop-float) var(--ease-in-out) infinite alternate;
      margin-top: 4px;
    }
    @keyframes wait-card-float {
      from { transform: translateY(0px) rotate(-1deg); }
      to   { transform: translateY(-10px) rotate(1deg); }
    }

    /* Animated dice for SELECT phase */
    .wait-select-icon {
      font-size: 3.8rem; line-height: 1;
      filter: drop-shadow(0 4px 14px rgba(229,141,0,0.38));
      animation: wait-select-bounce 2s var(--ease-in-out) infinite;
    }
    @keyframes wait-select-bounce {
      0%, 100% { transform: translateY(0) rotate(-4deg) scale(1); }
      50%       { transform: translateY(-12px) rotate(6deg) scale(1.05); }
    }
    .join-wrap[data-step="rules"] .wait-sheet {
      justify-content: center;
      gap: 20px;
      padding-top: var(--sp-4);
    }
    .join-wrap[data-step="rules"] .wait-select-icon {
      display: block;
      align-self: center;
      font-size: clamp(6.5rem, 30vw, 9rem);
      transform-origin: center;
      filter: drop-shadow(0 12px 30px rgba(229,141,0,.42));
    }
    .join-wrap[data-step="rules"] .wait-title {
      max-width: 19rem;
      font-size: 1.55rem;
      line-height: 1.45;
    }

    .wait-avatar-wrap { position: relative; width: 120px; height: auto; display: flex; align-items: center; justify-content: center; }
    .wait-avatar-img {
      width: 100%; height: auto; object-fit: contain; display: block;
      filter: drop-shadow(0 8px 24px rgba(0,0,0,0.50));
    }
    .wait-avatar-ring { display: none; }

    /* Text elements */
    .wait-title {
      font-size: 1.5rem; font-weight: 900; color: #FFFFFF;
      text-align: center; line-height: 1.25;
      text-shadow: 0 2px 14px rgba(0,0,0,0.50);
    }
    .wait-sub {
      font-size: 0.92rem; font-weight: 600;
      color: rgba(255,255,255,0.50); text-align: center;
    }

    /* Player name pill */
    .wait-me-row {
      display: flex; align-items: center; justify-content: center; gap: 8px;
      background: rgba(255,255,255,0.07);
      border: 1px solid rgba(255,255,255,0.12);
      border-radius: var(--rad-pill);
      padding: 8px 16px;
    }
    .wait-me-name { font-size: 1rem; font-weight: 800; color: #FFFFFF; }
    .wait-rename-btn {
      background: transparent; width: auto;
      font-family: inherit; font-size: 0.82rem; font-weight: 700;
      color: #E58D00; cursor: pointer;
      min-height: 44px; display: inline-flex; align-items: center;
      padding: 2px 10px; border-radius: var(--rad-pill);
      border: 1px solid rgba(229,141,0,0.30);
      transition: background var(--dur-fast);
    }
    .wait-rename-btn:active { background: rgba(229,141,0,0.14); transform: scale(0.96); }
    .lobby-avatar-picker { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
    .lap-title { font-size: 1rem; font-weight: 800; color: #FFFFFF; margin-bottom: 4px; }

    /* Live player count pill */
    .wait-count {
      display: inline-flex; align-items: center; gap: 8px;
      background: rgba(255,255,255,0.07);
      border: 1px solid rgba(255,255,255,0.10);
      border-radius: var(--rad-pill);
      padding: 8px 18px;
      font-size: 0.92rem; font-weight: 700; color: rgba(255,255,255,0.75);
    }
    .wait-count-dot {
      width: 8px; height: 8px; border-radius: 50%;
      background: #06D6A0;
      box-shadow: 0 0 7px rgba(6,214,160,0.65);
      animation: wait-count-pulse 2s ease-in-out infinite;
    }
    @keyframes wait-count-pulse {
      0%, 100% { opacity: 1; transform: scale(1); }
      50% { opacity: 0.6; transform: scale(0.85); }
    }

    /* ── Pre-game RULES screen (player phone) ─────────────────────────────── */
    .prules-title {
      font-size: 1.7rem; font-weight: 900; color: #fff;
      text-align: center; line-height: 1.15; margin-top: 6px;
      text-shadow: 0 2px 14px rgba(0,0,0,0.5);
    }
    .prules-title span { font-size: 0.9em; }
    .prules-eyebrow {
      font-size: 0.95rem; font-weight: 800;
      color: #FF9F1C; letter-spacing: 0.03em; text-align: center;
    }
    .prules-card {
      width: 100%; box-sizing: border-box;
      display: flex; flex-direction: column; gap: 14px;
      background: rgba(255,255,255,0.05);
      border: 1px solid rgba(255,255,255,0.10);
      border-radius: 18px;
      padding: 16px 14px;
    }
    .prules-step { display: flex; align-items: flex-start; gap: 11px; direction: rtl; text-align: right; }
    .prules-step-num {
      flex-shrink: 0;
      width: 28px; height: 28px; border-radius: 50%;
      display: grid; place-items: center;
      font-size: 0.95rem; font-weight: 900; color: #fff;
      background: linear-gradient(135deg, #FF8C00 0%, #E8A100 100%);
      box-shadow: 0 3px 10px rgba(232,161,0,0.45);
    }
    .prules-step-text {
      margin: 0; flex: 1;
      font-size: 1.02rem; line-height: 1.65;
      color: rgba(255,255,255,0.90); font-weight: 600;
    }
    .prules-wait {
      display: inline-flex; align-items: center; gap: 8px;
      background: rgba(255,255,255,0.07);
      border: 1px solid rgba(255,255,255,0.10);
      border-radius: var(--rad-pill);
      padding: 9px 18px; margin-top: 2px;
      font-size: 0.95rem; font-weight: 700; color: rgba(255,255,255,0.78);
    }

    /* Bouncing dots loader */
    .wait-pulse { display: inline-flex; gap: 6px; }
    .wait-dot {
      width: 10px; height: 10px; border-radius: 50%;
      background: rgba(229,141,0,0.85);
      animation: wp-bounce var(--dur-loop-bounce) var(--ease-in-out) infinite;
    }
    .wait-dot:nth-child(2) { animation-delay: var(--delay-stagger-sm); }
    .wait-dot:nth-child(3) { animation-delay: var(--delay-stagger-md); }

    /* Rename form inside the sheet */
    .wait-rename-form {
      width: 100%; display: flex; flex-direction: column; gap: var(--sp-2);
    }
    .wait-rename-row { display: flex; gap: var(--sp-2); }
    .wait-rename-row .join-btn { flex: 1; margin-top: 0; font-size: 1rem; padding: var(--sp-3); }
    .wait-rename-cancel {
      background: rgba(255,255,255,0.08) !important; color: rgba(255,255,255,0.70) !important;
      box-shadow: none !important; outline: none !important; text-shadow: none !important;
    }

    /* Leave room button — lobby only, unobtrusive */
    .btn-leave-room {
      background: transparent;
      border: 1px solid rgba(255,255,255,0.14);
      border-radius: var(--rad-pill);
      color: rgba(255,255,255,0.38);
      font-family: inherit; font-size: 0.80rem; font-weight: 700;
      min-height: 44px;
      padding: 7px 20px;
      cursor: pointer;
      margin-top: 6px;
      transition: color var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast);
    }
    .btn-leave-room:hover {
      color: rgba(255,255,255,0.65);
      border-color: rgba(255,255,255,0.28);
      background: rgba(255,255,255,0.05);
    }
    .btn-leave-room:active {
      color: #ff6b6b;
      border-color: rgba(255,107,107,0.40);
      background: rgba(255,107,107,0.08);
      transform: scale(0.96);
    }
    .wait-rename-error { font-size: 0.88rem; font-weight: 700; color: #FF6B6B; text-align: center; }
    /* Lobby "you are" row + inline rename editor */
    .me-row {
      margin-top: var(--sp-3);
      display: flex; align-items: center; justify-content: center;
      gap: var(--sp-2); flex-wrap: wrap;
      font-size: 0.95rem; color: var(--color-text-soft); font-weight: 700;
    }
    .me-name { color: var(--color-text); font-weight: 900; }
    .me-rename-btn {
      font-family: inherit; font-size: 0.9rem; font-weight: 800;
      padding: var(--sp-1) var(--sp-3);
      border-radius: var(--rad-pill);
      border: 1.5px solid var(--color-primary-soft);
      background: transparent; color: var(--color-primary);
      cursor: pointer;
      transition: var(--bounce);
    }
    .me-rename-btn:active { transform: scale(0.96); background: var(--color-primary-soft); }
    .me-rename-form {
      margin-top: var(--sp-3);
      width: 100%;
      display: flex; flex-direction: column; gap: var(--sp-2);
    }
    .me-rename-row { display: flex; gap: var(--sp-2); }
    .me-rename-row .join-btn { flex: 1; margin-top: 0; font-size: 1rem; padding: var(--sp-3); }
    .me-rename-cancel {
      background: var(--color-surface-2);
      color: var(--color-text-soft);
      box-shadow: none;
    }
    .me-rename-error {
      font-size: 0.9rem; font-weight: 700;
      color: var(--color-error, #e74c3c);
      text-align: center;
    }
    /* ── Player settings sheet ── */
    .player-settings-btn {
      position: fixed; top: calc(var(--safe-top) + 8px); left: 12px;
      z-index: 50; width: 48px; height: 48px; border-radius: 0;
      background: transparent; color: #FFFFFF; border: 0;
      box-shadow: none; font-size: 1.25rem; line-height: 1;
      padding: 0;
      display: flex; align-items: center; justify-content: center;
      transition: transform var(--dur-base) var(--ease-out-soft);
      filter: drop-shadow(0 2px 6px rgba(0,0,0,0.55));
      -webkit-tap-highlight-color: transparent;
    }
    .player-settings-btn:active { transform: scale(0.92); }
    .player-settings-btn:focus-visible {
      outline: 2px solid rgba(255,255,255,0.72);
      outline-offset: -5px;
      border-radius: 10px;
    }
    .player-settings-btn::before {
      content: "";
      width: 30px;
      height: 30px;
      flex: 0 0 30px;
      background: currentColor;
      -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19.1 13a7 7 0 0 0 0-2l2-1.6-2-3.4-2.5 1a8 8 0 0 0-1.7-1L14.5 3h-5L9 6a8 8 0 0 0-1.7 1L4.8 6l-2 3.4 2 1.6a7 7 0 0 0 0 2l-2 1.6 2 3.4 2.5-1a8 8 0 0 0 1.7 1l.5 3h5l.5-3a8 8 0 0 0 1.7-1l2.5 1 2-3.4zM12 15.5a3.5 3.5 0 1 1 0-7 3.5 3.5 0 0 1 0 7'/%3E%3C/svg%3E") center / contain no-repeat;
      mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19.1 13a7 7 0 0 0 0-2l2-1.6-2-3.4-2.5 1a8 8 0 0 0-1.7-1L14.5 3h-5L9 6a8 8 0 0 0-1.7 1L4.8 6l-2 3.4 2 1.6a7 7 0 0 0 0 2l-2 1.6 2 3.4 2.5-1a8 8 0 0 0 1.7 1l.5 3h5l.5-3a8 8 0 0 0 1.7-1l2.5 1 2-3.4zM12 15.5a3.5 3.5 0 1 1 0-7 3.5 3.5 0 0 1 0 7'/%3E%3C/svg%3E") center / contain no-repeat;
    }
    /* Gear turns ~90° while the settings sheet is open — ties control to sheet. */
    .player-settings-btn.spun { transform: rotate(90deg); }
    .player-settings-btn.spun:active { transform: rotate(90deg) scale(0.92); }

    /* ── Emoji reaction controller ──────────────────────────────────── */
    .rxn-fab {
      position: fixed;
      left: calc(env(safe-area-inset-left, 0px) + 12px);
      bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
      z-index: 90;
      display: none;
    }
    .rxn-fab.rxn-on { display: block; }
    .rxn-toggle {
      width: 52px; height: 52px;
      border-radius: 50%;
      border: 1px solid rgba(255,255,255,0.18);
      background: rgba(7,21,35,0.92);
      backdrop-filter: blur(10px);
      box-shadow: 0 6px 20px rgba(0,0,0,0.42);
      font-size: 1.5rem;
      display: flex; align-items: center; justify-content: center;
      color: #fff;
      cursor: pointer;
      transition: transform var(--dur-fast) var(--ease-spring-pop);
    }
    .rxn-toggle:active { transform: scale(0.88); }
    .rxn-fab.rxn-open .rxn-toggle { transform: rotate(45deg); }
    .rxn-tray {
      position: absolute;
      left: 0; bottom: 60px;
      display: flex;
      flex-wrap: wrap;
      width: 116px;
      gap: 8px;
      opacity: 0;
      transform: translateY(10px) scale(0.85);
      transform-origin: bottom left;
      pointer-events: none;
      transition: opacity var(--dur-fast) var(--ease-out),
                  transform var(--dur-fast) var(--ease-spring-pop);
    }
    .rxn-fab.rxn-open .rxn-tray {
      opacity: 1;
      transform: none;
      pointer-events: auto;
    }
    .rxn-emoji {
      width: 48px; height: 48px;
      border-radius: 50%;
      border: 1px solid rgba(255,255,255,0.14);
      background: rgba(7,21,35,0.94);
      box-shadow: 0 4px 14px rgba(0,0,0,0.38);
      font-size: 1.45rem;
      display: flex; align-items: center; justify-content: center;
      cursor: pointer;
      transition: transform var(--dur-fast) var(--ease-spring-pop);
    }
    .rxn-emoji:active { transform: scale(0.78); }
    .player-settings {
      position: fixed; inset: 0; z-index: 100;
      /* Dark dim scrim — a normal bottom-sheet backdrop. (Previously used
         --color-overlay-on-dark-strong, which is a near-opaque WHITE token, so
         the page behind the sheet read as white instead of a dimmed backdrop.) */
      background: rgba(3, 10, 18, 0.62);
      -webkit-backdrop-filter: blur(3px);
      backdrop-filter: blur(3px);
      display: flex; align-items: flex-end; justify-content: stretch;
      animation: ps-fade var(--dur-base) var(--ease-out-soft) both;
    }
    .player-settings[hidden] { display: none; }
    .ps-card {
      width: 100%; background: #0D2137; color: #FFFFFF;
      padding: 22px 20px calc(20px + var(--safe-bot, 0px));
      border-radius: 22px 22px 0 0;
      border-top: 1px solid rgba(255,255,255,0.10);
      box-shadow: var(--shadow-lg);
      animation: ps-slide var(--dur-slow) var(--ease-out-soft) both;
      max-height: 90vh; overflow-y: auto;
    }
    .ps-card::before {
      content: ""; display: block; width: 44px; height: 5px;
      border-radius: 999px; background: rgba(255,255,255,0.15);
      margin: -8px auto 14px;
    }
    @keyframes ps-fade  { from { opacity: 0; } to { opacity: 1; } }
    @keyframes ps-slide { from { transform: translateY(100%); } to { transform: none; } }
    .ps-title { font-size: 1.25rem; font-weight: 800; margin-bottom: 12px; text-align: center; color: #FFFFFF; }
    .ps-section {
      background: rgba(255,255,255,0.06);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 16px;
      padding: 4px 14px;
      margin-bottom: 12px;
    }
    .ps-section-title {
      font-size: 0.78rem; font-weight: 800;
      color: rgba(255,255,255,0.40); text-transform: uppercase;
      padding: 10px 2px 6px;
    }
    .ps-row {
      display: flex; align-items: center; justify-content: space-between;
      gap: 12px; padding: 12px 2px; min-height: 44px;
    }
    .ps-row + .ps-row { border-top: 1px solid rgba(255,255,255,0.08); }
    .ps-label { font-weight: 600; font-size: 1rem; color: #FFFFFF; }
    /* Effects-volume row: label + % on top, full-width custom slider below —
       matches the host settings slider's quality. Blue fill, white knob that
       edge-aligns to both ends; the track reads left→right even in the RTL
       sheet. JS paints the blue fill via a gradient (see updateSfxVolUI). */
    .ps-row-vol { flex-direction: column; align-items: stretch; gap: 10px; }
    .ps-vol-head { display: flex; align-items: baseline; justify-content: space-between; }
    .ps-vol-head .ps-label { text-align: right; }
    .ps-vol-pct {
      font-size: 0.95rem; font-weight: 700;
      color: rgba(255,255,255,0.55); min-width: 3em; text-align: left;
      font-variant-numeric: tabular-nums;
    }
    .ps-cslider {
      position: relative; height: 36px; display: flex; align-items: center;
      cursor: pointer; touch-action: pan-y; user-select: none; -webkit-user-select: none;
      margin: 4px 0 2px;
    }
    .ps-cslider-track {
      position: absolute; left: 0; right: 0; height: 4px; border-radius: 999px;
      background: var(--color-surface-2, rgba(255,255,255,0.12));
    }
    .ps-cslider-fill {
      position: absolute; left: 0; top: 0; bottom: 0; width: 0;
      background: #3B9EFF; border-radius: 999px;
      transition: width 40ms linear;
    }
    .ps-cslider-thumb {
      position: absolute; width: 22px; height: 22px; border-radius: 50%;
      background: #FFFFFF; box-shadow: 0 2px 10px rgba(0,0,0,0.45);
      left: 0; margin-left: 0;
      transition: transform 300ms cubic-bezier(0.34,1.56,0.64,1),
                  left 40ms linear;
      will-change: transform, left;
    }
    .ps-cslider.ps-dragging .ps-cslider-thumb {
      transform: scale(1.18);
      transition: transform 120ms cubic-bezier(0.25,0.46,0.45,0.94);
    }
    .ps-cslider.ps-dragging .ps-cslider-fill {
      transition: none;
    }
    .ps-cslider.ps-dragging .ps-cslider-thumb {
      transition: transform 120ms cubic-bezier(0.25,0.46,0.45,0.94);
    }
    /* Quiet "Switch mode" entry — secondary action, muted tone, full row tap target */
    .ps-mode-switch {
      width: 100%;
      background: transparent;
      color: rgba(255,255,255,0.45);
      border: 1px solid rgba(255,255,255,0.10);
      border-radius: 14px;
      padding: 12px 16px;
      margin-top: 4px;
      font-size: 0.95rem; font-weight: 600;
      display: flex; align-items: center; justify-content: center;
      gap: 8px; min-height: 44px;
      box-shadow: none;
      text-shadow: none;
      outline: none;
      transition: background var(--dur-fast) var(--ease-out-soft),
                  color var(--dur-fast) var(--ease-out-soft);
    }
    .ps-mode-switch:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.70); }
    .ps-mode-switch:active { transform: scale(0.98); }
    .ps-mode-switch .ps-mode-icon { font-size: 1rem; opacity: 0.85; }
    .ps-legal-links {
      display: flex; justify-content: center; gap: 18px;
      margin: 4px 0 12px; font-size: 0.86rem;
    }
    .ps-legal-links a { color: rgba(255,255,255,0.62); text-decoration: none; }
    .ps-legal-links a:active { color: #FFFFFF; }
    /* Smooth in-app fade transition between mode views: outgoing fade-out
       before navigation, and a paired fade-in on the next page load when
       the user just came from the other view. */
    body.mj-fade-out { opacity: 0; transition: opacity 200ms var(--ease-out-soft); }
    body.mj-fade-in  { opacity: 0; }
    body.mj-fade-in.mj-fade-in-ready {
      opacity: 1; transition: opacity 220ms var(--ease-out-soft);
    }
    @media (prefers-reduced-motion: reduce) {
      body.mj-fade-out, body.mj-fade-in { opacity: 1 !important; transition: none !important; }
    }
    .ps-switch { position: relative; width: 48px; height: 28px; direction: ltr; }
    .ps-switch input { opacity: 0; width: 0; height: 0; }
    .ps-slider {
      position: absolute; inset: 0; background: var(--muted);
      border-radius: 28px; transition: background var(--dur-fast) var(--ease-out-soft);
    }
    .ps-slider::before {
      content: ""; position: absolute; top: 3px; left: 3px; right: auto;
      width: 22px; height: 22px; background: var(--color-knob); border-radius: 50%;
      transition: left var(--dur-fast) var(--ease-out-soft), right var(--dur-fast) var(--ease-out-soft);
    }
    .ps-switch input:checked + .ps-slider { background: var(--primary); }
    .ps-switch input:checked + .ps-slider::before { left: auto; right: 3px; }
    .ps-close {
      width: 100%; margin-top: 14px; padding: 14px;
      background: #E58D00; color: #FFFFFF;
      border-radius: 14px; font-weight: 800; font-size: 1.05rem;
      min-height: 48px;
      outline: 3px solid #1A0A00;
      box-shadow: 0 4px 0 #B36E00;
      text-shadow: -1px -1px 0 #1A0A00, 1px -1px 0 #1A0A00, -1px 1px 0 #1A0A00, 1px 1px 0 #1A0A00;
      transition: transform var(--dur-fast) var(--ease-out-soft),
                  box-shadow var(--dur-fast) var(--ease-out-soft),
                  filter var(--dur-fast) var(--ease-out-soft);
    }
    /* Tactile press — sink the button into its 4px drop shadow. */
    .ps-close:active {
      transform: translateY(3px);
      box-shadow: 0 1px 0 #B36E00;
      filter: brightness(1.06);
    }
    /* ── Phase transition layer (mirrors host) ──
       Incoming fade-up only — no outgoing fade. Draining #app to opacity 0
       before the swap exposed the dark page background as a black flash. */
    @keyframes app-phase-in  { 0% { opacity: 0; transform: translateY(8px); } 100% { opacity: 1; transform: none; } }
    #app > * { animation: app-phase-in var(--dur-slow) var(--ease-out-soft) both; }
    /* RULES must remain painted continuously. Animating either the full
       wrapper or its newly inserted sheet briefly exposes the dark body
       between the lobby and the rules waiting state. */
    #app > .join-wrap[data-step="rules"],
    .join-wrap[data-step="rules"] .content-fade {
      animation: none !important;
    }
    @media (prefers-reduced-motion: reduce) {
      #app > * { animation: none !important; }
    }

    /* ── Top header bar ── */
    .player-header {
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: var(--sp-3);
      padding: calc(var(--sp-3) + var(--safe-top)) var(--sp-5) var(--sp-3);
      background: rgba(7,21,35,0.92);
      border-bottom: 1px solid rgba(255,255,255,0.08);
      box-shadow: 0 2px 16px rgba(0,0,0,0.30);
      backdrop-filter: blur(10px);
      transition: background var(--dur-slow) var(--ease-out),
                  border-color var(--dur-slow) var(--ease-out);
    }
    /* Mode-tinted top border on game screens */
    body[data-theme="faker"] .player-header,
    body[data-theme="khallat"] .player-header,
    body[data-theme="percent"] .player-header,
    body[data-theme="mahkama"] .player-header,
    body[data-theme="khedaa"] .player-header {
      border-bottom-color: var(--color-primary);
    }
    .brand-logo {
      height: 44px;
      width: auto;
      filter: drop-shadow(0 2px 8px rgba(229,141,0,0.30));
    }
    .header-mode-mark {
      display: none;
      align-items: center;
      gap: var(--sp-2);
      padding: 4px 12px;
      border-radius: var(--rad-pill);
      background: var(--color-primary);
      color: #FFFFFF;
      font-size: 0.85rem;
      font-weight: 800;
      box-shadow: 0 2px 8px rgba(0,0,0,0.3);
      font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
      text-shadow: -1px -1px 0 rgba(0,0,0,0.3), 1px 1px 0 rgba(0,0,0,0.3);
    }
    body[data-theme="answers"] .header-mode-mark,
    body[data-theme="faker"]   .header-mode-mark,
    body[data-theme="khallat"] .header-mode-mark,
    body[data-theme="percent"] .header-mode-mark,
    body[data-theme="mahkama"] .header-mode-mark,
    body[data-theme="khedaa"]  .header-mode-mark {
      display: inline-flex;
    }

    /* ── Main content area ── */
    #app {
      position: relative;
      min-height: 0;
      flex: 1;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    .auto-advance-indicator {
      position: fixed;
      left: 50%;
      bottom: calc(74px + var(--safe-bot));
      transform: translateX(-50%);
      z-index: 85;
      display: flex;
      align-items: center;
      gap: 8px;
      max-width: calc(100vw - 32px);
      padding: 8px 14px;
      border: 1px solid rgba(255,255,255,0.14);
      border-radius: 999px;
      background: rgba(5,15,31,0.9);
      color: #fff;
      box-shadow: 0 8px 24px rgba(0,0,0,0.25);
      backdrop-filter: blur(10px);
      font-size: 0.84rem;
      font-weight: 800;
      white-space: nowrap;
      pointer-events: none;
    }
    .auto-advance-indicator .aai-count {
      color: var(--primary);
      font-size: 1rem;
      font-variant-numeric: tabular-nums;
    }

    /* ── Screen shell (wraps each phase) ── */
    .screen {
      min-height: 0;
      flex: 1;
      display: flex;
      flex-direction: column;
      padding: 0 var(--sp-5) calc(var(--sp-5) + var(--safe-bot));
      overflow: hidden;
      background: transparent;
    }
    .screen-body {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: safe center;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      padding: var(--sp-4) 0;
      gap: var(--sp-3);
    }
    .screen-body,
    .wait-sheet,
    .join-sheet,
    .khallat-wb-root {
      scrollbar-width: none;
      -ms-overflow-style: none;
    }
    .screen-body::-webkit-scrollbar,
    .wait-sheet::-webkit-scrollbar,
    .join-sheet::-webkit-scrollbar,
    .khallat-wb-root::-webkit-scrollbar {
      display: none;
      width: 0;
      height: 0;
    }
    html,
    body {
      scrollbar-width: none;
      -ms-overflow-style: none;
    }
    html::-webkit-scrollbar,
    body::-webkit-scrollbar {
      display: none;
      width: 0;
      height: 0;
    }
    /* When there's a lot of scrollable content (vote lists), align top */
    .screen-body.scrollable {
      justify-content: flex-start;
    }
    .screen-foot {
      flex-shrink: 0;
      padding-top: var(--sp-3);
    }

    /* ── Typography ── */
    h1 { font-size: 1.95rem; font-weight: 800; color: #FFFFFF; line-height: 1.25; }
    h2 { font-size: 1.35rem; font-weight: 700; color: rgba(255,255,255,0.55); }

    /* ── Inputs ── */
    input, textarea {
      width: 100%;
      font-family: inherit;
      font-size: 1.25rem;
      font-weight: 600;
      padding: var(--sp-4) var(--sp-4);
      background: rgba(255,255,255,0.07);
      color: #FFFFFF;
      border: 2px solid rgba(255,255,255,0.12);
      border-radius: var(--rad-md);
      text-align: right;
      transition: border-color var(--dur-base);
    }
    input::placeholder, textarea::placeholder { color: rgba(255,255,255,0.30); font-weight: 400; }
    textarea { min-height: 120px; resize: none; line-height: 1.5; }
    input:focus, textarea:focus { outline: none; border-color: var(--primary); background: rgba(255,255,255,0.10); }

    /* ── Buttons ── */
    button {
      width: 100%;
      font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
      font-size: 1.35rem;
      font-weight: 800;
      padding: var(--sp-4);
      border: none;
      border-radius: var(--rad-pill);
      cursor: pointer;
      color: #FFFFFF;
      transition: transform 0.12s var(--ease-bounce), filter 0.12s, box-shadow 0.12s;
    }
    button:active { transform: scale(0.97); }
    button:disabled { opacity: 0.38; cursor: not-allowed; box-shadow: none; }
    .btn-primary {
      background: #E58D00;
      outline: 3px solid #1A0A00;
      outline-offset: 0;
      box-shadow: 0 5px 0 #B36E00, 0 8px 20px rgba(229,141,0,0.35);
      text-shadow: -1px -1px 0 #1A0A00, 1px -1px 0 #1A0A00, -1px 1px 0 #1A0A00, 1px 1px 0 #1A0A00;
    }
    .btn-primary:not(:disabled):hover { transform: translateY(-2px); filter: brightness(1.08); }
    .btn-primary:not(:disabled):active { transform: translateY(3px); box-shadow: 0 2px 0 #B36E00; }
    .btn-secondary {
      background: var(--color-surface-2);
      border: 1.5px solid rgba(255,255,255,0.15);
      box-shadow: var(--shadow-sm);
    }
    .btn-secondary:not(:disabled):active { filter: brightness(0.9); }

    /* ── Vote buttons ── */
    .btn-vote {
      background: rgba(255,255,255,0.07);
      color: #FFFFFF;
      border: 1px solid rgba(255,255,255,0.12);
      text-align: right;
      font-size: 1.25rem;
      padding: 20px 18px;
      border-radius: 20px;
      font-weight: 700;
      box-shadow: var(--shadow);
      outline: none;
      text-shadow: none;
      transition: background var(--dur-fast) var(--ease-out-soft),
                  border-color var(--dur-fast) var(--ease-out-soft),
                  color var(--dur-fast) var(--ease-out-soft),
                  transform 0.12s var(--ease-bounce),
                  box-shadow var(--dur-fast) var(--ease-out-soft);
    }
    .btn-vote:not(:disabled):hover { background: rgba(255,255,255,0.11); }
    .btn-vote:not(:disabled):active { transform: scale(0.98); }
    .btn-vote.selected {
      background: rgba(6,214,160,0.18);
      border-color: var(--accent-teal);
      color: var(--accent-teal);
      box-shadow: var(--shadow-teal-vote);
    }
    .btn-vote.dimmed { opacity: 0.28; cursor: not-allowed; box-shadow: none; }

    /* ── Cards ── */
    .question-card {
      background: rgba(255,255,255,0.07);
      color: #FFFFFF;
      border: 1px solid rgba(255,255,255,0.10);
      border-radius: 22px;
      padding: 22px 20px;
      font-size: 1.5rem;
      font-weight: 800;
      line-height: 1.55;
      box-shadow: var(--shadow);
    }
    .prompt-card {
      background: rgba(255,255,255,0.05);
      color: rgba(255,255,255,0.80);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 18px;
      padding: 14px 18px;
      font-size: 1.1rem;
      font-weight: 600;
      line-height: 1.5;
    }
    /* ── Faker identity reveal card ── */
    .faker-identity {
      background: linear-gradient(160deg, var(--color-faker-identity-start) 0%, var(--color-faker-identity-end) 100%);
      border-radius: 28px;
      padding: 32px 24px 28px;
      box-shadow: var(--shadow-faker-identity);
      border: 2px solid var(--color-faker-identity-border);
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 12px;
      width: 100%;
    }
    .fi-emoji { font-size: 4.5rem; line-height: 1; }
    .fi-title {
      font-size: 2.4rem;
      font-weight: 900;
      color: var(--color-faker-identity-accent);
      text-shadow: 0 0 24px var(--shadow-faker-title-halo);
      margin: 0;
      text-align: center;
    }
    .fi-divider {
      width: 60%;
      height: 2px;
      background: var(--color-faker-identity-divider);
      border-radius: 2px;
      margin: 4px 0;
    }
    .fi-hint-label {
      font-size: 0.95rem;
      color: var(--color-overlay-on-dark-text-faint);
      font-weight: 600;
      text-transform: uppercase;
    }
    .fi-hint {
      font-size: 2rem;
      font-weight: 900;
      color: var(--color-on-dark);
      text-align: center;
      background: var(--color-overlay-on-dark-soft);
      border-radius: 16px;
      padding: 14px 24px;
      width: 100%;
      box-sizing: border-box;
      border: 1.5px solid var(--color-overlay-on-dark-mid);
    }
    .fi-tip {
      font-size: 1rem;
      color: var(--color-overlay-on-dark-text-faint);
      text-align: center;
      line-height: 1.55;
      max-width: 280px;
    }
    /* legacy — keep for any remaining references */
    .faker-card { background: var(--card); border-radius: 24px; padding: 28px 22px; }
    .faker-card .fc-title { font-size: 1.7rem; color: var(--primary); font-weight: 900; margin-bottom: 12px; }
    .faker-card .fc-body { font-size: 1.15rem; color: var(--text); line-height: 1.6; font-weight: 600; }
    .info {
      background: var(--card);
      color: var(--text);
      padding: 18px;
      border-radius: 20px;
      font-size: 1.15rem;
      line-height: 1.5;
      box-shadow: var(--shadow);
      font-weight: 600;
    }
    .info-warn {
      background: var(--color-info-warn-bg);
      color: var(--accent-pink);
      padding: 14px 18px;
      border-radius: 18px;
      font-size: 1.05rem;
      font-weight: 700;
      line-height: 1.5;
    }
    /* ── Faker PROMPT: classified question card ──────────────────────────── */
    .question-card.classified {
      background: linear-gradient(160deg, #1A0A02 0%, #2C1308 100%);
      border: 2px solid rgba(224,90,32,0.40);
      border-radius: 22px;
      padding: 0;
      overflow: hidden;
      box-shadow: 0 0 30px rgba(224,90,32,0.18), var(--shadow);
      font-size: inherit;
      font-weight: inherit;
      line-height: inherit;
    }
    .classified-badge {
      background: rgba(224,90,32,0.18);
      border-bottom: 1px solid rgba(224,90,32,0.28);
      padding: 10px 18px;
      font-size: 0.82rem;
      font-weight: 800;
      color: #E05A20;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .classified-body {
      padding: 22px 20px 24px;
      font-size: 1.5rem;
      font-weight: 800;
      line-height: 1.55;
      color: #F5EBE0;
    }

    /* ── Faker identity: pulsing emoji ── */
    @keyframes fakerEmojiPulse {
      0%,100% { transform: scale(1); filter: drop-shadow(0 0 0px rgba(224,90,32,0)); }
      50%     { transform: scale(1.18); filter: drop-shadow(0 0 16px rgba(224,90,32,0.75)); }
    }
    .fi-emoji.pulsing {
      animation: fakerEmojiPulse 1.8s var(--ease-in-out) infinite;
    }

    /* ── Vote buttons with avatar ─────────────────────────────────────────── */
    .btn-vote-avatar {
      display: flex;
      align-items: center;
      gap: 14px;
      background: rgba(255,255,255,0.06);
      border: 1.5px solid rgba(255,255,255,0.12);
      border-radius: 18px;
      padding: 14px 18px;
      width: 100%;
      cursor: pointer;
      text-align: right;
      font-family: inherit;
      font-size: 1.15rem;
      font-weight: 700;
      color: #FFFFFF;
      box-shadow: var(--shadow);
      outline: none;
      text-shadow: none;
      transition: background var(--dur-fast) var(--ease-out-soft),
                  border-color var(--dur-fast) var(--ease-out-soft),
                  transform 0.12s var(--ease-bounce);
    }
    .btn-vote-avatar:not(:disabled):active { transform: scale(0.97); }
    .btn-vote-avatar.selected {
      background: rgba(6,214,160,0.15);
      border-color: var(--accent-teal);
      box-shadow: var(--shadow-teal-vote);
    }
    .btn-vote-avatar.dimmed { opacity: 0.28; cursor: not-allowed; box-shadow: none; }
    .bva-avatar {
      width: 46px;
      height: 46px;
      border-radius: 50%;
      object-fit: cover;
      border: 2px solid rgba(255,255,255,0.14);
      flex-shrink: 0;
    }
    .btn-vote-avatar.selected .bva-avatar { border-color: var(--accent-teal); }
    .bva-name { flex: 1; font-size: 1.15rem; font-weight: 700; }
    .bva-check {
      font-size: 1.15rem;
      color: var(--accent-teal);
      opacity: 0;
      transition: opacity var(--dur-fast);
      flex-shrink: 0;
    }
    .btn-vote-avatar.selected .bva-check { opacity: 1; }

    /* ── Results verdict header ────────────────────────────────────────────── */
    .faker-verdict-header {
      font-size: 2.2rem;
      font-weight: 900;
      margin: 8px 0 4px;
      line-height: 1.2;
    }
    .faker-verdict-header.caught  {
      color: #06D6A0;
      text-shadow: 0 0 22px rgba(6,214,160,0.45);
    }
    .faker-verdict-header.escaped {
      color: #FF6B9D;
      text-shadow: 0 0 22px rgba(255,107,157,0.45);
    }
    .faker-result-name {
      font-weight: 900;
      color: var(--primary);
    }
    /* ── تكذبني · one-action phone controller ─────────────────────────────
       The phone mirrors the television's paper, ink and category character,
       but never repeats host-only detail. Every state has one reading target
       and, when needed, one obvious action. */
    .fkp-stage {
      --fk-accent:#ef5f50;
      position:absolute;
      inset:0;
      width:auto;
      min-height:100svh;
      overflow:hidden;
      display:flex;
      flex-direction:column;
      color:#12110f;
      background:#f8f5ed;
      border:0;
      border-radius:0;
      box-shadow:inset 0 0 48px rgba(64,50,31,.09);
      isolation:isolate;
    }
    body.faker-player-phase{background:#f8f5ed!important;overflow:hidden}
    body.faker-player-phase .player-header,
    body.faker-player-phase #player-settings-btn,
    body.faker-player-phase #rxn-fab,
    body.faker-player-phase #auto-advance-indicator{display:none!important}
    body.faker-player-phase #app{position:absolute;inset:0;z-index:40;display:block;overflow:hidden;background:#f8f5ed}
    body.faker-player-phase .screen{position:absolute;inset:0;width:100%;max-width:none;margin:0;padding:0;overflow:hidden}
    body.faker-player-phase .screen-body{padding:0;gap:0;overflow:hidden}
    body.faker-player-phase .screen-foot{display:none!important}
    .fkp-stage.fk-point{--fk-accent:#58bf45}.fkp-stage.fk-fingers{--fk-accent:#2598e9}.fkp-stage.fk-text,.fkp-stage.fk-final{--fk-accent:#8b5a91}
    .fkp-stage::before{content:"";position:absolute;inset:0;z-index:-1;opacity:.18;background-image:radial-gradient(#5d5142 .5px,transparent .65px);background-size:7px 7px}
    .fkp-band{height:9px;flex:0 0 9px;background:var(--fk-accent)}
    .fkp-head{display:grid;grid-template-columns:82px 1fr;align-items:center;gap:14px;min-height:calc(108px + env(safe-area-inset-top,0px));padding:calc(12px + env(safe-area-inset-top,0px)) 22px 9px;border-bottom:6px solid #0a0908;box-shadow:0 4px 0 color-mix(in srgb,var(--fk-accent) 75%,transparent)}
    .fkp-character{width:76px;height:86px;background:url('/assets/faker/art/host-hand-male.png') center bottom/contain no-repeat}
    .fkp-sprite-1{background-image:url('/assets/faker/art/host-point-male.png')}.fkp-sprite-2{background-image:url('/assets/faker/art/host-number-male.png')}.fkp-sprite-3{background-image:url('/assets/faker/art/host-note-male.png')}
    .fkp-head small{display:block;color:var(--fk-accent);font-size:.72rem;font-weight:1000}.fkp-head strong{display:block;font-size:1.3rem;font-weight:1000;line-height:1.15}
    .fkp-body{flex:1;display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:18px;padding:24px 22px calc(30px + env(safe-area-inset-bottom,0px));text-align:right}
    .fkp-kicker{color:var(--fk-accent);font-size:.8rem;font-weight:1000}
    .fkp-task{margin:0;color:#12110f;font-size:clamp(1.65rem,7.2vw,2.5rem);line-height:1.32;font-weight:1000;letter-spacing:-.025em}
    .fkp-note{margin:0;color:#615b52;font-size:.92rem;font-weight:750;line-height:1.5}
    .fkp-secret{position:relative;padding:19px 17px 21px;color:#fff;background:#0b0a09;clip-path:polygon(2% 4%,98% 0,100% 89%,91% 100%,3% 94%,0 17%)}
    .fkp-secret::after{content:"";position:absolute;right:0;bottom:0;left:0;height:7px;background:var(--fk-accent)}
    .fkp-secret .fkp-task{color:#fff}.fkp-secret .fkp-kicker{color:var(--fk-accent)}
    .fkp-faker-avatar{width:150px;height:180px;align-self:center;object-fit:contain;border-radius:0;background:transparent;filter:grayscale(1) brightness(.08) drop-shadow(0 10px 0 rgba(0,0,0,.10));border:0;transform:rotate(-3deg)}
    .fkp-faker-title{text-align:center;font-size:clamp(2.25rem,10vw,3.4rem);font-weight:1000;line-height:1;color:#0b0a09}
    .fkp-faker-title span{display:block;margin-top:8px;color:var(--fk-accent);font-size:.38em;line-height:1.3}
    .fkp-vote-list{display:grid;gap:10px}
    .fkp-vote{width:100%;min-height:78px;display:flex;align-items:center;gap:13px;padding:7px 16px;border:0;border-radius:0;color:#111;background:#fffdf8;clip-path:polygon(2% 5%,98% 0,100% 88%,92% 100%,3% 93%,0 16%);box-shadow:0 2px 0 rgba(10,9,8,.18);font-family:inherit;font-size:1.05rem;font-weight:1000;text-align:right;transition:.18s transform,.18s opacity,.18s background}
    .fkp-vote:nth-child(2n){transform:rotate(.7deg)}.fkp-vote:active:not(:disabled){transform:scale(.97)}
    .fkp-vote img{width:58px;height:62px;object-fit:contain;border-radius:0;background:transparent;filter:drop-shadow(0 4px 0 rgba(0,0,0,.08))}.fkp-vote i{margin-right:auto;color:var(--fk-accent);font-style:normal;font-size:1.5rem;opacity:0}
    .fkp-vote.selected{color:#fff;background:#0b0a09}.fkp-vote.selected i{opacity:1}.fkp-vote.dimmed{opacity:.28}
    .fkp-category-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px}
    .fkp-category{--cat:#ef5f50;min-height:168px;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:6px;padding:8px 8px 14px;border:0;border-bottom:8px solid var(--cat);color:#111;background:#fffdf8;font:1000 1rem/1.2 inherit;clip-path:polygon(3% 3%,97% 0,100% 91%,90% 100%,2% 95%,0 15%);transition:transform .16s ease,filter .16s ease}
    .fkp-category:active{transform:scale(.95);filter:brightness(.94)}.fkp-category img{width:100%;height:112px;object-fit:contain;border:0;border-radius:0;filter:drop-shadow(0 5px 0 rgba(0,0,0,.1))}
    .fkp-category.cat-point{--cat:#58bf45}.fkp-category.cat-fingers{--cat:#2598e9}.fkp-category.cat-text{--cat:#8b5a91}
    .fkp-wait-character{width:min(72vw,290px);height:40svh;align-self:center;background:center bottom/contain no-repeat;animation:fkp-wait-bob 1.4s ease-in-out infinite alternate}
    @keyframes fkp-wait-bob{to{transform:translateY(-8px) rotate(1deg)}}
    @media (prefers-reduced-motion:reduce){.fkp-wait-character{animation:none}}
    .fkp-textarea{width:100%;min-height:150px;resize:none;padding:18px;border:0;border-bottom:8px solid var(--fk-accent);border-radius:0;color:#111;background:#fff;font:900 1.25rem/1.5 inherit;outline:0;box-shadow:0 7px 0 rgba(0,0,0,.08)}
    .fkp-submit{width:100%;min-height:58px;border:0;border-radius:0;color:#fff;background:#0b0a09;font:1000 1.05rem inherit;clip-path:polygon(1% 6%,98% 0,100% 87%,94% 100%,2% 94%,0 15%)}
    .fkp-ready{width:100%;min-height:68px;border:4px solid #0b0a09;border-radius:0;color:#0b0a09;background:var(--fk-accent);font:800 1.2rem inherit;box-shadow:7px 8px 0 #0b0a09;clip-path:none}
    .fkp-ready:disabled{opacity:1;color:#fff;background:#0b0a09;box-shadow:none}
    .fkp-answer-vote{min-height:94px;padding:15px 18px}.fkp-answer-vote span{font-size:1.08rem;line-height:1.35}.fkp-answer-vote img{display:none}
    .fkp-verdict{text-align:center;font-size:clamp(2.1rem,9vw,3.3rem);font-weight:1000;line-height:1.05}.fkp-verdict span{display:block;margin-top:8px;color:var(--fk-accent);font-size:.38em;line-height:1.45}
    .fkp-score{display:grid;grid-template-columns:76px 1fr auto;align-items:center;gap:12px;padding:9px 14px;background:#fffdf8;border-bottom:2px solid rgba(11,10,9,.2);transform-origin:center;animation:fkp-score-in .44s calc(var(--i)*70ms) cubic-bezier(.2,.72,.22,1) both}
    .fkp-score.has-gain{background:color-mix(in srgb,var(--fk-accent) 13%,#fffdf8)}.fkp-score.is-leader{border-right:7px solid var(--fk-accent)}
    @keyframes fkp-score-in{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
    .fkp-score img{width:68px;height:74px;object-fit:contain;border-radius:0;border:0;filter:drop-shadow(0 5px 0 rgba(0,0,0,.1))}.fkp-score strong{font-size:1.08rem}.fkp-score b{font-size:1.5rem;font-variant-numeric:tabular-nums}.fkp-score em{display:block;color:var(--fk-accent);font-style:normal;font-size:.8rem;font-weight:1000}
    .fkp-score.is-counting{z-index:3;animation:none;transform:translateX(-4px);background:color-mix(in srgb,var(--fk-accent) 24%,#fffdf8);transition:transform .3s ease,background .3s ease}
    .fkp-score.is-counting img{transform:scale(1.18)}.fkp-score.is-counting b{font-size:2rem;color:var(--fk-accent)}
    .fkp-own-score{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:8px;animation:fkp-own-score-in .7s cubic-bezier(.18,.9,.22,1.18) both}
    @keyframes fkp-own-score-in{from{opacity:0;transform:translateY(35px) scale(.75)}}
    .fkp-own-score img{width:min(42vw,170px);height:min(31svh,230px);object-fit:contain;border:0;border-radius:0;filter:drop-shadow(0 10px 0 rgba(0,0,0,.1));transition:transform .4s cubic-bezier(.18,.9,.22,1.2)}
    .fkp-own-score b{color:var(--fk-accent);font-size:clamp(3.4rem,18vw,6rem);font-weight:1000;line-height:.9;font-variant-numeric:tabular-nums;letter-spacing:-.06em}
    .fkp-own-score strong{font-size:clamp(1.3rem,6vw,2rem)}
    .fkp-own-score em{padding:4px 13px 7px;color:#fff;background:#0b0a09;clip-path:polygon(3% 8%,97% 0,100% 88%,84% 100%,3% 93%,0 18%);font-style:normal;font-weight:1000}
    .fkp-own-score.is-counting img{transform:scale(1.15) rotate(-2deg)}.fkp-own-score.is-counting b{transform:scale(1.12)}
    .fkp-stage.is-category-pick .fkp-band,
    .fkp-stage.is-category-pick .fkp-head{display:none}
    .fkp-stage.is-category-pick .fkp-body{padding-top:calc(22px + env(safe-area-inset-top,0px));justify-content:center}
    .fkp-final-hero{display:flex;flex-direction:column;align-items:center;gap:8px;padding:20px 16px 24px;border:5px solid #0b0a09;background:#fffdf8;box-shadow:9px 10px 0 #0b0a09;text-align:center}
    .fkp-final-hero img{width:min(46vw,190px);height:min(31svh,230px);object-fit:contain;filter:drop-shadow(0 8px 0 rgba(0,0,0,.11))}
    .fkp-final-label{color:var(--fk-accent);font-size:.9rem;font-weight:900}
    .fkp-final-name{color:#0b0a09;font-size:clamp(2rem,9vw,3.1rem);font-weight:1000;line-height:1.08}
    .fkp-final-score{display:inline-flex;align-items:baseline;gap:7px;padding:8px 16px 10px;color:#fff;background:#0b0a09;font-size:clamp(1.75rem,8vw,2.7rem);font-weight:900;font-variant-numeric:tabular-nums}
    .fkp-final-score small{font-size:.44em;color:#fff;opacity:.86}
    .fkp-stage.is-final.is-winner .fkp-final-hero{background:color-mix(in srgb,var(--fk-accent) 22%,#fffdf8)}
    body[data-theme="faker"] #mob-cd-overlay{background:#f8f5ed!important}
    body[data-theme="faker"] #mob-cd-overlay::before{content:"";position:absolute;inset:0;background:#f8f5ed;box-shadow:inset 0 0 48px rgba(64,50,31,.09)}
    body[data-theme="faker"] .mob-cd-label,body[data-theme="faker"] .mob-cd-num,body[data-theme="faker"] .mob-cd-go{position:relative;z-index:1;color:#111;text-shadow:none}
    /* ── Answer-submission countdown ─────────────────────────────────────── */
    .answer-timer {
      position: relative;
      display: inline-flex; align-items: center; gap: 8px;
      margin: 4px auto 14px;
      padding: 8px 20px;
      background: color-mix(in srgb, var(--primary) 18%, transparent);
      border: 2px solid color-mix(in srgb, var(--primary) 50%, transparent);
      border-radius: 999px;
      box-shadow: 0 2px 12px color-mix(in srgb, var(--primary) 20%, transparent);
      font-size: 1.45rem;
      font-weight: 900; color: var(--primary);
      min-width: 110px; justify-content: center;
      overflow: hidden;
      transition: color var(--dur-base) var(--ease-out),
                  background var(--dur-base) var(--ease-out),
                  border-color var(--dur-base) var(--ease-out);
    }
    .answer-timer .at-clock { font-size: 0.85em; }
    .answer-timer .at-num   { font-variant-numeric: tabular-nums; min-width: 1.6ch; text-align: center; }
    .answer-timer .at-unit  { font-size: 0.65em; color: var(--muted); }
    .answer-timer .at-fill {
      position: absolute; left: 0; bottom: 0; height: 4px;
      width: 100%; transform-origin: left center;
      background: var(--primary);
      transition: transform var(--dur-medium) linear, background var(--dur-base) var(--ease-out);
    }
    .answer-timer.urgent {
      background: rgba(255,60,60,0.18);
      border-color: rgba(255,60,60,0.55);
      color: var(--color-timer-urgent);
      animation: pTimer-pulse var(--dur-cinematic) var(--ease-in-out) infinite alternate;
    }
    .answer-timer.urgent .at-unit { color: rgba(255,100,80,0.75); }
    .answer-timer.urgent .at-fill { background: var(--color-timer-urgent); }
    .answer-timer.critical {
      animation: pTimer-critical var(--dur-fill) var(--ease-in-out) infinite alternate;
    }
    @keyframes pTimer-critical {
      from { transform: scale(1); }
      to   { transform: scale(1.12); }
    }
    .answer-timer.paused {
      background: rgba(255,255,255,0.07);
      border-color: rgba(255,255,255,0.15);
      color: var(--muted);
    }
    .answer-timer.paused .at-fill { background: var(--muted); transition: none; }
    @keyframes pTimer-pulse {
      from { transform: scale(1); }
      to   { transform: scale(1.05); }
    }

    .done-card {
      background: var(--accent-teal);
      color: var(--color-on-primary);
      border-radius: 26px;
      padding: 36px 22px;
      font-size: 1.8rem;
      font-weight: 900;
      box-shadow: var(--shadow-teal-card);
      animation: done-pop var(--dur-medium) var(--ease-spring-pop);
    }
    @keyframes done-pop {
      0% { transform: scale(0.9); opacity: 0; }
      100% { transform: scale(1); opacity: 1; }
    }
    .done-card .sub { font-size: 1.1rem; font-weight: 600; opacity: 0.9; margin-top: 10px; }
    .voted-banner {
      background: var(--accent-teal);
      color: var(--color-on-primary);
      border-radius: 20px;
      padding: 16px;
      font-size: 1.2rem;
      font-weight: 800;
      box-shadow: var(--shadow-teal-card-soft);
    }

    /* ── Mini roster (live progress feed of teammates) ─────────────────────
       Mirrors the host roster from host.html so players know who they're
       waiting on while their submission/vote is locked in. Reuses the same
       teal "done" + neutral "pending" treatment, just sized for mobile. */
    @keyframes mr-done-pop {
      0%   { transform: scale(1); }
      40%  { transform: scale(1.18); }
      100% { transform: scale(1); }
    }
    @keyframes mr-pending-float {
      0%, 100% { transform: translateY(0); }
      50%      { transform: translateY(-3px); }
    }
    .mini-roster {
      display: flex; flex-direction: column;
      gap: var(--sp-2);
      background: var(--card);
      border-radius: var(--rad-lg, 18px);
      padding: var(--sp-3);
      box-shadow: var(--shadow);
      width: 100%;
      box-sizing: border-box;
    }
    .mini-roster-title {
      font-size: 0.85rem;
      font-weight: 800;
      color: var(--muted);
      text-align: center;
    }
    .mini-roster-title b {
      color: var(--accent-teal);
      font-variant-numeric: tabular-nums;
    }
    .mini-roster-chips {
      display: flex; flex-wrap: wrap; justify-content: center;
      gap: 8px 10px;
    }
    .mr-chip {
      flex-shrink: 0;
      display: inline-flex; align-items: center; gap: 6px;
      padding: 5px 10px 5px 7px;
      border-radius: var(--rad-pill, 999px);
      background: var(--input-bg);
      font-size: 0.95rem;
      font-weight: 700;
      max-width: 100%;
      transition: background var(--dur-fast) var(--ease-out-soft),
                  color var(--dur-fast) var(--ease-out-soft);
    }
    .mr-chip .mr-bubble {
      flex-shrink: 0;
      width: 22px; height: 22px;
      border-radius: 50%;
      display: inline-flex; align-items: center; justify-content: center;
      font-size: 0.85rem;
      line-height: 1;
    }
    .mr-chip .mr-name {
      white-space: nowrap;
    }
    .mr-chip.is-pending {
      color: var(--muted);
    }
    .mr-chip.is-pending .mr-bubble {
      background: var(--card);
      color: var(--muted);
      animation: mr-pending-float var(--dur-loop-float) var(--ease-in-out) infinite;
    }
    .mr-chip.is-done {
      background: var(--accent-teal);
      color: var(--color-on-primary);
    }
    .mr-chip.is-done .mr-bubble {
      background: var(--color-overlay-on-dark-soft, rgba(255,255,255,0.22));
      color: var(--color-on-primary);
      animation: mr-done-pop var(--dur-medium) var(--ease-out);
    }
    .mr-chip.is-self {
      outline: 2px solid var(--primary);
      outline-offset: 1px;
    }
    /* ── شطحات duel UI ─────────────────────────────────────────────────── */
    .duel-prompt-meta {
      font-size: 1rem;
      font-weight: 700;
      color: var(--muted);
      letter-spacing: 0.02em;
      margin-bottom: 6px;
    }
    .duel-prompt-meta b { color: var(--primary); }
    .duel-vote-btn {
      display: flex; align-items: center; gap: 14px;
      padding: 18px 16px;
    }
    .duel-vote-btn .dvb-side {
      flex-shrink: 0;
      width: 44px; height: 44px;
      border-radius: 12px;
      background: var(--primary);
      color: var(--color-on-primary);
      font-weight: 900;
      font-size: 1.4rem;
      display: flex; align-items: center; justify-content: center;
      box-shadow: 0 4px 12px var(--shadow-duel-side-mobile);
    }
    .duel-vote-btn.selected .dvb-side {
      background: var(--color-overlay-on-dark-mid);
      box-shadow: none;
    }
    .duel-vote-btn .dvb-text {
      flex: 1;
      text-align: right;
      line-height: 1.4;
    }
    .sh-player-vote {
      width: 100%;
      display: flex;
      flex-direction: column;
      gap: 12px;
      align-items: stretch;
    }
    .sh-player-matchup {
      align-self: center;
      color: var(--muted);
      font-size: .85rem;
      font-weight: 800;
      padding: 5px 12px;
      border: 1px solid rgba(255,255,255,.12);
      border-radius: 999px;
    }
    .sh-player-vote-title {
      min-height: 30px;
      color: #fff;
      font-size: clamp(1.2rem, 6vw, 1.55rem);
      font-weight: 900;
      text-align: center;
    }
    .sh-player-vote-prompt {
      color: #fff;
      font-size: clamp(1.15rem, 5.2vw, 1.45rem);
      font-weight: 850;
      line-height: 1.45;
      text-align: center;
      text-wrap: balance;
      padding: 4px 8px 10px;
      animation: sh-mobile-prompt-in 420ms var(--ease-out-soft) both;
    }
    .sh-player-vote-timer {
      min-height: 38px;
      display: grid;
      place-items: center;
    }
    .sh-player-vote-timer .answer-timer {
      margin: 0;
      width: min(220px, 76%);
      font-size: 1rem;
    }
    .duel-vote-btn.sh-choice {
      position: relative;
      min-height: 92px;
      margin: 0;
      padding: 18px;
      gap: 16px;
      border-radius: 24px;
      border: 1.5px solid rgba(255,255,255,.15);
      background: linear-gradient(145deg, rgba(255,255,255,.105), rgba(255,255,255,.055));
      box-shadow: 0 12px 28px rgba(0,0,0,.18);
      overflow: hidden;
      visibility: hidden;
      opacity: 0;
    }
    .duel-vote-btn.sh-choice.sh-visible {
      visibility: visible;
    }
    .duel-vote-btn.sh-choice.sh-choice-a.sh-visible {
      animation: sh-mobile-a-in 520ms var(--ease-spring-pop) both;
    }
    .duel-vote-btn.sh-choice.sh-choice-b.sh-visible {
      animation: sh-mobile-b-in 520ms var(--ease-spring-pop) both;
    }
    .duel-vote-btn.sh-choice .dvb-side {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      box-shadow: none;
    }
    .duel-vote-btn.sh-choice-b .dvb-side {
      background: var(--accent-teal);
    }
    .duel-vote-btn.sh-choice .dvb-text {
      color: #fff;
      font-size: clamp(1.08rem, 4.8vw, 1.3rem);
      font-weight: 800;
    }
    .duel-vote-btn.sh-choice:disabled {
      opacity: 1;
    }
    .duel-vote-btn.sh-choice.dimmed {
      opacity: .32;
    }
    .duel-vote-btn.sh-choice.selected {
      opacity: 1;
      color: #fff;
      background: linear-gradient(145deg, rgba(6,214,160,.28), rgba(6,214,160,.12));
      border-color: var(--accent-teal);
      box-shadow: 0 0 0 2px rgba(6,214,160,.2), 0 14px 34px rgba(6,214,160,.16);
      transform: scale(1.015);
    }
    .duel-vote-btn.sh-choice.selected::after {
      content: "✓";
      position: absolute;
      top: 10px;
      left: 12px;
      width: 25px;
      height: 25px;
      display: grid;
      place-items: center;
      border-radius: 50%;
      background: var(--accent-teal);
      color: #05231d;
      font-size: .9rem;
      font-weight: 900;
      animation: sh-mobile-check 260ms var(--ease-spring-pop) both;
    }
    .sh-player-vote-ack {
      min-height: 28px;
      color: var(--accent-teal);
      font-size: 1rem;
      font-weight: 850;
      text-align: center;
    }
    @keyframes sh-mobile-prompt-in {
      from { opacity: 0; transform: translateY(-10px); }
      to { opacity: 1; transform: none; }
    }
    @keyframes sh-mobile-a-in {
      0% { opacity: 0; transform: translateX(-55px) rotate(-2deg) scale(.94); }
      70% { opacity: 1; transform: translateX(5px) scale(1.015); }
      100% { opacity: 1; transform: none; }
    }
    @keyframes sh-mobile-b-in {
      0% { opacity: 0; transform: translateX(55px) rotate(2deg) scale(.94); }
      70% { opacity: 1; transform: translateX(-5px) scale(1.015); }
      100% { opacity: 1; transform: none; }
    }
    @keyframes sh-mobile-check {
      from { opacity: 0; transform: scale(.3) rotate(-14deg); }
      to { opacity: 1; transform: none; }
    }

    /* ── Shathaat phone stage: pure paper, hard ink, no blur ───────────── */
    body.shathaat-player-phase {
      background-color: #075a78;
      background-image:
        repeating-radial-gradient(circle at 50% 40%, rgba(255,255,255,.035) 0 2px, transparent 2px 48px),
        linear-gradient(112deg, #075a78 0 64%, #064e69 64% 100%);
    }
    body.shathaat-player-phase .player-header { display: none !important; }
    body.shathaat-player-phase .screen {
      min-height: 100dvh;
      background: transparent;
    }
    body.shathaat-player-phase .screen-body {
      justify-content: safe center;
      gap: 14px;
      padding-top: max(22px, env(safe-area-inset-top));
    }
    body.shathaat-player-phase .screen-foot {
      background: transparent;
      border: 0;
      padding-bottom: max(18px, env(safe-area-inset-bottom));
    }
    .sh-phone-step {
      align-self: center;
      padding: 4px 11px;
      border: 3px solid #07090d;
      background: #fff;
      color: #07090d;
      font-size: .8rem;
      font-weight: 900;
      transform: rotate(-1deg);
    }
    .sh-question-progress {
      align-self: center;
      width: min(280px, 86%);
      display: grid;
      grid-template-columns: 1fr 24px 1fr;
      align-items: center;
      direction: rtl;
    }
    .sh-question-progress-item {
      min-height: 34px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      padding: 4px 10px;
      border: 2px solid rgba(255,255,255,.72);
      color: rgba(255,255,255,.82);
      font-size: .78rem;
      font-weight: 900;
      line-height: 1;
    }
    .sh-question-progress-item.is-current {
      border-color: #07090d;
      background: #fff;
      color: #07090d;
      box-shadow: 3px 3px 0 #07090d;
      transform: rotate(-1deg);
    }
    .sh-question-progress-item.is-done {
      border-color: #07090d;
      background: #07090d;
      color: #fff;
    }
    .sh-question-progress-number {
      min-width: 1.25em;
      font-size: .95rem;
      text-align: center;
    }
    .sh-question-progress-line {
      height: 3px;
      background: #07090d;
    }
    .sh-phone-title {
      margin: 0;
      color: #fff;
      font-size: clamp(1.5rem, 7vw, 2.05rem);
      font-weight: 900;
      line-height: 1.2;
      text-align: center;
      text-shadow: 2px 2px 0 #07090d, -1px -1px 0 #07090d;
    }
    .sh-phone-question,
    .sh-player-vote-prompt {
      width: 100%;
      box-sizing: border-box;
      padding: 18px 16px;
      border: 5px solid #07090d;
      border-radius: 3px 8px 4px 7px;
      background: #fff;
      color: #07090d;
      box-shadow: 7px 8px 0 #07090d;
      font-size: clamp(1.15rem, 5.4vw, 1.48rem);
      font-weight: 900;
      line-height: 1.45;
      text-align: center;
      text-wrap: balance;
    }
    .sh-phone-write {
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 16px;
    }
    .sh-phone-write textarea {
      min-height: 126px;
      border: 5px solid #07090d;
      border-radius: 0;
      background: #fff;
      color: #07090d;
      box-shadow: 7px 8px 0 #07090d;
      font-size: 1.16rem;
      font-weight: 800;
    }
    .sh-phone-write textarea:focus {
      border-color: #07090d;
      outline: 4px solid #ffd22e;
      box-shadow: 7px 8px 0 #07090d;
    }
    .sh-phone-submit {
      width: 100%;
      border: 5px solid #07090d !important;
      border-radius: 0 !important;
      background: #ffd22e !important;
      color: #07090d !important;
      box-shadow: 7px 8px 0 #07090d !important;
      font-weight: 700 !important;
      text-shadow: none !important;
      letter-spacing: 0 !important;
    }
    .sh-phone-wait {
      display: grid;
      place-items: center;
      gap: 14px;
      min-height: 58dvh;
      color: #fff;
      text-align: center;
    }
    .sh-phone-wait-mark {
      width: 72px;
      height: 72px;
      display: grid;
      place-items: center;
      border: 5px solid #07090d;
      background: #fff;
      color: #07090d;
      box-shadow: 7px 8px 0 #07090d;
      font-size: 2.1rem;
      font-weight: 900;
      transform: rotate(-2deg);
    }
    .sh-phone-vote,
    .sh-player-vote {
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 14px;
    }
    .sh-player-vote-title {
      min-height: 0;
      color: #fff;
      font-size: clamp(1.45rem, 7vw, 2rem);
      text-shadow: 2px 2px 0 #07090d, -1px -1px 0 #07090d;
    }
    .sh-player-vote-prompt { padding: 12px 14px; }
    .duel-vote-btn.sh-choice {
      min-height: 104px;
      padding: 22px 18px;
      border: 5px solid #07090d;
      border-radius: 3px 8px 4px 7px;
      background: #fff;
      box-shadow: 7px 8px 0 #07090d;
      overflow: visible;
    }
    .duel-vote-btn.sh-choice-b {
      border-radius: 8px 3px 7px 4px;
    }
    .duel-vote-btn.sh-choice .dvb-text {
      color: #07090d;
      font-size: clamp(1.12rem, 5.2vw, 1.42rem);
      font-weight: 900;
      text-align: center;
    }
    .duel-vote-btn.sh-choice.selected {
      background: #ffd22e;
      border-color: #07090d;
      box-shadow: 7px 8px 0 #07090d;
      transform: translate(-2px, -2px);
    }
    .duel-vote-btn.sh-choice.selected::after {
      top: -13px;
      left: -10px;
      width: 36px;
      height: 36px;
      border: 4px solid #fff;
      background: #07090d;
      color: #fff;
    }
    .duel-vote-btn.sh-choice.dimmed { opacity: .42; }
    .sh-player-vote-timer .answer-timer,
    .sh-phone-write .answer-timer {
      border: 4px solid #07090d;
      border-radius: 0;
      background: #fff;
      color: #07090d;
      box-shadow: 5px 6px 0 #07090d;
    }
    .sh-player-vote-ack {
      min-height: 24px;
      color: #fff;
      text-shadow: 2px 2px 0 #07090d;
    }
    body.shathaat-player-phase .final-vote-card {
      border: 5px solid #07090d;
      border-radius: 0;
      background: #fff;
      color: #07090d;
      box-shadow: 7px 8px 0 #07090d;
      margin-bottom: 0;
    }
    .sh-phone-write:has(.final-vote-card) { gap: 12px; }
    body.shathaat-player-phase .final-vote-card.has-votes {
      border-color: #07090d;
      background: #ffd22e;
      box-shadow: 7px 8px 0 #07090d;
    }
    body.shathaat-player-phase .final-vote-card .fvc-text { color: #07090d; }
    body.shathaat-player-phase .screen-body.scrollable { justify-content: flex-start; }
    body.shathaat-player-phase .screen-body:has(.final-vote-card) { padding-block: 8px; }
    body.shathaat-player-phase .final-vote-card .fvc-btn {
      border: 3px solid #07090d;
      border-radius: 0;
      background: #fff;
      color: #07090d;
      box-shadow: 3px 3px 0 #07090d;
    }
    body.shathaat-player-phase .final-vote-card .fvc-btn.fvc-plus {
      background: #ffd22e;
    }
    body.shathaat-player-phase .final-vote-card .fvc-count { color: #07090d; }
    /* ── Khedaa phone deck ────────────────────────────────────────────────
       The phone uses the same paper-and-ink construction as Shathaat, with
       gold/orange reserved for the sealed truth and the player's choice. */
    body.khedaa-player-phase {
      background: #075a78 !important;
      background-image:
        linear-gradient(rgba(2,34,50,.48), rgba(2,34,50,.48)),
        var(--mj-art-khedaa),
        repeating-radial-gradient(circle at 50% 42%, rgba(255,255,255,.035) 0 2px, transparent 2px 48px),
        linear-gradient(112deg, #075a78 0 64%, #064e69 64% 100%) !important;
      background-position: center !important;
      background-size: cover, cover, auto, cover !important;
    }
    body.khedaa-player-phase .player-header { display: none !important; }
    body.khedaa-player-phase .screen {
      min-height: 100dvh;
      background: transparent;
    }
    body.khedaa-player-phase .screen-body {
      justify-content: safe center;
      gap: 14px;
      padding-top: max(18px, env(safe-area-inset-top));
      padding-bottom: 16px;
    }
    body.khedaa-player-phase .screen-foot {
      background: transparent;
      border: 0;
      padding-bottom: max(17px, env(safe-area-inset-bottom));
    }
    .kdp-stage {
      --kdp-ink: #07090d;
      --kdp-paper: #fffdf7;
      --kdp-gold: #f2b92f;
      --kdp-orange: #ee6a24;
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 14px;
      color: #fff;
      direction: rtl;
    }
    .kdp-hud {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }
    .kdp-brand,
    .kdp-round,
    .kdp-mult {
      border: 3px solid var(--kdp-ink);
      background: var(--kdp-paper);
      color: var(--kdp-ink);
      box-shadow: 4px 4px 0 var(--kdp-ink);
      font-size: .78rem;
      font-weight: 900;
      padding: 5px 9px;
    }
    .kdp-brand { transform: rotate(-1deg); }
    .kdp-round { transform: rotate(1deg); }
    .kdp-hud-meta {
      display: flex;
      align-items: center;
      gap: 7px;
      margin-left: 48px;
    }
    .kdp-mult { background: var(--kdp-gold); transform: rotate(-2deg); }
    .kdp-question {
      padding: 16px 14px;
      border: 5px solid var(--kdp-ink);
      border-radius: 3px 8px 4px 7px;
      background: var(--kdp-paper);
      color: var(--kdp-ink);
      box-shadow: 7px 8px 0 var(--kdp-ink);
      font-size: clamp(1.08rem, 5.2vw, 1.42rem);
      font-weight: 900;
      line-height: 1.42;
      text-align: center;
      text-wrap: balance;
    }
    .kdp-instruction {
      margin: 0;
      color: #fff;
      font-size: clamp(1.35rem, 6.4vw, 1.8rem);
      font-weight: 900;
      line-height: 1.2;
      text-align: center;
      text-shadow: 2px 2px 0 var(--kdp-ink), -1px -1px 0 var(--kdp-ink);
    }
    .kdp-timer { display: grid; place-items: center; min-height: 42px; }
    .kdp-timer .answer-timer {
      min-width: 98px;
      margin: 0;
      border: 4px solid var(--kdp-ink);
      border-radius: 0;
      background: var(--kdp-paper);
      color: var(--kdp-ink);
      box-shadow: 5px 6px 0 var(--kdp-ink);
    }
    .kdp-timer .at-fill { background: var(--kdp-orange); }
    .kdp-input {
      width: 100%;
      min-height: 122px;
      box-sizing: border-box;
      padding: 15px;
      border: 5px solid var(--kdp-ink);
      border-radius: 0;
      background: var(--kdp-paper);
      color: var(--kdp-ink);
      box-shadow: 7px 8px 0 var(--kdp-ink);
      font: 800 1.12rem/1.5 inherit;
      resize: vertical;
    }
    .kdp-input:focus {
      outline: 4px solid var(--kdp-gold);
      border-color: var(--kdp-ink);
      background: var(--kdp-paper);
      color: var(--kdp-ink);
    }
    .kdp-input::placeholder { color: #7b756a; font-weight: 700; }
    .kdp-submit {
      width: 100%;
      border: 5px solid var(--kdp-ink) !important;
      border-radius: 0 !important;
      background: var(--kdp-gold) !important;
      color: var(--kdp-ink) !important;
      box-shadow: 7px 8px 0 var(--kdp-ink) !important;
      font-weight: 900 !important;
      text-shadow: none !important;
    }
    .kdp-submit:disabled { opacity: .62; }
    .kdp-note,
    .kdp-error {
      padding: 9px 11px;
      border: 3px solid var(--kdp-ink);
      background: var(--kdp-paper);
      color: var(--kdp-ink);
      box-shadow: 4px 4px 0 var(--kdp-ink);
      font-size: .82rem;
      font-weight: 800;
      line-height: 1.45;
      text-align: center;
    }
    .kdp-error { background: #ffdfd6; color: #741f13; }
    .kdp-wait {
      min-height: 58dvh;
      display: grid;
      place-items: center;
      align-content: center;
      gap: 16px;
      text-align: center;
    }
    .kdp-seal {
      width: 68px;
      height: 68px;
      display: grid;
      place-items: center;
      border: 6px double var(--kdp-ink);
      border-radius: 50%;
      background: var(--kdp-gold);
      color: var(--kdp-ink);
      box-shadow: 6px 7px 0 var(--kdp-ink);
      font-size: 1.8rem;
      font-weight: 900;
      transform: rotate(-7deg);
    }
    .kdp-wait h1 {
      margin: 0;
      color: #fff;
      font-size: clamp(1.7rem, 8vw, 2.2rem);
      font-weight: 900;
      text-shadow: 2px 2px 0 var(--kdp-ink), -1px -1px 0 var(--kdp-ink);
    }
    .kdp-my-lie,
    .kdp-truth-card {
      width: 100%;
      box-sizing: border-box;
      padding: 15px;
      border: 5px solid var(--kdp-ink);
      background: var(--kdp-paper);
      color: var(--kdp-ink);
      box-shadow: 7px 8px 0 var(--kdp-ink);
      font-size: 1.06rem;
      font-weight: 900;
      line-height: 1.45;
      text-align: center;
    }
    .kdp-truth-card { background: var(--kdp-gold); }
    .kdp-choice-list {
      display: grid;
      grid-template-columns: 1fr;
      gap: 11px;
    }
    .kdp-choice-list.is-dense {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
    }
    .kdp-choice {
      position: relative;
      width: 100%;
      min-height: 82px;
      margin: 0;
      padding: 15px 52px 15px 15px;
      border: 5px solid var(--kdp-ink);
      border-radius: 3px 8px 4px 7px;
      background: var(--kdp-paper);
      color: var(--kdp-ink);
      box-shadow: 7px 8px 0 var(--kdp-ink);
      font: 900 clamp(1rem, 4.8vw, 1.3rem)/1.4 inherit;
      text-align: center;
      overflow-wrap: anywhere;
    }
    .kdp-choice:nth-child(even) { border-radius: 8px 3px 7px 4px; }
    .kdp-choice-list.is-dense .kdp-choice {
      min-height: 84px;
      padding: 11px 39px 11px 9px;
      border-width: 4px;
      box-shadow: 5px 6px 0 var(--kdp-ink);
      font-size: clamp(.86rem, 3.9vw, 1.02rem);
    }
    .kdp-choice-number {
      position: absolute;
      top: 50%;
      right: -10px;
      width: 42px;
      height: 42px;
      display: grid;
      place-items: center;
      border: 4px solid var(--kdp-ink);
      border-radius: 50%;
      background: var(--kdp-orange);
      color: #fff;
      transform: translateY(-50%) rotate(4deg);
    }
    .kdp-choice-list.is-dense .kdp-choice-number {
      right: -8px;
      width: 34px;
      height: 34px;
      border-width: 3px;
      font-size: .9rem;
    }
    .kdp-choice.selected {
      background: var(--kdp-gold);
      transform: translate(-2px, -2px);
    }
    .kdp-choice.dimmed { opacity: .38; }
    .kdp-choice.is-own {
      background: #163247;
      color: rgba(255,255,255,.68);
      border-color: var(--kdp-ink);
    }
    .kdp-choice.is-own .kdp-choice-number { background: #fff; color: var(--kdp-ink); }
    .kdp-voted {
      color: #fff;
      font-size: 1rem;
      font-weight: 900;
      text-align: center;
      text-shadow: 2px 2px 0 var(--kdp-ink);
    }
    body.khedaa-player-phase .score-card {
      border: 5px solid #07090d;
      border-radius: 0;
      background: #fffdf7;
      color: #07090d;
      box-shadow: 7px 8px 0 #07090d;
    }
    body.khedaa-player-phase .rank-chip {
      border: 4px solid #07090d;
      border-radius: 0;
      box-shadow: 5px 5px 0 #07090d;
      color: #07090d;
    }
    @media (prefers-reduced-motion: reduce) {
      .kdp-stage * { animation-duration: 1ms !important; transition-duration: 1ms !important; }
    }
    /* ── Game-phase title bar ─────────────────────────────────────────────── */
    .gp-bar {
      display: flex; flex-direction: column;
      align-items: center;
      padding: 2px 0 14px;
      gap: 2px; flex-shrink: 0;
    }
    .gp-bar-icon {
      font-size: 2.4rem; line-height: 1;
      filter: drop-shadow(0 2px 10px rgba(0,0,0,0.5));
    }
    .gp-bar-name {
      font-size: 2rem; font-weight: 900; color: #FFFFFF;
      text-shadow: -1px -1px 0 rgba(0,0,0,0.55), 1px -1px 0 rgba(0,0,0,0.55),
                   -1px 1px 0 rgba(0,0,0,0.55),  1px 1px 0 rgba(0,0,0,0.55);
      line-height: 1.15; letter-spacing: 0.02em;
    }
    .gp-bar-sub {
      font-size: 1rem; font-weight: 700;
      color: rgba(255,255,255,0.60);
      margin-top: 2px;
    }

    /* Final-round vote distribution cards */
    .final-vote-card {
      background: var(--card);
      border-radius: 20px;
      padding: 16px 14px;
      margin-bottom: 12px;
      box-shadow: var(--shadow);
      transition: var(--bounce);
    }
    .final-vote-card.has-votes {
      box-shadow: var(--shadow-teal-card-faint);
      outline: 2px solid var(--accent-teal);
    }
    .final-vote-card .fvc-text {
      font-size: 1.15rem;
      font-weight: 700;
      line-height: 1.45;
      color: var(--text);
      margin-bottom: 12px;
      text-align: right;
    }
    .final-vote-card .fvc-controls {
      display: flex; align-items: center; justify-content: center;
      gap: 16px;
    }
    .final-vote-card .fvc-btn {
      width: 52px; height: 52px;
      border-radius: 14px;
      font-size: 1.7rem;
      font-weight: 900;
      background: var(--primary);
      color: var(--color-on-primary);
      box-shadow: var(--shadow);
      padding: 0;
    }
    .final-vote-card .fvc-btn.fvc-minus { background: var(--color-final-vote-minus); }
    .final-vote-card .fvc-btn:disabled {
      opacity: 0.25; box-shadow: none;
    }
    .final-vote-card .fvc-count {
      min-width: 44px;
      font-size: 2rem;
      font-weight: 900;
      color: var(--accent-teal);
      font-variant-numeric: tabular-nums;
      text-align: center;
    }

    /* ── Mobile countdown ── */
    @keyframes mobSoftDrop {
      0%   { opacity: 0; transform: scale(1.12); }
      100% { opacity: 1; transform: scale(1); }
    }
    @keyframes mobSoftExit {
      0%   { opacity: 1; transform: scale(1); }
      100% { opacity: 0; transform: scale(0.88); }
    }
    @keyframes mobVoteGlow {
      0%,100% { text-shadow: 0 0 20px var(--shadow-faker-glow-soft), 0 0 40px var(--shadow-faker-glow-faint); }
      50%      { text-shadow: 0 0 32px var(--shadow-faker-glow-mid),  0 0 60px var(--shadow-faker-glow-deep); }
    }
    .mob-cd-label {
      font-size: 0.9rem; font-weight: 700; color: var(--muted);
    }
    .mob-cd-num {
      font-size: clamp(7rem, 28vw, 11rem);
      font-weight: 900; color: var(--primary); line-height: 1;
      animation: mobSoftDrop var(--dur-tap) var(--ease-out) both;
      user-select: none;
    }
    .mob-cd-num.exit { animation: mobSoftExit var(--dur-base) var(--ease-in-soft) forwards; }
    .mob-cd-go {
      font-size: clamp(2.4rem, 9vw, 4rem);
      font-weight: 900; color: var(--primary);
      text-align: center; line-height: 1.3;
      animation: mobSoftDrop var(--dur-tap) var(--ease-out) both,
                 mobVoteGlow var(--dur-loop-glow) var(--ease-in-out) var(--dur-tap) infinite;
      user-select: none;
    }
    /* Score screens may scroll on short phones. Keep their countdown in the
       flex layout so it never covers the score or rank. */
    .screen-body.scrollable:has(> .score-card) {
      justify-content: safe center;
      padding-bottom: 16px;
    }
    body:has(.score-card) #auto-advance-indicator {
      position: static;
      transform: none;
      align-self: center;
      flex-shrink: 0;
      margin: 0 64px calc(14px + var(--safe-bot));
      max-width: calc(100% - 128px);
      white-space: normal;
    }
    @media (max-height: 600px) {
      .screen-body .score-player-avatar { width: 80px; height: 80px; }
      .screen-body .score-card .sc-value { font-size: 2.8rem; line-height: 1.3; }
    }
    .score-card {
      background: var(--primary);
      color: var(--color-on-primary);
      border-radius: 26px;
      padding: 32px 24px;
      box-shadow: 0 6px 0 #B36E00, 0 10px 30px rgba(229,141,0,0.35);
      outline: 2.5px solid #1A0A00;
      outline-offset: 0;
    }
    .score-card .sc-label { font-size: 1.1rem; font-weight: 700; opacity: 0.88; margin-bottom: 6px; }
    .score-card .sc-value {
      font-size: 4rem; font-weight: 900; letter-spacing: 0.03em;
      text-shadow: -1px -1px 0 rgba(0,0,0,0.3), 1px 1px 4px rgba(0,0,0,0.3);
    }
    .score-card .sc-sub { font-size: 0.95rem; opacity: 0.8; margin-top: 6px; }
    .screen-hint {
      background: var(--card);
      color: var(--muted);
      border-radius: 18px;
      padding: 16px;
      font-size: 1.1rem;
      font-weight: 700;
      box-shadow: var(--shadow);
    }
    .badge {
      display: inline-block;
      background: rgba(255,209,102,0.18);
      color: var(--accent-yellow);
      border: 1.5px solid rgba(255,209,102,0.45);
      padding: 7px 20px;
      border-radius: 999px;
      font-size: 1rem;
      font-weight: 700;
    }
    .rank-chip {
      display: inline-block;
      background: var(--accent-yellow);
      color: #1A0A00;
      border-radius: 999px;
      padding: 10px 28px;
      font-size: 1.15rem;
      font-weight: 900;
      outline: 2.5px solid #1A0A00;
      box-shadow: 0 4px 0 rgba(0,0,0,0.35);
      text-shadow: none;
    }
    .champion-badge { font-size: 2.6rem; font-weight: 900; color: var(--primary); }
    /* ── Join screen (full-bleed, staged pre-game flow) ─────────────────
       Native iPhone first chooses Host or Player inside the lower sheet.
       Player then enters a room code, nickname and avatar as before.
       Join screen — dark navy Figma design (matching Home screen aesthetic). */
    .join-wrap {
      position: absolute;
      inset: 0;
      display: flex;
      flex-direction: column;
      background-color: #071523;
      background-image: var(--mj-art-lobby);
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
      z-index: 1;
      overflow: clip;
    }
    /* Ambient glow blobs */
    .join-wrap::before,
    .join-wrap::after {
      content: '';
      position: absolute;
      border-radius: 50%;
      background: rgba(0, 93, 161, 0.45);
      filter: blur(120px);
      pointer-events: none;
    }
    .join-wrap::before {
      width: clamp(280px, 70vw, 480px);
      height: clamp(280px, 70vw, 480px);
      top: -25%; right: -15%;
    }
    .join-wrap::after {
      width: clamp(300px, 75vw, 500px);
      height: clamp(300px, 75vw, 500px);
      bottom: -25%; left: -15%;
    }
    .join-hero {
      flex: 0 0 auto;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: calc(var(--safe-top) + var(--sp-7)) var(--sp-4) var(--sp-5);
      gap: var(--sp-2);
      position: relative;
      z-index: 1;
      transition: padding var(--dur-slow) var(--ease-out);
    }
    .join-wrap[data-step="name"] .join-hero,
    .join-wrap[data-step="avatar"] .join-hero {
      padding-top: calc(var(--safe-top) + var(--sp-5));
      padding-bottom: var(--sp-3);
    }
    .join-wrap[data-step="avatar"] {
      /* Keep the fixed wallpaper in its own paint boundary while the cards
         animate. Safari otherwise re-rasterizes the blurred backdrop during
         every pointer frame, which looks like the background is drifting. */
      contain: layout paint;
      isolation: isolate;
    }
    .join-wrap[data-step="avatar"] .join-hero { display: none; }
    .join-wrap[data-step="avatar"] .join-sheet {
      border-radius: 0;
      padding-top: calc(var(--safe-top) + var(--sp-6));
      touch-action: pan-y;
      overscroll-behavior: none;
      background: rgba(13, 33, 55, 0.97);
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }
    .join-logo {
      width: min(82vw, 360px);
      height: auto;
      filter: drop-shadow(0 4px 16px rgba(229,141,0,0.35));
      transition: width var(--dur-slow) var(--ease-out);
    }
    .join-wrap[data-step="name"] .join-logo,
    .join-wrap[data-step="avatar"] .join-logo { width: min(62vw, 260px); }
    .join-wrap[data-step="select"] .join-logo {
      width: min(86vw, 380px);
    }
    .join-sheet {
      min-height: 0;
      flex: 1;
      background: rgba(13, 33, 55, 0.92);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: var(--rad-xl) var(--rad-xl) 0 0;
      padding: var(--sp-6) var(--sp-5) calc(var(--sp-6) + var(--safe-bot));
      display: flex;
      flex-direction: column;
      gap: var(--sp-3);
      overflow-y: auto;
      /* overflow-y:auto otherwise computes the other axis as auto too.
         The offset 3D card then creates a tiny horizontal scroll range on
         iOS, making the entire sheet drift while the wheel is dragged. */
      overflow-x: hidden;
      position: relative;
      z-index: 1;
      backdrop-filter: blur(12px);
      box-shadow: 0 -4px 40px rgba(0,0,0,0.35);
    }
    .join-sheet-title {
      font-size: 1.6rem;
      font-weight: 900;
      color: #FFFFFF;
      text-align: right;
    }
    .join-sheet-sub {
      font-size: 0.95rem;
      font-weight: 600;
      color: rgba(255,255,255,0.55);
      text-align: right;
      margin-top: calc(var(--sp-1) * -1);
    }
    /* Confirmation badge that appears on Step 2 showing the entered code. */
    .join-confirm-badge {
      display: flex; align-items: center; justify-content: space-between;
      gap: var(--sp-3);
      background: rgba(229,141,0,0.12);
      border: 1px solid rgba(229,141,0,0.25);
      border-radius: var(--rad-md);
      padding: var(--sp-3) var(--sp-4);
      direction: rtl;
    }
    .join-confirm-badge .jcb-info {
      display: flex; flex-direction: column; gap: var(--sp-1); text-align: right;
    }
    .join-confirm-badge .jcb-label {
      font-size: var(--fs-xs); font-weight: 700;
      color: rgba(255,255,255,0.55);
    }
    .join-confirm-badge .jcb-code {
      font-size: 1.4rem; font-weight: 900;
      letter-spacing: 0.3em; color: var(--color-primary);
      direction: ltr;
    }
    .join-confirm-badge .jcb-change {
      background: transparent; border: none; cursor: pointer;
      font-family: inherit; font-size: 0.95rem; font-weight: 800;
      color: rgba(255,255,255,0.7);
      padding: var(--sp-2) var(--sp-3);
      border-radius: var(--rad-pill);
      min-height: 44px;
      display: inline-flex; align-items: center;
    }
    .join-confirm-badge .jcb-change:active { background: rgba(255,255,255,0.08); }
    .join-field {
      display: flex;
      flex-direction: column;
      gap: var(--sp-1);
      text-align: right;
    }
    .join-label {
      font-size: var(--fs-xs);
      font-weight: 800;
      color: rgba(255,255,255,0.45);
      letter-spacing: 0.03em;
      text-transform: uppercase;
    }
    .join-input {
      font-size: 1.3rem;
      font-weight: 700;
      padding: var(--sp-4);
      background: rgba(255,255,255,0.07);
      border: 2px solid rgba(255,255,255,0.12);
      border-radius: var(--rad-md);
      color: #FFFFFF;
      font-family: inherit;
      text-align: right;
      width: 100%;
      transition: border-color var(--dur-base) var(--ease-out);
    }
    .join-input::placeholder { color: rgba(255,255,255,0.30); font-weight: 400; }
    .join-input:focus { outline: none; border-color: var(--color-primary); background: rgba(255,255,255,0.10); }
    /* Room code input: big, centered, letter-spaced */
    .join-input-code {
      text-align: center;
      direction: ltr;
      font-size: 2.2rem;
      font-weight: 900;
      letter-spacing: 0.4em;
      padding: var(--sp-5) var(--sp-4) var(--sp-5) calc(var(--sp-4) + 0.4em);
      text-transform: uppercase;
      color: #FFFFFF;
    }
    .join-input-code::placeholder {
      letter-spacing: 0.4em;
      font-size: 1.6rem;
      color: rgba(255,255,255,0.25);
      font-weight: 800;
    }
    .join-foot-hint {
      margin-top: var(--sp-3);
      font-size: 0.9rem;
      color: rgba(255,255,255,0.40);
      font-weight: 600;
      line-height: 1.5;
      text-align: center;
    }
    .join-btn {
      margin-top: var(--sp-1);
      width: 100%;
      font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
      font-size: 1.35rem;
      font-weight: 900;
      padding: var(--sp-4);
      border: none;
      border-radius: var(--rad-pill);
      cursor: pointer;
      color: #FFFFFF;
      background: #E58D00;
      outline: 3px solid #1A0A00;
      outline-offset: 0;
      box-shadow: 0 5px 0 #B36E00, 0 8px 20px rgba(229,141,0,0.35);
      text-shadow: -1px -1px 0 #1A0A00, 1px -1px 0 #1A0A00, -1px 1px 0 #1A0A00, 1px 1px 0 #1A0A00;
      transition: transform 0.12s var(--ease-bounce), box-shadow 0.12s, filter 0.12s;
    }
    .join-btn:hover:not([disabled]) { transform: translateY(-2px); filter: brightness(1.08); }
    .join-btn:active:not([disabled]) { transform: translateY(3px); box-shadow: 0 2px 0 #B36E00; }
    .join-btn[disabled] {
      background: rgba(255,255,255,0.12);
      outline-color: transparent;
      box-shadow: none;
      text-shadow: none;
      cursor: not-allowed;
      opacity: 0.6;
    }
    /* Sheet content fades/slides between steps so the user feels guided. */
    @keyframes joinStepIn {
      from { opacity: 0; transform: translateY(var(--sp-3)); }
      to   { opacity: 1; transform: translateY(0); }
    }
    .join-step {
      display: flex; flex-direction: column; gap: var(--sp-3);
      animation: joinStepIn var(--dur-slow) var(--ease-out) both;
    }

    /* Native iPhone entry choice. This lives entirely inside the existing
       lower sheet so the logo, wallpaper and Settings control never move. */
    .native-mode-step { gap: var(--sp-4); }
    .native-mode-options {
      display: grid;
      gap: var(--sp-3);
      margin-top: var(--sp-1);
    }
    .native-mode-option {
      width: 100%;
      min-height: 102px;
      display: flex;
      align-items: center;
      gap: var(--sp-3);
      padding: var(--sp-4);
      border: 2px solid rgba(255,255,255,0.12);
      border-radius: var(--rad-lg);
      background: rgba(255,255,255,0.06);
      color: #FFFFFF;
      font-family: inherit;
      text-align: right;
      direction: rtl;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
      transition: transform 0.14s var(--ease-bounce),
                  border-color 0.14s ease,
                  background 0.14s ease;
    }
    .native-mode-option:hover {
      border-color: var(--mode-accent);
      background: rgba(255,255,255,0.09);
    }
    .native-mode-option:active { transform: scale(0.98); }
    .native-mode-option:focus-visible {
      outline: 3px solid var(--mode-accent);
      outline-offset: 3px;
    }
    .native-mode-option-player {
      --mode-accent: #E58D00;
      --mode-icon-bg: rgba(229,141,0,0.16);
    }
    .native-mode-option-host {
      --mode-accent: #19B8D5;
      --mode-icon-bg: rgba(25,184,213,0.16);
    }
    .native-mode-option-icon {
      flex: 0 0 56px;
      width: 56px;
      height: 56px;
      display: grid;
      place-items: center;
      border-radius: 17px;
      background: var(--mode-icon-bg);
      color: var(--mode-accent);
    }
    .native-mode-option-icon svg {
      width: 31px;
      height: 31px;
      fill: none;
      stroke: currentColor;
      stroke-width: 2.2;
      stroke-linecap: round;
      stroke-linejoin: round;
    }
    .native-mode-option-copy {
      min-width: 0;
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 3px;
    }
    .native-mode-option-title {
      font-size: 1.16rem;
      font-weight: 900;
      line-height: 1.35;
    }
    .native-mode-option-sub {
      color: rgba(255,255,255,0.52);
      font-size: 0.84rem;
      font-weight: 650;
      line-height: 1.5;
    }
    .native-mode-option-arrow {
      flex: 0 0 auto;
      color: var(--mode-accent);
      font-size: 1.45rem;
      font-weight: 900;
      line-height: 1;
    }

    @media (max-height: 700px) {
      .native-mode-option {
        min-height: 86px;
        padding: var(--sp-3);
      }
      .native-mode-option-icon {
        flex-basis: 48px;
        width: 48px;
        height: 48px;
        border-radius: 15px;
      }
      .native-mode-option-icon svg { width: 27px; height: 27px; }
    }

    @keyframes contentFadeIn {
      from { opacity: 0; transform: translateY(10px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    .content-fade {
      animation: contentFadeIn 0.4s var(--ease-out) both;
    }
    /* ── Avatar picker: native, momentum-scrolling carousel ── */
    .avatar-wheel-shell {
      width: 100%;
      max-width: 430px;
      margin: 2px auto 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 9px;
      overscroll-behavior: contain;
    }
    .avatar-wheel-tabs {
      display: grid;
      grid-template-columns: 1fr 1fr;
      width: 184px;
      padding: 4px;
      border-radius: var(--rad-pill);
      background: rgba(3,15,28,0.55);
      border: 1px solid rgba(255,255,255,0.09);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
    }
    .avatar-wheel-tab {
      min-height: 36px;
      border: 0;
      border-radius: var(--rad-pill);
      background: transparent;
      color: rgba(255,255,255,0.54);
      font: 800 0.92rem 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
      cursor: pointer;
      transition: color 180ms ease, background 220ms ease, transform 180ms ease;
    }
    .avatar-wheel-tab[aria-selected="true"] {
      color: #FFFFFF;
      background: rgba(229,141,0,0.92);
      box-shadow: 0 3px 12px rgba(229,141,0,0.24);
    }
    .avatar-wheel-tab:active { transform: scale(0.94); }
    .avatar-wheel-tab:focus-visible {
      outline: 2px solid #FFFFFF;
      outline-offset: 2px;
    }
    .avatar-picker-split {
      position: relative;
      display: flex;
      width: 100%;
      height: clamp(306px, 82vw, 350px);
      overflow-x: auto;
      overflow-y: hidden;
      direction: ltr;
      scroll-snap-type: x mandatory;
      scroll-behavior: auto;
      scrollbar-width: none;
      -webkit-overflow-scrolling: touch;
      touch-action: none;
      overscroll-behavior-x: contain;
      contain: layout paint style;
      isolation: isolate;
      user-select: none;
      -webkit-user-select: none;
      -webkit-tap-highlight-color: transparent;
    }
    .avatar-picker-split::-webkit-scrollbar { display: none; }
    .avatar-picker-col {
      position: relative;
      flex: 0 0 calc(100% - 34px);
      min-width: 0;
      height: calc(100% - 14px);
      margin: 5px 17px 9px;
      box-sizing: border-box;
      display: flex;
      flex-direction: column;
      direction: rtl;
      gap: 10px;
      padding: 13px 15px 15px;
      border-radius: 26px;
      background:
        radial-gradient(circle at 50% 0%, rgba(31,111,151,0.18), transparent 48%),
        linear-gradient(155deg, rgba(28,54,78,0.98), rgba(11,32,52,0.98));
      border: 1px solid rgba(151,194,220,0.19);
      box-shadow: 0 18px 34px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.055);
      overflow: visible;
      scroll-snap-align: center;
      scroll-snap-stop: always;
      transform: translateZ(0);
      backface-visibility: hidden;
    }
    .avatar-picker-split[data-active-gender="boys"] .avatar-picker-col[data-gender="boys"],
    .avatar-picker-split[data-active-gender="girls"] .avatar-picker-col[data-gender="girls"] {
      opacity: 1;
      pointer-events: auto;
    }
    .avatar-picker-split[data-active-gender="boys"] .avatar-picker-col[data-gender="girls"],
    .avatar-picker-split[data-active-gender="girls"] .avatar-picker-col[data-gender="boys"] {
      opacity: 1;
      pointer-events: none;
    }
    .avatar-card-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      min-height: 27px;
      padding-inline: 3px;
    }
    .avatar-col-title {
      margin: 0;
      font-size: 1.05rem;
      font-weight: 900;
      color: #FFFFFF;
    }
    .avatar-card-count {
      font-size: 0.72rem;
      font-weight: 700;
      color: rgba(255,255,255,0.42);
    }
    .avatar-picker-grid {
      flex: 1;
      min-height: 0;
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      grid-template-rows: repeat(3, minmax(0, 1fr));
      gap: 7px 9px;
    }
    .avatar-option {
      position: relative;
      isolation: isolate;
      min-width: 0;
      min-height: 0;
      border: 0;
      border-radius: 16px;
      padding: 2px;
      background: transparent;
      cursor: pointer;
      transition: transform 160ms ease, filter 160ms ease, background 160ms ease;
      overflow: visible;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .avatar-option::before {
      content: '';
      position: absolute;
      z-index: 0;
      inset: -5px;
      border-radius: 20px;
      background: radial-gradient(circle, rgba(229,141,0,0.62) 0%, rgba(229,141,0,0.22) 46%, transparent 72%);
      opacity: 0;
      transform: scale(0.82);
      pointer-events: none;
    }
    .avatar-art {
      position: relative;
      z-index: 1;
      width: 100%;
      height: 100%;
      overflow: visible;
      transform: scale(1);
      transform-origin: 50% 54%;
      transition: transform 180ms cubic-bezier(0.2,0.8,0.2,1);
      pointer-events: none;
    }
    .avatar-option img {
      position: absolute;
      left: 50%;
      top: 50%;
      height: 100%;
      width: auto;
      max-width: none;
      display: block;
      transform:
        translate(
          calc(-50% + var(--avatar-shift-x, 0%)),
          calc(-50% + var(--avatar-shift-y, 0%))
        )
        scale(var(--avatar-normalize, 1));
      transform-origin: 50% 50%;
      filter: drop-shadow(0 3px 8px rgba(0,0,0,0.35));
      pointer-events: none;
    }
    @media (hover: hover) and (pointer: fine) {
      .avatar-option:hover { transform: scale(1.06); }
    }
    .avatar-option:focus-visible {
      outline: 2px solid rgba(255,255,255,0.88);
      outline-offset: 1px;
      background: rgba(255,255,255,0.06);
    }
    .avatar-option.av-taken {
      filter: grayscale(0.9);
      opacity: 0.32;
      cursor: not-allowed;
      pointer-events: none;
    }
    .avatar-option.av-selected {
      background: rgba(229,141,0,0.09);
    }
    .avatar-option.av-selected::before {
      opacity: 1;
      transform: scale(1);
    }
    .avatar-option.av-selected .avatar-art {
      transform: scale(1.045);
    }
    /* A selected avatar may still exist on the card behind the active one.
       Its halo must not shine through the front card and look like stale UI. */
    .avatar-picker-col[aria-hidden="true"] .avatar-option::before {
      opacity: 0;
    }
    .avatar-picker-col[aria-hidden="true"] .avatar-option.av-selected,
    .avatar-picker-col[aria-hidden="true"] .avatar-option:focus-visible {
      background: transparent;
      outline: none;
    }
    .avatar-picker-col[aria-hidden="true"] .avatar-option.av-selected .avatar-art {
      transform: scale(1);
    }
    .avatar-wheel-hint {
      display: flex;
      align-items: center;
      gap: 7px;
      color: rgba(255,255,255,0.43);
      font-size: 0.78rem;
      font-weight: 700;
    }
    .avatar-wheel-hint::before,
    .avatar-wheel-hint::after {
      content: '';
      width: 15px;
      height: 1px;
      background: currentColor;
    }
    @media (max-height: 700px) {
      .avatar-picker-split { height: 280px; }
      .avatar-picker-col { flex-basis: calc(100% - 44px); margin-inline: 22px; }
      .avatar-wheel-hint { display: none; }
    }
    @media (prefers-reduced-motion: reduce) {
      .avatar-picker-split { scroll-behavior: auto; }
      .avatar-wheel-tab { transition-duration: 1ms !important; }
    }

    /* ── Error toast (fixed at bottom) ── */
    #error-box {
      position: fixed;
      bottom: calc(var(--sp-5) + var(--safe-bot));
      left: 50%;
      transform: translateX(-50%);
      z-index: 200;
      background: var(--accent-pink);
      color: var(--color-on-primary);
      padding: var(--sp-3) var(--sp-6);
      border-radius: var(--rad-pill);
      font-size: 1.1rem;
      font-weight: 700;
      box-shadow: var(--shadow-lg);
      display: none;
      opacity: 0;
      transition: opacity 200ms ease;
      white-space: normal;
      max-width: calc(100vw - var(--sp-8));
      text-align: center;
    }
    /* ── خلاط phone — intentionally simple paper workspace ─────────────── */
    .screen:has(.khp-shell) {
      --khp-ink: #292824;
      --khp-paper: #fff9e7;
      --khp-paper-2: #f3e8c9;
      --khp-teal: #4e8c87;
      --khp-rose: #b96f76;
      background: var(--khp-paper);
      color: var(--khp-ink);
      border: 1px solid rgba(41,40,36,.12);
      box-shadow: 0 16px 60px rgba(29,20,16,.18);
    }
    .screen-body:has(.khp-shell) {
      justify-content: flex-start;
      padding: 0;
      overflow: hidden;
      background:
        radial-gradient(circle at 20% 10%, rgba(110,95,61,.05) 0 1px, transparent 1.5px) 0 0 / 18px 18px,
        var(--khp-paper);
    }
    .screen-foot:has(.khp-primary) {
      padding: 10px 18px calc(12px + var(--safe-bot));
      background: var(--khp-paper);
      border-top: 1px dashed rgba(41,40,36,.25);
    }
    .khp-shell {
      width: 100%;
      min-height: 100%;
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 14px;
      padding: 18px 18px 20px;
      direction: rtl;
      text-align: right;
      box-sizing: border-box;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }
    .khp-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
    .khp-step {
      width: fit-content;
      padding: 5px 10px;
      border: 2px solid var(--khp-ink);
      border-radius: 3px;
      color: var(--khp-ink);
      background: #d8b75f;
      box-shadow: 3px 3px 0 rgba(41,40,36,.22);
      font-size: .75rem;
      font-weight: 900;
      transform: rotate(1deg);
    }
    .khp-shell .answer-timer { margin: 0; min-width: 82px; padding: 7px 12px; }
    .khp-shell .answer-timer .at-clock {
      position: relative;
      width: 14px;
      height: 14px;
      flex: 0 0 14px;
      border: 2px solid currentColor;
      border-radius: 50%;
      font-size: 0;
      box-sizing: border-box;
    }
    .khp-shell .answer-timer .at-clock::before,
    .khp-shell .answer-timer .at-clock::after {
      content: "";
      position: absolute;
      left: 50%;
      top: 50%;
      width: 1.5px;
      border-radius: 2px;
      background: currentColor;
      transform-origin: 50% 100%;
    }
    .khp-shell .answer-timer .at-clock::before { height: 4px; transform: translate(-50%, -100%); }
    .khp-shell .answer-timer .at-clock::after { height: 3px; transform: translate(-50%, -100%) rotate(125deg); }
    body[data-theme="khallat"] .rxn-fab { display: none !important; }
    .khp-prompt {
      margin: 2px 0 0;
      color: var(--khp-ink);
      font-size: clamp(1.45rem, 7vw, 2rem);
      font-weight: 950;
      line-height: 1.35;
      text-align: right;
      text-wrap: balance;
    }
    .khp-input {
      width: 100%;
      min-height: 142px;
      margin: 0;
      padding: 16px;
      resize: none;
      border: 2px solid var(--khp-ink);
      border-radius: 4px 7px 3px 6px;
      background: rgba(255,255,255,.58);
      color: var(--khp-ink);
      box-shadow: 5px 6px 0 rgba(41,40,36,.18);
      font-family: inherit;
      font-size: 1.08rem;
      font-weight: 750;
      line-height: 1.7;
      text-align: right;
      direction: rtl;
      box-sizing: border-box;
    }
    .khp-input::placeholder { color: rgba(41,40,36,.42); }
    .khp-primary,
    .khp-clear {
      min-height: 52px;
      border: 2px solid var(--khp-ink);
      border-radius: 4px;
      color: var(--khp-paper);
      background: var(--khp-teal);
      box-shadow: 4px 5px 0 rgba(41,40,36,.22);
      font-family: inherit;
      font-size: 1.06rem;
      font-weight: 900;
      line-height: 1.2;
    }
    .khp-primary:disabled { opacity: .36; box-shadow: none; }
    .khp-primary:not(:disabled):active,
    .khp-clear:active { transform: translate(2px, 2px); box-shadow: 2px 3px 0 rgba(41,40,36,.18); }
    .khp-wait {
      flex: 1;
      min-height: 50vh;
      display: grid;
      place-items: center;
      text-align: center;
    }
    .khp-wait-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; }
    .khp-seal {
      width: 92px;
      aspect-ratio: 1;
      display: grid;
      place-items: center;
      border: 6px double var(--khp-teal);
      border-radius: 50%;
      color: var(--khp-teal);
      font-size: 2.6rem;
      font-weight: 950;
      transform: rotate(-8deg);
      animation: khp-stamp 360ms cubic-bezier(.2,.8,.2,1.3) both;
    }
    .khp-wait strong { color: var(--khp-ink); font-size: 1.45rem; font-weight: 950; }
    .khp-wait span { color: rgba(41,40,36,.58); font-size: .95rem; font-weight: 750; }
    .khp-shuffle-dots { display: flex; gap: 10px; direction: ltr; }
    .khp-shuffle-dots i { width: 14px; height: 14px; border: 2px solid var(--khp-ink); border-radius: 50%; background: var(--khp-teal); animation: khp-dot 700ms ease-in-out infinite alternate; }
    .khp-shuffle-dots i:nth-child(2) { animation-delay: 140ms; }
    .khp-shuffle-dots i:nth-child(3) { animation-delay: 280ms; }
    .khallat-wb-root { gap: 11px; padding-bottom: calc(14px + var(--safe-bot)); }
    .khallat-q-header { padding: 0 0 10px; border-bottom: 1px dashed rgba(41,40,36,.28); }
    .khallat-q-text { color: var(--khp-ink); font-size: 1.25rem; font-weight: 950; line-height: 1.42; }
    .khp-compose {
      min-height: 98px;
      padding: 12px;
      border: 2px solid var(--khp-ink);
      border-radius: 4px;
      background: rgba(255,255,255,.52);
      box-shadow: 4px 5px 0 rgba(41,40,36,.16);
    }
    #answer-box { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-height: 48px; direction: rtl; }
    .khallat-answer-placeholder { padding: 17px 0; color: rgba(41,40,36,.4); font-size: .92rem; font-weight: 800; text-align: center; }
    .answer-word {
      width: auto;
      min-height: 34px;
      padding: 3px 7px;
      border: 0;
      border-bottom: 2px solid var(--khp-rose);
      border-radius: 0;
      background: transparent;
      color: var(--khp-ink);
      box-shadow: none;
      font-family: inherit;
      font-size: 1.08rem;
      font-weight: 900;
      line-height: 1.35;
    }
    #word-bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 3px 0; direction: rtl; }
    .word-pill {
      width: auto;
      min-height: 40px;
      padding: 7px 13px;
      border: 1.5px solid var(--khp-ink);
      border-radius: 2px 5px 3px 4px;
      background: #f2e3bb;
      color: var(--khp-ink);
      box-shadow: 2px 3px 0 rgba(41,40,36,.18);
      font-family: inherit;
      font-size: .98rem;
      font-weight: 850;
      line-height: 1.2;
      transform: rotate(var(--khp-tilt, -.6deg));
    }
    .word-pill:nth-child(2n) { --khp-tilt: .7deg; }
    .word-pill:active { transform: translate(1px, 2px) rotate(var(--khp-tilt, -.6deg)); box-shadow: 1px 1px 0 rgba(41,40,36,.18); }
    .khallat-foot { display: grid; grid-template-columns: 52px 1fr; gap: 9px; margin-top: auto; }
    .khallat-foot .khp-clear { padding: 0; background: #c9857d; font-size: 1.35rem; }
    .khp-vote-list { display: flex; flex-direction: column; gap: 11px; }
    .khp-vote-paper {
      width: 100%;
      min-height: 78px;
      padding: 14px 16px;
      border: 2px solid var(--khp-ink);
      border-radius: 3px 6px 4px 2px;
      background: rgba(255,255,255,.56);
      color: var(--khp-ink);
      box-shadow: 4px 5px 0 rgba(41,40,36,.17);
      font-family: inherit;
      font-size: 1.05rem;
      font-weight: 900;
      line-height: 1.48;
      text-align: right;
    }
    .khp-vote-paper:active { transform: translate(2px,2px); box-shadow: 2px 3px 0 rgba(41,40,36,.14); }
    @keyframes khp-stamp { from { opacity: 0; transform: scale(1.7) rotate(7deg); } to { opacity: 1; transform: scale(1) rotate(-8deg); } }
    @keyframes khp-dot { to { transform: translateY(-8px); background: #d8b75f; } }
    @media (max-height: 720px) {
      .khp-shell { gap: 9px; padding-top: 12px; }
      .khp-prompt { font-size: 1.32rem; }
      .khp-input { min-height: 108px; }
      .word-pill { min-height: 36px; padding: 6px 11px; }
      .khp-compose { min-height: 76px; }
    }
    @media (prefers-reduced-motion: reduce) {
      .khp-seal,
      .khp-shuffle-dots i { animation: none !important; }
    }
    /* ── Software keyboard viewport ──────────────────────────────────────
       iOS Safari shrinks visualViewport without reliably changing 100dvh;
       Capacitor's native resize path can do the reverse. JS writes the exact
       visible height for both, while these focused-editor rules keep the
       editor readable and let the content pane scroll above the keyboard. */
    body.keyboard-open .screen {
      min-height: 0 !important;
      height: 100%;
    }
    body.keyboard-open .screen-body {
      justify-content: flex-start;
      min-height: 0;
      scroll-padding-block: max(10px, env(safe-area-inset-top)) 12px;
      padding-top: max(10px, env(safe-area-inset-top));
    }
    body.keyboard-open .screen-foot { padding-top: 6px; }
    body.keyboard-open .sh-phone-write { gap: 8px; }
    body.keyboard-open .sh-phone-question,
    body.keyboard-open .question-card,
    body.keyboard-open .keyboard-sticky-prompt,
    body.keyboard-open .fkp-task {
      position: static;
    }
    body.keyboard-open .question-card,
    body.keyboard-open .keyboard-sticky-prompt {
      background: var(--card);
    }
    /* Keep the paper question readable when the blue mode's keyboard opens. */
    body.keyboard-open.khedaa-player-phase .kdp-question.keyboard-sticky-prompt {
      background: #fffdf6;
    }
    body.keyboard-open .sh-phone-question,
    body.keyboard-open .question-card,
    body.keyboard-open .keyboard-sticky-prompt {
      max-height: 34vh;
      overflow-y: auto;
    }
    body.keyboard-open textarea,
    body.keyboard-open .sh-phone-write textarea,
    body.keyboard-open .fkp-textarea {
      min-height: 76px;
    }
    body.keyboard-open.faker-player-phase #app,
    body.keyboard-open.faker-player-phase .screen,
    body.keyboard-open .fkp-stage {
      bottom: auto;
      height: var(--mj-player-viewport-height, 100dvh);
      min-height: 0;
    }
    body.keyboard-open .fkp-head {
      grid-template-columns: 1fr;
      min-height: auto;
      padding-block: calc(7px + env(safe-area-inset-top, 0px)) 7px;
    }
    body.keyboard-open .fkp-character { display: none; }
    body.keyboard-open .fkp-body {
      min-height: 0;
      justify-content: flex-start;
      overflow-y: auto;
      padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
    }
    body.keyboard-open .fkp-task {
      padding-block: 6px;
      background: #f8f5ed;
    }

    /* ── Desktop responsive cap ──────────────────────────────────────────
       Player UI is mobile-first. On wider viewports, contain the join
       sheet and the in-game screen body so cards/inputs/buttons don't
       stretch edge-to-edge. The orange hero band keeps its full-bleed
       look (no max-width on .join-wrap or .join-hero). */
    @media (min-width: 640px) {
      .join-sheet {
        max-width: 480px;
        width: 100%;
        margin-inline: auto;
        border-radius: var(--rad-xl);
        box-sizing: border-box;
      }
      .screen {
        max-width: 520px;
        width: 100%;
        margin-inline: auto;
        box-sizing: border-box;
      }
    }

    /* Keep active game controls inside one common 720px iPhone viewport.
       Longer lists may still scroll, but standard three-player rounds should
       never hide the final option or progress roster below the fold. */
    @media (max-height: 760px) {
      .player-header { min-height: 68px; padding-block: 8px; }
      .screen { padding: 0 24px calc(10px + var(--safe-bot)); }
      .screen-body { padding: 8px 0; gap: 8px; }
      .screen-foot { padding-top: 8px; }
      .gp-bar { padding-bottom: 6px; }
      .gp-bar-icon { font-size: 1.8rem; }
      .gp-bar-name { font-size: 1.65rem; }
      .gp-bar-sub { font-size: 0.9rem; }
      h1 { font-size: 1.65rem; }
      h2 { font-size: 1.2rem; line-height: 1.35 !important; margin-block: 2px !important; }
      .btn-vote { padding: 13px 16px; border-radius: 17px; font-size: 1.12rem; }
      .answer-timer { margin-block: 2px; }
      .mini-roster { padding: 8px; gap: 5px; }
      .mini-roster-chips { gap: 5px 7px; }
      .mr-chip { padding: 3px 8px 3px 5px; font-size: 0.82rem; }
      .mr-chip .mr-bubble { width: 19px; height: 19px; font-size: 0.72rem; }
      .waiting-card { padding: 22px 18px; }
      .screen-hint { padding: 11px; font-size: 1rem; }
    }

    /* ── Software keyboard stability ───────────────────────────────────
       Editor screens start at the top even before focus, so shrinking the
       visual viewport cannot abruptly re-center the prompt and textarea.
       One viewport controller sizes the shell and reveals the active editor
       inside its content pane after the native keyboard settles. */
    .screen-body:has(textarea),
    .screen-body:has(input:not([type])),
    .screen-body:has(input[type="text"]),
    .screen-body:has(input[type="search"]),
    .screen-body:has(input[type="email"]),
    .screen-body:has(input[type="number"]),
    .screen-body:has(input[type="tel"]),
    .screen-body:has(input[type="url"]),
    .screen-body:has(input[type="password"]),
    .fkp-body:has(textarea),
    .fkp-body:has(input:not([type])),
    .fkp-body:has(input[type="text"]) {
      /* Phase-specific shells (for example Shatahat) otherwise win the
         cascade with a more specific centered layout and jump on resize. */
      justify-content: flex-start !important;
    }
    .fkp-body:has(textarea),
    .fkp-body:has(input:not([type])),
    .fkp-body:has(input[type="text"]) {
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }
    body.keyboard-open .screen-body,
    body.keyboard-open .fkp-body,
    body.keyboard-open .join-sheet,
    body.keyboard-open .wait-sheet {
      overscroll-behavior-y: contain;
      scroll-behavior: auto;
      scroll-padding-block: 12px;
      padding-bottom: 12px;
    }
    body.keyboard-open .screen-body:has(.khp-shell) { overflow-y: auto; }
    body.keyboard-open .khp-shell { min-height: 0; overflow: visible; flex-shrink: 0; }
    body.keyboard-open #rxn-fab { display: none; }
    body.keyboard-open .join-hero { display: none; }
    body.keyboard-open .join-sheet { border-radius: 0; }
    body.keyboard-open .join-step { animation: none; }
    body.keyboard-open .screen { padding-bottom: 8px; }
    body.keyboard-open .screen-foot { flex-shrink: 0; padding-bottom: 4px; }
    body.keyboard-open textarea { max-height: 120px; scroll-margin-block: 12px; }
    body.keyboard-open .sh-phone-write,
    body.keyboard-open .kdp-stage { flex-shrink: 0; }

    .join-back { display:flex;align-items:center;justify-content:center;gap:8px;position:absolute; top:max(16px,var(--safe-top)); left:20px; z-index:5; min-height:48px; padding:9px 22px; border:1px solid #ffffff30; border-radius:22px; color:#fff; background:#204e68; box-shadow:0 4px 0 #102e42; font-family:inherit;font-weight:800;font-size:1.12rem;width:auto; cursor:pointer; }
    .join-sheet { position:relative; }
    .join-wrap:has(.join-back) .join-sheet { padding-top:calc(max(16px, var(--safe-top)) + 60px); }
    .gender-choices { display:grid;grid-template-columns:1fr 1fr;gap:14px;width:100%;margin:20px 0; }
    .gender-choices button { display:flex;flex-direction:column;align-items:center; border:1px solid #ffffff35;border-radius:26px;background:#214c67;color:#fff;padding:18px 8px;font:inherit;cursor:pointer; }
    .gender-choices img { width:100%;height:clamp(150px,32dvh,310px);object-fit:contain; }
    .gender-choices strong {font-size:1.5rem;}
    .avatar-picker-split { direction:ltr;display:flex;gap:0;width:100%;height:clamp(230px,43dvh,470px);overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;touch-action:pan-x pan-y; padding:0;margin:0; }
    .avatar-picker-split > .avatar-option { flex:0 0 100%;width:100%;height:100%;scroll-snap-align:center;scroll-snap-stop:always;border:0;border-radius:0;background:transparent;transform:none;position:relative;padding:0; }
    .avatar-picker-split > .avatar-option::before { display:none; }
    .avatar-picker-split > .avatar-option img { position:static;display:block;width:100%;height:100%;object-fit:contain;transform:none;filter:drop-shadow(0 16px 14px #0003); }
    .avatar-picker-split > .avatar-option.av-taken {opacity:.38;}
    .avatar-unavailable {position:absolute;bottom:14px;left:50%;transform:translateX(-50%);background:#102e42;color:#fff;border-radius:20px;padding:5px 18px;}
    .avatar-carousel-controls {display:flex;align-items:center;justify-content:center;gap:28px;width:100%;}
    .avatar-carousel-controls button {width:48px;height:48px;border:1px solid #ffffff40;border-radius:50%;background:#204e68;color:#fff;font-size:2rem;line-height:1;padding:0;cursor:pointer;}
    .avatar-wheel-shell > .jcb-change {width:auto;min-height:40px;padding:6px 18px;color:#fff;background:#204e68;border:1px solid #ffffff35;font-size:1rem;}
    body:has(.join-wrap) .player-settings-btn{left:auto;right:20px;}
    .avatar-position {color:var(--text);font-weight:800;font-variant-numeric:tabular-nums;}
    #room-check-status {min-height:25px;color:var(--text);font-size:.95rem;text-align:center;}
    body.shathaat-player-phase .final-vote-card .fvc-text { color:#07090d !important; opacity:1; }
    .fkp-own-score img {margin-bottom:16px;position:relative;z-index:1;}
    .fkp-final-score {color:#111;font-size:2.5rem;text-align:center;}
    .round-multiplier-note {display:flex;justify-content:center;gap:9px;align-items:center;align-self:center;background:#fff6d0;color:#17130b;padding:8px 18px;border-radius:50px;font-weight:900;font-size:1rem;margin-bottom:10px;}
    @media(min-width:768px){ .join-wrap[data-step="avatar"] .join-sheet{max-width:660px;} .gender-choices img{height:330px;} }
    @media(max-height:600px){.avatar-picker-split{height:220px}.join-wrap:has(.join-back) .join-sheet{padding-top:calc(max(10px, var(--safe-top)) + 54px)}.join-back{top:max(10px,var(--safe-top))}.gender-choices img{height:150px}}

    .score-player-avatar{display:block;width:min(45vw,180px);height:clamp(140px,23dvh,230px);object-fit:contain;margin:0 auto 16px;filter:drop-shadow(0 8px 5px #0002)}
    body[data-theme="answers"] .score-card{background:#fffaf0!important;border:3px solid #171717;border-radius:20px;color:#111;box-shadow:7px 7px 0 #171717;}
    body[data-theme="answers"] .score-card :is(.sc-value,.sc-label,.sc-sub){color:#111;}
    body[data-theme="khedaa"] .score-card{background:#fff5da!important;border:2px solid #5b331f;border-radius:18px;color:#452719;box-shadow:0 8px 0 #532f2330;}
    body[data-theme="khedaa"] .score-card :is(.sc-value,.sc-label,.sc-sub){color:#452719;}
    .join-wrap[data-step="gender"] .join-hero{display:none;}

    .join-step[data-active-step="avatar"] :is(.join-sheet-title,.join-sheet-sub){text-align:center;}
    .ps-title{position:sticky;top:0;z-index:2;padding:12px 0;background:inherit;}
    body[data-theme="faker"] .ps-card{background:#fff8ee;border:3px solid #111;color:#111;border-radius:16px;}
    body[data-theme="answers"] .ps-card{background:#fffaf0;border:3px solid #171717;color:#111;box-shadow:7px 7px 0 #171717;}
    body[data-theme="khedaa"] .ps-card{background:#fff5da;border:2px solid #63361e;color:#452719;}
    body[data-theme="khallat"] .ps-card{background:#fff8e8;border:2px solid #213b32;color:#213b32;}
    body:is([data-theme="faker"],[data-theme="answers"],[data-theme="khedaa"],[data-theme="khallat"]) .ps-card :is(.ps-title,.ps-label,.ps-section-title,.ps-vol-pct,.ps-legal-links a){color:inherit;}
    .score-gain{position:relative;display:grid;place-items:center;min-height:42px;font-weight:900;font-size:1.5rem;color:inherit;font-variant-numeric:tabular-nums;}
    .score-gain-original,.score-gain-final{grid-area:1/1;}
    .score-gain-original{animation:gain-merge 1.6s ease-in-out forwards;}
    .score-gain-original b{display:inline-block;padding:2px 8px;background:#f0b900;color:#111;border-radius:9px;}
    .score-gain-final{opacity:0;animation:gain-total .3s 1.35s ease-out forwards;}
    @keyframes gain-merge{0%,65%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}
    @keyframes gain-total{to{opacity:1;transform:scale(1)}}
    @media(prefers-reduced-motion:reduce){.score-gain-original{display:none}.score-gain-final{opacity:1;animation:none}}

    @media(max-height:760px){.score-player-avatar{width:120px;height:120px;margin-bottom:8px}.score-card{padding:16px}.score-card .sc-value{font-size:3.4rem}.score-card .sc-label{font-size:1rem}}
.question-blank{display:inline-block;padding:.08em .4em;border:1px dashed currentColor;border-radius:8px;font-size:.85em;line-height:1.65}
.question-blank-person{color:var(--person-color,#68cfff)}
.question-blank-action{color:#ffcf66}
.question-blank-place{color:#c6adff}
.question-blank-free{color:#83dfbd}
.sentence-editor{font-size:clamp(1.15rem,4vw,1.5rem);line-height:2.5;text-align:right;overflow-wrap:anywhere}
.sentence-slot{display:inline-flex;vertical-align:middle;flex-direction:column;gap:3px;margin:6px 3px;max-width:100%;line-height:1.5}
.sentence-slot>span{font-size:.8rem;font-weight:700}
.sentence-slot input,.sentence-slot select{box-sizing:border-box;width:100%;max-width:260px;min-height:48px;font:inherit;font-size:1rem;color:inherit;border:1px solid currentColor;border-radius:10px;background:#102335;padding:9px 12px}
.sentence-slot select option{background:#102335;color:#fff}
.sentence-slot input::placeholder{color:inherit;opacity:.8}
.sentence-slot :focus-visible{outline:3px solid currentColor;outline-offset:3px}
.sentence-error{color:#ffacac;font-size:1rem;line-height:1.6}
html[data-appearance="light"] .question-blank-person{color:var(--person-color,#006e98)}
html[data-appearance="light"] .question-blank-action{color:#805000}
html[data-appearance="light"] .question-blank-place{color:#6b3bb5}
html[data-appearance="light"] .question-blank-free{color:#176b53}
html[data-appearance="light"] .sentence-slot input,html[data-appearance="light"] .sentence-slot select{background:#fff;color:#172c40}

.sentence-slot.question-blank-person{color:inherit;border-bottom:3px solid var(--person-color,#68cfff);padding-bottom:4px}
.sentence-slot.question-blank-person>span{color:inherit}

html[data-appearance="light"] .sentence-slot>span{align-self:flex-start;background:#fff;padding:2px 8px;border-radius:5px}
html[data-appearance="light"] .sentence-slot.question-blank-person>span{color:#172c40}
