/* ═══════════════════════════════════════════════════════════
   بيتزا روما — طبقة الهاتف: مشهد حيّ + شريط مطبخ + ورقة طلب
   ═══════════════════════════════════════════════════════════ */
html, body { height: 100%; overscroll-behavior: none; }
body { -webkit-tap-highlight-color: transparent; }

/* ── هيكل شاشة اللعب ── */
.scr.is-on#scr-game { display: flex; }
#scr-game {
  position: relative; z-index: 1;
  flex-direction: column; gap: 6px;
  height: 100dvh; min-height: 100vh;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) 8px calc(env(safe-area-inset-bottom, 0px) + 6px);
  overflow: hidden;
}
.stage { flex: 1 1 auto; display: flex; flex-direction: column; gap: 6px; min-height: 0; }

/* ── الشريط العلوي ── */
#scr-game .hud {
  flex: 0 0 auto; display: flex; align-items: center; gap: .45rem;
  padding: .32rem .5rem; border-radius: 14px;
  background: rgba(255,255,255,.86); backdrop-filter: blur(10px);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
#scr-game .hud-brand b { font-size: .88rem; }
#scr-game .hud-brand .lvl { font-size: .62rem; padding: .1rem .45rem; }
.logo-mini { width: 26px; height: 26px; }
#scr-game .hud-stats { display: flex; gap: .3rem; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; }
#scr-game .hud-stats::-webkit-scrollbar { display: none; }
#scr-game .hstat { padding: .18rem .42rem; border-radius: 10px; font-size: .72rem; gap: .22rem; flex: 0 0 auto; }
#scr-game .hstat .v { font-size: .78rem; }
#scr-game .hbar { width: 30px; height: 6px; }
#scr-game .hud-actions { flex: 0 0 auto; gap: .28rem; }
#scr-game .hud-btn { width: 32px; height: 32px; }

/* ── مسرح المشهد ── */
.scene-wrap {
  position: relative; flex: 1 1 auto; min-height: 128px;
  border-radius: 18px; overflow: hidden;
  border: 2px solid var(--line-2);
  background: #241610;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.5), var(--shadow);
}
#hall { display: block; width: 100%; height: 100%; touch-action: manipulation; }
.scene-hint {
  position: absolute; inset-inline: 8px; bottom: 8px;
  display: flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .3rem .55rem; border-radius: 999px;
  background: rgba(40,18,8,.72); color: #FFE9B0;
  font-size: .7rem; font-weight: 800; pointer-events: none;
  transition: opacity .3s;
}
.scene-hint .sh-ico svg { width: 15px; height: 15px; }
.scene-hint.is-off { opacity: 0; }

.k-head { flex: 0 0 auto; display: flex; align-items: baseline; gap: .45rem; padding: 0 .2rem; }
.k-head .ph-t { font-size: .82rem; }
.k-head .ph-sub { font-size: .62rem; color: var(--muted); }
/* ── شريط المطبخ المدمج ── */
#scr-game .stations {
  flex: 0 0 auto; display: flex; gap: 6px; overflow-x: auto; padding: 0 0 2px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
#scr-game .stations::-webkit-scrollbar { display: none; }
#scr-game .station {
  flex: 1 1 0; min-width: 116px; padding: .34rem .34rem .42rem;
  border-width: 1.5px; border-radius: 14px; box-shadow: var(--shadow-sm);
}
#scr-game .station::before { width: 4px; }
#scr-game .st-head { margin-bottom: .28rem; gap: .28rem; }
#scr-game .st-ico { width: 20px; height: 20px; border-radius: 6px; }
#scr-game .st-ico svg { width: 13px; height: 13px; }
#scr-game .st-name { font-size: .74rem; }
#scr-game .st-q { font-size: .56rem; padding: .1rem .4rem; }
#scr-game .slots { display: flex; gap: 4px; justify-content: center; }
#scr-game .slot { flex: 1 1 0; max-width: 46px; min-width: 30px; }
#scr-game .slot-name { display: none; }
#scr-game .slot-empty svg { width: 16px; height: 16px; }

/* ── ورقة طلب الزبون ── */
.sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40;
  transform: translateY(112%); transition: transform .28s cubic-bezier(.3,.9,.3,1);
  max-height: 72dvh; display: flex; flex-direction: column;
  background: var(--card); border-radius: 22px 22px 0 0;
  border-top: 2px solid var(--line-2);
  box-shadow: 0 -14px 40px rgba(80,35,10,.28);
  padding: 0 .7rem calc(env(safe-area-inset-bottom, 0px) + .7rem);
}
.sheet.is-on { transform: translateY(0); }
.sheet::before {
  content: ''; display: block; width: 46px; height: 4px; border-radius: 999px;
  background: var(--line-2); margin: .45rem auto .3rem;
}
.sheet-close {
  position: absolute; top: .55rem; inset-inline-start: .6rem;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg-2); color: var(--ink-2); display: grid; place-items: center;
}
.sheet-close svg { width: 16px; height: 16px; }
.sheet-head { display: flex; align-items: baseline; gap: .45rem; padding: 0 .1rem .4rem; }
.sheet-head b { font-family: var(--f-display); font-size: 1.02rem; }
.sheet-head span { font-size: .68rem; color: var(--muted); font-weight: 700; }
.sheet-body { overflow-y: auto; padding-bottom: .3rem; }
.sheet-body .cust { border: 0; box-shadow: none; padding: 0; background: none; animation: none; }
.sheet-body .cust:not(.is-sel) { display: none; }
.sheet-body .order { gap: .4rem; }
.sheet-body .oi { padding: .42rem .5rem; }
.sheet-body .serve { margin-top: .55rem; padding: .68rem; font-size: .95rem; }
/* ── شريط الطاقم المدمج ── */
#scr-game .crew {
  flex: 0 0 auto; display: flex; gap: 6px; padding: 0; margin: 0; max-width: none; width: 100%;
}
#scr-game .crew-card {
  flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: .35rem;
  padding: .3rem .35rem; border-radius: 14px; border-width: 1.5px;
}
#scr-game .crew-av { width: 32px; height: 32px; }
#scr-game .crew-name { font-size: .74rem; }
#scr-game .crew-role { display: none; }
#scr-game .crew-pips { gap: 2px; }
#scr-game .pip { width: 5px; height: 5px; }
#scr-game .g { padding: 1px; }
#scr-game .crew-buy {
  flex: 0 0 auto; min-width: 76px; border-radius: 14px; padding: .3rem .5rem;
  font-size: .76rem; gap: .25rem;
}
#scr-game .crew-buy svg { width: 17px; height: 17px; }

/* ── نوافذ منبثقة أصغر على الهاتف ── */
@media (max-width: 620px) {
  .modal { border-radius: 20px; padding: 1rem .85rem; max-height: 92dvh; overflow-y: auto; }
  .m-title { font-size: 1.15rem; }
  .m-sub { font-size: .8rem; }
  .m-actions { gap: .4rem; }
  .m-actions .btn { flex: 1 1 44%; padding: .62rem .7rem; font-size: .88rem; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shop-grid { grid-template-columns: minmax(0, 1fr); }
  .shop-group-head { gap: .4rem; }
  .crew-intro { gap: .6rem; }
  .toasts { inset-inline: .5rem; top: calc(env(safe-area-inset-top, 0px) + 8px); }
  .toast { font-size: .78rem; }
}

/* ── لوحة مفاتيح/شاشات عريضة: المشهد يسار والمطبخ يمين ── */
@media (min-width: 900px) {
  #scr-game { padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px; gap: 10px; }
  #scr-game .stage { flex-direction: row; align-items: stretch; gap: 10px; }
  .scene-wrap { flex: 1 1 auto; }
  #scr-game .k-head { display: none; }
  #scr-game .stations {
    flex: 0 0 300px; flex-direction: column; overflow: visible;
  }
  #scr-game .station { flex: 0 0 auto; min-width: 0; padding: .5rem .55rem .6rem; }
  #scr-game .slots { flex-wrap: wrap; justify-content: flex-start; }
  #scr-game .slot { flex: 0 0 46px; max-width: 46px; }
  #scr-game .slot-name { display: block; }
  #scr-game .crew-card { max-width: 260px; }
  #scr-game .crew-role { display: block; font-size: .62rem; }
  .sheet { inset-inline: auto 16px; bottom: 16px; width: 360px; border-radius: 20px; max-height: 66dvh; }
  .sheet.is-on { transform: translateY(0); }
}
