/* Almighty Piya Helper — responsive refinements for public website pages.
   Load AFTER existing page <style> blocks. Does not modify backend or scripts. */

:root { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* Avoid intrinsic-width overflow without hiding content. */
img, video, svg, canvas { max-width: 100%; }
img, video { height: auto; }
.hero > *, .split > *, .command-showcase > *, .features-grid > *,
.pricing-grid > *, .pricing-card, .legal-layout > *,
.modules-card, .comparison-wrap, .card, .public-checkout { min-width: 0; }
button, input, select, textarea { max-width: 100%; }
.terminal, .comparison-scroll { max-width: 100%; overflow-x: auto; }
.long-text, .legal-content, .legal-block, .feature-card,
.pricing-card, .command-module, .modules-card { overflow-wrap: anywhere; }

/* Original desktop (901px+) navbar, colors and layout stay unchanged. */
@media (max-width: 900px) {
  /* Override legacy 721–1050px forced single-row grid, which clips actions. */
  .navbar {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    width: 100%;
    min-width: 0;
    gap: 14px !important;
    padding: 16px !important;
  }
  .navbar .brand {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    justify-self: auto !important;
    flex: 0 1 auto !important;
  }
  .navbar .brand-icon { flex: 0 0 48px; width: 48px; height: 48px; }
  .navbar .brand-title { font-size: clamp(15px, 3.2vw, 18px); line-height: 1.25; }
  .navbar .brand-subtitle { font-size: 11px; }
  .navbar .nav-links {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    gap: 8px !important;
    margin: 0 !important;
    flex-wrap: wrap !important;
    justify-self: stretch !important;
    white-space: normal !important;
    font-size: 12px !important;
  }
  .navbar .nav-links a {
    min-width: 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 9px 7px;
    text-align: center;
    line-height: 1.35;
    white-space: normal !important;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px;
    background: rgba(255,255,255,.035);
    overflow-wrap: normal;
  }
  .navbar .nav-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px !important;
    width: 100% !important;
    min-width: 0 !important;
    justify-self: stretch !important;
  }
  .navbar .nav-actions > *, .navbar .public-auth,
  .navbar .public-user-btn, .navbar .nav-actions .btn {
    min-width: 0;
    width: 100% !important;
    max-width: none !important;
  }
  .navbar .nav-actions .btn {
    min-height: 44px;
    padding: 10px 8px !important;
    font-size: 12px !important;
    white-space: normal !important;
    text-align: center;
  }
  .public-user-menu { max-width: min(280px, calc(100vw - 44px)); }
  .legal-layout, .command-showcase, .split, .hero { grid-template-columns: minmax(0, 1fr) !important; }
  .legal-toc { position: static; }
  .section { padding-top: 64px; padding-bottom: 64px; }
  .hero { min-height: auto; padding: 60px 0; gap: 32px; }
  .hero h1 { font-size: clamp(37px, 6vw, 54px); line-height: 1.06; letter-spacing: -2px; }
  .hero p { font-size: 16px; line-height: 1.7; }
  .comparison-scroll { -webkit-overflow-scrolling: touch; }
  .public-checkout { width: min(620px,100%); }
}

@media (max-width: 600px) {
  .container { width: calc(100% - 28px) !important; }
  .navbar { margin-top: 20px; border-radius: 18px; padding: 14px !important; }
  .navbar .nav-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .navbar .nav-links a:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .hero { padding: 48px 0 52px; gap: 28px; }
  .hero h1 { font-size: clamp(34px, 9.5vw, 46px); line-height: 1.08; letter-spacing: -1.5px; }
  .hero p { font-size: 15px; line-height: 1.7; }
  .hero .badge { max-width: 100%; line-height: 1.4; }
  .section { padding: 48px 0; }
  .section-header h2, .split-copy h2, .cta h2 {
    font-size: clamp(30px, 8vw, 40px); letter-spacing: -1.5px;
  }
  .section-header p, .split-copy p, .cta p { font-size: 15px; }
  .features-grid, .pricing-grid, .command-highlight-grid, .mini-stats,
  .stat-grid, .commands-list { grid-template-columns: minmax(0, 1fr); }
  .bot-card, .commands-card, .modules-card { padding: 18px; border-radius: 20px; }
  .terminal { font-size: 12px; }
  .pricing-card { padding: 20px; min-height: 0; }
  .pricing-card .price strong { font-size: clamp(26px, 8vw, 38px); }
  .legal-card { padding: 18px; border-radius: 20px; }
  .legal-block { padding: 17px; border-radius: 16px; }
  .legal-topline { align-items: flex-start; }
  .module-toolbar { flex-wrap: wrap; }
  .command-module summary { gap: 10px; }
  .cta { padding: 34px 18px; border-radius: 22px; }
  .public-checkout-backdrop {
    align-items: flex-start;
    overflow-y: auto;
    max-height: 100dvh;
    padding: 12px;
  }
  .public-checkout {
    padding: 18px;
    border-radius: 20px;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .public-checkout-head h3 { font-size: 22px; }
  .public-checkout-price { font-size: clamp(25px, 7.8vw, 35px); }
}

@media (max-width: 360px) {
  .navbar .nav-actions { gap: 7px !important; }
  .navbar .nav-actions .btn { font-size: 11px !important; }
  .navbar .nav-links { gap: 6px !important; }
  .navbar .nav-links a { font-size: 11px; padding: 9px 4px; }
  .hero h1 { font-size: 34px; }
}
