.live-game :is(.shop-layout > div, .shop-sidebar, .detail-info) {
  min-width: 0;
}
.live-game main:focus {
  outline: none;
}
.live-game:has(dialog[open]) {
  overflow: hidden;
}

@media (max-width: 700px) {
  .live-game {
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
      calc(82px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
    -webkit-text-size-adjust: 100%;
  }
  .live-game main {
    width: calc(100% - 32px);
    margin: 20px auto 30px;
  }
  .live-game .app-header.header-v2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: 16px;
    gap: 16px 10px;
  }
  .live-game .app-brand {
    min-width: 0;
    padding-bottom: 0;
    border: 0;
  }
  .live-game .app-brand strong {
    font-size: 27px;
  }
  .live-game .app-brand small {
    font-size: 10px;
    max-width: 18ch;
    line-height: 1.4;
  }
  .live-game .app-header-tools {
    gap: 8px;
  }
  .live-game .app-header-tools .ui-btn {
    font-size: 11px;
    max-width: 100px;
    padding: 8px;
    line-height: 1.4;
  }
  .live-game .app-header.header-v2 > .balances {
    grid-column: 1/-1;
    grid-row: 2;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 1fr;
    width: 100%;
    gap: 6px;
    padding-top: 0;
    border: 0;
  }
  .live-game .app-header .wallet-v2 > div {
    min-width: 0;
    gap: 5px;
    justify-content: center;
    padding: 10px 6px;
  }
  .live-game .balances strong {
    font-size: clamp(12px, 3.7vw, 17px);
    white-space: nowrap;
    letter-spacing: -0.5px;
  }
  .live-game .balances .ui-icon {
    width: 16px;
    height: 16px;
  }
  .live-game #game-nav {
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;
  }
  .live-game .app-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 8px max(8px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--t-border, #cbd3bb);
    box-shadow: 0 -4px 20px #0003;
    overflow: visible;
  }
  .live-game .app-nav > button {
    max-width: none;
    min-width: 0;
    min-height: 58px;
    padding: 6px 2px;
    gap: 4px;
    font-size: 11px;
    border: 1px solid var(--t-border, #cbd3bb);
    border-radius: 5px;
  }
  .live-game .app-nav > button > .ui-icon {
    width: 24px;
    height: 24px;
  }
  .live-game .app-nav > .nav-help {
    display: none;
  }
  .live-game button:not(.collectible):not(.empty-display-place):not(.prism-unopened),
  .live-game .ui-icon-btn {
    min-height: 44px !important;
  }
  .live-game .ui-icon-btn,
  .live-game .icon-button {
    min-width: 44px;
    flex-shrink: 0;
  }
  .live-game :is(.primary-button, .quiet-button, .ui-btn, .danger-button) {
    font-size: 13px;
    line-height: 1.4;
    white-space: normal;
  }
  .live-game :is(select, input:not([type='checkbox'])) {
    font-size: 16px;
    min-height: 44px;
    max-width: 100%;
  }
  .live-game :is(button, a, select, input) {
    touch-action: manipulation;
  }
  .live-game :is(.shop-subnav a, summary) {
    min-height: 44px;
    align-content: center;
  }
  .live-game .shop-subnav a {
    font-size: 12px;
  }
  .live-game .page-heading {
    flex-wrap: wrap;
    gap: 14px;
    padding-bottom: 20px;
  }
  .live-game .page-heading h1 {
    font-size: 28px;
    line-height: 1.15;
    letter-spacing: -1px;
  }
  .live-game .page-heading p {
    font-size: 13px;
    line-height: 1.6;
  }
  .live-game :is(.tutorial-note, .offline-note) {
    padding: 16px;
    gap: 12px;
    flex-wrap: wrap;
  }
  .live-game :is(.tutorial-note, .offline-note) > button {
    flex: 1 1 auto;
  }
  .live-game :is(.tutorial-note p, .offline-note p) {
    font-size: 13px;
    line-height: 1.6;
  }
  .live-game .offline-note > div {
    flex-basis: 100%;
  }
  .live-game .hero-copy {
    padding: 24px 20px 24px 70px;
  }
  .live-game .hero-copy h2 {
    font-size: 32px;
    max-width: 13ch;
  }
  .live-game .hero-copy .hero-greeting {
    font-size: 11px;
  }
  .live-game .hero-copy > p:not(.hero-greeting) {
    font-size: 13px;
    line-height: 1.6;
    margin: 12px 0 16px;
  }
  .live-game .hero-guide {
    left: 15px;
    bottom: 28px;
  }
  .live-game .hero-art {
    min-height: 210px;
  }
  .live-game .hero-art .collectible {
    zoom: 0.8;
  }
  .live-game .hero-art > small {
    font-size: 10px;
  }
  .live-game .cabinet {
    scroll-snap-align: start;
    flex-basis: 230px;
    margin-inline: auto;
  }
  .live-game .request :is(h3, strong) {
    font-size: 15px;
  }
  .live-game .request p {
    font-size: 13px;
  }
  .live-game .request .quiet-button {
    font-size: 13px;
  }
  .live-game .pack-shop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .live-game .pack-product-new .pack-stage {
    min-height: 155px;
    padding: 20px 8px;
  }
  .live-game .pack-product-new .pack-content {
    padding: 14px 10px;
  }
  .live-game .pack-content h3 {
    font-size: 18px;
    line-height: 1.2;
  }
  .live-game .pack-content > p {
    font-size: 12px;
    min-height: 54px;
  }
  .live-game .pack-content .pack-meta {
    flex-wrap: wrap;
    gap: 4px 8px;
    font-size: 10px;
    margin-bottom: 10px;
  }
  .live-game .pack-meta > span + span {
    padding-left: 0;
    border: 0;
  }
  .live-game .pack-content > .ui-btn {
    font-size: 12px;
    padding: 10px 5px;
  }
  .live-game .pack-price {
    font-size: 19px;
  }
  .live-game .pack-odds-note {
    font-size: 11px;
  }
  .live-game .pack-balance-note {
    font-size: 13px;
  }
  .live-game .collection-filter {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px;
    gap: 8px;
  }
  .live-game .collection-filter .filter-chip {
    font-size: 12px;
    padding: 8px;
  }
  .live-game .collection-filter > .button-row {
    grid-column: 1/-1;
    gap: 8px;
  }
  .live-game .collection-filter > .button-row > button {
    flex: 1;
    font-size: 12px;
  }
  .live-game .collection-tools label {
    flex: 1 1 130px;
    min-width: 0;
  }
  .live-game .collection-tools select {
    width: 100%;
  }
  .live-game .owned-card .collectible {
    --card-w: clamp(88px, 27vw, 108px);
    --card-h: calc(var(--card-w) * 150 / 108);
  }
  .live-game .card-check {
    top: 0;
    left: 0;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
  }
  .live-game .card-check input {
    width: 20px;
    height: 20px;
    margin: 0;
  }
  .live-game .owned-card.collection-v0 {
    padding-top: 36px;
  }
  .live-game .card-meta strong {
    font-size: 13px;
  }
  .live-game .card-meta small {
    font-size: 11px;
  }
  .live-game .team-strength {
    align-items: flex-start;
    gap: 12px;
  }
  .live-game .team-strength > .button-row {
    width: 100%;
  }
  .live-game .team-strength > .button-row > button {
    flex: 1;
  }
  .live-game .team-board {
    padding: 22px 8px;
    gap: 24px;
  }
  .live-game .lineup-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }
  .live-game .lineup-row:first-child {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 240px;
  }
  .live-game .lineup-slot {
    min-width: 0;
  }
  .live-game .lineup-slot .collectible {
    --card-w: clamp(64px, 22vw, 100px) !important;
    --card-h: calc(var(--card-w) * 150 / 108) !important;
  }
  .live-game .lineup-slot > button:not(.collectible):first-child {
    width: 100%;
    height: 132px;
    font-size: 12px;
    padding: 6px;
  }
  .live-game .lineup-slot > small {
    font-size: 10px;
    margin: 5px 0;
  }
  .live-game .lineup-slot .quiet-button {
    display: block;
    width: 100%;
    font-size: 11px;
    padding: 6px 2px;
  }
  .live-game :is(.campaign-grid, .upgrade-grid) {
    grid-template-columns: 1fr;
  }
  .live-game .campaign-level {
    padding: 16px 10px;
  }
  .live-game .game-list {
    gap: 5px;
  }
  .live-game .game-list button {
    padding: 10px 2px;
    font-size: 11px;
  }
  .live-game .game-list small {
    font-size: 10px;
  }
  .live-game dialog {
    width: calc(100% - 24px);
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 16px;
    overscroll-behavior: contain;
  }
  .live-game .dialog-top {
    position: sticky;
    z-index: 20;
    top: -16px;
    background: var(--t-surface, #f8f7eb);
    padding: 12px 16px;
    margin: -16px -16px 16px;
    border-bottom: 1px solid var(--t-border, #cbd3bb);
  }
  .live-game .dialog-top h2 {
    font-size: 21px;
    line-height: 1.3;
  }
  .live-game .confirm-order {
    gap: 16px;
  }
  .live-game .confirm-order-art {
    min-height: 130px;
  }
  .live-game .confirm-order-art .pack-art {
    width: 65px;
  }
  .live-game .confirm-order h3 {
    font-size: 21px;
  }
  .live-game .confirm-order .button-row > button {
    flex: 1;
  }
  .live-game .cinematic-opening {
    height: clamp(230px, 45dvh, 360px);
  }
  .live-game .opening-progress {
    font-size: 12px;
  }
  .live-game .batch-progress {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }
  .live-game .batch-progress > button {
    width: 100%;
    font-size: 13px;
  }
  .live-game .prism-reveal-stage {
    min-height: 0;
    padding: 16px 10px;
  }
  .live-game .prism-reveal-heading {
    gap: 10px;
    align-items: center;
  }
  .live-game .prism-reveal-heading strong {
    font-size: 16px;
  }
  .live-game .prism-hand {
    gap: 24px 10px;
    padding: 26px 0 12px;
  }
  .live-game .prism-slot {
    transform: none;
  }
  .live-game .prism-hand .collectible {
    --card-w: 100%;
    --card-h: 100%;
  }
  .live-game .prism-slot > small {
    font-size: 11px;
  }
  .live-game .reveal-actions > button {
    flex: 1 1 120px;
  }
  .live-game .detail-dialog-art .collectible {
    zoom: 1;
  }
  .live-game .detail-info :is(p, dt, dd) {
    font-size: 13px;
  }
  .live-game .detail-controls > label {
    flex: 1 1 130px;
    min-width: 0;
  }
  .live-game .detail-controls select {
    width: 100%;
    max-width: 100%;
  }
  .live-game .opponent-lineup {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px 8px;
  }
  .live-game .opponent-lineup > div {
    min-width: 0;
  }
  .live-game .opponent-lineup .collectible {
    --card-w: 64px !important;
    --card-h: 89px !important;
  }
  .live-game .scoreboard {
    padding: 22px 10px;
  }
  .live-game .scoreboard .score {
    font-size: 42px;
    letter-spacing: 2px;
  }
  .live-game .dev-form > label {
    min-width: 0;
    flex: 1 1 130px;
  }
  .live-game .demo-footer {
    font-size: 12px;
    line-height: 1.6;
  }
  .live-game #game-toast {
    bottom: calc(88px + env(safe-area-inset-bottom));
    width: max-content;
    font-size: 13px;
  }
}

@media (max-width: 360px) {
  .live-game main {
    width: calc(100% - 24px);
  }
  .live-game .app-header.header-v2 {
    padding: 12px;
  }
  .live-game .app-header-tools .ui-btn {
    max-width: 76px;
  }
  .live-game .app-header .wallet-v2 > div {
    gap: 3px;
    padding-inline: 4px;
  }
  .live-game .balances .ui-icon {
    width: 13px;
    height: 13px;
  }
  .live-game .pack-shop-grid {
    grid-template-columns: 1fr;
  }
  .live-game .pack-product-new {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
  }
  .live-game .pack-product-new .pack-stage {
    height: 100%;
    border-bottom: 0;
  }
  .live-game .pack-product-new .pack-stage .pack-art {
    width: 60px;
  }
  .live-game .pack-content > p {
    min-height: 0;
  }
  .live-game .hero-copy {
    padding-left: 20px;
  }
  .live-game .hero-guide {
    display: none;
  }
}
