/* Phone-specific Home layout, DC Only and full-access parity.
   Load last: old desktop selectors used !important two-column grids under
   600px and compressed WOTD/Status to unreadable narrow strips. */
@media (max-width:860px) {
 body[data-current-view="home"] #content,
 body[data-current-view="home"] #content .h162-root {
  box-sizing:border-box!important;
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  overflow-x:clip;
 }
 body[data-current-view="home"] #content .h162-root {
  padding-inline:clamp(4px,2vw,12px)!important;
 }
 body[data-current-view="home"] #content .h162-root
 :is(.h162-primary,.h162-challenge-row,.h162-bottom.h164-home-lower,.h164-home-events) {
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  grid-template-rows:auto!important;
  grid-auto-columns:minmax(0,1fr)!important;
  grid-auto-flow:row!important;
  align-items:stretch!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  height:auto!important;
  gap:12px!important;
 }
 /* The older balanced desktop renderer can leave explicit row/column
    assignments if a phone is rotated or browser zoom changes. */
 body[data-current-view="home"] #content .h162-root
 :is(.h162-primary,.h162-challenge-row,.h164-home-lower,.h164-home-events)>* {
  box-sizing:border-box!important;
  grid-column:auto!important;
  grid-row:auto!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  height:auto!important;
  min-height:0;
  align-self:stretch!important;
 }
 body[data-current-view="home"] #content .h162-root
 .h162-primary :is(.h162-wotd,.h162-status,.h162-votw) {
  grid-column:auto!important;
  grid-row:auto!important;
  height:auto!important;
  max-height:none!important;
  overflow:visible!important;
 }
 body[data-current-view="home"] #content .h162-root .h162-card {
  box-sizing:border-box!important;
  min-width:0!important;
  max-width:100%!important;
 }
 body[data-current-view="home"] #content .h162-root
 :is(.h162-header,.h162-home-heading,.h245-server-top,.h245-server-identity) {
  min-width:0!important;
  max-width:100%!important;
 }
 body[data-current-view="home"] #content .h162-root
 .h164-home-events > .h242-event-card {
  min-height:310px!important;
  height:auto!important;
 }
 body[data-current-view="home"] #content .h162-root .h163-video-thumb {
  width:100%!important;
  max-width:100%!important;
  height:auto!important;
  aspect-ratio:16 / 9;
  min-height:0!important;
 }
 body[data-current-view="home"] #content .h162-root .h163-video-thumb img {
  display:block;
  width:100%!important;
  height:100%!important;
  object-fit:cover!important;
 }
 body[data-current-view="home"] #content .h162-root .h241-arcade-games {
  grid-template-columns:minmax(0,1fr)!important;
 }
}
@media (max-width:480px) {
 body[data-current-view="home"] #content .h162-root .h162-card {
  padding:14px!important;
 }
 body[data-current-view="home"] #content .h162-root
 .h162-primary .h162-status .h245-server-primary-text {
  grid-template-columns:minmax(0,1fr)!important;
  grid-template-rows:auto!important;
  gap:9px!important;
 }
 body[data-current-view="home"] #content .h162-root
 .h162-primary .h162-status
 :is(.h245-server-count-main,.h245-server-time) {
  width:100%!important;
  min-height:78px!important;
 }
 body[data-current-view="home"] #content .h162-root
 .h162-status .h245-server-chart-meta {
  grid-template-columns:minmax(0,1fr)!important;
 }
 body[data-current-view="home"] #content .h162-root
 .h162-status .h245-server-chart-meta > .h245-chart-stat {
  width:100%!important;
  grid-column:auto!important;
 }
 body[data-current-view="home"] #content .h162-root
 .h242-event-heading .h249-event-name {
  max-width:100%!important;
  font-size:clamp(14px,4.5vw,19px)!important;
 }
}
/* The public release has 3 actual mobile routes. Don't reserve blank slots
   for Market and Arcade after their access check explicitly hid them. */
html[data-gtt-design-mode="workbench"] #gtt-mobile-navigation .gtt-mobile-tabs {
 grid-template-columns:repeat(var(--gtt-mobile-visible-count,5),minmax(0,1fr))!important;
}
html[data-gtt-design-mode="workbench"]
#gtt-mobile-navigation .gtt-mobile-tabs > .gtt-mobile-tab[hidden] {
 display:none!important;
}

/* Fail closed even before the async access resolver paints. DC Only
   HTML cannot display Market / Arcade tab placeholders at any point. */
html[data-gtt-design-mode="workbench"]
body[data-gtt-restricted-shell="true"] #gtt-mobile-navigation
:is(.gtt-mobile-tab[data-gtt-mobile-group="market"],.gtt-mobile-tab[data-gtt-mobile-group="arcade"]),
html[data-gtt-design-mode="workbench"]
body:not([data-gtt-nav-access-ready="true"]) #gtt-mobile-navigation
:is(.gtt-mobile-tab[data-gtt-mobile-group="market"],.gtt-mobile-tab[data-gtt-mobile-group="arcade"]) {
 display:none!important;
}
html[data-gtt-design-mode="workbench"]
body[data-gtt-restricted-shell="true"] #gtt-mobile-navigation .gtt-mobile-tabs {
 grid-template-columns:repeat(3,minmax(0,1fr))!important;
}

/* MOBILE GRID GUARANTEE (Nov 15): legacy desktop Home rules can win the
   grid-template cascade at handset widths. Block flow is safer than trying
   to out-specify each individual grid rule and cannot show two skinny cards. */
@media screen and (max-width:980px) {
 html body[data-current-view="home"] #content .h162-root > .h162-primary,
 html body[data-current-view="home"] #content .h162-root > .h162-challenge-row,
 html body[data-current-view="home"] #content .h162-root > .h164-home-lower,
 html body[data-current-view="home"] #content .h162-root .h164-home-events,
 html body #content .h162-root > .h162-primary,
 html body #content .h162-root > .h162-challenge-row,
 html body #content .h162-root > .h164-home-lower,
 html body #content .h162-root .h164-home-events {
  display:block!important;
  grid-template-columns:none!important;
  grid-template-rows:none!important;
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  height:auto!important;
 }
 html body #content .h162-root > .h162-primary > .h162-card,
 html body #content .h162-root > .h162-challenge-row > .h162-card,
 html body #content .h162-root > .h164-home-lower > .h162-card,
 html body #content .h162-root .h164-home-events > .h162-card {
  box-sizing:border-box!important;
  grid-column:auto!important;
  grid-row:auto!important;
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  height:auto!important;
  max-height:none!important;
  margin:0 0 12px!important;
 }
 html body #content .h162-root .h162-primary :is(.h162-wotd,.h162-status,.h162-votw) {
  height:auto!important;
  max-height:none!important;
  grid-column:auto!important;
  grid-row:auto!important;
  align-self:stretch!important;
  overflow:visible!important;
 }
 html body #content .h162-root :is(.h162-primary,.h162-challenge-row,.h164-home-lower,.h164-home-events) > :last-child {
  margin-bottom:0!important;
 }
}
@media screen and (max-width:600px) {
 html body #content .h162-root .h162-status .h245-server-top {
  flex-wrap:wrap!important;
  align-items:center!important;
  gap:10px!important;
 }
 html body #content .h162-root .h162-status .h245-server-identity {
  flex:1 1 210px!important;
  max-width:100%!important;
  min-width:0!important;
 }
 html body #content .h162-root .h162-status .h245-server-badge {
  margin-left:auto!important;
 }
 html body #content .h162-root .h162-status
 :is(.h245-server-primary-text,.h245-server-chart-meta) {
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  grid-template-rows:auto!important;
  gap:8px!important;
  min-width:0!important;
  max-width:100%!important;
 }
 html body #content .h162-root .h162-status
 :is(.h245-server-count-main,.h245-server-time,.h245-chart-stat) {
  box-sizing:border-box!important;
  grid-column:auto!important;
  grid-row:auto!important;
  min-width:0!important;
  width:100%!important;
  max-width:100%!important;
 }
 html body #content .h162-root .h162-status .h245-server-number {
  font-size:clamp(25px,7.5vw,35px)!important;
  max-width:100%!important;
 }
 html body #content .h162-root .h162-status #h245-growtopia-clock {
  font-size:clamp(23px,6.9vw,30px)!important;
  max-width:100%!important;
 }
 html body #content .h162-root .h162-status .h245-chart-shell {
  box-sizing:border-box!important;
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  overflow:hidden!important;
 }
 html body #content .h162-root .h162-status .h245-chart-shell svg {
  display:block;
  width:100%!important;
  max-width:100%!important;
 }
}

/* DC prediction countdown: phone/compact-card layout must have two rows.
   A timer on the left and the absolute local date on the right overlap on
   320–400px phones, especially with large font settings. The actual
   measured-width JS guard marks compact Home containers, so this layout
   applies even if the device reports an unusually wide CSS viewport. */
@media screen and (max-width:720px) {
 body[data-current-view="home"] #content .h162-root .h162-next-card .h245-next-footer {
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  grid-template-rows:auto auto!important;
  gap:10px!important;
  align-items:start!important;
  justify-content:stretch!important;
  min-width:0!important;
  width:100%!important;
  height:auto!important;
  min-height:0!important;
 }
 body[data-current-view="home"] #content .h162-root .h162-next-card .h245-next-footer > .h242-timer-copy,
 body[data-current-view="home"] #content .h162-root .h162-next-card .h245-next-footer > .h245-next-when {
  grid-column:1!important;
  grid-row:auto!important;
  flex:initial!important;
  box-sizing:border-box!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  height:auto!important;
  margin:0!important;
  padding:0!important;
  align-items:flex-start!important;
  text-align:left!important;
 }
 body[data-current-view="home"] #content .h162-root .h162-next-card .h245-next-footer .h242-countdown {
  font-size:clamp(24px,7vw,34px)!important;
  line-height:1.12!important;
  white-space:normal!important;
  overflow-wrap:anywhere!important;
  max-width:100%!important;
 }
 body[data-current-view="home"] #content .h162-root .h162-next-card .h245-next-when > :is(span,small) {
  display:block!important;
  width:100%!important;
  max-width:100%!important;
  white-space:normal!important;
  overflow-wrap:anywhere!important;
  text-align:left!important;
  line-height:1.4!important;
 }
 body[data-current-view="home"] #content .h162-root .h162-next-card .h245-next-when > span {
  font-size:12px!important;
 }
 body[data-current-view="home"] #content .h162-root .h162-next-card .h245-next-when > small {
  font-size:11px!important;
 }
}
/* Also catch 320px embedded views that falsely expose a desktop CSS width:
   Home's measured-width safeguard sets this marker when the actual card
   column is narrow. A grid is used rather than flex-wrap, so text cannot
   land in the same visual row regardless of content length. */
body[data-current-view="home"] #content .h162-root[data-h162-phone-stack="true"]
.h162-next-card .h245-next-footer {
 display:grid!important;
 grid-template-columns:minmax(0,1fr)!important;
 grid-template-rows:auto auto!important;
 gap:10px!important;
 align-items:start!important;
 justify-content:stretch!important;
 width:100%!important;
 height:auto!important;
 min-width:0!important;
 min-height:0!important;
}
body[data-current-view="home"] #content .h162-root[data-h162-phone-stack="true"]
.h162-next-card .h245-next-footer > :is(.h242-timer-copy,.h245-next-when) {
 grid-column:1!important;
 grid-row:auto!important;
 flex:initial!important;
 box-sizing:border-box!important;
 width:100%!important;
 max-width:100%!important;
 min-width:0!important;
 margin:0!important;
 padding:0!important;
 align-items:flex-start!important;
 text-align:left!important;
}
body[data-current-view="home"] #content .h162-root[data-h162-phone-stack="true"]
.h162-next-card .h245-next-footer .h242-countdown {
 max-width:100%!important;
 font-size:clamp(24px,7vw,34px)!important;
 line-height:1.12!important;
 white-space:normal!important;
 overflow-wrap:anywhere!important;
}
body[data-current-view="home"] #content .h162-root[data-h162-phone-stack="true"]
.h162-next-card .h245-next-when > :is(span,small) {
 display:block!important;
 max-width:100%!important;
 white-space:normal!important;
 overflow-wrap:anywhere!important;
 text-align:left!important;
 line-height:1.4!important;
}
