/* Prime City — Mobile / Touch Optimierungen */

html {
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* ── Site navigation ── */
@media (max-width: 880px) {
  nav.site-nav,
  nav.sticky-nav {
    z-index: 200;
    overflow: visible;
  }

  nav.sticky-nav {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: min(1120px, calc(100% - 24px));
    margin: 0;
  }

  body.page-doc {
    padding-top: 64px;
  }

  body.page-doc .page-head {
    padding-top: 88px;
  }

  .burger {
    min-width: 44px;
    min-height: 44px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-md);
    background: var(--surface-soft);
  }

  .nav-links {
    z-index: 210;
    max-height: min(70vh, 480px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-links a,
  .nav-cta {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

@media (max-width: 420px) {
  .nav-brand span.brand-font {
    display: none;
  }

  nav.site-nav,
  nav.sticky-nav {
    width: calc(100% - 16px);
    padding: 8px 10px 8px 12px;
  }
}

/* ── Homepage: normal scroll on mobile (no snap hijack) ── */
@media (max-width: 880px) {
  html.home-snap,
  html.home-snap body {
    overflow: auto !important;
    height: auto !important;
    min-height: 100%;
  }

  html.home-snap header.hero,
  html.home-snap section,
  html.home-snap footer {
    height: auto;
    min-height: 0;
    overflow: visible;
    padding-top: 88px;
    padding-bottom: 56px;
  }

  html.home-snap header.hero {
    min-height: calc(100dvh - 24px);
    padding-top: 100px;
    padding-bottom: 64px;
  }

  html.home-snap .hero-actions {
    flex-direction: column;
    width: 100%;
    max-width: 320px;
  }

  html.home-snap .hero-actions .btn {
    width: 100%;
  }

  html.home-snap .scroll-cue,
  html.home-snap .snap-hint {
    display: none;
  }

  html.home-snap .slides-wrapper {
    transform: none !important;
  }

  html.home-snap .shop-card {
    padding: 28px 20px;
  }

  html.home-snap .shop-perks {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
}

/* ── Portal top bar ── */
.portal-nav {
  position: relative;
  flex-wrap: wrap;
  gap: 10px;
}

.portal-burger {
  display: none;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

@media (max-width: 640px) {
  .portal-nav {
    padding: 12px 4%;
  }

  .portal-nav .brand {
    font-size: 0.82rem;
    gap: 8px;
  }

  .portal-nav .brand img {
    height: 30px;
  }

  .portal-burger {
    display: grid;
    place-items: center;
    margin-left: auto;
  }

  .portal-nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 4%;
    left: 4%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(14, 14, 16, 0.96);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-panel);
    z-index: 50;
  }

  .portal-nav.open .portal-nav-links {
    display: flex;
  }

  .portal-nav-links .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .login-onepager {
    padding: 20px 4% 48px;
    gap: 28px;
    min-height: 0;
  }

  .login-card {
    padding: 28px 20px;
  }

  .login-showcase h1 {
    font-size: clamp(1.75rem, 8vw, 2.4rem);
  }
}

/* ── UCP / ACP dashboard ── */
@media (max-width: 960px) {
  .dash-shell,
  #ucpApp.dash-shell,
  #acpApp.dash-shell {
    padding: 16px 4% 48px;
    gap: 16px;
  }

  .dash-content,
  #ucpApp .dash-content,
  #acpApp .dash-content {
    overflow: visible !important;
    width: 100%;
  }

  .dash-sidebar,
  #ucpApp .dash-sidebar,
  #acpApp .dash-sidebar {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 10px;
    padding: 14px 12px;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: none !important;
    position: static !important;
  }

  .dash-sidebar-label {
    display: block !important;
    padding: 0 4px 4px;
  }

  .dash-sidebar-user {
    display: flex !important;
    align-items: center;
    gap: 12px;
    margin-top: 0 !important;
    padding-top: 0 !important;
    border-top: none !important;
    order: -1;
  }

  .dash-sidebar-user .dash-avatar {
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .dash-nav,
  #ucpApp .dash-nav,
  #acpApp .dash-nav {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding-bottom: 4px;
    scrollbar-width: none;
    width: 100%;
  }

  .dash-nav::-webkit-scrollbar {
    display: none;
  }

  .dash-nav-btn,
  #ucpApp .dash-nav-btn,
  #acpApp .dash-nav-btn {
    flex: 0 0 auto;
    width: auto !important;
    white-space: nowrap;
    min-height: 44px;
    padding: 10px 14px;
  }

  .dash-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .dash-topbar-actions {
    width: 100%;
  }

  .dash-topbar-actions .btn {
    flex: 1 1 auto;
    min-height: 44px;
  }

  .portal-grid.acp-stat-grid,
  #acpApp .acp-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .quick-grid,
  #acpApp .quick-grid {
    grid-template-columns: 1fr !important;
  }

  .property-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .portal-grid.acp-stat-grid,
  #acpApp .acp-stat-grid,
  #ucpApp .portal-grid.wealth-row,
  #ucpApp .portal-grid.cols-3 {
    grid-template-columns: 1fr !important;
  }

  .portal-panel {
    padding: 16px 14px;
    border-radius: var(--radius-lg);
  }

  .portal-panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding: 0 4px;
  }

  .data-table {
    min-width: 520px;
  }

  .search-bar {
    flex-direction: column;
  }

  .search-bar input,
  .search-bar .btn {
    width: 100%;
    min-height: 44px;
  }

  .player-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .char-switcher {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .char-switcher::-webkit-scrollbar {
    display: none;
  }

  .char-pill {
    flex: 0 0 auto;
    min-height: 40px;
  }

  .extend-row select,
  .extend-row .btn {
    width: 100%;
    min-height: 44px;
  }
}

/* ── Doc / content pages ── */
@media (max-width: 640px) {
  body.page-doc .page-head {
    padding: 80px 4% 24px;
    text-align: left;
  }

  body.page-doc .wrap {
    padding: 12px 4% 64px;
  }

  body.page-doc .page-actions {
    flex-direction: column;
    align-items: stretch;
  }

  body.page-doc .page-actions .btn,
  body.page-doc .page-actions .back-link {
    width: 100%;
    min-height: 44px;
    justify-content: center;
    text-align: center;
  }

  .rule-q,
  .law-q {
    padding: 14px 14px;
    font-size: 0.88rem;
    gap: 10px;
  }

  .rule-a-inner,
  .law-a-inner {
    padding-left: 14px !important;
    padding-right: 14px;
  }

  .calc-layout {
    padding: 12px 4% 64px;
  }

  .calc-panel {
    padding: 16px 14px;
  }
}
