/* Responsive presentation only. Rewards, reports and construction rules are unchanged. */
/* These semantic headers must not inherit the main toolbar's fixed height. */
#rank-preview107 .rank-profile107,
#season-kpi109 .season-kpi-head109 {
  height:auto; min-height:0; max-height:none; position:relative;
  box-sizing:border-box; margin:0; overflow:visible;
}
.mini-board.mini-kind-2 { position:relative; width:100%; aspect-ratio:1; }
.mini-board.mini-kind-2>svg { position:absolute; inset:0; display:block; width:100%; height:100%; }

@media(max-width:800px) {
  /* Explicit placement also covers headings whose illustration is hidden. */
  .page>.heading.heading-illustrated,
  #shop>.heading.heading-illustrated,
  #catalog>.heading.heading-illustrated {
    display:grid!important;
    grid-template-columns:48px minmax(0,1fr)!important;
    width:100%; min-width:0; box-sizing:border-box;
  }
  .page>.heading>.heading-art,
  #shop>.heading>.heading-art,
  #catalog>.heading>.heading-art {
    display:block!important; grid-column:1; grid-row:1;
    width:48px!important; height:48px!important; max-width:100%; object-fit:contain;
  }
  .page>.heading>.heading-copy { grid-column:2; grid-row:1; width:100%; min-width:0; }
  .page>.heading>.heading-actions,
  .page>.heading>.wallet-pill,
  .page>.heading>select { grid-column:1/-1; grid-row:auto; max-width:100%; }
  .page>.heading .heading-copy h1 { overflow-wrap:normal; word-break:normal; hyphens:none; }
  #shop>.heading>.heading-copy,
  #catalog>.heading>.heading-copy { grid-column:2; grid-row:1; width:100%; min-width:0; }
  #shop>.heading>.heading-actions { grid-column:1/-1; width:100%; margin:0!important; }
  #shop .build-centre-cta { width:100%; justify-content:space-between; }
  #catalog>.heading>.wallet-pill { margin:0 0 0 auto; }

  #rank-preview107,#season-kpi109 {
    box-sizing:border-box; width:calc(100% - 24px); max-width:calc(100% - 24px);
    max-height:calc(100dvh - 28px); padding:18px;
    overflow-x:hidden; overflow-y:auto; scrollbar-gutter:stable;
  }
  #rank-preview107 .rank-close107,#season-kpi109 .season-close109 {
    display:block; position:sticky; top:0; float:none; margin:0 0 12px auto;
    width:40px; height:40px; min-width:40px; flex:none; z-index:5;
  }
  #rank-preview107 .rank-profile107,#season-kpi109 .season-kpi-head109 {
    clear:both; display:grid; grid-template-columns:56px minmax(0,1fr);
    align-items:center; justify-content:normal; gap:10px 12px; padding:0;
  }
  #rank-preview107 .rank-profile107>div,#season-kpi109 .season-kpi-head109>div { min-width:0; width:auto; }
  #rank-preview107 .rank-profile107 .player-avatar,#season-kpi109 .player-avatar { --avatar-size109:56px; }
  #rank-preview107 .rank-profile107 .eyebrow,#season-kpi109 .season-kpi-head109 .eyebrow {
    font-size:8px; letter-spacing:1.3px; line-height:1.6;
    white-space:normal; overflow-wrap:normal; word-break:normal;
  }
  #rank-preview107 h2,#season-kpi109 h2 { font-size:24px; line-height:1.2; margin:5px 0; overflow-wrap:break-word; }
  #rank-preview107 .rank-profile107 p,#season-kpi109 .season-kpi-head109 p { font-size:12px; line-height:1.5; margin:5px 0 0; }
  #rank-preview107 .rank-profile107>strong {
    grid-column:1/-1; margin:8px 0 0; padding-top:12px; border-top:1px solid #afc8d52b;
    font-size:30px; display:flex; align-items:baseline; gap:10px; white-space:normal;
  }
  #rank-preview107 .rank-profile107>strong small { font-size:12px; }
  #rank-preview107 .rank-summary107 { gap:7px; margin:18px 0; }
  #rank-preview107 .rank-summary107>div { min-width:0; padding:12px 8px; }
  #rank-preview107 .rank-summary107 small { font-size:11px; line-height:1.4; }
  #rank-preview107 .rank-summary107 b { font-size:14px; line-height:1.5; white-space:normal; }
  #rank-preview107 .rank-detail-grid107 { grid-template-columns:minmax(0,1fr); gap:22px; }
  #rank-preview107 .rank-view107 { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); }
  #rank-preview107 .rank-view107 button { min-width:0; font-size:10px; padding:10px 5px; white-space:normal; line-height:1.4; }
  #rank-preview107 h3 { font-size:20px; line-height:1.3; }
  #season-kpi109 .season-kpi-count109 { padding:14px; gap:12px; margin:18px 0; }
  #season-kpi109 .season-kpi-count109>p { min-width:0; flex-basis:100%; }

  /* The same KPI table becomes a labelled card for each parameter on a phone. */
  #rank-preview107 .table-wrap,#season-kpi109 .table-wrap { overflow:visible; border:0; background:none; }
  #rank-preview107 .rank-kpis107,#season-kpi109 .season-kpi-table109,
  #rank-preview107 .rank-kpis107 tbody,#season-kpi109 .season-kpi-table109 tbody {
    display:block; width:100%; min-width:0; max-width:100%; white-space:normal;
  }
  #rank-preview107 .rank-kpis107 thead,#season-kpi109 .season-kpi-table109 thead { display:none; }
  #rank-preview107 .rank-kpis107 tr,#season-kpi109 .season-kpi-table109 tr {
    display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px 10px;
    padding:15px 13px; margin:0 0 12px; border:1px solid #a7c3d32b; border-radius:14px;
    background:#abc8db0b;
  }
  #rank-preview107 .rank-kpis107 td,#season-kpi109 .season-kpi-table109 td {
    display:block; min-width:0!important; width:auto; padding:0; border:0;
    font-size:12px; line-height:1.55; white-space:normal; overflow-wrap:break-word;
  }
  #rank-preview107 .rank-kpis107 td:first-child,#season-kpi109 .season-kpi-table109 td:first-child {
    grid-column:1/-1; padding-bottom:9px; border-bottom:1px solid #a7c3d31f;
    color:#f0d895; font-size:14px;
  }
  #rank-preview107 .rank-kpis107 td:before,#season-kpi109 .season-kpi-table109 td:before {
    content:attr(data-label); display:block; font-size:10px; font-weight:400;
    color:#9eb8c9; margin-bottom:4px;
  }
  #rank-preview107 .rank-kpis107 td:first-child:before,#season-kpi109 .season-kpi-table109 td:first-child:before { display:none; }
  #rank-preview107 .rank-kpis107 td small { white-space:normal; font-size:11px; line-height:1.6; }
  #season-kpi109 .season-kpi-table109 .season-status109 { white-space:normal; font-size:11px; }
  #season-kpi109 .season-met109 { color:#8fdfb7; }
  #ranking .podium-player { min-width:0; }
  #ranking .podium-player .rank-open107 { max-width:100%; white-space:normal; overflow-wrap:normal; }
  #ranking .podium-player h3 { line-height:1.4; white-space:normal; overflow-wrap:break-word; }
  #ranking .my-rank>div { min-width:0; }
  #ranking .my-rank h2 { line-height:1.3; }
}

@media(max-width:600px) {
  /* Keep the player's identity on the right, with menu directly beneath it. */
  .game-chrome .game-topbar {
    display:grid; grid-template-columns:minmax(80px,.85fr) minmax(0,1.55fr);
    grid-template-rows:auto auto; column-gap:8px!important; row-gap:6px!important;
    padding:12px 12px 10px; height:auto; align-items:center;
  }
  .game-chrome .game-topbar .topbar-brand.brand-life52 {
    grid-column:1; grid-row:1/3; justify-self:start; align-self:center;
    width:100%; max-width:130px; height:70px; min-width:0; margin:0;
  }
  .game-chrome .game-topbar .brand-stage52 { width:100%; height:70px; max-height:70px; }
  .game-chrome .game-topbar .player-identity {
    grid-column:2; grid-row:1; justify-self:end; align-self:center;
    width:auto; min-width:0; max-width:100%; height:auto; padding:0;
    border:0!important; margin:0; gap:7px; text-align:left;
  }
  .game-chrome .game-topbar .player-identity .player-avatar {
    width:30px!important; height:30px!important; min-width:30px!important;
    max-width:30px!important; min-height:30px!important; flex:0 0 30px!important; aspect-ratio:1;
  }
  .game-chrome .game-topbar .player-identity .identity-copy {
    display:block; flex:0 1 auto; min-width:0; max-width:100%;
  }
  .game-chrome .game-topbar .player-identity .identity-copy b {
    font-size:10px; line-height:1.5; letter-spacing:0; white-space:nowrap;
  }
  .game-chrome .game-topbar .player-identity .identity-copy small {
    display:block; font-size:8px; line-height:1.5; letter-spacing:0; white-space:normal;
  }
  .game-chrome .game-topbar .player-identity .profile-wallet { font-size:10px; margin-top:3px; line-height:1.4; }
  .game-chrome .game-topbar .player-identity .profile-wallet img { width:15px; height:15px; }
  .game-chrome .game-topbar .topbar-navigation {
    grid-column:2; grid-row:2; justify-self:end; width:auto; margin:0; padding:0;
  }
  .game-chrome .game-topbar .menu-toggle {
    width:76px; min-width:76px; height:32px; min-height:32px;
    padding:6px 10px; border-radius:10px;
  }
  .game-chrome .game-topbar .menu-toggle span { left:10px; width:16px; }
  .game-chrome .game-topbar .menu-toggle b { margin-left:21px; font-size:10px; }
  .game-chrome .game-topbar #main-navigation.is-open {
    grid-template-columns:minmax(0,1fr); max-height:calc(100dvh - 155px);
    left:0; right:0; width:auto; box-sizing:border-box;
  }
  .game-chrome .game-topbar #main-navigation .more-navigation>div { grid-template-columns:minmax(0,1fr); }
  .mini-content,.mini-content>* { min-width:0; max-width:100%; box-sizing:border-box; }
  .mini-content { grid-template-columns:minmax(0,1fr); gap:20px; }
  .mini-play { width:100%; max-width:430px; }
  .mini-board { width:100%; height:auto; min-height:0; max-width:100%; }
  .mini-board.mini-kind-2 { height:auto; aspect-ratio:1; }
  .mini-timer { gap:10px; }
  .mini-timer span { font-size:10px; letter-spacing:1.3px; }
  .mini-timer strong { font-size:30px; }
  .mini-play>.primary,.mini-restart { max-width:100%; white-space:normal; line-height:1.5; }
}

@media(max-width:360px) {
  .game-chrome .game-topbar { padding-inline:9px; column-gap:6px!important; grid-template-columns:minmax(68px,.7fr) minmax(0,1.6fr); }
  .game-chrome .game-topbar .player-identity .player-avatar { width:26px!important; height:26px!important; min-width:26px!important; min-height:26px!important; flex-basis:26px!important; }
  .game-chrome .game-topbar .player-identity .identity-copy b { font-size:9px; }
  .page>.heading.heading-illustrated,#shop>.heading.heading-illustrated,#catalog>.heading.heading-illustrated { grid-template-columns:38px minmax(0,1fr)!important; }
  .page>.heading>.heading-art,#shop>.heading>.heading-art,#catalog>.heading>.heading-art { width:38px!important; height:38px!important; }
  #rank-preview107,#season-kpi109 { padding:14px; }
  #rank-preview107 .rank-summary107 { grid-template-columns:minmax(0,1fr); }
  #rank-preview107 .rank-summary107>div { display:flex; align-items:center; justify-content:space-between; gap:8px; }
  #rank-preview107 .rank-summary107 b { margin:0; }
}

/* Compact phone controls, with a consistent touch area. */
@media(max-width:600px) {
  body>main button.primary,
  body>main a.primary,
  #shop button.build-centre-cta {
    box-sizing:border-box;
    min-height:44px!important;
    padding:10px 14px!important;
    font-size:12px!important;
    line-height:1.35!important;
    border-radius:12px!important;
    white-space:normal;
  }
  #shop .heading-actions { justify-content:flex-start; }
  #shop .build-centre-cta {
    width:min(240px,100%); max-width:100%; gap:12px!important;
    justify-content:space-between;
  }
  #shop .build-centre-cta b { font-size:12px!important; line-height:1.35; }
  #shop .build-centre-cta i { font-size:20px; line-height:1; }
  .building-views button,
  .catalog-showcase .building-views button {
    box-sizing:border-box; min-height:44px; padding:8px 10px;
    font-size:10px; line-height:1.35;
  }
  .welcome-screen .welcome-content #play-button.play-button {
    box-sizing:border-box; width:min(260px,100%); min-width:0;
    min-height:60px; padding:10px 14px; gap:10px;
    grid-template-columns:34px minmax(0,1fr) 18px;
    border-radius:15px; margin:10px auto;
  }
  .welcome-screen #play-button .play-symbol {
    box-sizing:border-box; width:34px; height:34px; border-radius:11px;
  }
  .welcome-screen #play-button .play-symbol::before {
    border-top-width:7px; border-bottom-width:7px; border-left-width:11px;
    margin-left:3px;
  }
  .welcome-screen #play-button .play-copy strong { font-size:20px; letter-spacing:1.5px; }
  .welcome-screen #play-button .play-copy small { font-size:10px; line-height:1.3; margin-top:3px; }
  .welcome-screen #play-button .play-arrow { font-size:21px; }
}
