/* ChatRupee - shared phone/tablet polish. Loaded LAST on every page so it can refine the page's own CSS.
   Safe to edit: everything lives inside media queries, so desktop is untouched. */

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
img, svg, video, canvas { max-width: 100%; }
body { overflow-wrap: break-word; }

@media (max-width: 760px) {
  /* ---- Header / navigation: logo on top, links centred and easy to tap ---- */
  nav { flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding-block: 14px 8px; text-align: center; }
  nav > .nav-links, .nav-links { width: 100%; justify-content: center; align-items: center; gap: 4px 6px; }
  .nav-links a:not(.btn), .nav-links button:not(.btn), .nav-actions a {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 0 12px; font-size: 14px; line-height: 1.2; white-space: nowrap;
  }
  .nav-links a.hide-s { display: none; } /* keep the page's own choice to hide these on small screens */
  .nav-links .btn, .nav-actions .btn { min-height: 44px; }
  .logo { min-height: 44px; }
  /* signed-in account chip + sign out sit on one tidy row */
  .nav-user, .user-chip, .account-chip { justify-content: center; }

  /* ---- Tap targets: every link/button at least ~44px tall ---- */
  .back, .path-action, footer .links a, .footer-links a {
    display: inline-flex; align-items: center; min-height: 44px;
  }
  footer .links a { padding: 0 6px; }
  .btn, button, [type="submit"], [type="button"], select { min-height: 44px; }
  .btn.small { min-height: 44px; }

  /* ---- Footer: stacked and centred, with room for the theme button ---- */
  footer { flex-direction: column !important; align-items: center !important; justify-content: center !important; text-align: center; gap: 4px; padding-block: 20px 96px !important; margin-top: 32px !important; }
  footer .links { justify-content: center; gap: 4px 10px; }
  footer .copy { margin-left: 0 !important; text-align: center !important; }

  /* ---- Theme switcher: small round icon button, tucked in the corner ---- */
  .theme { left: auto !important; right: max(14px, env(safe-area-inset-right, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .theme-btn { width: 46px; height: 46px; padding: 0 !important; justify-content: center; gap: 0; }
  .theme-btn #themeLabel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .theme-menu { left: auto !important; right: 0; }
  body { padding-bottom: env(safe-area-inset-bottom, 0px); }

  /* ---- Forms: bigger inputs, no iOS zoom, tidy file picker ---- */
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea { font-size: 16px; min-height: 48px; }
  input[type="checkbox"], input[type="radio"] { min-height: 0; }
  input[type="file"] { width: 100%; min-height: 0; padding: 10px; font-size: 14px; }
  input[type="file"]::file-selector-button { margin-right: 10px; padding: 9px 14px; border: 0; border-radius: 10px; background: var(--bg-soft, #f1eaff); color: var(--accent-ink, #5b21b6); font: 700 14px inherit; cursor: pointer; }
  /* ad-copy placeholder was getting cut off */
  input::placeholder, textarea::placeholder { text-overflow: ellipsis; font-size: 15px; }
  /* the agree-to-terms checkbox: bigger tap area */
  input[type="checkbox"] { width: 22px; height: 22px; flex: none; }

  /* ---- Bid options: three equal-height boxes ---- */
  .bids { gap: 8px; }
  .bid { display: flex; }
  .bid span { flex: 1; height: 100%; box-sizing: border-box; align-content: center; padding: 12px 4px; }
  .bid b { font-size: 18px; }
  .bid small { font-size: 12px; line-height: 1.25; }

  /* ---- Live auction list: rows have a fixed height (the page animates them), so clamp the text to fit ---- */
  .row .ad b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; white-space: normal !important; overflow: hidden; text-overflow: ellipsis; font-size: 14px; line-height: 1.25; overflow-wrap: break-word; }
  .row .ad span { font-size: 12px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .row .price small { font-size: 11px; white-space: nowrap; }

  /* ---- Text never below 12px; long words and emails wrap ---- */
  small, .path-kicker, .sp, .eyebrow, .kicker, .badge, .chip { font-size: max(12px, 1em); }
  h1, h2, h3, p, li, td, th, a, label { overflow-wrap: anywhere; }
  .muted, .email, #accountEmail { overflow-wrap: anywhere; }

  /* ---- Wide content scrolls inside itself, never the whole page ---- */
  table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; min-width: 0 !important; }
  pre, code { max-width: 100%; overflow-x: auto; }
  .table-wrap, .table-scroll, .transactions, .overflow-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* ---- Cards: comfortable side margins, no cramped padding ---- */
  .wrap, .container, .page-wrap, .account-wrap, .settings-wrap { width: calc(100% - 28px) !important; margin-inline: auto; }
  .panel, .card, .step, .formcard, .board, .settings-card { border-radius: 20px; }
  .hero-cta { justify-content: center; }
  .hero-cta .btn, .cta .btn { width: 100%; }
}

@media (max-width: 380px) {
  .wrap, .container, .page-wrap, .account-wrap, .settings-wrap { width: calc(100% - 20px) !important; }
  .nav-links a:not(.btn), .nav-links button:not(.btn) { padding: 0 9px; font-size: 13px; }
  h1 { font-size: clamp(28px, 9vw, 40px); }
  .bid b { font-size: 16px; }
}

/* Short landscape phones: keep the floating theme button from covering things */
@media (max-height: 480px) and (orientation: landscape) {
  .theme { position: absolute; }
}
