/* Shared mobile rhythm and controls. Feature behavior stays in its components. */
@media (max-width: 600px) {
    .app-header-content { display: flex; flex-wrap: nowrap; padding: 12px 16px; gap: 12px; }
    .app-header-content .brand { font-size: 20px; letter-spacing: -1px; }
    .header-identity { flex: 0 0 auto; min-width: 0; gap: 3px; }
    .header-user-name { max-width: 8rem; font-size: 12px; }
    .app-header-content .header-actions { flex: 1 1 auto; flex-wrap: nowrap; margin-left: auto; gap: 8px; min-width: 0; }
    .app-header-content .header-actions > * { flex: 0 0 auto; }
    .app-header-content .anonymous-actions { flex-wrap: wrap; }
    .app-header-content .header-sign-in-link { min-height: 44px; }
    .app-header-content .token-wallet { flex: 0 1 auto; min-width: 0; min-height: 44px; padding: 0 0 0 8px; gap: 6px; border: 1px solid #3b4932; border-radius: 10px; background: #1d261b; }
    .app-header-content .token-wallet-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 1.4; }
    .app-header-content .token-wallet-value:last-child { margin-right: 8px; }
    .app-header-content .token-wallet-symbol, .app-header-content .token-wallet-action { flex-shrink: 0; }
    .app-header-content .token-wallet-action { width: 28px; }
    .app-header-content .token-wallet-add { width: 28px; height: 44px; border: 0; background: transparent; font-size: 20px; }
    .app-header-content .user-menu-toggle { width: 44px; height: 44px; }
    .app-header-content .header-dashboard-link { display: none; }
    .app-header-content .user-menu-dashboard { display: flex; }
    .header-actions > .language-selector select { min-height: 44px; font-size: 16px; }
    .header-actions > .language-selector::after { top: 18px; }
    .header-language { display: none; }
    .user-menu-language { display: block; }
    .user-menu-language select { min-height: 44px; font-size: 16px; }
    .user-menu-language .language-selector::after { top: 18px; }
    .user-menu-panel { top: calc(100% + 10px); border-radius: 12px; }

    main { padding: 24px 16px; }
    h1 { margin: 0 0 8px; font-size: 28px; line-height: 1.2; letter-spacing: -.8px; overflow-wrap: anywhere; }
    .page-header { flex-direction: column; align-items: stretch; gap: 20px; }
    .page-header > div, .arena-title > div { min-width: 0; }
    .page-header .eyebrow { display: none; }
    .page-header .muted { font-size: var(--text-body); line-height: 1.5; font-weight: var(--weight-body); }
    .page-header-actions { display: flex; align-items: stretch; width: 100%; gap: 10px; flex-wrap: nowrap; }
    .page-header-actions > .button { flex: 1; }
    .page-header-actions > .refresh-button { flex: 0 0 48px; width: 48px; padding: 0; font-size: 0; }
    .page-header-actions > .refresh-button .refresh-label { display: none; }
    .arena-page-header .page-header-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .arena-page-header .page-header-actions > .button { min-width: 0; }
    .arena-page-header .page-header-actions > .button:not(.secondary) { grid-column: 1 / -1; }
    .arena-heading { width: 100%; gap: 16px; }
    .arena-heading > .refresh-button.icon-button { flex-basis: 48px; width: 48px; height: 48px; padding: 0; }
    .arena-heading .arena-title { flex: 1; }
    .button, .refresh-button { min-height: 48px; border-radius: 10px; padding: 12px 16px; font-size: 14px; line-height: 1.4; white-space: normal; text-align: center; }
    .page-header-actions > .button:not(.secondary):not(.arena-remove), .login-panel form .button, .wizard-actions .button:not(.secondary), .modal-dialog-footer .button:not(.secondary) { border-color: #bdf37b; background: #bdf37b; color: #14200d; font-weight: 700; }
    .page-header-actions > .button:not(.secondary):not(.arena-remove):hover, .login-panel form .button:hover, .wizard-actions .button:not(.secondary):hover, .modal-dialog-footer .button:not(.secondary):hover { background: #cafa91; }
    .refresh-button, .button.secondary { background: #1a2022; color: #c3cec6; border-color: #343e3b; }
    .button:disabled { opacity: .5; cursor: default; }
    .back-link { display: inline-flex; align-items: center; min-height: 44px; margin: -8px 0 16px; color: #aab8ad; font-size: 13px; }
    .arena-title { align-items: center; gap: 14px; }
    .arena-game-art { width: 52px; height: 56px; border-radius: 12px; }
    .arena-game-name { display: inline-block; font-size: var(--text-body); font-weight: var(--weight-body); }

    .game-tabs { flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding: 0 0 12px; margin-top: 24px; border-bottom: 0; }
    .game-tabs .game-tab { width: auto; flex: 0 0 auto; min-height: 44px; padding: 10px 12px; gap: 8px; border-radius: 10px; font-size: 13px; white-space: nowrap; background: #171d1f; border-color: #2c3532; }
    .game-tabs .game-tab[aria-pressed="true"] { color: #c7edab; border-color: #526445; background: #222e20; }
    .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 4px 0 24px; border-block: 1px solid #2c3432; }
    .metrics .metric-card { border: 0; border-radius: 0; padding: 16px 12px; background: transparent; }
    .metrics .metric-card:first-child { padding-left: 0; }
    .metrics .metric-card + .metric-card { border-left: 1px solid #2c3432; }
    .metrics .metric-card:last-child { padding-right: 0; }
    .metrics .metric-card > p:first-child { min-height: 2.8em; margin: 0 0 8px; font-size: var(--text-label); line-height: 1.4; font-weight: var(--weight-body); }
    .metrics .metric-card strong { font-size: var(--text-body); line-height: 1; font-weight: var(--weight-body); }
    .metrics .metric-detail { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
    .metrics .metric-status { font-size: var(--text-label); font-weight: var(--weight-body); }

    .dashboard-panel { border-color: #303937; border-radius: 12px; background: #171d1f; }
    .panel-heading { padding: 20px; }
    .panel-heading .eyebrow { display: none; }
    .panel-heading h2 { margin: 0; font-size: var(--text-heading); font-weight: var(--weight-heading); }
    .count-badge { background: #252f25; border: 0; min-width: 28px; height: 28px; border-radius: 8px; }
    .expandable-group > summary { min-height: 52px; padding: 12px 16px; gap: 8px; background: #1c2424; }
    .group-title { font-size: var(--text-body); font-weight: var(--weight-body); }
    .group-description { max-width: 88px; font-size: var(--text-label); font-weight: var(--weight-body); }
    .group-content { margin-left: 0; border-left: 0; }
    .server-row { padding: 16px 20px 8px; gap: 16px; }
    .server-identity { gap: 12px; }
    .server-identity h3 { font-size: var(--text-heading); font-weight: var(--weight-heading); }
    .server-identity .arena-link { display: inline-flex; align-items: center; min-height: 32px; }
    .server-identity .muted { margin-top: 0; font-size: var(--text-body); font-weight: var(--weight-body); }
    .server-row > div:nth-child(2) { grid-column: 1 / -1; }
    .server-row > div:nth-child(2) .mobile-label { display: none; }
    .mobile-label { font-size: var(--text-label); color: #9baaa0; font-weight: var(--weight-body); }
    .map-cell, .players-cell { font-size: var(--text-body); font-weight: var(--weight-body); }
    .state-badge { padding: 6px 9px; border-radius: 6px; font-size: var(--text-label); font-weight: var(--weight-body); }
    .server-sessions { margin: 8px 20px 4px; border-top: 1px solid #2c3632; }
    .server-sessions summary { min-height: 48px; font-size: var(--text-body); font-weight: var(--weight-body); }
    .active-session-cards { padding: 16px; }
    .compact-session { border-radius: 10px; }
    .panel-empty { font-size: var(--text-body); padding: 20px; font-weight: var(--weight-body); }
    .dashboard-aside { gap: 16px; }

    .arena-session-workspace, .arena-details-grid { margin-top: 24px; }
    .arena-session-workspace, .arena-details-grid, .arena-details-main, .arena-details-aside { gap: 16px; }
    .arena-details-aside { grid-row: auto; }
    .section-panel-heading { min-height: 64px; padding: 18px 20px; gap: 12px; }
    .arena-connection-panel .section-panel-heading h2 { font-size: var(--text-heading); font-weight: var(--weight-heading); }
    .section-panel-heading h2 { font-size: var(--text-heading); line-height: 1.4; font-weight: var(--weight-heading); }
    .section-panel-body { padding: 20px; }
    .arena-current-session .section-panel-heading { flex-wrap: wrap; }
    .arena-current-session .section-panel-heading > div { flex-basis: 100%; }
    .arena-current-session .section-panel-heading > .button { flex: 1 1 120px; }
    .arena-connection-panel .section-panel-heading { min-height: 64px; padding: 18px 20px; border-bottom: 1px solid #2b3234; }
    .arena-connection-panel .section-panel-body { padding: 20px; }
    .section-panel-body > .muted, .panel-empty-state p { font-size: var(--text-body); font-weight: var(--weight-body); }
    .detail-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; row-gap: 24px; }
    .detail-field dt { font-size: var(--text-label); line-height: 1.5; font-weight: var(--weight-body); }
    .detail-field dd { font-size: var(--text-body); line-height: 1.5; font-weight: var(--weight-body); }
    .arena-history-row { padding-block: 20px; gap: 14px; }
    .copy-text-button { width: 100%; min-width: 0; }
    .arena-connection-actions { gap: 12px; }
    .arena-connection-actions .button { min-height: 48px; }
    .copy-text-control-address { align-items: stretch; }
    .copy-text-address { border-radius: 8px; padding: 14px; }
    .secret-toggle { min-height: 48px; }

    .wizard-steps { display: flex; gap: 8px; margin-block: 24px; }
    .wizard-steps li { flex: 0 0 26px; gap: 0; padding: 10px 0; font-size: 0; }
    .wizard-steps li span { font-size: 12px; }
    .wizard-steps li.current { flex: 1; gap: 8px; font-size: 13px; }
    .wizard-panel { padding: 24px 20px; }
    .wizard-fields, .session-booking-fields { gap: 20px; }
    .wizard-field { font-size: var(--text-label); gap: 8px; font-weight: var(--weight-body); }
    .wizard-field input, .wizard-field select, .wizard-field textarea, .map-search input, .secret-value input { min-height: 48px; border-radius: 8px; font-size: var(--text-input-mobile); border-color: #3b4941; }
    .admin-parameter select { font-size: var(--text-input-mobile); }
    .wizard-actions { gap: 10px; margin-top: 24px; }
    .wizard-actions .button { flex: 1 1 110px; }
    .wizard-checkbox { min-height: 48px; line-height: 1.5; font-size: 14px; }
    .session-start-options { display: grid; grid-template-columns: 1fr; gap: 10px; }
    .session-start-options .wizard-checkbox { padding: 12px; border: 1px solid #36433a; border-radius: 10px; background: #131a16; }
    .session-start-options .wizard-checkbox:has(input:checked) { border-color: #7b9e5b; background: #202d1c; }
    .map-builder-header, .map-catalog, .map-rotation-panel { padding: 16px; }
    .map-builder-header p, .map-queue-hint { font-size: var(--text-body); font-weight: var(--weight-body); }
    .map-option { min-height: 48px; border-radius: 8px; }
    .rotation-actions button { width: 44px; height: 44px; }
    .rotation-queue li { gap: 6px; padding: 8px; flex-wrap: wrap; }
    .rotation-queue code { flex: 1; }
    .rotation-actions { margin-left: auto; }

    .modal-overlay { align-items: end; padding-top: 16px; }
    .modal-dialog { display: flex; flex-direction: column; width: 100%; height: auto; max-height: calc(100dvh - 16px); overflow: hidden; border: 1px solid #3b473f; border-bottom: 0; border-radius: 18px 18px 0 0; }
    .modal-dialog-heading { flex-shrink: 0; padding: 16px 20px; gap: 12px; }
    .modal-dialog-heading h2 { font-size: var(--text-heading); letter-spacing: -.3px; font-weight: var(--weight-heading); }
    .modal-dialog-close { width: 44px; min-height: 44px; border-radius: 10px; flex-shrink: 0; color: #b3c0b6; background: #252e28; }
    .modal-dialog-body { flex: 0 1 auto; min-height: 0; overflow-y: auto; padding: 24px 20px; overscroll-behavior: contain; }
    .modal-dialog-footer { position: static; flex-shrink: 0; display: grid; grid-template-columns: minmax(80px, 1fr) minmax(0, 3fr); gap: 10px; margin-inline: 20px; padding: 16px 0 max(20px, env(safe-area-inset-bottom)); }
    .modal-dialog-footer .button { width: 100%; }
    .modal-dialog-footer > .secondary { padding-inline: 8px; font-size: 13px; background: transparent; border-color: transparent; }
    .session-booking-summary { padding-top: 20px; }
    .session-booking-quote { min-height: 0; }
    .session-booking-summary h3 { font-size: var(--text-heading); color: #abbba9; font-weight: var(--weight-heading); }
    .session-booking-price { font-size: var(--text-body); font-weight: var(--weight-body); }
    .session-maintenance-hint { line-height: 1.6; }
    .notice-warning { border-radius: 10px; font-size: var(--text-body); font-weight: var(--weight-body); }
}

@media (max-width: 360px) {
    .app-header-content { padding-inline: 10px; gap: 8px; }
    .app-header-content .token-wallet { gap: 4px; }
    .app-header-content .token-wallet-symbol + .token-wallet-value { padding-left: 0; border-left: 0; }
}

@media (max-width: 380px) {
    .app-header-content:has(.anonymous-actions) { flex-wrap: wrap; align-items: flex-start; gap: 12px; }
    .app-header-content:has(.anonymous-actions) .header-identity { flex-basis: 100%; }
    .app-header-content:has(.anonymous-actions) .anonymous-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); flex: 1 0 100%; width: 100%; gap: 8px; margin-left: 0; }
    .app-header-content:has(.anonymous-actions) .anonymous-actions > * { min-width: 0; width: 100%; }
    .app-header-content:has(.anonymous-actions) .header-sign-in-link,
    .app-header-content:has(.anonymous-actions) .language-selector select { width: 100%; min-width: 0; min-height: 44px; font-size: 16px; line-height: 18px; }
}
