/* EPT Football — Stage 12: responsive viewport and safe-area only.
 * Additive styles: does not alter routes, scores, video playback, leagues, artwork, or APIs.
 * Load after all previously approved EPT Football stylesheets. */
:root { --ept12-gutter: clamp(12px, 1.8vw, 30px); --ept12-content-width: 1820px; }
html { min-width: 0; max-width: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { min-width: 0; width: 100%; margin: 0; overflow-x: clip; }
#app {
  box-sizing: border-box; width: min(100%, var(--ept12-content-width)); max-width: var(--ept12-content-width);
  min-width: 0; margin-inline: auto; padding-inline: var(--ept12-gutter);
  padding-bottom: calc(128px + env(safe-area-inset-bottom, 0px));
}
#screen, #screen > *, #app > main, .screen { min-width: 0; max-width: 100%; }
#screen { width: 100%; }
.masthead { margin-inline: calc(-1 * var(--ept12-gutter)); padding-inline: var(--ept12-gutter); }
.headtop, .mast-label, .section-title, .subhead, .layout-header, .v15-news-headline { min-width: 0; }
.brand { min-width: 0; }
.league-strip, .tab-row { max-width: 100%; -webkit-overflow-scrolling: touch; overscroll-behavior-inline: contain; }
.top-banner, .v15-hero, .v15-hero-editorial, .v15-league-head, .v15-live-mast,
.news-hero, .title-hero, .section, .news-card, .match-card, .ept10-league-picker { max-width: 100%; min-width: 0; }
.top-banner .hero-copy, .v15-hero-editorial h1, .v15-hero-editorial p { min-width: 0; overflow-wrap: anywhere; }
.news-grid, .grid-2, .grid-3, .match-grid, .video-grid, .shortcut-grid, .v15-league-links,
.v15-secondary-live, .ept10-two { max-width: 100%; }
.news-grid > *, .grid-2 > *, .grid-3 > *, .match-grid > *, .video-grid > *,
.shortcut-grid > *, .v15-league-links > *, .v15-secondary-live > *, .ept10-two > * { min-width: 0; }
.match-card .match-teams { min-width: 0; }
.stand-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.bottom-nav {
  box-sizing: border-box; width: min(calc(100% - 2 * var(--ept12-gutter)), calc(var(--ept12-content-width) - 2 * var(--ept12-gutter)));
  max-width: calc(100% - 12px); bottom: 0; left: 50%; right: auto; transform: translateX(-50%);
  padding-bottom: calc(9px + env(safe-area-inset-bottom, 0px));
}
.bottom-nav .nav-btn { min-width: 0; max-width: 100%; }
.bottom-nav .nav-btn > span:last-child { display: block; max-width: 100%; text-align: center; overflow: hidden; text-overflow: ellipsis; }
.modal-layer { padding-top: max(12px, env(safe-area-inset-top, 0px)); padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)); }
.modal { max-height: min(90dvh, 900px); }

/* Wide screens: use the desktop display rather than a narrow 1230px island. */
@media (min-width: 1500px) {
  .news-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .match-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .v15-hero, .v15-hero-editorial { min-height: 370px; }
  .v15-league-head { min-height: 320px; }
  .section { padding: 20px; }
  .news-card img { height: 215px; }
}
@media (min-width: 1040px) and (max-width: 1499.98px) {
  .match-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 1100px) {
  .v15-league-links { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .news-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .match-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 700px) {
  :root { --ept12-gutter: 10px; }
  #app { padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px)); }
  .masthead { padding-top: calc(9px + env(safe-area-inset-top, 0px)); }
  .headtop { gap: 4px; }
  .headtop > .circle-btn { flex: 0 0 35px; }
  .head-tools { flex: 0 0 auto; gap: 3px; }
  .head-tools .circle-btn { width: 33px; height: 33px; font-size: 18px; }
  .brand { flex: 1 1 auto; width: auto; max-width: 180px; height: 55px; margin-inline: auto; }
  .brand .ept-logo { height: 43px; max-width: 95%; object-fit: contain; }
  .mast-label { margin: 0 0 9px; }
  .league-strip { margin-inline: 0; }
  .top-banner, .v15-hero, .v15-hero-editorial { min-height: 210px; }
  .v15-hero-editorial h1, .v15-hero-editorial p { max-width: 100%; }
  .v15-league-head { min-height: 190px; background-position: center; }
  .v15-league-head-overlay { max-width: 100%; padding: 9px 12px; }
  .v15-league-head-overlay h1 { font-size: clamp(20px,5vw,26px); }
  .title-hero { min-height: 125px; padding: 14px 11px; gap: 8px; }
  .title-hero .bigicon { flex: 0 0 auto; font-size: clamp(34px,11vw,57px); }
  .title-hero h1 { font-size: clamp(19px,5.8vw,27px); }
  .title-hero p { line-height: 1.7; }
  .section-title { flex-wrap: wrap; }
  .section-title h2 { font-size: 17px; }
  .match-grid { grid-template-columns: minmax(0,1fr); }
  .match-teams { grid-template-columns: minmax(0,1fr) 67px minmax(0,1fr); gap: 5px; }
  .match-teams .score { font-size: clamp(21px,6vw,29px); }
  .team .crest, .team .crest-missing { width: 45px; height: 45px; }
  .match-actions { flex-wrap: wrap; }
  .match-actions .mini-btn, .match-actions .btn { flex: 1 1 115px; min-width: 0; }
  .shortcut-grid:not(.arena-shortcuts-v4) { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .v15-league-links { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .video-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .news-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .news-card img { height: clamp(105px,28vw,160px); }
  .news-card .news-copy { padding: 8px 9px; }
  .news-card strong { font-size: 12px; }
  .ept10-league-picker .tab-row { flex-wrap: nowrap; }
  .ept10-two { grid-template-columns: minmax(0,1fr); }
  #bottomNav { gap: 1px; padding: 5px 3px calc(6px + env(safe-area-inset-bottom, 0px)); border-radius: 18px 18px 0 0; }
  #bottomNav .nav-btn { flex: 1 1 0; min-width: 0; min-height: 58px; padding: 2px 0; }
  #bottomNav .nav-btn .ept-nav-icon-step06 { width: clamp(26px,8.2vw,35px); height: clamp(26px,8.2vw,35px); flex-basis: clamp(26px,8.2vw,35px); }
  #bottomNav .nav-btn>span:last-child { font-size: clamp(7px,2.2vw,10px); line-height: 1.2; margin-top: 0; }
  .modal-layer { padding-inline: 9px; }
  .modal { width: 100%; border-radius: 19px; max-height: min(88dvh, 900px); }
  .modal-body { padding: 12px; }
}
@media (max-width: 390px) {
  .head-tools .circle-btn { width: 31px; height: 31px; }
  .headtop>.circle-btn { width: 33px; height: 33px; }
  .brand { max-width: 141px; height: 50px; }
  .brand .ept-logo { height: 37px; }
  .news-grid { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 7px; }
  .news-card strong { font-size: 11px; line-height: 1.65; }
  .news-card .news-copy { padding: 7px; }
  .v15-league-links button small { font-size: 10px; }
  #bottomNav .nav-btn > span:last-child { font-size: 8px; letter-spacing: -.35px; }
}
@media (max-width: 340px) {
  .v15-league-links, .video-grid, .news-grid { grid-template-columns: minmax(0,1fr); }
  .head-tools .circle-btn:nth-child(2) { display: none; }
}
@media (orientation: landscape) and (max-height: 520px) and (max-width: 960px) {
  #app { padding-bottom: calc(79px + env(safe-area-inset-bottom,0px)); }
  #bottomNav .nav-btn { min-height: 44px; }
  #bottomNav .nav-btn .ept-nav-icon-step06 { width: 23px; height: 23px; flex-basis: 23px; }
  .modal { max-height: min(84dvh, 440px); }
}
@media (prefers-reduced-motion: reduce) {
  .league-strip, .tab-row { scroll-behavior: auto; }
}
