/* Current server account UI. Loaded last so phone controls stay readable. */
.mobile-brand, .team-depth-cards, .sheet-handle { display: none; }
.home-task-card { display: grid; gap: 18px; margin-block: 18px; }
.home-task-summary { display: flex; align-items: center; gap: 12px; min-width: 0; }
.home-task-summary > div { flex: 1; min-width: 0; }
.home-task-summary h2 { font-size: 18px; }
.home-task-summary p { margin-top: 4px; color: var(--muted); }
.home-task-timer { color: var(--gold-light); text-align: end; }
.home-task-timer small { display: block; color: var(--muted); font-size: 12px; }
.home-task-card > .button { justify-self: start; }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 6px 0; border: 0; background: transparent; color: var(--gold-light); font: inherit; font-size: 14px; }
.text-button svg { width: 18px; height: 18px; }
.level-card-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.level-card-top > .level-badge { position: static; font-size: 19px; line-height: 1.5; }
.level-cost { margin-top: 18px; }
.level-cost > span { font-size: 13px; }
.level-cost .level-price { margin-top: 4px; }
.level-card-action > .button { width: 100%; }
.level-status { display: flex; align-items: center; justify-content: center; min-height: 48px; color: var(--muted); }
.production-more-menu { width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 40px); padding: 22px; overflow: auto; border: 1px solid #786846; border-radius: 22px; background: #101d30; color: var(--text); overscroll-behavior: contain; }
.production-more-menu::backdrop { background: #020812cf; backdrop-filter: blur(5px); }
.more-menu-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.more-menu-header h2 { font-size: 21px; }
.production-more-menu > p { margin-block: 10px 18px; font-size: 14px; line-height: 1.7; }
.more-menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.more-menu-item { display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: center; gap: 6px 10px; min-height: 72px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: #152238; color: var(--text); font-size: 15px; line-height: 1.6; }
.more-menu-item > svg { width: 23px; height: 23px; color: var(--gold-light); }
.more-menu-item > span { min-width: 0; overflow-wrap: anywhere; }
.more-menu-item > small { grid-column: 2; color: var(--gold-light); font-size: 12px; }
.more-menu-item.active { border-color: var(--gold-dark); background: #ad813a24; }

.app-shell:has(> .production-auth-shell) { display: block; min-height: 100dvh; padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.production-auth-shell { width: 100%; }
.production-auth-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: min(480px, 100%); margin: 0 auto 28px; }
.production-auth-brand { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--gold-light); }
.production-auth-brand .mara-brand-logo { display: block; width: 58px; height: 58px; flex: 0 0 58px; object-fit: contain; }
.production-auth-brand > div { display: grid; gap: 2px; min-width: 0; }
.production-auth-brand bdi { font-size: 24px; line-height: 1.3; letter-spacing: 1px; }
.production-auth-brand small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.production-auth-brand small bdi { font-size: 11px; line-height: 1.5; letter-spacing: .2px; }
.production-auth-header .language-toggle { min-width: 50px; min-height: 48px; flex-shrink: 0; }
.production-auth-content { width: min(480px, 100%); margin-inline: auto; }
.production-auth-content .usdt-wallet { margin: 0; max-width: none; }
.production-auth-content .auth-card { margin: 0; }
.production-session-check { display: grid; gap: 18px; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.production-session-check .button { min-height: 50px; width: 100%; }
@media screen and (min-width: 1024px) { .app-shell:has(> .production-auth-shell) { padding-top: 64px; } }

@media screen and (max-width: 1023px) {
  :root { font-size: 16px; --phone-width: 680px; --phone-nav: 76px; }
  html { scroll-padding-top: 88px; }
  body { background: #040a13; }
  body:has(.production-confirm[open]), body:has(.production-more-menu[open]), body:has(.usdt-wallet dialog[open]) { overflow: hidden; }
  .app-main { width: 100%; max-width: var(--phone-width); min-height: 100dvh; margin-inline: auto; padding-bottom: calc(var(--phone-nav) + env(safe-area-inset-bottom) + 18px); background: var(--bg); }
  .app-sidebar { display: none; }
  .topbar { position: sticky; inset-block-start: 0; z-index: 60; min-height: 70px; gap: 12px; padding: calc(9px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 9px max(16px, env(safe-area-inset-left)); background: #0b1525f5; backdrop-filter: blur(18px); }
  .topbar-title { min-width: 0; }
  .topbar-title > .desktop-page-title, .topbar-title > .topbar-meta { display: none; }
  .mobile-brand { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 44px; }
  .mobile-brand > .mara-brand-logo { display: block; flex: 0 0 44px; width: 44px; height: 44px; min-width: 44px; padding: 0; border: 0; border-radius: 0; background: transparent; object-fit: contain; }
  .mobile-brand > span { display: grid; gap: 1px; min-width: 0; }
  .mobile-brand bdi { color: var(--gold-light); font: 700 20px/1.2 "Segoe UI", Tahoma, sans-serif; letter-spacing: 1.3px; white-space: nowrap; }
  .mobile-brand small { display: block; line-height: 1.4; }
  .mobile-brand small bdi { color: #aab8cc; font-size: 9px; letter-spacing: .1px; }
  .topbar-actions { gap: 8px; }
  .topbar-actions > .avatar { display: none; }
  .topbar-actions > .language-toggle { min-width: 44px; min-height: 44px; padding: 8px 10px; font-size: 13px; }
  .icon-button { width: 44px; height: 44px; min-width: 44px; border-radius: 13px; }
  .icon-button svg { width: 22px; height: 22px; }
  .page-content { max-width: var(--phone-width); padding: 16px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left)); animation: none; }
  .page-heading { margin-bottom: 20px; }
  .page-heading .eyebrow { font-size: 12px; line-height: 1.7; letter-spacing: 0; }
  .page-heading h1 { margin: 5px 0 10px; font-size: 26px; line-height: 1.45; letter-spacing: 0; }
  .page-heading p { font-size: 16px; line-height: 1.85; }
  .section { margin-top: 22px; }
  .section-heading { gap: 10px; margin-bottom: 12px; }
  .section-heading h2 { font-size: 19px; }
  .section-heading .text-button { font-size: 14px; }
  .button, .button.small { min-height: 50px; padding: 12px 16px; border-radius: 14px; font-size: 16px; line-height: 1.55; white-space: normal; }
  .button:hover { transform: none; }
  .button:active:not(:disabled) { transform: scale(.985); }
  .button svg { flex-shrink: 0; width: 20px; height: 20px; }
  .card { padding: 20px; border-radius: 19px; }
  .card-title { font-size: 18px; line-height: 1.65; }
  .card p, .inline-note, .notice { font-size: 16px; line-height: 1.8; }
  .inline-note { display: block; margin-top: 16px; color: var(--muted); }
  .notice { display: flex; flex-wrap: wrap; gap: 10px; margin-block: 14px; padding: 15px; overflow-wrap: anywhere; }
  .notice > .button { width: 100%; margin-top: 8px; }
  .grid-two, .grid-three { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .production-empty { min-height: 260px; gap: 16px; padding: 22px; }
  .production-empty h1 { font-size: 24px; }
  .production-empty > .button { width: 100%; }
  .numeric { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; white-space: normal; }
  .numeric small { display: inline-block; font-size: .45em; letter-spacing: 0; white-space: nowrap; }
  .chip { max-width: 100%; min-height: 28px; font-size: 12px; line-height: 1.6; white-space: normal; }

  /* Real balances and collection actions are the first signed-in controls. */
  .account-dashboard { margin-top: 0; padding: 20px; border-radius: 21px; }
  .dashboard-head { align-items: flex-start; gap: 12px; font-size: 15px; }
  .membership-chip { min-height: 44px; padding: 7px 10px; font-size: 12px; line-height: 1.5; }
  .dashboard-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; margin: 14px 0 20px; }
  .dashboard-balance { min-width: 0; font-size: clamp(28px, 7.9vw, 40px); line-height: 1.35; letter-spacing: -.7px; }
  .dashboard-balance > bdi { display: block; max-width: 100%; }
  .dashboard-balance small { font-size: 14px; }
  .dashboard-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 14px 0 0; border: 0; border-top: 1px solid #d9b96730; }
  .dashboard-stats > div { display: block; min-width: 0; }
  .dashboard-stats span { display: block; font-size: 13px; line-height: 1.65; }
  .dashboard-stats strong { display: block; margin-top: 6px; font-size: 17px; }
  .dashboard-stats strong small { font-size: 10px; }
  .dashboard-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .dashboard-actions > .button { min-height: 52px; padding-inline: 10px; font-size: 16px; }
  .home-task-card { gap: 16px; margin-block: 16px; padding: 18px; }
  .home-task-summary { gap: 11px; }
  .home-task-summary .feature-icon { flex: 0 0 40px; width: 40px; height: 40px; }
  .home-task-summary h2 { font-size: 17px; }
  .home-task-summary p { font-size: 14px; }
  .home-task-timer { font-size: 23px; }
  .home-task-card > .button { width: 100%; justify-self: stretch; }
  .mara-company-hero { display: grid; grid-template-columns: minmax(0, 1fr) 48px; gap: 12px; min-height: 0; padding: 16px; border-radius: 17px; }
  .mara-company-hero .brand-hero-copy { grid-column: 1; grid-row: 1; max-width: none; }
  .mara-company-hero .mara-stock { font-size: 10px; line-height: 1.5; letter-spacing: .5px; }
  .mara-company-hero h1.mara-company-name { margin: 6px 0 0; font-size: 19px; line-height: 1.4; letter-spacing: -.25px; overflow-wrap: normal; }
  .mara-company-hero .brand-hero-copy > p { display: none; }
  .mara-company-hero .brand-hero-art { position: static; inset: auto; grid-column: 2; grid-row: 1; align-self: center; width: 48px; height: 48px; mask: none; opacity: 1; }
  .mara-company-hero .brand-hero-art img { width: 48px; height: 48px; max-width: 48px; max-height: 48px; object-fit: contain; }
  .mara-business-grid { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 0; }
  .mara-business-grid > span { min-height: 38px; padding: 7px; border-radius: 8px; font-size: 12px; line-height: 1.5; }
  .home-service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .home-service-item { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; min-height: 78px; padding: 14px; border-radius: 15px; }
  .home-service-item > span { flex: 0 0 36px; width: 36px; height: 36px; margin: 0; }
  .home-service-item strong { font-size: 14px; line-height: 1.65; text-align: start; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-block: 16px; }
  .stat-card { min-width: 0; padding: 16px; border-radius: 16px; }
  .stat-label { min-height: 0; padding: 0; margin-bottom: 9px; font-size: 14px; line-height: 1.65; }
  .stat-value { font-size: 23px; line-height: 1.45; letter-spacing: -.3px; overflow-wrap: anywhere; }
  .stat-value small { font-size: 11px; }
  .stats-grid > .stat-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .home-summary-grid { grid-template-columns: minmax(0, 1fr); }

  /* Levels, task completion and reward claims use full-width touch targets. */
  .level-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .level-card { padding: 20px; border-radius: 19px; }
  .level-card-top > .level-badge { position: static; padding: 5px 12px; font-size: 20px; }
  .level-cost { margin-top: 18px; }
  .level-cost > span { font-size: 14px; }
  .level-price { margin-top: 5px; font-size: 32px; line-height: 1.4; overflow-wrap: anywhere; }
  .level-price small { font-size: 13px; }
  .production-facts { margin-block: 18px; }
  .production-facts > div { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; gap: 12px; padding-block: 13px; font-size: 15px; line-height: 1.75; }
  .production-facts dt, .production-facts dd { min-width: 0; overflow-wrap: anywhere; }
  .production-facts dd { margin: 0; text-align: end; }
  .production-facts dd bdi { font-size: 15px; }
  .production-facts .level-reward { padding: 14px 12px; border: 1px solid #b28c4b44; border-radius: 12px; background: #b28c4b0c; }
  .level-reward dd { color: var(--gold-light); }
  .level-card-action > .button, .team-tier > .button, .robot-card > .button, .production-account-meta > .button, [data-page="tasks"] .card > .button { width: 100%; }
  .level-card-action { margin-top: 8px; }
  .level-status { font-size: 15px; }
  .production-progress { height: 10px; margin-block: 22px; }
  [data-task-countdown] { font-size: 25px; color: var(--gold-light); }
  .mining-panel { padding: 24px 20px; }
  .mining-orbit { width: 150px; margin: 20px auto; }
  .mining-core { width: 88px; height: 88px; }
  .mining-controls { margin-top: 20px; }
  .mining-controls > .button, .mining-panel > .button { width: 100%; min-width: 0; }
  .counter { font-size: 17px; line-height: 1.7; }
  .robot-visual { width: 96px; height: 96px; margin: 4px auto 20px; border-radius: 22px; }
  .robot-visual > svg { width: 48px; height: 48px; }
  .robot-card h2, .team-tier h2 { font-size: 23px; }
  .robot-card > .button { margin-top: 20px; }
  .team-tier { padding: 20px; }
  .team-tier .card-header { align-items: flex-start; }
  .milestone-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .milestone-card { padding: 20px; }
  .milestone-number { font-size: 26px; }
  .milestone-number small { font-size: 14px; }
  .milestone-card > strong { display: block; margin-block: 12px; font-size: 24px; }
  .milestone-card p { min-height: 0; font-size: 16px; }
  .milestone-card .button { min-height: 50px; margin-top: 16px; font-size: 16px; }

  /* Every referral depth stays visible on phones, with no table scrolling. */
  .team-depth-section { padding: 18px; }
  .team-depth-table { display: none; }
  .team-depth-cards { display: grid; gap: 12px; margin-top: 16px; }
  .team-depth-card { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #142238; }
  .team-depth-card > header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
  .team-depth-card h3 { font-size: 17px; }
  .team-depth-card .chip { gap: 6px; font-size: 12px; }
  .team-depth-card dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
  .team-depth-card dt { color: var(--muted); font-size: 14px; line-height: 1.7; }
  .team-depth-card dd { margin: 5px 0 0; color: var(--text); font-size: 23px; }
  [data-page="team"] .card > .button { width: 100%; }
  .production-members > div { gap: 6px 12px; padding-block: 16px; font-size: 16px; }
  .production-members strong { min-width: 0; overflow-wrap: anywhere; }
  .production-members small { font-size: 13px; line-height: 1.7; }
  .field { gap: 9px; }
  .field > span { font-size: 15px; }
  .input { min-height: 52px; padding: 13px 14px; border-radius: 13px; font-size: 16px; scroll-margin-block: 95px 28px; }
  .production-account-meta > .button { margin: 12px 0 0; }
  .page-footer { display: grid; gap: 4px; margin: 12px 16px 0; padding-top: 18px; font-size: 11px; line-height: 1.8; }

  /* The wallet occupies the centre thumb target; all nine pages are in More. */
  .mobile-nav { position: fixed; z-index: 70; inset-inline: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; max-width: var(--phone-width); min-height: var(--phone-nav); margin-inline: auto; padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)); border: 1px solid #63533a; border-bottom: 0; border-radius: 21px 21px 0 0; background: #0b192bf8; box-shadow: 0 -8px 28px #0005; backdrop-filter: blur(18px); }
  .mobile-nav .nav-item { display: flex; align-items: center; justify-content: center; min-height: 62px; gap: 6px; padding: 6px 2px; border-radius: 13px; color: #b1bed0; font-size: 11px; line-height: 1.4; }
  html[dir="ltr"] .mobile-nav .nav-item { font-size: 11px; }
  .mobile-nav .nav-item > svg { box-sizing: border-box; width: 23px; height: 23px; padding: 0; margin: 0; border: 0; background: none; color: inherit; }
  .mobile-nav .nav-wallet { color: var(--gold-light); background: #b58a3b20; }
  .mobile-nav .nav-wallet > svg { width: 27px; height: 27px; }
  .mobile-nav .nav-item.active { color: var(--gold-light); background: #b58a3b2e; box-shadow: inset 0 0 0 1px #b58a3b45; }
  .toast { inset-inline: 16px; bottom: calc(var(--phone-nav) + env(safe-area-inset-bottom) + 14px); max-width: min(calc(100% - 32px), 648px); font-size: 15px; }

  /* Native dialogs provide focus containment and remain above the bottom bar. */
  .production-more-menu, .production-confirm { position: fixed; inset: auto 0 0; width: 100%; max-width: var(--phone-width); max-height: calc(100dvh - 24px - env(safe-area-inset-top)); margin: 0 auto; padding: 0; overflow-y: auto; border: 1px solid #786846; border-bottom: 0; border-radius: 24px 24px 0 0; background: #101d30; overscroll-behavior: contain; scroll-padding-block: 24px 100px; }
  .sheet-handle { display: block; width: 42px; height: 4px; margin: 12px auto 0; border-radius: 8px; background: #76819780; }
  .production-more-menu { padding: 0 20px calc(22px + env(safe-area-inset-bottom)); }
  .more-menu-header { margin-top: 12px; }
  .more-menu-header h2 { font-size: 21px; }
  .more-menu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .more-menu-item { min-height: 80px; padding: 13px; font-size: 15px; }
  .production-confirm-body { padding: 18px 20px 0; }
  .production-confirm-body > h2 { font-size: 23px; line-height: 1.5; }
  .production-confirm-body > p { font-size: 16px; line-height: 1.8; }
  .production-confirm-body .field { gap: 10px; margin-block: 20px; }
  .production-confirm-body .field > small { font-size: 14px; line-height: 1.7; }
  .production-confirm .production-facts > div { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
  .production-confirm .production-facts dd bdi { font-size: 17px; }
  .production-confirm-actions { position: sticky; bottom: 0; display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 12px; margin-inline: -20px; padding: 16px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #101d30; }
  .production-confirm-actions > .button { min-height: 52px; padding-inline: 10px; font-size: 16px; }
}

@media screen and (max-width: 359px) {
  .topbar { gap: 8px; padding-inline: 12px; }
  .page-content { padding-inline: 12px; }
  .topbar-actions { gap: 6px; }
  .mobile-brand { gap: 6px; }
  .mobile-brand > .mara-brand-logo { flex-basis: 40px; width: 40px; height: 40px; min-width: 40px; }
  .mobile-brand bdi { font-size: 18px; }
  .mobile-brand small bdi { font-size: 8px; }
  .account-dashboard, .card, .level-card { padding: 17px; }
  .membership-chip { font-size: 11px; }
  .dashboard-balance { font-size: 29px; }
  .dashboard-stats { gap: 10px; }
  .dashboard-stats strong { font-size: 15px; }
  .dashboard-actions { gap: 10px; }
  .home-task-summary .feature-icon { display: none; }
  .home-service-item { gap: 8px; padding: 12px; }
  .home-service-item > span { flex-basis: 30px; width: 30px; height: 30px; }
  .home-service-item strong { font-size: 13px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 21px; }
  .production-facts > div { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 9px; font-size: 14px; }
  .production-facts dd bdi { font-size: 14px; }
  .more-menu-item { grid-template-columns: 20px minmax(0, 1fr); gap: 6px; padding: 11px; font-size: 14px; }
  .more-menu-item > svg { width: 20px; height: 20px; }
  .production-confirm-body { padding-inline: 17px; }
  .production-confirm-actions { margin-inline: -17px; padding-inline: 17px; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .button:active:not(:disabled) { transform: none; }
}
