@media (min-width:1001px){
  :root{
    --dark-chat-w: 300px;
    --dark-table-max: 1280px;
    --dark-rack-w: min(1280px, calc(100vw - 380px));
    --dark-rack-h: clamp(178px, 21dvh, 210px);
  }
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame){
    background:radial-gradient(circle at 50% 0%, #1a1311 0%, #0b0908 48%, #080707 100%) !important;
    color:#f4e9cf !important;
  }
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .gameTableWrap::before,
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .gameTableWrap::after{display:none!important;content:none!important}

  html body #root main.gameScreen.yuzbirGame>.gameTableWrap,
  html body #root main.gameScreen.duzGame>.gameTableWrap{
    position:fixed!important;
    top:58px!important;
    left:0!important;
    right:0!important;
    bottom:0!important;
    width:100vw!important;
    max-width:none!important;
    margin:0!important;
    padding:12px 10px calc(var(--dark-rack-h) + 18px)!important;
    display:block!important;
    overflow:visible!important;
    z-index:1!important;
  }

  html body #root main.gameScreen:is(.yuzbirGame,.duzGame):not(.socialCollapsed):has(.desktopSocialRail)>.gameTableWrap{
    width:calc(100vw - var(--dark-chat-w))!important;
    right:var(--dark-chat-w)!important;
    padding-right:12px!important;
  }

  html body #root main.gameScreen.yuzbirGame .feltTable101,
  html body #root main.gameScreen.duzGame .feltTable{
    position:relative!important;
    width:min(var(--dark-table-max), calc(100vw - 48px))!important;
    height:clamp(290px, 44dvh, 430px)!important;
    margin:0 auto!important;
    border:12px solid #734019!important;
    border-radius:34px!important;
    background:
      linear-gradient(180deg, rgba(4,12,26,.16), rgba(0,11,20,.28)),
      url('/assets/layout/mavi-cuha-kirpim.webp') center/240px 110px repeat,
      radial-gradient(ellipse at center,#0d5b87 0%,#0b4065 58%,#082a47 100%)!important;
    box-shadow:inset 0 0 0 3px #cb9957,inset 0 0 0 8px #412311,inset 0 0 90px #001625b5,0 12px 0 #2e170b,0 18px 36px #000a!important;
    overflow:visible!important;
    isolation:isolate!important;
  }
  html body #root main.gameScreen.yuzbirGame .feltTable101::before,
  html body #root main.gameScreen.duzGame .feltTable::before{
    content:""!important; position:absolute!important; inset:3px!important; border-radius:26px!important;
    background:none!important;
    pointer-events:none!important; z-index:1!important; opacity:.98!important;
  }
  html body #root main.gameScreen.yuzbirGame .feltTable101::after,
  html body #root main.gameScreen.duzGame .feltTable::after{
    content:""!important; position:absolute!important; inset:14px!important; border-radius:22px!important;
    box-shadow: inset 0 0 0 1px rgba(233,199,131,.38), inset 0 0 42px rgba(0,15,32,.34)!important;
    pointer-events:none!important; z-index:2!important;
  }

  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .feltTable101 > *,
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .feltTable > *{position:relative!important; z-index:4!important}

  /* seats */
  html body #root main.gameScreen.yuzbirGame .seat,
  html body #root main.gameScreen.duzGame .seat{
    border:1px solid #b98b4d!important;
    border-radius:14px!important;
    background:linear-gradient(145deg,#1a1411f3,#06090cf5)!important;
    color:#f8ebc7!important;
    box-shadow:0 8px 20px #0008!important;
    padding:6px 10px!important;
    min-width:104px!important;
  }
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .seat b{color:#ffefcb!important}
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .seat span{color:#e2c98f!important}
  html body #root main.gameScreen.yuzbirGame .seat.seat-2,
  html body #root main.gameScreen.duzGame .seat.seat-2{
    top:-6px!important; left:50%!important; transform:translate(-50%,-48%)!important;
    min-width:160px!important; max-width:240px!important; z-index:8!important;
  }
  html body #root main.gameScreen.yuzbirGame .seat.seat-1,
  html body #root main.gameScreen.duzGame .seat.seat-1{
    left:16px!important; top:50%!important; transform:translate(-28%,-50%)!important;
    min-width:86px!important; max-width:132px!important; z-index:8!important;
  }
  html body #root main.gameScreen.yuzbirGame .seat.seat-3,
  html body #root main.gameScreen.duzGame .seat.seat-3{
    right:16px!important; top:50%!important; transform:translate(28%,-50%)!important;
    min-width:86px!important; max-width:132px!important; z-index:8!important;
  }
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .seat.turn{box-shadow:0 0 0 2px rgba(249,206,110,.45),0 0 18px rgba(255,207,92,.3),0 8px 20px #0008!important}

  /* 101 meld board */
  html body #root main.gameScreen.desktopGame.yuzbirGame:not(.phoneGame) .feltTable101 .yuzbirMeldBoard,
  html body #root main.gameScreen.desktopGame.yuzbirGame:not(.phoneGame) .feltTable101 .yuzbirMeldBoard.layoffReady{
    position:absolute!important;
    left:76px!important; right:76px!important; top:58px!important; bottom:18px!important;
    width:auto!important; height:auto!important; padding:0!important;
    display:grid!important; grid-template-columns:1fr 1fr; grid-template-rows:1fr 1fr; gap:8px!important;
    background:transparent!important; border:0!important; box-shadow:none!important;
    overflow:visible!important; z-index:4!important;
  }
  html body #root main.gameScreen.desktopGame.yuzbirGame:not(.phoneGame) .feltTable101 .yuzbirMeldLane{
    min-height:0!important; height:auto!important; margin:0!important; padding:7px 8px!important;
    display:flex!important; flex-direction:column!important; overflow:auto!important;
    background:linear-gradient(180deg, rgba(10,42,39,.78), rgba(9,31,31,.72))!important;
    border:1px solid rgba(179,151,93,.48)!important; border-radius:12px!important;
    box-shadow:inset 0 1px 0 rgba(255,255,255,.06), inset 0 0 18px rgba(0,0,0,.18)!important;
  }
  html body #root main.gameScreen.desktopGame.yuzbirGame:not(.phoneGame) .feltTable101 .yuzbirMeldLaneHead{
    margin:0 0 5px!important; font-size:10px!important; color:#f1dfaf!important; min-height:16px!important;
  }
  html body #root main.gameScreen.desktopGame.yuzbirGame:not(.phoneGame) .feltTable101 .yuzbirMeldGroups{
    gap:7px 8px!important; align-content:flex-start!important;
  }
  html body #root main.gameScreen.desktopGame.yuzbirGame:not(.phoneGame) .feltTable101 .yuzbirMeldGroup{
    gap:1px!important; padding:2px!important; background:rgba(18,68,56,.55)!important; border-radius:7px!important;
  }

  /* center deck */
  html body #root main.gameScreen.yuzbirGame .centerDeck,
  html body #root main.gameScreen.duzGame .centerDeck{
    top:54%!important; transform:translate(-50%,-50%)!important; z-index:6!important;
  }
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .deckStack{
    background:linear-gradient(155deg,#885228,#412214)!important;
    border-color:#cb9852!important; box-shadow:0 6px 14px rgba(0,0,0,.32)!important;
  }

  /* rack area */
  html body #root main.gameScreen.yuzbirGame .rackArea,
  html body #root main.gameScreen.yuzbirGame.finishedHand .rackArea,
  html body #root main.gameScreen.duzGame .rackArea{
    position:fixed!important;
    left:50%!important; transform:translateX(-50%)!important; bottom:10px!important;
    width:var(--dark-rack-w)!important; max-width:var(--dark-table-max)!important; height:var(--dark-rack-h)!important;
    border:3px solid #b47d43!important; border-radius:20px!important;
    background:linear-gradient(180deg,#ab7239 0%,#6e401f 18%,#341d11 100%), url('/assets/layout/ceviz-kirpim.webp') center/280px 58px repeat!important;
    box-shadow:inset 0 2px 0 rgba(255,220,164,.4), inset 0 -10px 22px rgba(22,8,2,.65), 0 14px 30px rgba(0,0,0,.42)!important;
    padding:5px 8px 6px!important; z-index:40!important;
  }
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame):not(.socialCollapsed):has(.desktopSocialRail) .rackArea{
    left:calc((100vw - var(--dark-chat-w))/2)!important;
    width:min(var(--dark-table-max), calc(100vw - 360px))!important;
  }
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .rackBoardShell{
    background:linear-gradient(180deg,#6a4123,#2b180f)!important;
    border:1px solid #a67340!important; border-radius:14px!important;
    box-shadow:inset 0 1px 0 rgba(255,241,204,.12)!important;
  }
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .tileRackGrid{gap:0!important;padding:3px!important}
  html body #root main.gameScreen.yuzbirGame .tileRackGrid{grid-template-columns:repeat(14, 44px)!important}
  html body #root main.gameScreen.duzGame .tileRackGrid{grid-template-columns:repeat(15, 44px)!important}
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .tileRackGrid .rackSlot{width:44px!important; min-width:44px!important}
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .rackTools button,
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .rack101UnifiedActions button{
    border:1px solid #c59153!important; border-radius:10px!important; color:#ffefcb!important;
    background:linear-gradient(180deg,#4b311d,#19110d)!important; box-shadow:inset 0 1px 0 rgba(255,247,225,.12)!important;
  }

  /* Social rail keep readable */
  html body #root main.gameScreen.yuzbirGame .gameChatDock.floatingSocial.desktopSocialRail,
  html body #root main.gameScreen.duzGame .gameChatDock.floatingSocial.desktopSocialRail{
    width:var(--dark-chat-w)!important; right:0!important; top:58px!important; bottom:0!important;
  }
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .chatPanel,
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .richChat{
    border-color:#8f6d41!important; background:#f0f2f5!important;
  }

  /* minor topbar tweak */
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .topbar{overflow-x:auto!important; scrollbar-width:thin!important}
}

/* V4: prevent DOM rack from being shifted under fixed right social rail. */
@media (min-width:1001px) {
 html body #root#root#root#root#root#root#root#root#root main.gameScreen.yuzbirGame:not(.socialCollapsed):has(.desktopSocialRail) .rackArea,
 html body #root#root#root#root#root#root#root#root#root main.gameScreen.duzGame:not(.socialCollapsed):has(.desktopSocialRail) .rackArea {
   position:fixed!important;left:12px!important;right:auto!important;bottom:8px!important;
   margin:0!important;transform:none!important;translate:none!important;
   width:calc(100vw - 336px)!important;max-width:none!important;
 }
 html body #root#root#root#root#root#root#root#root#root main.gameScreen.yuzbirGame.socialCollapsed .rackArea,
 html body #root#root#root#root#root#root#root#root#root main.gameScreen.duzGame.socialCollapsed .rackArea {
   left:12px!important;right:12px!important;transform:none!important;translate:none!important;
   width:calc(100vw - 24px)!important;max-width:none!important;
 }
 html body #root#root#root#root#root#root#root#root#root main.gameScreen.yuzbirGame:not(.socialCollapsed):has(.desktopSocialRail) .feltTable101,
 html body #root#root#root#root#root#root#root#root#root main.gameScreen.duzGame:not(.socialCollapsed):has(.desktopSocialRail) .feltTable {
   width:calc(100vw - 336px)!important;max-width:none!important;margin-left:0!important;margin-right:0!important;
 }
 html body #root#root#root#root#root#root#root#root#root main.gameScreen:is(.yuzbirGame,.duzGame) :is(.feltTable,.feltTable101)::before{
   background:none!important;pointer-events:none!important;
 }
 html body #root#root#root#root#root#root#root#root#root main.gameScreen:is(.yuzbirGame,.duzGame) .rackArea .tileRackGrid {
   max-width:100%!important;overflow:visible!important;
 }
}

/* V5: masa olcegine bagli dekor; canli taslar hicbir zaman gorsel katmana donusturulmez. */
@media (min-width:1001px) {
  /* Don't generate a second full table image; leave actual game DOM and drag targets intact. */
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .gameTableWrap::before,
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .gameTableWrap::after {
    display:none!important; content:none!important;
  }
  /* Keep center game controls above ornamental graphics; no layout transforms to drop targets. */
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) :is(.centerDeck,.indicatorPanel,.discardSpot) {
    pointer-events:auto!important;
  }
  /* Opened meld zones are translucent so the actual blue felt remains visible. */
  html body #root main.gameScreen.desktopGame.yuzbirGame:not(.phoneGame) .feltTable101 .yuzbirMeldLane {
    background:linear-gradient(180deg,rgba(8,43,62,.55),rgba(7,31,49,.62))!important;
    border-color:rgba(203,152,81,.48)!important;
  }
  /* Center Auto Arrange within existing button row, preserving its React onClick. */
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .rackArea .rackTools {
    display:flex!important; align-items:center!important; justify-content:center!important;
    gap:7px!important; width:100%!important;
    position:relative!important; left:auto!important; right:auto!important;
    transform:none!important;
  }
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .rackArea .rackHead .rackTools>button:first-child {
    order:2!important;
  }
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .rackArea .rackHead .rackTools>button:nth-child(2) {order:1!important;}
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .rackArea .rackHead .rackTools>button:nth-child(3) {order:3!important;}
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) .rackArea .rackHead .rackTools>button {flex:0 0 auto!important;min-width:100px!important;}
  /* Avoid creating duplicate perspective rails atop live player panels. */
  html body #root main.gameScreen:is(.yuzbirGame,.duzGame) :is(.feltTable,.feltTable101)::before {background:none!important;pointer-events:none!important;}
}

/* V6 — left collapsible chat, original radio, and a single centered auto-arrange. */
@media(min-width:1001px){
 html body #root main.gameScreen:is(.duzGame,.yuzbirGame) .darkV6ChatTab {
  position:fixed!important;left:0!important;top:calc(50dvh - 62px)!important;z-index:980!important;
  display:flex!important;align-items:center!important;gap:5px!important;
  writing-mode:vertical-rl!important;min-height:110px!important;width:37px!important;
  padding:12px 7px!important;margin:0!important;border-radius:0 13px 13px 0!important;
  border:1px solid #c69254!important;border-left:0!important;
  color:#fbe7be!important;background:linear-gradient(130deg,#172e2b,#0a1414)!important;
  box-shadow:2px 5px 18px #0009!important;cursor:pointer!important;
 }
 html body #root main.gameScreen:is(.duzGame,.yuzbirGame) .darkV6ChatTab:focus-visible{outline:3px solid #f6d282!important;outline-offset:3px!important}
 html body #root main.gameScreen:is(.duzGame,.yuzbirGame) .darkV6ChatTab[aria-expanded=true]{background:linear-gradient(#503176,#281942)!important}
 html body #root main.gameScreen:is(.duzGame,.yuzbirGame) .darkV6OriginalChatControl{display:none!important}
 /* Center the same functional auto-arrange button in the top rail. */
 html body #root main.gameScreen:is(.duzGame,.yuzbirGame) .rackArea .rackHead .rackTools{position:relative!important;justify-content:center!important;}
 html body #root main.gameScreen:is(.duzGame,.yuzbirGame) .rackArea .rackHead .rackTools>button.darkV6AutoArrange{
   order:2!important;position:relative!important;left:auto!important;right:auto!important;transform:none!important;
   min-width:135px!important;background:linear-gradient(180deg,#7445a4,#3b2259)!important;
   border:1px solid #c99ae6!important;color:#fff7ff!important;
 }
}
/* V7: actual header center, desktop chat default closed by controller. */
@media(min-width:1001px){
 html body #root main.gameScreen:is(.duzGame,.yuzbirGame) .rackArea .rackHead{
   position:relative!important; overflow:visible!important;
 }
 html body #root main.gameScreen:is(.duzGame,.yuzbirGame) .rackArea .rackHead .rackTools{
   position:static!important;transform:none!important;left:auto!important;right:auto!important;
   display:flex!important;justify-content:space-between!important;width:100%!important;
 }
 html body #root main.gameScreen:is(.duzGame,.yuzbirGame) .rackArea .rackHead .rackTools>button.darkV7AutoArrange{
   position:absolute!important;left:50%!important;top:0!important;transform:translateX(-50%)!important;
   z-index:30!important;width:max-content!important;min-width:128px!important;
   order:unset!important;background:linear-gradient(#7955a8,#4e2c72)!important;
 }
 html body #root main.gameScreen:is(.duzGame,.yuzbirGame) .darkV7ChatTab{
  position:fixed!important;left:0!important;top:calc(50dvh - 62px)!important;z-index:980!important;
  writing-mode:vertical-rl!important;display:flex!important;gap:6px!important;align-items:center!important;
  min-height:110px!important;width:38px!important;border-radius:0 12px 12px 0!important;
  border:1px solid #c69254!important;color:#fff1ce!important;background:#122727!important;
  padding:10px 7px!important;box-shadow:2px 6px 18px #0009!important;
 }
 html body #root main.gameScreen:is(.duzGame,.yuzbirGame) .darkV7ChatTab[aria-expanded=true]{background:#493066!important}
 html body #root main.gameScreen:is(.duzGame,.yuzbirGame) .darkV7OriginalChatControl{display:none!important}
}
