/*
 * Mobile Web App adapter.
 * Desktop remains controlled by the existing page styles; everything here is
 * scoped to the mobile shell class and the small-screen breakpoint.
 */

@media only screen and (max-width: 820px) {
  html.ceboo-mobile-webapp,
  html.ceboo-mobile-webapp body {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
    background: #050816 !important;
    -webkit-text-size-adjust: 100%;
  }

  html.ceboo-mobile-webapp body {
    height: auto !important;
    min-height: 100dvh !important;
    padding-top: calc(64px + env(safe-area-inset-top, 0px)) !important;
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
    touch-action: manipulation;
  }

  html.ceboo-mobile-webapp *,
  html.ceboo-mobile-webapp *::before,
  html.ceboo-mobile-webapp *::after {
    max-width: 100%;
    box-sizing: border-box;
  }

  html.ceboo-mobile-webapp img,
  html.ceboo-mobile-webapp video,
  html.ceboo-mobile-webapp canvas,
  html.ceboo-mobile-webapp svg {
    max-width: 100%;
  }

  html.ceboo-mobile-webapp .navbar,
  html.ceboo-mobile-webapp .asset-navbar,
  html.ceboo-mobile-webapp .sidebar,
  html.ceboo-mobile-webapp .sidebar-collapse-toggle,
  html.ceboo-mobile-webapp .mobile-menu-trigger,
  html.ceboo-mobile-webapp .mobile-overlay {
    display: none !important;
  }

  html.ceboo-mobile-webapp .main-content,
  html.ceboo-mobile-webapp main.main-content,
  html.ceboo-mobile-webapp .asset-main,
  html.ceboo-mobile-webapp .wrap,
  html.ceboo-mobile-webapp .page-container,
  html.ceboo-mobile-webapp .page-shell {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 14px !important;
    overflow: visible !important;
    display: block !important;
  }

  html.ceboo-mobile-webapp main.main-content > :first-child,
  html.ceboo-mobile-webapp .main-content > :first-child,
  html.ceboo-mobile-webapp .asset-main > :first-child {
    margin-top: 0 !important;
  }

  .ceboo-mobile-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 12000;
    height: calc(60px + env(safe-area-inset-top, 0px));
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    align-items: center;
    gap: 10px;
    background: rgba(6, 10, 22, 0.92);
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
  }

  html[data-theme='light'] .ceboo-mobile-topbar {
    background: rgba(255, 255, 255, 0.9);
    border-bottom-color: rgba(15, 23, 42, 0.1);
    box-shadow: 0 14px 34px rgba(148, 163, 184, 0.22);
  }

  .ceboo-mobile-icon-btn,
  .ceboo-mobile-avatar-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.7);
    color: #e5f7ff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  html[data-theme='light'] .ceboo-mobile-icon-btn,
  html[data-theme='light'] .ceboo-mobile-avatar-btn {
    background: rgba(248, 250, 252, 0.92);
    color: #0f172a;
  }

  .ceboo-mobile-avatar-btn {
    overflow: hidden;
    padding: 0;
    font-weight: 900;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(45, 212, 191, 0.18));
  }

  .ceboo-mobile-avatar-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .ceboo-mobile-title {
    min-width: 0;
    text-align: center;
  }

  .ceboo-mobile-title strong {
    display: block;
    color: #f8fafc;
    font-size: 16px;
    line-height: 1.15;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html[data-theme='light'] .ceboo-mobile-title strong {
    color: #0f172a;
  }

  .ceboo-mobile-title span {
    display: block;
    margin-top: 2px;
    color: rgba(148, 163, 184, 0.9);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }

  .ceboo-mobile-bottom-nav {
    position: fixed;
    left: 10px;
    right: auto;
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
    z-index: 12000;
    width: calc(100vw - 88px) !important;
    max-width: calc(100vw - 88px) !important;
    height: 68px;
    display: flex;
    align-items: stretch;
    gap: 4px;
    padding: 8px;
    border-radius: 24px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(7, 11, 24, 0.94);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
  }

  .ceboo-mobile-bottom-nav > * {
    flex: 1 1 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  html[data-theme='light'] .ceboo-mobile-bottom-nav {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 18px 42px rgba(148, 163, 184, 0.22);
  }

  .ceboo-mobile-nav-item {
    width: auto !important;
    height: 52px !important;
    min-width: 0;
    min-height: 0 !important;
    padding: 0 2px !important;
    margin: 0 !important;
    border: 0;
    border-radius: 18px;
    background: transparent;
    color: rgba(203, 213, 225, 0.68);
    text-decoration: none;
    display: inline-flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 1 !important;
    visibility: visible !important;
    gap: 3px;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
  }

  .ceboo-mobile-nav-item span {
    display: block;
    width: 100%;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html[data-theme='light'] .ceboo-mobile-nav-item {
    color: rgba(71, 85, 105, 0.72);
  }

  .ceboo-mobile-nav-item .iconify {
    font-size: 20px;
  }

  .ceboo-mobile-nav-item.is-active {
    color: #22e7ff;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.17), rgba(45, 212, 191, 0.14));
  }

  html[data-theme='light'] .ceboo-mobile-nav-item.is-active {
    color: #0891b2;
    background: rgba(8, 145, 178, 0.1);
  }

  .ceboo-mobile-more-tab {
    position: fixed;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
    z-index: 12001;
    width: 68px;
    height: 68px;
    padding: 0 4px;
    border-radius: 24px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(7, 11, 24, 0.94);
    color: rgba(203, 213, 225, 0.72);
    display: inline-flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    -webkit-tap-highlight-color: transparent;
  }

  .ceboo-mobile-more-tab .iconify {
    font-size: 20px;
  }

  .ceboo-mobile-more-tab span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ceboo-mobile-more-tab.is-active {
    color: #22e7ff;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.17), rgba(45, 212, 191, 0.14));
  }

  html[data-theme='light'] .ceboo-mobile-more-tab {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(15, 23, 42, 0.08);
    color: rgba(71, 85, 105, 0.72);
  }

  html[data-theme='light'] .ceboo-mobile-more-tab.is-active {
    color: #0891b2;
    background: rgba(8, 145, 178, 0.1);
  }

  .ceboo-mobile-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 12010;
    display: none;
    background: rgba(2, 6, 23, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .ceboo-mobile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 12020;
    width: min(86vw, 340px);
    padding: calc(18px + env(safe-area-inset-top, 0px)) 16px calc(18px + env(safe-area-inset-bottom, 0px));
    transform: translateX(105%);
    transition: transform 220ms ease;
    background: #0d1424;
    border-left: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: -28px 0 70px rgba(0, 0, 0, 0.42);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  html[data-theme='light'] .ceboo-mobile-drawer {
    background: #ffffff;
    border-left-color: rgba(15, 23, 42, 0.1);
  }

  html.ceboo-mobile-drawer-open .ceboo-mobile-drawer-backdrop {
    display: block;
  }

  html.ceboo-mobile-drawer-open .ceboo-mobile-drawer {
    transform: translateX(0);
  }

  html.ceboo-mobile-drawer-open body {
    overflow: hidden !important;
  }

  .ceboo-mobile-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
  }

  .ceboo-mobile-profile {
    min-width: 0;
  }

  .ceboo-mobile-profile strong {
    display: block;
    color: #f8fafc;
    font-size: 18px;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html[data-theme='light'] .ceboo-mobile-profile strong {
    color: #0f172a;
  }

  .ceboo-mobile-profile span {
    display: block;
    margin-top: 4px;
    color: rgba(148, 163, 184, 0.9);
    font-size: 12px;
  }

  .ceboo-mobile-drawer-section {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(148, 163, 184, 0.14);
  }

  .ceboo-mobile-drawer-section-title {
    margin: 0 0 8px;
    color: rgba(148, 163, 184, 0.9);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.16em;
  }

  .ceboo-mobile-drawer-link,
  .ceboo-mobile-drawer-button {
    width: 100%;
    min-height: 46px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: #dbeafe;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    text-align: left;
  }

  html[data-theme='light'] .ceboo-mobile-drawer-link,
  html[data-theme='light'] .ceboo-mobile-drawer-button {
    color: #1e293b;
  }

  .ceboo-mobile-drawer-link.is-active {
    color: #22e7ff;
    background: rgba(34, 211, 238, 0.11);
  }

  .ceboo-mobile-drawer-link .iconify,
  .ceboo-mobile-drawer-button .iconify {
    flex: 0 0 auto;
    font-size: 20px;
    color: rgba(125, 211, 252, 0.92);
  }

  .ceboo-mobile-drawer-button.is-danger {
    color: #fb7185;
    background: rgba(251, 113, 133, 0.08);
  }

  html.ceboo-mobile-webapp .grid-cols-12,
  html.ceboo-mobile-webapp .plaza-grid,
  html.ceboo-mobile-webapp #strategy-grid,
  html.ceboo-mobile-webapp .plaza-cp-grid,
  html.ceboo-mobile-webapp .creator-strategy-list,
  html.ceboo-mobile-webapp .follower-metrics-grid,
  html.ceboo-mobile-webapp .asset-summary-grid,
  html.ceboo-mobile-webapp .asset-tab-grid,
  html.ceboo-mobile-webapp .grid4,
  html.ceboo-mobile-webapp .layout-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  html.ceboo-mobile-webapp .strategy-card,
  html.ceboo-mobile-webapp .strategy-card-panel,
  html.ceboo-mobile-webapp .creator-work-card,
  html.ceboo-mobile-webapp .auth-table-card,
  html.ceboo-mobile-webapp .card,
  html.ceboo-mobile-webapp .table-panel,
  html.ceboo-mobile-webapp .asset-card,
  html.ceboo-mobile-webapp .asset-panel,
  html.ceboo-mobile-webapp .right-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    border-radius: 18px !important;
  }

  html.ceboo-mobile-webapp .strategy-card,
  html.ceboo-mobile-webapp .creator-work-card {
    min-height: auto !important;
  }

  html.ceboo-mobile-webapp .strategy-card-chart,
  html.ceboo-mobile-webapp .cp-card-chart,
  html.ceboo-mobile-webapp .creator-card-chart,
  html.ceboo-mobile-webapp .chart-shell,
  html.ceboo-mobile-webapp .curve-shell {
    width: 100% !important;
    min-width: 0 !important;
    height: 110px !important;
    max-height: 120px !important;
  }

  html.ceboo-mobile-webapp .strategy-card-metrics,
  html.ceboo-mobile-webapp .creator-metrics,
  html.ceboo-mobile-webapp .cp-card-metrics,
  html.ceboo-mobile-webapp .metric-row,
  html.ceboo-mobile-webapp .stats-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  html.ceboo-mobile-webapp .strategy-card-actions,
  html.ceboo-mobile-webapp .creator-card-actions,
  html.ceboo-mobile-webapp .cp-modal-actions,
  html.ceboo-mobile-webapp .modal-actions,
  html.ceboo-mobile-webapp .toolbar,
  html.ceboo-mobile-webapp .toolbar-group,
  html.ceboo-mobile-webapp .asset-head-actions,
  html.ceboo-mobile-webapp .tabbar {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
  }

  html.ceboo-mobile-webapp .strategy-card-actions > *,
  html.ceboo-mobile-webapp .creator-card-actions > *,
  html.ceboo-mobile-webapp .cp-modal-actions > *,
  html.ceboo-mobile-webapp .modal-actions > *,
  html.ceboo-mobile-webapp .toolbar-group > *,
  html.ceboo-mobile-webapp .asset-head-actions > * {
    min-width: 0 !important;
    flex: 1 1 140px !important;
  }

  html.ceboo-mobile-webapp button,
  html.ceboo-mobile-webapp a[role='button'],
  html.ceboo-mobile-webapp .btn,
  html.ceboo-mobile-webapp .tab,
  html.ceboo-mobile-webapp .input-btn {
    min-height: 42px;
    -webkit-tap-highlight-color: transparent;
  }

  html.ceboo-mobile-webapp input,
  html.ceboo-mobile-webapp select,
  html.ceboo-mobile-webapp textarea,
  html.ceboo-mobile-webapp .input,
  html.ceboo-mobile-webapp .select,
  html.ceboo-mobile-webapp .textarea {
    max-width: 100% !important;
    font-size: 16px !important;
  }

  html.ceboo-mobile-webapp .overflow-x-auto,
  html.ceboo-mobile-webapp .table-wrap,
  html.ceboo-mobile-webapp .trades-table-wrap,
  html.ceboo-mobile-webapp .auth-table-wrap,
  html.ceboo-mobile-webapp .asset-table-wrap {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
  }

  html.ceboo-mobile-webapp table,
  html.ceboo-mobile-webapp .trades-table {
    min-width: 680px !important;
  }

  html.ceboo-mobile-webapp .profile-menu {
    display: none !important;
  }

  html.ceboo-mobile-webapp .modal,
  html.ceboo-mobile-webapp .modal-overlay,
  html.ceboo-mobile-webapp .contact-modal-overlay,
  html.ceboo-mobile-webapp .strategy-runtime-overlay,
  html.ceboo-mobile-webapp .cp-modal-overlay,
  html.ceboo-mobile-webapp .plaza-purchase-modal,
  html.ceboo-mobile-webapp .cp-publish-modal {
    align-items: flex-end !important;
    justify-content: center !important;
    padding: 10px !important;
    overflow-y: auto !important;
  }

  html.ceboo-mobile-webapp .modal-panel,
  html.ceboo-mobile-webapp .modal-content,
  html.ceboo-mobile-webapp .contact-modal-panel,
  html.ceboo-mobile-webapp .strategy-runtime-modal,
  html.ceboo-mobile-webapp .cp-modal-panel,
  html.ceboo-mobile-webapp .plaza-purchase-panel,
  html.ceboo-mobile-webapp .cp-publish-panel,
  html.ceboo-mobile-webapp .drawer-panel {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 88px - env(safe-area-inset-top, 0px)) !important;
    border-radius: 22px 22px 18px 18px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  html.ceboo-mobile-webapp .cp-create-modal,
  html.ceboo-mobile-webapp #cp-create-modal,
  html.ceboo-mobile-webapp .creator-drawer,
  html.ceboo-mobile-webapp .drawer {
    max-width: 100% !important;
  }

  html.ceboo-mobile-webapp .head,
  html.ceboo-mobile-webapp .page-header,
  html.ceboo-mobile-webapp .asset-head,
  html.ceboo-mobile-webapp .dashboard-hero,
  html.ceboo-mobile-webapp .strategy-zone-head,
  html.ceboo-mobile-webapp .creator-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  html.ceboo-mobile-webapp h1,
  html.ceboo-mobile-webapp .title,
  html.ceboo-mobile-webapp .page-title {
    font-size: clamp(24px, 7vw, 32px) !important;
    line-height: 1.15 !important;
    letter-spacing: 0 !important;
  }

  html.ceboo-mobile-webapp .auth-section {
    width: 100% !important;
    padding: 22px 12px !important;
  }

  html.ceboo-mobile-webapp .glass-card,
  html.ceboo-mobile-webapp .auth-card {
    width: 100% !important;
    max-width: 100% !important;
  }

  html.ceboo-mobile-webapp .toast {
    left: 12px !important;
    right: 12px !important;
    top: calc(72px + env(safe-area-inset-top, 0px)) !important;
    width: auto !important;
  }
}
