/* Qadha emergency display contract r220
   Restores the approved two-team board and drawing geometry.
   Loaded LAST after all historical Qadha layers. */

html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active{
  --q220-bg:#080b20;
  --q220-panel:#111630;
  --q220-panel-2:#181e3d;
  --q220-line:rgba(255,255,255,.11);
  --q220-gold:#f5cf58;
  --q220-text:#fffaf0;
  --q220-muted:#aeb5ca;
  overflow-x:hidden!important;
  background:
    radial-gradient(700px 420px at 50% -120px,rgba(125,72,255,.12),transparent 68%),
    linear-gradient(180deg,#0a0e28 0%,#080b20 58%,#050717 100%)!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active #qApp{
  width:100%!important;
  max-width:100%!important;
  min-height:100dvh!important;
  padding:10px clamp(10px,1.7vw,24px) 14px!important;
  overflow:visible!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .qadha-reference-board{
  width:min(1580px,100%)!important;
  min-height:calc(100dvh - 24px)!important;
  margin:0 auto!important;
  display:grid!important;
  grid-template-rows:auto minmax(0,1fr) auto!important;
  gap:12px!important;
}

/* No heavy top bar: brand + unobtrusive host tools only. */
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-qadha-toolbar{
  position:relative!important;
  top:auto!important;
  min-height:60px!important;
  height:auto!important;
  padding:5px 8px!important;
  display:grid!important;
  grid-template-columns:minmax(190px,1fr) auto minmax(190px,1fr)!important;
  grid-template-areas:"actions brand turn"!important;
  align-items:center!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
  backdrop-filter:none!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .q-board-brand{
  grid-area:brand!important;
  text-align:center!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .q-board-brand>strong{
  display:block!important;
  color:var(--q220-text)!important;
  font-size:clamp(26px,3vw,46px)!important;
  line-height:.95!important;
  font-weight:950!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .q-board-slogan{
  display:block!important;
  margin-top:5px!important;
  color:var(--q220-muted)!important;
  font-size:clamp(11px,1vw,14px)!important;
  white-space:normal!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .q-board-slogan b{color:var(--q220-gold)!important}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .q-toolbar-actions{
  grid-area:actions!important;
  width:auto!important;
  display:flex!important;
  align-items:center!important;
  justify-content:flex-start!important;
  gap:5px!important;
  overflow:visible!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .q-toolbar-action{
  width:38px!important;min-width:38px!important;height:38px!important;min-height:38px!important;
  padding:0!important;border:1px solid rgba(255,255,255,.08)!important;border-radius:11px!important;
  display:grid!important;place-items:center!important;
  color:#d9dceb!important;background:rgba(255,255,255,.035)!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .q-toolbar-action>b{display:none!important}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .q-toolbar-action.danger{
  width:auto!important;min-width:112px!important;padding:0 12px!important;
  display:flex!important;gap:6px!important;color:#ffbec3!important;
  border-color:rgba(239,82,97,.24)!important;background:rgba(239,82,97,.07)!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .q-toolbar-action.danger>b{display:inline!important;font-size:11px!important}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-turn-pill{
  grid-area:turn!important;justify-self:end!important;
  min-width:176px!important;max-width:260px!important;min-height:45px!important;
  padding:7px 12px!important;border:1px solid rgba(245,207,88,.24)!important;border-radius:13px!important;
  background:rgba(245,207,88,.055)!important;color:var(--q220-text)!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-turn-pill strong{
  max-width:none!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;
}

/* Board: approved 3x2 category field on TV/desktop. */
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-board-grid.qadha-reference-grid{
  width:100%!important;
  min-height:0!important;
  padding:0!important;
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  grid-template-rows:repeat(2,minmax(170px,1fr))!important;
  grid-auto-rows:minmax(170px,1fr)!important;
  gap:clamp(10px,1vw,16px)!important;
  align-content:stretch!important;
  overflow:visible!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .board-category-panel{
  width:100%!important;height:auto!important;min-width:0!important;min-height:170px!important;
  padding:9px!important;
  display:grid!important;
  grid-template-columns:minmax(70px,.72fr) minmax(108px,1.08fr) minmax(70px,.72fr)!important;
  grid-template-areas:"right cat left"!important;
  grid-template-rows:minmax(0,1fr)!important;
  align-items:stretch!important;
  gap:8px!important;
  border:1px solid var(--q220-line)!important;border-radius:21px!important;
  background:linear-gradient(150deg,rgba(28,34,68,.92),rgba(13,18,44,.96))!important;
  box-shadow:0 16px 42px rgba(0,0,0,.22),inset 0 1px rgba(255,255,255,.035)!important;
  overflow:hidden!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .category-value-column{
  min-height:0!important;display:grid!important;grid-template-rows:repeat(3,minmax(44px,1fr))!important;gap:7px!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .board-category-panel .slot{
  width:100%!important;height:auto!important;min-height:44px!important;margin:0!important;padding:4px!important;
  border:1px solid rgba(255,255,255,.09)!important;border-radius:12px!important;
  color:#fff!important;background:rgba(255,255,255,.045)!important;
  font-size:clamp(22px,2.3vw,34px)!important;line-height:1!important;font-weight:950!important;
  box-shadow:inset 0 1px rgba(255,255,255,.035)!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .board-category-panel .slot.available:hover{
  transform:translateY(-2px)!important;border-color:rgba(245,207,88,.48)!important;background:rgba(245,207,88,.07)!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .board-category-panel :is(.slot.used,.slot.closed){
  pointer-events:none!important;
  opacity:.10!important;
  border-color:rgba(255,255,255,.035)!important;
  background:rgba(255,255,255,.012)!important;
  box-shadow:none!important;
  filter:none!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .board-category-panel :is(.slot.used,.slot.closed)>span{
  visibility:hidden!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .board-category-panel .board-cat{
  min-width:0!important;min-height:0!important;padding:7px!important;border-radius:15px!important;
  display:flex!important;flex-direction:column!important;justify-content:center!important;
  background:rgba(255,255,255,.025)!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .board-category-panel .board-cat-art{
  flex:1 1 auto!important;min-height:96px!important;max-height:130px!important;border-radius:12px!important;overflow:hidden!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .board-category-panel .board-cat strong{
  display:block!important;margin-top:7px!important;
  color:var(--q220-text)!important;font-size:clamp(12px,1.2vw,17px)!important;line-height:1.25!important;
  text-align:center!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;
}

/* Two teams only: team 1 right, team 2 left, turn arrow in the middle. */
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-board-footer.qadha-reference-footer{
  position:relative!important;left:auto!important;right:auto!important;bottom:auto!important;
  width:100%!important;min-height:118px!important;max-height:none!important;padding:0!important;
  display:grid!important;grid-template-columns:minmax(260px,1fr) minmax(150px,230px) minmax(260px,1fr)!important;
  grid-template-rows:1fr!important;align-items:stretch!important;gap:12px!important;
  border:0!important;background:transparent!important;box-shadow:none!important;backdrop-filter:none!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-board-footer .team-0{grid-column:3!important;grid-row:1!important}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-board-footer .team-1{grid-column:1!important;grid-row:1!important}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .modern-turn-arrow{
  grid-column:2!important;grid-row:1!important;
  align-self:center!important;min-height:72px!important;padding:10px 15px!important;border-radius:16px!important;
  display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;
  position:relative!important;color:#1b1608!important;background:linear-gradient(135deg,#ffe68c,var(--q220-gold))!important;
  border:0!important;box-shadow:0 12px 32px rgba(245,207,88,.16)!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .modern-turn-arrow::after{
  content:""!important;position:absolute!important;top:50%!important;width:18px!important;height:18px!important;
  background:var(--q220-gold)!important;transform:translateY(-50%) rotate(45deg)!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .modern-turn-arrow.turn-team-0::after{right:-8px!important}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .modern-turn-arrow.turn-team-1::after{left:-8px!important}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .modern-turn-arrow small{font-size:10px!important}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .modern-turn-arrow strong{
  font-size:clamp(15px,1.4vw,21px)!important;white-space:normal!important;text-align:center!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-team-box{
  min-width:0!important;min-height:118px!important;padding:11px 13px!important;
  display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;
  grid-template-areas:"name score" "help help" "shield shield"!important;gap:7px 12px!important;
  border:1px solid var(--q220-line)!important;border-radius:19px!important;
  background:linear-gradient(150deg,var(--q220-panel-2),var(--q220-panel))!important;
  box-shadow:0 14px 36px rgba(0,0,0,.20)!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-team-box.active{
  border-color:rgba(245,207,88,.55)!important;
  box-shadow:0 0 0 2px rgba(245,207,88,.10),0 14px 38px rgba(0,0,0,.22)!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .team-name-button{
  grid-area:name!important;width:100%!important;max-width:none!important;min-width:0!important;min-height:52px!important;
  justify-content:flex-start!important;text-align:right!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .team-name-button strong{
  max-width:none!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;
  font-size:clamp(16px,1.6vw,24px)!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-score-control{
  grid-area:score!important;width:auto!important;min-width:168px!important;display:grid!important;
  grid-template-columns:42px minmax(74px,1fr) 42px!important;align-items:center!important;gap:5px!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-score-control output{
  min-width:74px!important;height:48px!important;display:grid!important;place-items:center!important;
  color:var(--q220-gold)!important;font-size:clamp(28px,3vw,44px)!important;font-weight:950!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-score-control .score-step{
  width:42px!important;height:42px!important;min-height:42px!important;padding:0!important;border-radius:11px!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .team-help-block{grid-area:help!important}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .help-btn.used{display:none!important}

/* Question screen: full copy, no clipped sentences. */
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .q-question-screen-v129{
  width:min(1580px,100%)!important;min-height:calc(100dvh - 20px)!important;margin:0 auto!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .q-question-body-v129{
  min-height:0!important;display:grid!important;grid-template-columns:minmax(0,1fr) minmax(240px,320px)!important;gap:14px!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .q-question-content-scroll{
  min-width:0!important;max-height:none!important;overflow:visible!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .question-text{
  max-width:100%!important;padding:clamp(16px,2vw,30px)!important;
  font-size:clamp(25px,3.1vw,48px)!important;line-height:1.45!important;text-align:center!important;
  white-space:normal!important;overflow:visible!important;text-overflow:clip!important;overflow-wrap:anywhere!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .q-question-control-dock{
  position:relative!important;bottom:auto!important;width:100%!important;min-width:0!important;
}

/* Drawing observer must never stretch/crop participant strokes. */
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .drawing-stage-v260{
  min-width:0!important;display:grid!important;grid-template-columns:minmax(180px,250px) minmax(0,1fr)!important;gap:16px!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .host-draw-paper{
  width:min(100%,980px)!important;aspect-ratio:900/560!important;height:auto!important;margin-inline:auto!important;
  overflow:hidden!important;display:grid!important;place-items:center!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .host-draw-canvas{
  display:block!important;width:100%!important;height:100%!important;max-width:100%!important;max-height:100%!important;
  object-fit:contain!important;touch-action:none!important;
}

/* Tablet / phone host: preserve hierarchy without fixed footer covering content. */
@media(max-width:900px){
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active #qApp{padding:6px!important}
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .qadha-reference-board{
    min-height:100dvh!important;grid-template-rows:auto auto auto!important;gap:8px!important;
  }
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-qadha-toolbar{
    grid-template-columns:minmax(0,1fr) auto!important;grid-template-areas:"brand turn" "actions actions"!important;
    gap:6px!important;
  }
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .q-toolbar-actions{
    justify-content:center!important;overflow-x:auto!important;scrollbar-width:none!important;
  }
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-board-grid.qadha-reference-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;grid-template-rows:none!important;grid-auto-rows:minmax(142px,auto)!important;
    padding-bottom:0!important;
  }
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .board-category-panel{min-height:142px!important}
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-board-footer.qadha-reference-footer{
    position:relative!important;left:auto!important;right:auto!important;bottom:auto!important;max-height:none!important;
    grid-template-columns:minmax(0,1fr) minmax(100px,145px) minmax(0,1fr)!important;
  }
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-team-box{
    min-height:100px!important;padding:8px!important;grid-template-columns:1fr!important;grid-template-areas:"name" "score" "help" "shield"!important;
  }
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-score-control{width:100%!important;min-width:0!important}
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .q-question-body-v129{grid-template-columns:1fr!important}
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .q-question-sidebar-v129{display:grid!important;grid-template-columns:1fr 1fr!important}
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .drawing-stage-v260{grid-template-columns:1fr!important}
}
@media(max-width:560px){
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-board-grid.qadha-reference-grid{
    grid-template-columns:1fr!important;grid-auto-rows:minmax(126px,auto)!important;
  }
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .board-category-panel{
    min-height:126px!important;grid-template-columns:minmax(58px,.68fr) minmax(92px,1fr) minmax(58px,.68fr)!important;gap:5px!important;padding:5px!important;
  }
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .category-value-column{grid-template-rows:repeat(3,minmax(34px,1fr))!important;gap:4px!important}
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .board-category-panel .slot{min-height:34px!important;font-size:18px!important}
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .board-category-panel .board-cat-art{min-height:70px!important}
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-board-footer.qadha-reference-footer{
    grid-template-columns:1fr 1fr!important;grid-template-rows:auto auto!important;gap:5px!important;
  }
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .modern-turn-arrow{grid-column:1/-1!important;grid-row:1!important;min-height:42px!important}
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .modern-turn-arrow::after{display:none!important}
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-board-footer .team-0{grid-column:2!important;grid-row:2!important}
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-board-footer .team-1{grid-column:1!important;grid-row:2!important}
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .premium-team-box{min-height:86px!important}
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .team-help-block{display:none!important}
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .q-board-slogan{display:none!important}
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active .question-text{font-size:clamp(22px,7vw,32px)!important;padding:12px!important}
}


/* r220 post-deploy: compact/landscape host boards must scroll to both team cards.
   Historical shell layers may pin body/#qApp to the viewport; undo that outside drawing focus. */
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active:not(.qadha-drawing-focus){
  position:relative!important;
  inset:auto!important;
  width:100%!important;
  height:auto!important;
  min-height:100dvh!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  overscroll-behavior-y:auto!important;
}
html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active:not(.qadha-drawing-focus) #qApp{
  position:relative!important;
  inset:auto!important;
  height:auto!important;
  min-height:100dvh!important;
  overflow:visible!important;
}
@media (max-height:520px) and (orientation:landscape){
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active:not(.qadha-drawing-focus) #qApp{
    padding-bottom:18px!important;
  }
  html[data-ui-mode="modern"] body[data-game-brand="qadha"].q-game-active:not(.qadha-drawing-focus) .qadha-reference-board{
    min-height:max(100dvh,720px)!important;
  }
}
