@import url("./action-console-stable.css");
/* v1.8.4 Phase 4 — modern game rail, segmented modes and action console.
   Composition/presentation only. Gameplay, board geometry and mode semantics
   remain owned by the existing family runtimes. */
:root{
  --ag-rail-surface:linear-gradient(180deg,rgba(16,22,30,.82),rgba(8,12,17,.88));
  --ag-rail-border:rgba(237,224,199,.105);
  --ag-rail-divider:rgba(237,224,199,.075);
  --ag-segment-track:rgba(5,9,14,.72);
  --ag-segment-border:rgba(237,224,199,.11);
  --ag-segment-active:linear-gradient(180deg,rgba(181,138,77,.2),rgba(181,138,77,.105));
  --ag-console-surface:linear-gradient(180deg,rgba(14,20,28,.72),rgba(7,11,16,.82));
}

/* Rail hierarchy: one quiet card, fewer nested boxes, stronger typographic rhythm. */
[data-game-architecture="v1"] .ag-game-rail{gap:.42rem!important}
[data-game-architecture="v1"] [data-game-zone="game-panel"]{
  padding:.72rem!important;
  border:1px solid var(--ag-rail-border)!important;
  border-radius:14px!important;
  background:var(--ag-rail-surface)!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.025),0 10px 28px rgba(0,0,0,.13)!important;
}
[data-game-architecture="v1"] [data-game-zone="game-panel"]>.eyebrow:first-child{
  margin:0 0 .48rem;
  font-size:.68rem;
  letter-spacing:.14em;
}

/* One semantic segmented control for Local / AI / Online across all families. */
[data-game-architecture="v1"] .ag-mode-segmented{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:2px!important;
  width:100%;
  margin:0 0 .62rem!important;
  padding:3px!important;
  border:1px solid var(--ag-segment-border);
  border-radius:12px;
  background:var(--ag-segment-track);
  box-shadow:inset 0 1px 2px rgba(0,0,0,.3),inset 0 1px 0 rgba(255,255,255,.018);
}
[data-game-architecture="v1"] .ag-mode-segmented>.ag-button[data-control-role="toggle"]{
  width:100%;
  min-width:0;
  min-height:38px;
  height:38px;
  margin:0;
  padding:0 .38rem;
  border:0!important;
  border-radius:9px!important;
  background:transparent!important;
  color:var(--ag-text-subtle)!important;
  box-shadow:none!important;
  font-size:.76rem;
  font-weight:690;
  line-height:1.08;
  transform:none!important;
}
[data-game-architecture="v1"] .ag-mode-segmented>.ag-button[data-control-role="toggle"][aria-pressed="true"]{
  background:var(--ag-segment-active)!important;
  color:var(--ag-text-primary)!important;
  box-shadow:inset 0 0 0 1px rgba(209,173,104,.36),0 3px 10px rgba(0,0,0,.18)!important;
}
@media(hover:hover){
  [data-game-architecture="v1"] .ag-mode-segmented>.ag-button[data-control-role="toggle"]:not(:disabled):hover{
    background:rgba(255,255,255,.045)!important;
    color:var(--ag-text-primary)!important;
  }
  [data-game-architecture="v1"] .ag-mode-segmented>.ag-button[data-control-role="toggle"][aria-pressed="true"]:not(:disabled):hover{
    background:linear-gradient(180deg,rgba(196,151,86,.23),rgba(181,138,77,.13))!important;
  }
}
[data-game-architecture="v1"] .ag-mode-segmented>.ag-button[data-control-role="toggle"]:focus-visible{
  outline:2px solid var(--ag-focus);
  outline-offset:1px;
  z-index:1;
}
[data-game-architecture="v1"] .ag-game-intro>.ag-mode-segmented.play-scope-row{
  width:auto;
  max-width:100%;
  grid-template-columns:repeat(2,max-content)!important;
  flex:0 0 auto;
  margin:0!important;
}
[data-game-architecture="v1"] .ag-game-intro>.ag-mode-segmented.play-scope-row>.ag-button{
  width:auto;
  min-width:7.25rem;
  padding-inline:.85rem;
}
@media(max-width:520px){
  [data-game-architecture="v1"] .ag-game-intro>.ag-mode-segmented.play-scope-row{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    width:min(100%,18rem);
  }
  [data-game-architecture="v1"] .ag-game-intro>.ag-mode-segmented.play-scope-row>.ag-button{
    width:100%;
    min-width:0;
  }
}

/* Fields become lightweight rows rather than independent visual cards. */
[data-game-architecture="v1"] [data-game-zone="game-panel"]>label,
[data-game-architecture="v1"] [data-game-zone="game-panel"]>.traditional-role-field{
  display:grid;
  gap:.28rem;
  margin:.52rem 0 0;
  color:var(--ag-text-subtle);
  font-size:.69rem;
  font-weight:650;
  line-height:1.2;
}
[data-game-architecture="v1"] [data-game-zone="game-panel"]>label :is(select,input)[data-control-field]{
  width:100%;
  min-width:0;
  min-height:36px;
  padding-inline:.65rem;
  font-size:.78rem;
}
[data-game-architecture="v1"] [data-game-zone="game-panel"] :is(#modeHint,#connectionStatus){
  margin:.6rem 0 0!important;
  padding:.5rem 0 0;
  border-top:1px solid var(--ag-rail-divider);
  color:var(--ag-text-subtle)!important;
  font-size:.71rem;
  line-height:1.36;
}

/* Commands: a compact footer inside the Partie card, not another nested panel. */
[data-game-architecture="v1"] [data-game-zone="game-panel"] .session-actions{
  display:grid;
  gap:.34rem;
  margin:.58rem 0 0!important;
  padding:.56rem 0 0!important;
  border-top:1px solid var(--ag-rail-divider);
}
[data-game-architecture="v1"] [data-game-zone="game-panel"] .session-actions-label{
  color:var(--ag-brass);
  font-size:.62rem;
  font-weight:760;
  letter-spacing:.13em;
}
[data-game-architecture="v1"] [data-game-zone="game-panel"] .session-action-row{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(0,1fr));
  gap:.3rem;
}
[data-game-architecture="v1"] [data-game-zone="game-panel"] .session-action-row .ag-button{
  width:100%;
  min-height:36px;
  justify-content:center;
}

/* Bottom action console: compact floating command strip with one visual plane. */
[data-game-architecture="v1"] .ag-action-console{
  margin-top:.42rem!important;
  padding:.36rem .44rem!important;
  border:1px solid rgba(237,224,199,.09)!important;
  border-top-color:rgba(209,173,104,.18)!important;
  border-radius:12px!important;
  background:var(--ag-console-surface)!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.025),0 8px 24px rgba(0,0,0,.12);
}
[data-game-architecture="v1"] .ag-action-console>.game-state-line{
  gap:.38rem;
  min-height:34px;
}
[data-game-architecture="v1"] .ag-action-console .game-turn-pill{
  min-height:28px;
  padding:.24rem .56rem;
  border-color:rgba(209,173,104,.24);
  background:rgba(181,138,77,.075);
  font-size:.72rem;
  font-weight:760;
  box-shadow:inset 3px 0 0 var(--turn-accent,rgba(209,173,104,.56));
}
[data-game-architecture="v1"] .ag-action-console .game-state-message{
  min-height:26px;
  padding:.18rem .24rem;
  border-left:0;
  color:var(--ag-text-subtle);
  font-size:.7rem;
}
[data-game-architecture="v1"] .ag-action-console-actions{
  gap:.3rem;
}
[data-game-architecture="v1"] .ag-action-console-actions .ag-button,
[data-game-architecture="v1"] .ag-action-console .direct-confirm-button{
  min-height:34px;
  height:34px;
  padding:.3rem .62rem;
}
[data-game-architecture="v1"] .ag-global-replay-host .ag-button{
  min-height:34px;
}

/* Nim direct-selection console keeps its special semantics but shares the strip. */
[data-game-architecture="v1"] .ag-action-console--direct .direct-selection-console{
  min-width:0;
  gap:.38rem;
}
[data-game-architecture="v1"] .ag-action-console--direct .direct-selection-summary,
[data-game-architecture="v1"] .ag-action-console--direct .direct-selection-hint{
  margin:0;
  font-size:.7rem;
  line-height:1.3;
}

@media(max-width:899px){
  [data-game-architecture="v1"] .ag-mode-segmented>.ag-button[data-control-role="toggle"]{
    min-height:44px;
    height:auto;
    padding:.35rem .28rem;
    font-size:.74rem;
  }
  [data-game-architecture="v1"] [data-game-zone="game-panel"]{padding:.62rem!important}
  [data-game-architecture="v1"] .ag-action-console{padding:.3rem .36rem!important}
}

/* Phase 5: BOARD MAX already switches 900–1199 px surfaces to a temporary
   Partie drawer. Keep those tablet-landscape controls at the 44 px touch floor. */
@media(min-width:900px) and (max-width:1199px){
  [data-game-architecture="v1"] .ag-mode-segmented>.ag-button[data-control-role="toggle"]{
    min-height:44px;
    height:auto;
    padding:.35rem .28rem;
  }
}

@media(max-width:430px){
  [data-game-architecture="v1"] .ag-mode-segmented>.ag-button[data-control-role="toggle"]{
    padding-inline:.18rem;
    font-size:.7rem;
  }
}

/* v1.8.4 Phase 5 — desktop Alquerque fit.
   The square board must share the stage height with its persistent heading.
   Family CSS historically used height:100%, which overran the stage by the
   heading/margin reserve on large desktops and clipped the lower board edge. */
@media(min-width:1200px) and (min-height:701px){
  [data-game-architecture="v1"] .ag-board-stage .carre-board[data-board-master="true"]{
    flex:0 1 auto!important;
    width:auto!important;
    height:calc(100% - 3.85rem)!important;
    max-width:100%!important;
    max-height:calc(100% - 3.85rem)!important;
    aspect-ratio:1!important;
    margin:.45rem auto!important;
  }
}

@media(prefers-reduced-motion:reduce){
  [data-game-architecture="v1"] .ag-mode-segmented>.ag-button{transition:none!important}
}

/* Origines 2.1.0 M2 — two-level Local / Online navigation. */
[data-game-architecture="v1"] .ag-mode-segmented.play-scope-row{
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  margin-bottom:.36rem!important;
}
[data-game-architecture="v1"] .ag-mode-segmented.local-mode-choices{
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  margin-bottom:.62rem!important;
}
[data-game-architecture="v1"] .local-mode-choices[hidden]{display:none!important}
