/* PyRoller Mobile 0.1.0 — responsive/PWA compatibility layer.
   Desktop layouts remain authoritative above the mobile/tablet breakpoint. */
:root{--py-mobile-nav-height:68px;--py-safe-top:env(safe-area-inset-top,0px);--py-safe-bottom:env(safe-area-inset-bottom,0px)}
html{min-height:100%;background:var(--py-bg,#eef3f8)}
body{min-height:100%;overflow-x:hidden;-webkit-text-size-adjust:100%;text-size-adjust:100%}
button,a,input,select,textarea{touch-action:manipulation}
input,select,textarea{font-size:16px}
.mobile-build-badge{display:none}
.mobile-only{display:none!important}

@media (max-width:980px){
  body{padding-bottom:var(--py-safe-bottom)}
  .topbar{padding-top:calc(10px + var(--py-safe-top));position:relative;align-items:flex-start}
  .brand-row{min-width:0}.brand-row>div{min-width:0}.brand,.subbrand{overflow-wrap:anywhere}
  .theme-controls{max-width:100%;flex-wrap:wrap}
  .theme-field select{min-height:44px}
  .btn,.nav-pill,button,input[type=file],select{min-height:44px}
  .container{width:100%;max-width:none;padding-left:12px;padding-right:12px}
  .hero-card,.panel,.option-card{border-radius:14px}
  .mobile-build-badge{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line);background:var(--py-panel-soft);border-radius:999px;padding:5px 9px;font-size:11px;font-weight:800;letter-spacing:.02em}
  .mobile-only{display:initial!important}
  .desktop-only-on-mobile{display:none!important}
  .mobile-tool-unavailable{opacity:.72;pointer-events:none}
  .mobile-tool-unavailable .site-card-cta{display:none}
  .mobile-tool-unavailable::after{content:'Desktop only';display:inline-flex;width:max-content;margin-top:8px;border:1px solid var(--line);border-radius:999px;padding:5px 9px;font-size:12px;font-weight:800;color:var(--muted)}
  .module-launcher-card-list,.site-tool-grid{grid-template-columns:1fr!important}
  .module-option-card,.site-tool-card{min-height:0}
  .creator-app .topbar{position:sticky;top:0;z-index:25;background:var(--py-panel-glass);backdrop-filter:blur(14px)}
  .creator-app .nav-links{width:100%;display:flex;overflow-x:auto;flex-wrap:nowrap;padding:3px 0 5px;scrollbar-width:none}
  .creator-app .nav-links::-webkit-scrollbar{display:none}
  .creator-app .nav-pill{flex:0 0 auto;white-space:nowrap}
  .creator-app .grid.two,.creator-app .creator-layout,.creator-app .creator-workspace{grid-template-columns:1fr!important}
  .creator-app .creator-preview,.creator-app [class*='preview-panel']{position:static!important;max-height:none!important}
  .pycodex-topbar,.pyencounters-topbar{position:sticky;top:0;z-index:25;background:var(--py-panel-glass);backdrop-filter:blur(14px)}
  .pycodex-shell .nav-links,.pyencounters-shell .nav-links{width:100%;overflow-x:auto;flex-wrap:nowrap;scrollbar-width:none}
  .pycodex-shell .nav-pill,.pyencounters-shell .nav-pill{flex:0 0 auto;white-space:nowrap}
  table{max-width:100%}.table-wrap,[class*='table-wrap']{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
}

@media (max-width:620px){
  .topbar{padding-left:12px;padding-right:12px;gap:10px}
  .brand-icon{width:38px;height:38px}.brand{font-size:18px}.subbrand{font-size:12px}
  .theme-controls{width:100%;display:grid;grid-template-columns:1fr 1fr}
  .theme-field{min-width:0}.theme-field select{width:100%}
  .hero-card{padding:15px}.section-title{font-size:clamp(22px,7vw,30px)}
  .option-card{padding:14px}.option-card .btn{width:100%;justify-content:center}
}

/* Digital sheet: mobile is a reorganized set of workspaces, not a squeezed desktop grid. */
.mobile-sheet-nav{display:none}
@media (max-width:980px){
  .digital-sheet-body{padding-bottom:calc(var(--py-mobile-nav-height) + var(--py-safe-bottom) + 8px)}
  .digital-sheet-header{position:sticky;top:0;z-index:24;padding:calc(8px + var(--py-safe-top)) 10px 8px;background:var(--py-panel-glass);backdrop-filter:blur(16px)}
  .digital-header-row{align-items:center}.digital-header-title{display:none}.digital-character-name{font-size:20px}.digital-character-meta{font-size:11px;white-space:normal}
  .digital-header-actions>.btn{display:none}.digital-header-menu-button{width:44px;height:44px}
  .digital-header-menu-panel{right:0;left:auto;max-width:calc(100vw - 20px)}
  .digital-sheet-container{width:100%;padding:10px 10px 18px;display:block}
  .digital-main-grid{display:block!important}
  .digital-top-ribbon,.digital-left-column,.digital-center-column,.digital-right-column{display:none!important}
  .digital-top-ribbon.mobile-panel-active,.digital-left-column.mobile-panel-active,.digital-center-column.mobile-panel-active,.digital-right-column.mobile-panel-active{display:grid!important}
  .digital-right-column.mobile-panel-active{gap:10px}
  .digital-top-ribbon.mobile-panel-active{grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
  .digital-top-ribbon .digital-hp-card{grid-column:1/-1;min-width:0}
  .digital-left-column.mobile-panel-active{grid-template-columns:1fr;gap:10px}
  .digital-center-column.mobile-panel-active{display:block!important}
  .digital-right-column .digital-right-top-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .digital-right-column .digital-defense-condition-card{grid-column:1/-1}
  .digital-feature-shell{min-height:calc(100dvh - 185px)}
  .digital-feature-shell-body{margin:8px;padding:10px;overflow:visible}
  .digital-tab-row{position:sticky;top:64px;z-index:8;background:var(--py-panel);padding:8px;scrollbar-width:none}
  .digital-tab-row::-webkit-scrollbar{display:none}
  .digital-tab{min-height:42px}
  .mobile-sheet-nav{display:grid;grid-template-columns:repeat(4,1fr);position:fixed;left:0;right:0;bottom:0;z-index:40;min-height:calc(var(--py-mobile-nav-height) + var(--py-safe-bottom));padding:6px 6px calc(6px + var(--py-safe-bottom));border-top:1px solid var(--line);background:var(--py-panel-glass);backdrop-filter:blur(18px);box-shadow:0 -8px 24px var(--py-shadow-panel)}
  .mobile-sheet-nav button{border:0;background:transparent;color:var(--muted);border-radius:11px;display:grid;place-items:center;align-content:center;gap:2px;font:inherit;font-size:11px;font-weight:800;padding:4px}
  .mobile-sheet-nav button span{font-size:20px;line-height:1}
  .mobile-sheet-nav button.active{background:var(--accent);color:var(--py-on-primary)}
  .digital-inspection-drawer,.summon-reference-drawer{width:100vw;height:100dvh}
  .digital-inspection-card,.summon-reference-card{border-radius:0;border-left:0}
  .digital-dice-fab{bottom:calc(var(--py-mobile-nav-height) + var(--py-safe-bottom) + 12px)}
  .digital-dice-tray{left:0;right:0;bottom:calc(var(--py-mobile-nav-height) + var(--py-safe-bottom));width:100%;max-height:72dvh;border-radius:18px 18px 0 0}
  .digital-roll-toast{left:8px;right:8px;bottom:calc(var(--py-mobile-nav-height) + var(--py-safe-bottom) + 8px);transform:translateY(16px);width:auto;border-radius:14px}
  .digital-roll-toast.show{transform:translateY(0)}
  .digital-roll-history-panel{left:0;right:0;bottom:calc(var(--py-mobile-nav-height) + var(--py-safe-bottom));width:100%;max-height:72dvh}
}
@media (max-width:430px){
  .digital-top-ribbon.mobile-panel-active{grid-template-columns:repeat(2,minmax(0,1fr))}
  .digital-hp-card{grid-template-columns:76px minmax(0,1fr)}
  .digital-skill-row{grid-template-columns:28px 36px minmax(0,1fr) 48px;gap:5px}
  .digital-skills-head{grid-template-columns:28px 36px minmax(0,1fr) 48px;gap:5px}
}

/* Mobile 0.1.1 — compact chrome, denser lookup cards, and first real sheet layout pass. */
@media (max-width:980px){
  html{background:var(--py-topbar)}
  body,.app-shell{width:100%;max-width:100%;min-width:0}
  body{background:linear-gradient(180deg,var(--bg),var(--bg2));}

  /* Let installed iOS web apps paint the selected theme behind the status bar. */
  .topbar,
  .digital-sheet-header{
    width:100%;
    max-width:100%;
    background:var(--py-topbar)!important;
  }

  /* The compact display control owns only the top-right corner until opened. */
  .topbar{
    display:flex;
    align-items:center;
    flex-wrap:wrap;
    gap:8px 10px;
    min-height:calc(62px + var(--py-safe-top));
    padding:calc(8px + var(--py-safe-top)) 12px 8px!important;
  }
  .topbar>.brand-row,
  .topbar>.home-brand-link{
    order:10;
    flex:1 1 auto;
    width:auto;
    max-width:100%;
    min-width:0;
    padding-right:58px;
    flex-wrap:nowrap;
    gap:10px;
  }
  .topbar>.brand-row>div,
  .topbar>.home-brand-link>div{min-width:0}
  .topbar>.nav-links{order:30;flex:1 0 100%;margin-top:2px}
  .topbar>.theme-controls:not(.theme-expanded),
  .module-launcher-shell .topbar>.theme-controls:not(.theme-expanded){
    position:absolute!important;
    top:calc(8px + var(--py-safe-top))!important;
    right:12px!important;
    left:auto!important;
    width:48px!important;
    min-width:48px!important;
    max-width:48px!important;
    height:48px;
    margin:0!important;
    padding:4px!important;
    border-radius:999px!important;
  }
  .topbar>.theme-controls:not(.theme-expanded) .theme-toggle-button{
    width:36px;
    min-width:36px;
    height:36px;
    font-size:18px;
  }
  .topbar>.theme-controls.theme-expanded,
  .module-launcher-shell .topbar>.theme-controls.theme-expanded{
    position:static!important;
    order:20;
    flex:1 0 100%;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    margin:2px 0 0!important;
    padding:6px!important;
    border-radius:15px!important;
    display:grid!important;
    grid-template-columns:40px minmax(0,1fr);
    gap:7px!important;
    align-items:center;
  }
  .topbar>.theme-controls.theme-expanded .theme-toggle-button{
    width:38px;
    min-width:38px;
    height:38px;
  }
  .topbar>.theme-controls.theme-expanded .theme-fields,
  .module-launcher-shell .topbar>.theme-controls.theme-expanded .theme-fields{
    width:100%!important;
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:7px!important;
  }
  .topbar>.theme-controls.theme-expanded .theme-field,
  .module-launcher-shell .topbar>.theme-controls.theme-expanded .theme-field{
    width:100%!important;
    min-width:0!important;
    display:grid!important;
    grid-template-columns:auto minmax(0,1fr);
    gap:5px!important;
    align-items:center;
    justify-content:stretch!important;
    font-size:10px;
  }
  .topbar>.theme-controls.theme-expanded .theme-field select,
  .module-launcher-shell .topbar>.theme-controls.theme-expanded .theme-field select{
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    height:38px!important;
    min-height:38px!important;
    padding:6px 25px 6px 8px!important;
    font-size:16px!important;
  }

  .brand-icon,.brand-fallback{width:38px;height:38px;min-width:38px;border-radius:11px}
  .brand{font-size:clamp(18px,4.8vw,23px);line-height:1.08;white-space:normal}
  .subbrand{font-size:12px;line-height:1.25}

  /* Touch taps should feel immediate instead of waiting for desktop hover animation. */
  @media (hover:none) and (pointer:coarse){
    a,button,.option-card,.spell-result-card,.codex-tab{transition-duration:.06s!important}
    .mobile-tap-active{filter:brightness(.94);transform:scale(.988)!important}
    a,button{-webkit-tap-highlight-color:transparent}
  }

  /* Keep all inputs at iOS's no-auto-zoom threshold. */
  input,select,textarea,
  .field input,.field select,.field textarea,
  .digital-header-menu-panel select{
    font-size:16px!important;
  }

  /* Generic mobile table safety. Specific dense tables may opt into a card layout below. */
  table{width:100%;max-width:100%;word-break:normal}
  th,td{word-break:normal;overflow-wrap:anywhere}
  .feature-table-scroll,.table-wrap,[class*='table-wrap']{width:100%;max-width:100%;overflow-x:auto!important}

  /* Splash page: remove the duplicate Current Modules block and keep only useful copy. */
  .home-page .site-home-container{gap:12px;padding:12px}
  .home-page .site-hero-card{display:block;padding:16px;margin:0}
  .home-page .site-hero-panel{display:none!important}
  .home-page .site-kicker,
  .home-page .site-pill-row{display:none!important}
  .home-page .site-title{font-size:clamp(34px,10vw,44px);line-height:1;margin:0}
  .home-page .site-lede{font-size:16px;line-height:1.35;margin-top:8px;max-width:36rem}
  .home-page .mobile-build-badge{margin-top:10px}
  .home-page .site-module-panel,
  .home-page .site-info-panel{padding:15px}
  .home-page .site-section-title{font-size:24px;margin-bottom:4px}
  .home-page .section-sub{margin-top:4px}
  .home-page .site-tool-card{min-height:0;padding:13px}
  .home-page .site-tool-card p{margin-top:5px;line-height:1.32}

  /* PyCodex header and hero: name + display pill on one compact row. */
  .pycodex-page .pycodex-topbar .subbrand{display:none!important}
  .pycodex-page .pycodex-container{gap:12px;padding:12px 12px 34px}
  .pycodex-page .pycodex-hero{margin:0;padding:14px}
  .pycodex-page .pycodex-hero .site-kicker{display:none}
  .pycodex-page .pycodex-title{font-size:34px;margin:0 0 5px}
  .pycodex-page .pycodex-lede{
    font-size:15px;
    line-height:1.3;
    display:-webkit-box;
    -webkit-box-orient:vertical;
    -webkit-line-clamp:2;
    overflow:hidden;
  }
  .pycodex-page .pycodex-module-nav{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:6px;
    margin:0;
    padding:7px;
  }
  .pycodex-page .codex-tab{
    min-height:52px;
    padding:8px 5px;
    border-radius:13px;
    align-items:center;
    justify-content:center;
    text-align:center;
  }
  .pycodex-page .codex-tab-kicker,
  .pycodex-page .codex-tab::after{display:none!important}
  .pycodex-page .codex-tab strong{font-size:16px;line-height:1.1}
  .pycodex-page .spell-browser-panel,
  .pycodex-page .spell-results-panel,
  .pycodex-page .search-panel,
  .pycodex-page .results-panel,
  .pycodex-page .item-browser-panel,
  .pycodex-page .item-results-panel{padding:14px}

  /* Put the level in the corner instead of giving it a full row above every spell. */
  .pycodex-page .spell-result-card{cursor:pointer;border-radius:13px}
  .pycodex-page .spell-result-main{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    grid-template-areas:'name level'!important;
    gap:8px!important;
    align-items:start!important;
    padding:10px 11px!important;
  }
  .pycodex-page .spell-result-main>div:first-child{grid-area:level;align-self:start}
  .pycodex-page .spell-name-block{grid-area:name;min-width:0}
  .pycodex-page .spell-level-badge{
    min-width:0!important;
    padding:4px 7px!important;
    border-width:1px;
    font-size:10px;
    line-height:1;
    white-space:nowrap;
  }
  .pycodex-page .spell-name-btn{font-size:17px;line-height:1.12;padding-right:2px}
  .pycodex-page .spell-subline{margin-top:4px;font-size:12px;gap:4px}
  .pycodex-page .spell-inline-pill{padding:2px 5px;font-size:9px}
  .pycodex-page .spell-school,
  .pycodex-page .spell-casting,
  .pycodex-page .spell-range{display:none!important}

  /* Demo page: enforce full-width chrome and stop the QA explanation from dominating the phone. */
  .demo-characters-page,
  .demo-characters-page .app-shell,
  .demo-characters-page .topbar{width:100%!important;max-width:100%!important}
  .demo-characters-page .site-home-container{padding:12px;gap:12px}
  .demo-characters-page .site-hero-card{display:block;padding:14px}
  .demo-characters-page .site-kicker,
  .demo-characters-page .site-pill-row{display:none}
  .demo-characters-page .site-title{font-size:36px;line-height:1}
  .demo-characters-page .site-lede{font-size:15px;line-height:1.35}
  .demo-characters-page .site-hero-panel{margin-top:12px}
  .demo-characters-page .site-status-card{padding:14px;gap:7px;box-shadow:none}
  .demo-characters-page .site-status-title{font-size:22px;line-height:1.08}
  .demo-characters-page .site-status-card p{font-size:14px;line-height:1.35}
  .demo-characters-page .site-module-panel{padding:14px}
  .demo-characters-page .site-module-panel>.section-sub{display:none}
  .demo-characters-page .demo-character-card{width:100%;min-width:0;padding:13px}
  .demo-characters-page .test-character-actions,.demo-characters-page .test-character-actions .btn{width:100%}

  /* Character Forge: compact header, reliable selectors, and readable two-column reference tables. */
  .creator-page .topbar .subbrand{display:none}
  .creator-page .container{padding:12px 10px 28px!important}
  .creator-page .nav-links{padding-bottom:3px}
  .creator-page .nav-pill{padding:8px 12px}
  .creator-page select,
  .creator-page input,
  .creator-page textarea{max-width:100%;min-width:0}
  .creator-page .modal,
  .creator-page .compact-modal{max-width:calc(100vw - 18px)!important;width:calc(100vw - 18px)!important}
  .creator-page .fighter-style-reference-table{
    display:block!important;
    width:100%!important;
    table-layout:auto!important;
  }
  .creator-page .fighter-style-reference-table thead{display:none!important}
  .creator-page .fighter-style-reference-table tbody,
  .creator-page .fighter-style-reference-table tr,
  .creator-page .fighter-style-reference-table td{display:block!important;width:100%!important;max-width:100%!important}
  .creator-page .fighter-style-reference-table tr{
    padding:9px 10px;
    border:1px solid var(--py-border-soft);
    border-radius:11px;
    background:var(--py-panel);
    margin-bottom:8px;
  }
  .creator-page .fighter-style-reference-table td{border:0!important;padding:0!important}
  .creator-page .fighter-style-reference-table td:first-child{font-weight:900;color:var(--py-text-strong);margin-bottom:5px}
  .creator-page .fighter-style-reference-table td:last-child{line-height:1.38;color:var(--py-text)}

  /* Digital sheet: use the active accent for the header and fit the nine overview cards 3 × 3. */
  .digital-sheet-header{
    background:var(--py-topbar)!important;
    box-shadow:0 2px 8px var(--py-header-shadow)!important;
  }
  .digital-header-row{width:100%;gap:8px;flex-wrap:nowrap}
  .digital-header-left{min-width:0;flex:1}
  .digital-character-name{font-size:19px;line-height:1.05}
  .digital-character-meta{font-size:11px;line-height:1.25}
  .digital-header-menu-panel{
    width:min(270px,calc(100vw - 18px));
    min-width:0;
    max-width:calc(100vw - 18px)!important;
  }
  .digital-header-menu-panel .sheet-menu-theme-control,
  .digital-header-menu-panel .theme-fields,
  .digital-header-menu-panel .theme-field,
  .digital-header-menu-panel .theme-field select{
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
  }
  .digital-header-menu-panel .theme-field select{height:42px!important;padding:7px 28px 7px 10px!important}
  .digital-top-ribbon.mobile-panel-active{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:6px!important;
  }
  .digital-top-ribbon .digital-ability-card,
  .digital-top-ribbon .digital-mini-stat-card{
    min-width:0!important;
    min-height:104px!important;
    padding:7px 5px!important;
    border-radius:14px;
    gap:5px!important;
  }
  .digital-top-ribbon .digital-stat-label{font-size:9px!important;line-height:1.1;text-align:center;min-height:22px}
  .digital-top-ribbon .digital-mod-chip{min-width:42px!important;padding:6px 7px!important;font-size:15px!important}
  .digital-top-ribbon .digital-score-total{font-size:20px!important}
  .digital-top-ribbon .digital-mini-value{font-size:18px!important}
  .digital-top-ribbon .digital-mini-footer{font-size:9px!important}
  .digital-top-ribbon .digital-hp-card{
    grid-column:1/-1!important;
    min-width:0!important;
    width:100%!important;
  }

  /* Make hidden desktop roll gestures discoverable on touch screens. */
  .mobile-roll-guidance{
    margin:0 0 8px;
    padding:9px 11px;
    border:1px solid var(--py-border-soft);
    border-radius:12px;
    background:var(--py-panel-soft);
    color:var(--py-muted);
    font-size:12px;
    line-height:1.35;
  }
  .mobile-roll-guidance strong{color:var(--py-text-strong)}
  .mobile-tooltip-popover{
    position:fixed;
    left:10px;
    right:10px;
    bottom:calc(var(--py-mobile-nav-height) + var(--py-safe-bottom) + 10px);
    z-index:1200;
    padding:15px 42px 15px 15px;
    border:2px solid var(--line);
    border-radius:15px;
    background:var(--py-panel-glass-strong);
    color:var(--py-text);
    box-shadow:0 18px 42px var(--py-shadow-panel-strong);
    font-size:14px;
    line-height:1.4;
  }
  .mobile-tooltip-popover[hidden]{display:none!important}
  .mobile-tooltip-close{
    position:absolute;right:7px;top:7px;width:32px;height:32px;min-height:32px;border:0;border-radius:999px;background:var(--py-panel-soft);color:var(--py-text-strong);font-size:22px;line-height:1
  }

  /* Play workspace: stop using a clipped desktop tab strip and turn action filters into a phone grid. */
  .digital-right-column.mobile-panel-active{display:grid!important;grid-template-columns:minmax(0,1fr)!important;width:100%;min-width:0}
  .digital-right-column .digital-right-top-grid{width:100%;min-width:0}
  .digital-feature-shell{
    width:100%!important;
    min-width:0!important;
    min-height:0!important;
    height:auto!important;
    max-height:none!important;
    overflow:visible!important;
    contain:none!important;
  }
  .digital-tab-row{
    position:sticky!important;
    top:calc(58px + var(--py-safe-top))!important;
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:6px!important;
    width:100%!important;
    overflow:visible!important;
    padding:7px!important;
  }
  .digital-tab{width:100%;min-width:0!important;min-height:40px!important;padding:7px 6px!important;white-space:normal!important;line-height:1.1;text-align:center}
  .digital-feature-shell-body{
    width:100%!important;
    min-width:0!important;
    height:auto!important;
    max-height:none!important;
    overflow:visible!important;
    margin:0!important;
    padding:8px!important;
  }
  .digital-feature-shell-body>.digital-equipment-shell,
  .digital-actions-shell,
  .digital-action-section{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    overflow:visible!important;
    box-sizing:border-box!important;
  }
  .digital-equipment-head .digital-placeholder-copy{display:none}
  .digital-actions-shell>.digital-subtab-row{
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:6px!important;
    width:100%;
  }
  .digital-actions-shell>.digital-subtab-row .digital-subtab{
    width:100%;
    min-width:0;
    padding:7px 5px;
    white-space:normal;
    text-align:center;
    line-height:1.12;
  }
  .digital-action-section{padding:9px!important;border-radius:14px!important}
  .digital-action-row,
  .digital-action-row.split-damage-with-extra{
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    gap:7px!important;
    width:100%!important;
    padding:10px 0!important;
  }
  .digital-action-hit-wrap,
  .digital-action-hit-stack,
  .digital-action-damage-stack,
  .digital-action-extra-stack{
    display:flex!important;
    flex-wrap:wrap!important;
    width:100%!important;
    max-width:100%!important;
    justify-content:flex-start!important;
    align-items:flex-start!important;
    overflow:visible!important;
  }
  .digital-action-hit-stack .digital-mod-chip,
  .digital-action-hit-wrap .digital-mod-chip,
  .digital-action-damage-stack .digital-mod-chip,
  .digital-action-extra-stack .digital-mod-chip{
    width:auto!important;
    min-width:72px!important;
    max-width:100%!important;
  }
  .digital-action-extra-stack .digital-mod-chip{width:auto!important}
}

@media (max-width:430px){
  /* Override the original two-column phone rule: the requested mobile overview is always 3 × 3. */
  .digital-top-ribbon.mobile-panel-active{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  .digital-top-ribbon .digital-ability-card,
  .digital-top-ribbon .digital-mini-stat-card{min-height:98px!important}
  .digital-top-ribbon .digital-stat-label{font-size:8px!important}
  .digital-top-ribbon .digital-mod-chip{min-width:38px!important;font-size:14px!important}
  .digital-actions-shell>.digital-subtab-row{grid-template-columns:repeat(2,minmax(0,1fr))}
}

@media (max-width:620px){
  .topbar>.theme-controls:not(.theme-expanded),
  .module-launcher-shell .topbar>.theme-controls:not(.theme-expanded){
    display:flex!important;
    grid-template-columns:none!important;
    align-items:center!important;
    justify-content:center!important;
  }
}
@media (max-width:980px){
  .demo-characters-page .test-character-meta{width:100%;min-width:0;max-width:100%}
  .demo-characters-page .test-character-meta span{min-width:0;max-width:100%;overflow-wrap:anywhere;word-break:break-word}
  .demo-characters-page .test-character-meta span:last-child{display:none}
}
