/* r946 — entry/setup legibility and low-friction controls only.
   Preserves each game brand and never changes active round or TV board UI. */
:root[data-ui-mode="modern"] body[data-game-brand] :is(
  #app.home-shell,.qadha-initial-home,.qadha-setup-v217,
  .k-setup-shell,#setupView,#authView
){max-width:100%;min-width:0;overflow-wrap:break-word}
:root[data-ui-mode="modern"] body[data-game-brand] :is(
  #app.home-shell,.qadha-initial-home,.qadha-setup-v217,
  .k-setup-shell,#setupView,#authView
) :is(.home-action,.btn,.k-btn,.t10-btn,.round-option,.mode-toggle,.category-choice,button){
  min-width:0;max-width:100%;min-height:44px;
  white-space:normal;overflow-wrap:anywhere;
  -webkit-tap-highlight-color:transparent;touch-action:manipulation;
  transition:background-color .13s ease,border-color .13s ease,color .13s ease!important;
}
:root[data-ui-mode="modern"] body[data-game-brand] :is(
  #app.home-shell,.qadha-initial-home,.qadha-setup-v217,.k-setup-shell,#setupView
) :is(button,a,input,select,textarea):focus-visible{
  outline:3px solid #ffe2a1!important;outline-offset:3px!important;
}
:root[data-ui-mode="modern"] body[data-game-brand] :is(
  #app.home-shell,.qadha-initial-home,.qadha-setup-v217,.k-setup-shell,#setupView
) :is(input:not([type="checkbox"]),select,textarea){
  min-height:46px;max-width:100%;font-size:max(16px,1rem);
  text-overflow:clip;
}
:root[data-ui-mode="modern"] body[data-game-brand] :is(
  #app.home-shell,.qadha-initial-home,.qadha-setup-v217,.k-setup-shell,#setupView
) :is(label,.field small,.setup-card small,.setup-card p,.muted,.hint,.section-title span){
  opacity:1!important;line-height:1.55;overflow-wrap:anywhere;
}
/* Dark setup: bright readable controls and labels, no ghost text on purple. */
:root[data-ui-mode="modern"]:not([data-theme="light"]) body[data-game-brand] :is(
  .qadha-setup-v217,.k-setup-shell,#setupView
) :is(input:not([type=checkbox]),select,textarea){
  background:#231b36!important;color:#fff9ff!important;
  border-color:#b2a3cf!important;
}
:root[data-ui-mode="modern"]:not([data-theme="light"]) body[data-game-brand] :is(
  .qadha-setup-v217,.k-setup-shell,#setupView
) :is(input,textarea)::placeholder{color:#d1c5dc!important;opacity:1}
/* Light setup: explicit dark text and surfaces, including nonselected choices. */
:root[data-theme="light"][data-ui-mode="modern"] body[data-game-brand] :is(
  .qadha-setup-v217,.k-setup-shell,#setupView
) :is(input:not([type=checkbox]),select,textarea){
  background:#fff!important;color:#271936!important;
  border:1px solid #867196!important;
}
:root[data-theme="light"][data-ui-mode="modern"] body[data-game-brand] :is(
  .qadha-setup-v217,.k-setup-shell,#setupView
) :is(input,textarea)::placeholder{color:#665873!important;opacity:1}
:root[data-theme="light"][data-ui-mode="modern"] body[data-game-brand="top10"] #setupView
 :is(.round-option:not(.active),.timer-options button:not(.active),.segmented button:not(.active)){
  background:#fff!important;color:#30213f!important;border-color:#927ca7!important;
}
:root[data-theme="light"][data-ui-mode="modern"] body[data-game-brand="top10"] #setupView
 :is(.round-option:not(.active),.timer-options button:not(.active),.segmented button:not(.active))
 :is(b,span,small){color:#30213f!important;opacity:1!important}
/* Preserve fast-start call-to-action on a narrow phone without hiding settings. */
@media(max-width:640px){
  :root[data-ui-mode="modern"] body[data-game-brand="top10"] #top10QuickStart,
  :root[data-ui-mode="modern"] body[data-game-brand="qadha"] #qadhaQuickStart,
  :root[data-ui-mode="modern"] body[data-game-brand="khaltaha"] #kQuickStart{
    width:100%!important;min-height:50px!important;font-size:1rem!important;
  }
  :root[data-ui-mode="modern"] body[data-game-brand] :is(
    .qadha-setup-v217,.k-setup-shell,#setupView
  ){scroll-padding-bottom:calc(88px + env(safe-area-inset-bottom,0px))}
}
/* The free-floating ornamental layers have no function on Fbrkha's landing.
   Avoid a competing background while prioritizing fast create/join actions. */
:root[data-ui-mode="modern"] body[data-game-brand="fbrkha"]:has(> #app.home-shell)
 > .background-shapes{display:none!important}
@media(prefers-reduced-motion:reduce){
  :root[data-ui-mode="modern"] body[data-game-brand] :is(
    #app.home-shell,.qadha-initial-home,.qadha-setup-v217,.k-setup-shell,#setupView
  ) :is(.home-action,.btn,.k-btn,.t10-btn,.round-option,button){
    animation:none!important;transition:none!important;
  }
}

/* r1007: professional readable microcopy in entry/setup surfaces only.
   Every game's own artwork, palette, live board and reveal layout stay intact. */
:root[data-ui-mode="modern"] body[data-game-brand] :is(
  #app.home-shell,.qadha-initial-home,.qadha-setup-v217,
  .k-setup-shell,#setupView,#authView
) :is(label,.field small,.setup-card small,.setup-card p,
      .muted,.hint,.section-title span,.qadha-fast-start small,
      .top10-fast-start small){
  font-size:max(13px,.86rem);
  line-height:1.65!important;
  opacity:1!important;
  overflow-wrap:break-word;
}
:root[data-ui-mode="modern"] body[data-game-brand] :is(
  #app.home-shell,.qadha-initial-home,.qadha-setup-v217,
  .k-setup-shell,#setupView,#authView
) :is(button,a[role="button"],.home-action,.round-option,.mode-toggle,.category-choice){
  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
}
:root[data-ui-mode="modern"] body[data-game-brand] :is(
  #app.home-shell,.qadha-initial-home,.qadha-setup-v217,
  .k-setup-shell,#setupView,#authView
) :is(button,a,input,select,textarea,.home-action,.round-option,
      .mode-toggle,.category-choice):focus-visible{
  outline:3px solid #ffe2a1!important;
  outline-offset:3px!important;
}
@media(max-width:380px){
  :root[data-ui-mode="modern"] body[data-game-brand] :is(
    #app.home-shell,.qadha-setup-v217,.k-setup-shell,#setupView
  ){
    min-width:0!important;
    max-width:100%!important;
  }
  :root[data-ui-mode="modern"] body[data-game-brand] :is(
    .qadha-setup-v217,.k-setup-shell,#setupView
  ) :is(.round-option,.mode-toggle,.category-choice){
    min-width:0!important;
    overflow-wrap:break-word!important;
  }
}
@media(prefers-reduced-motion:reduce){
  :root[data-ui-mode="modern"] body[data-game-brand] :is(
    #app.home-shell,.qadha-initial-home,.qadha-setup-v217,
    .k-setup-shell,#setupView,#authView
  ) :is(.home-action,.round-option,.mode-toggle,.category-choice){
    transition:none!important;
    animation:none!important;
  }
}

/* r1007 light-contrast keyboard focus: cream ring belongs on dark panels,
   deep violet belongs on white panels. Never change game/team colours. */
:root[data-ui-mode="modern"][data-theme="light"] body[data-game-brand] :is(
  #app.home-shell,.qadha-initial-home,.qadha-setup-v217,
  .k-setup-shell,#setupView,#authView
) :is(button,a,input,select,textarea,.home-action,.round-option,
      .mode-toggle,.category-choice):focus-visible{
  outline-color:#6121bd!important;
}

/* r1010 — allow complete, current participant/team names in other party rooms.
   No forced single-line ellipsis in Khaltaha, Qadha or Top10. Game artwork,
   scoring, team indicators, controls and color coding remain unchanged. */
:root[data-ui-mode="modern"] body[data-game-brand="khaltaha"] :is(
  .player-chip b,.place b,.rank-podium-card b,.ranking-row b,
  .author-line b,.profile-edit b,.leader-change b
){
  min-width:0!important;max-width:100%!important;
  height:auto!important;max-height:none!important;
  white-space:normal!important;overflow:visible!important;
  text-overflow:clip!important;-webkit-line-clamp:unset!important;
  overflow-wrap:anywhere!important;word-break:normal!important;
  line-height:1.45!important;
  font-size:clamp(13px,1.25vw,18px)!important;
}
:root[data-ui-mode="modern"] body[data-game-brand="khaltaha"] :is(
  .player-chip,.place,.rank-podium-card,.ranking-row
){height:auto!important;min-width:0!important;max-height:none!important}
:root[data-ui-mode="modern"] body[data-game-brand="qadha"] :is(
  .team-box h2,.team-name-row h2,.team-name-button strong,
  .side-team-name strong,.qadha-v260 .team-name-button strong,
  .qadha-v260 .premium-turn-pill strong,.qadha-v260 .qadha-turn-banner strong,
  .qadha-final-v260 .final-team-score b
){
  white-space:normal!important;overflow:visible!important;
  text-overflow:clip!important;-webkit-line-clamp:unset!important;
  overflow-wrap:anywhere!important;word-break:normal!important;
  min-width:0!important;max-width:100%!important;max-height:none!important;
  line-height:1.4!important;
}
:root[data-ui-mode="modern"] body[data-game-brand="top10"] :is(
  .team-score-card .team-name,.team-name,.team-label
){
  min-width:0!important;max-width:100%!important;max-height:none!important;
  white-space:normal!important;overflow:visible!important;
  text-overflow:clip!important;-webkit-line-clamp:unset!important;
  overflow-wrap:anywhere!important;word-break:normal!important;
  line-height:1.45!important;
}
