/* Mobile Rebuild Phase 5 — Final Visual Freeze
   Final player-facing authority. The legacy duel-visual-v4 skin is retired at runtime;
   this layer also outranks older tool/game-screen selectors that used !important. */

.duel-final-v5.cm-phase2-screen{
  --mf5-blue:#2f95df;
  --mf5-blue-strong:#197fc6;
  --mf5-line:#e4eaee;
  --mf5-wall:#edf2f5;
  --mf5-clue:#d7edf8;
  --mf5-clue-active:#c8e6f6;
  --mf5-ink:#20262d;
  --mf5-muted:#7f8a92;
  background:#fff!important;color:var(--mf5-ink)!important;
  border:0!important;border-radius:0!important;box-shadow:none!important;
}
.duel-final-v5.cm-phase2-screen:before,.duel-final-v5.cm-phase2-screen:after{display:none!important;content:none!important}

/* Quiet, native header + score line. */
.duel-final-v5.cm-phase2-screen .duel-compact-top{
  background:#fff!important;border:0!important;border-bottom:1px solid var(--mf5-line)!important;
  border-radius:0!important;box-shadow:none!important;backdrop-filter:none!important;
}
.duel-final-v5.cm-phase2-screen .duel-compact-top:after{display:none!important;content:none!important}
.duel-final-v5.cm-phase2-screen .duel-title b{color:#171c22!important;font-weight:760!important;text-shadow:none!important}
.duel-final-v5.cm-phase2-screen .duel-title small{color:#909aa3!important;text-shadow:none!important}
.duel-final-v5.cm-phase2-screen .aw-scorebar{
  background:#fff!important;background-image:none!important;color:var(--mf5-ink)!important;
  border:0!important;border-bottom:1px solid var(--mf5-line)!important;border-radius:0!important;
  box-shadow:none!important;overflow:visible!important;
}
.duel-final-v5.cm-phase2-screen .aw-scorebar:before,.duel-final-v5.cm-phase2-screen .aw-scorebar:after{display:none!important;content:none!important;animation:none!important}
.duel-final-v5.cm-phase2-screen .duelist{padding:0!important;background:transparent!important;border-radius:0!important;filter:none!important;transform:none!important}
.duel-final-v5.cm-phase2-screen .duelist:after{display:none!important;content:none!important}
.duel-final-v5.cm-phase2-screen .duelist .avatar{
  width:auto!important;height:auto!important;min-width:0!important;padding:0!important;
  border:0!important;border-radius:0!important;background:transparent!important;background-image:none!important;
  box-shadow:none!important;color:#525c64!important;text-shadow:none!important;
}
.duel-final-v5.cm-phase2-screen .duelist.active .avatar{color:var(--mf5-blue)!important;font-weight:720!important}
.duel-final-v5.cm-phase2-screen .duelist b{
  border:0!important;border-radius:9px!important;background:#f2f5f7!important;background-image:none!important;
  box-shadow:none!important;color:#9aa3aa!important;text-shadow:none!important;
}
.duel-final-v5.cm-phase2-screen .duelist.active b{background:#eaf6fd!important;color:var(--mf5-blue)!important}
.duel-final-v5.cm-phase2-screen .duel-vs>span{color:#a0a8af!important;letter-spacing:.04em!important;text-shadow:none!important}

/* The board is the hero. No arena/card survives the final cascade. */
.duel-final-v5.cm-phase2-screen .duel-board-stage,
.duel-final-v5.cm-phase2-screen .aw-scroller{
  background:#fff!important;background-image:none!important;border:0!important;border-radius:0!important;
  box-shadow:none!important;backdrop-filter:none!important;filter:none!important;
}
.duel-final-v5.cm-phase2-screen .duel-board-stage:before,.duel-final-v5.cm-phase2-screen .duel-board-stage:after{display:none!important;content:none!important}
.duel-final-v5.cm-phase2-screen .aw-grid{
  gap:1px!important;padding:1px!important;background:#9eabb5!important;background-image:none!important;
  border:0!important;border-radius:0!important;box-shadow:none!important;filter:none!important;transform:none!important;
}
.duel-final-v5.cm-phase2-screen .true-arrowword-grid .aw-wall{background:var(--mf5-wall)!important;background-image:none!important;box-shadow:none!important}
.duel-final-v5.cm-phase2-screen .true-arrowword-grid .aw-clue{
  background:var(--mf5-clue)!important;background-image:none!important;color:#26323b!important;
  border:0!important;border-radius:0!important;box-shadow:none!important;text-shadow:none!important;
}
.duel-final-v5.cm-phase2-screen .true-arrowword-grid .aw-clue.active{background:var(--mf5-clue-active)!important;box-shadow:inset 0 0 0 2px var(--mf5-blue)!important}
.duel-final-v5.cm-phase2-screen .true-arrowword-grid .aw-answer{
  background:#fff!important;background-image:none!important;color:var(--mf5-ink)!important;
  border:0!important;border-radius:0!important;box-shadow:none!important;text-shadow:none!important;
}
.duel-final-v5.cm-phase2-screen .true-arrowword-grid .aw-answer.lane{background:#fff1d8!important;box-shadow:inset 0 0 0 1px rgba(228,173,84,.72)!important}
.duel-final-v5.cm-phase2-screen .true-arrowword-grid .aw-answer.lane-open,
.duel-final-v5.cm-phase2-screen .true-arrowword-grid .aw-answer.buffered{background:#fff0d3!important;box-shadow:inset 0 0 0 2px #e4ad54!important}
.duel-final-v5.cm-phase2-screen .true-arrowword-grid .aw-answer.hint-target{background:#dff2d7!important;box-shadow:inset 0 0 0 2px #74b65d!important}
.duel-final-v5.cm-phase2-screen .true-arrowword-grid .aw-answer.ai-preview,
.duel-final-v5.cm-phase2-screen .true-arrowword-grid .aw-answer.opponent-preview{background:#e7f3de!important;box-shadow:inset 0 0 0 2px #83c369!important}

/* Warm rack tiles, immediately followed by a clean thumb bar. */
.duel-final-v5.cm-phase2-screen .aw-rack{background:#fff!important;border:0!important;box-shadow:none!important}
.duel-final-v5.cm-phase2-screen .aw-tile{
  border:1px solid #ead6ad!important;border-radius:9px!important;
  background:linear-gradient(180deg,#fff9e9,#fff2d5)!important;color:#22282f!important;
  box-shadow:0 3px 0 #dbc08a,0 6px 11px rgba(82,65,31,.10)!important;
}
.duel-final-v5.cm-phase2-screen .aw-tile.selected{transform:translateY(-5px)!important;border-color:#dcb266!important;box-shadow:0 3px 0 #d1ab63,0 8px 14px rgba(76,58,24,.14),0 0 0 2px rgba(47,149,223,.22)!important}

.duel-final-v5.cm-phase2-screen .cm2-actions{
  background:#fff!important;border:0!important;border-top:1px solid #eef2f4!important;
  box-shadow:none!important;
}
.duel-final-v5.cm-phase2-screen .cm2-actions .gameplay-tool{
  margin:0!important;padding:0!important;border:0!important;box-shadow:none!important;filter:none!important;
}
.duel-final-v5.cm-phase2-screen .cm2-utility{
  display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;
  gap:2px!important;position:relative!important;background:transparent!important;color:#68747d!important;border-radius:12px!important;
  grid-template-columns:none!important;grid-template-rows:none!important;
}
.duel-final-v5.cm-phase2-screen .cm2-utility>span{
  position:relative!important;display:grid!important;place-items:center!important;flex:0 0 auto!important;
  border:1px solid #dce4e9!important;border-radius:50%!important;background:#fff!important;color:#5f6d77!important;
  box-shadow:0 1px 2px rgba(29,43,54,.04)!important;font-weight:560!important;
}
.duel-final-v5.cm-phase2-screen .cm2-utility>b{
  position:static!important;display:block!important;margin:0!important;padding:0!important;
  color:#7f8a92!important;font-weight:650!important;line-height:1!important;white-space:nowrap!important;
}
.duel-final-v5.cm-phase2-screen .cm2-utility>small{
  position:absolute!important;display:grid!important;place-items:center!important;margin:0!important;padding:0!important;
  border:0!important;border-radius:999px!important;background:var(--mf5-blue)!important;color:#fff!important;
  font-weight:850!important;line-height:1!important;text-transform:uppercase!important;letter-spacing:0!important;
}
.duel-final-v5.cm-phase2-screen .cm2-primary{
  display:flex!important;align-items:center!important;justify-content:center!important;gap:7px!important;position:relative!important;
  border:0!important;border-radius:999px!important;background:var(--mf5-blue)!important;background-image:none!important;
  color:#fff!important;box-shadow:0 2px 5px rgba(47,149,223,.22)!important;filter:none!important;
  font-weight:760!important;letter-spacing:-.01em!important;
}
.duel-final-v5.cm-phase2-screen .cm2-primary>span,.duel-final-v5.cm-phase2-screen .cm2-primary>b{position:static!important;color:#fff!important;text-shadow:none!important}
.duel-final-v5.cm-phase2-screen .cm2-primary:not(:disabled):active{background:var(--mf5-blue-strong)!important;transform:scale(.98)!important}
.duel-final-v5.cm-phase2-screen .cm2-primary:disabled{background:#a9d1ed!important;opacity:.38!important}

/* Phone is canonical. Board → rack → controls is one continuous gameplay stack;
   spare height stays below the game instead of splitting rack and controls apart. */
@media(max-width:520px){
  .duel-final-v5.cm-phase2-screen{
    display:grid!important;grid-template-rows:48px 44px auto 58px 56px minmax(0,1fr)!important;
    align-content:start!important;padding:0 max(3px,var(--native-right,0px)) max(2px,var(--native-bottom,0px)) max(3px,var(--native-left,0px))!important;
  }
  .duel-final-v5.cm-phase2-screen .duel-compact-top{grid-row:1!important}
  .duel-final-v5.cm-phase2-screen .aw-scorebar{grid-row:2!important}
  .duel-final-v5.cm-phase2-screen .duel-board-stage{grid-row:3!important;width:100%!important;height:auto!important;padding:3px 0 0!important;align-self:start!important;display:grid!important;place-items:start center!important}
  .duel-final-v5.cm-phase2-screen .aw-scroller{width:100%!important;height:auto!important;display:grid!important;place-items:start center!important;overflow:hidden!important}
  .duel-final-v5.cm-phase2-screen .aw-dock{display:contents!important}
  .duel-final-v5.cm-phase2-screen .aw-rack{grid-row:4!important;height:58px!important;min-height:58px!important;gap:6px!important;align-self:start!important}
  .duel-final-v5.cm-phase2-screen .cm2-actions{
    grid-row:5!important;width:100%!important;height:56px!important;min-height:56px!important;
    display:grid!important;grid-template-columns:48px 48px minmax(120px,1fr) 48px!important;grid-template-rows:54px!important;
    align-items:center!important;justify-items:center!important;gap:5px!important;padding:0 3px 2px!important;align-self:start!important;
  }
  .duel-final-v5.cm-phase2-screen .cm2-utility{width:46px!important;height:52px!important}
  .duel-final-v5.cm-phase2-screen .cm2-utility>span{width:31px!important;height:31px!important;font-size:17px!important}
  .duel-final-v5.cm-phase2-screen .cm2-utility>b{font-size:9px!important}
  .duel-final-v5.cm-phase2-screen .cm2-utility>small{right:0!important;top:1px!important;width:15px!important;height:15px!important;font-size:5.5px!important}
  .duel-final-v5.cm-phase2-screen .cm2-primary{grid-column:3!important;grid-row:1!important;width:100%!important;max-width:224px!important;height:44px!important;min-height:44px!important;font-size:15px!important}
  .duel-final-v5.cm-phase2-screen .cm2-extra{grid-column:1!important}.duel-final-v5.cm-phase2-screen .cm2-swap{grid-column:2!important}.duel-final-v5.cm-phase2-screen .cm2-hint{grid-column:4!important}
}

@media(max-width:350px){
  .duel-final-v5.cm-phase2-screen{grid-template-rows:44px 40px auto 52px 50px minmax(0,1fr)!important}
  .duel-final-v5.cm-phase2-screen .aw-rack{height:52px!important;min-height:52px!important}
  .duel-final-v5.cm-phase2-screen .cm2-actions{height:50px!important;min-height:50px!important;grid-template-columns:42px 42px minmax(104px,1fr) 42px!important;grid-template-rows:48px!important;gap:3px!important}
  .duel-final-v5.cm-phase2-screen .cm2-utility{width:42px!important;height:48px!important}
  .duel-final-v5.cm-phase2-screen .cm2-primary{height:40px!important;min-height:40px!important}
}

/* Larger screens adapt outward without changing the mobile visual language. */
@media(min-width:521px){
  .duel-final-v5.cm-phase2-screen .cm2-actions{border-top:0!important}
  .duel-final-v5.cm-phase2-screen .cm2-utility{width:50px!important;height:48px!important}
  .duel-final-v5.cm-phase2-screen .cm2-utility>span{width:31px!important;height:31px!important;font-size:17px!important}
  .duel-final-v5.cm-phase2-screen .cm2-utility>b{font-size:9px!important}
  .duel-final-v5.cm-phase2-screen .cm2-utility>small{right:1px!important;top:0!important;width:15px!important;height:15px!important;font-size:5.5px!important}
  .duel-final-v5.cm-phase2-screen .cm2-primary{height:43px!important;min-height:43px!important;font-size:15px!important}
}

.high-contrast .duel-final-v5.cm-phase2-screen .aw-scorebar{background:#fff!important;color:#000!important;border-bottom:2px solid #000!important}
.high-contrast .duel-final-v5.cm-phase2-screen .true-arrowword-grid .aw-clue{background:#d9e8ff!important;color:#000!important}
.high-contrast .duel-final-v5.cm-phase2-screen .cm2-primary{background:#005bd7!important;color:#fff!important}
.reduced-motion .duel-final-v5.cm-phase2-screen *{scroll-behavior:auto!important;animation-duration:.001ms!important;animation-iteration-count:1!important}
@media(prefers-reduced-motion:reduce){.duel-final-v5.cm-phase2-screen *{scroll-behavior:auto!important;animation-duration:.001ms!important;animation-iteration-count:1!important}}
