/* ============================================================
   Public site — native-app mobile shell (phones / small tablets)
   Activates only below 991px. Desktop layout is untouched.
   ============================================================ */

:root {
  --app-orange: #fe5c00;
  --app-orange-soft: #f89230;
  --app-ink: #1a1a1a;
  --app-muted: #6b6b6b;
  --app-surface: #ffffff;
  --app-bar-h: 56px;
  --app-tab-h: 64px;
  --app-safe-top: env(safe-area-inset-top, 0px);
  --app-safe-bottom: env(safe-area-inset-bottom, 0px);
  --app-safe-left: env(safe-area-inset-left, 0px);
  --app-safe-right: env(safe-area-inset-right, 0px);
}

/* Hidden on desktop / large tablets */
.app-chrome-actions,
.app-tab-bar {
  display: none;
}

@media (max-width: 991px) {
  html {
    scroll-padding-bottom: calc(var(--app-tab-h) + var(--app-safe-bottom) + 8px);
  }

  body:not([data-lang-page="presentation"]) {
    padding-bottom: calc(var(--app-tab-h) + var(--app-safe-bottom));
    background: #f7f7f7;
  }

  /* ---- Sticky compact app bar ---- */
  body:not([data-lang-page="presentation"]) header {
    position: sticky;
    top: 0;
    z-index: 40;
    padding-top: var(--app-safe-top);
    background: var(--app-surface);
  }

  body:not([data-lang-page="presentation"]) .menu-bar.v1 {
    padding: 0;
    border-bottom: 2px solid var(--app-orange);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 0 8px 20px rgba(0, 0, 0, 0.06);
    background: var(--app-surface);
    background-image: none;
  }

  body:not([data-lang-page="presentation"]) .menu-bar .container {
    max-width: 100%;
    padding-left: max(12px, var(--app-safe-left));
    padding-right: max(12px, var(--app-safe-right));
  }

  body:not([data-lang-page="presentation"]) .menu-bar .menu-bar-content {
    min-height: var(--app-bar-h);
    flex-wrap: nowrap;
    gap: 8px;
    justify-content: flex-start;
  }

  body:not([data-lang-page="presentation"]) .menu-bar .menu-logo a {
    max-width: 148px;
    margin-bottom: 0;
    display: flex;
    align-items: center;
  }

  body:not([data-lang-page="presentation"]) .menu-bar .menu-logo img {
    height: 36px;
    width: auto;
    object-fit: contain;
  }

  /* Utility / mega menu already hidden by header.css; keep chrome actions */
  .app-chrome-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
  }

  .app-chrome-lang {
    min-width: 44px;
    min-height: 44px;
    padding: 0 10px;
    border: 0;
    border-radius: 10px;
    background: #111;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    font-family: var(--secondary-font, "Rubik", sans-serif);
    line-height: 1;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease;
  }

  .app-chrome-lang:active {
    transform: scale(0.94);
  }

  .app-chrome-signin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    max-width: 118px;
    padding: 0 12px;
    border-radius: 10px;
    background: var(--app-orange);
    color: #fff !important;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: transform 0.18s ease, background 0.18s ease;
  }

  .app-chrome-signin:active {
    transform: scale(0.96);
    background: #e45300;
  }

  body:not([data-lang-page="presentation"]) .menu-bar .mobile-menu-btn {
    display: block;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    margin: 0 0 0 2px;
  }

  body:not([data-lang-page="presentation"]) .menu-bar .mobile-menu-btn span {
    left: 10px;
    width: calc(100% - 20px);
  }

  body:not([data-lang-page="presentation"]) .menu-bar .mobile-menu-btn span:nth-child(1) {
    top: 14px;
  }

  body:not([data-lang-page="presentation"]) .menu-bar .mobile-menu-btn span:nth-child(2) {
    top: 21px;
  }

  body:not([data-lang-page="presentation"]) .menu-bar .mobile-menu-btn span:nth-child(3) {
    top: auto;
    bottom: 14px;
  }

  /* Drawer above tab bar */
  body:not([data-lang-page="presentation"]) .menu-bar .mobile-menu {
    z-index: 60;
    padding-top: var(--app-safe-top);
    padding-bottom: var(--app-safe-bottom);
  }

  body:not([data-lang-page="presentation"]) .menu-bar .mobile-menu-overlay {
    z-index: 55;
  }

  /* ---- Bottom tab bar ---- */
  .app-tab-bar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    height: calc(var(--app-tab-h) + var(--app-safe-bottom));
    padding: 4px max(6px, var(--app-safe-right)) var(--app-safe-bottom) max(6px, var(--app-safe-left));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.08);
    justify-content: space-around;
    align-items: stretch;
  }

  .app-tab {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    min-height: 48px;
    padding: 6px 4px;
    color: var(--app-muted);
    text-decoration: none;
    border-radius: 12px;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s ease, transform 0.18s ease;
  }

  .app-tab i {
    font-size: 20px;
    line-height: 1;
    transition: transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
  }

  .app-tab span {
    font-size: 10px;
    font-weight: 600;
    font-family: var(--secondary-font, "Rubik", sans-serif);
    line-height: 1.1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-tab::before {
    content: "";
    position: absolute;
    top: 4px;
    width: 28px;
    height: 3px;
    border-radius: 999px;
    background: var(--app-orange);
    opacity: 0;
    transform: scaleX(0.4);
    transition: opacity 0.2s ease, transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
  }

  .app-tab.is-active {
    color: var(--app-orange);
  }

  .app-tab.is-active i {
    transform: translateY(-1px) scale(1.08);
  }

  .app-tab.is-active::before {
    opacity: 1;
    transform: scaleX(1);
  }

  .app-tab:active {
    transform: scale(0.96);
  }

  /* Lift scroll-to-top above the tab bar */
  .scroll-bottom-Top.show {
    bottom: calc(var(--app-tab-h) + var(--app-safe-bottom) + 16px);
    right: 16px;
  }

  /* Compact market ticker */
  .prices-marquee {
    height: 44px;
    padding: 0 8px;
    position: sticky;
    top: calc(var(--app-bar-h) + var(--app-safe-top));
    z-index: 30;
  }

  .prices-marquee .price-item {
    padding-left: 20px;
    gap: 8px;
  }

  .prices-marquee .price-item .head {
    font-size: 11px;
  }

  .prices-marquee .price-item .cell {
    font-size: 12px;
  }

  .prices-marquee .price-item .change {
    font-size: 15px;
  }

  .prices-marquee .price-item .echart-prices {
    width: 48px;
    height: 28px;
  }

  .prices-marquee .marquee {
    --gap: 1.25rem;
  }

  /* Full-bleed hero, brand-first spacing */
  .principal-banner.banner.v1,
  .banner-with-video {
    min-height: calc(100svh - var(--app-bar-h) - 44px - var(--app-safe-top));
    margin-top: 0;
    padding-top: 0 !important;
    border-radius: 0;
  }

  .banner-with-video .container {
    max-width: 100% !important;
    padding-left: max(16px, var(--app-safe-left));
    padding-right: max(16px, var(--app-safe-right));
  }

  .banner-with-video .banner-content {
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 28px 20px;
    border-radius: 0;
    background: linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.15) 0%,
      rgba(0, 0, 0, 0.55) 100%
    );
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

  .banner.v1 .banner-content h6 {
    font-size: 13px;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
  }

  .banner.v1 .banner-content h2 {
    font-size: clamp(1.75rem, 7vw, 2.35rem);
    line-height: 1.15;
    margin-bottom: 12px;
  }

  .banner.v1 .banner-content p {
    font-size: 14px;
    line-height: 1.45;
    margin-bottom: 18px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .banner .banner-content ul {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .banner .banner-content ul li a {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
  }

  /* Soften decorative circle on small screens */
  .banner.v1::after {
    opacity: 0.25 !important;
  }

  /* Footer breathing room above tab bar (body already padded) */
  footer .info-footer {
    padding-bottom: 12px;
  }
}

@media (max-width: 991px) and (prefers-reduced-motion: reduce) {
  .app-tab,
  .app-tab i,
  .app-tab::before,
  .app-chrome-lang,
  .app-chrome-signin {
    transition: none;
  }
}
