/* ═══════════════════════════════════════════════════════════════
   UNI LINGUS — Global Responsive Stylesheet
   Breakpoints:
     xs  — ≤ 480px           (phone portrait)
     sm  — ≤ 768px           (phone / phablet)
     md  — ≤ 1024px          (tablet / small laptop)
     lg  — 1025 – 1439px    (MacBook 13-14")
     xl  — 1440 – 1919px    (MacBook 15"/16", iMac)
     2xl — ≥ 1920px          (large desktop / TV)
   Landscape:
     ls  — landscape + max-height 500px  (phone landscape)
═══════════════════════════════════════════════════════════════ */

/* ── Box model & overflow ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body { overflow-x: hidden; }
img, video, canvas, svg { max-width: 100%; height: auto; }

/* Fluid base font: 13px @ 320px → 17px @ 1920px */
html {
  font-size: clamp(13px, 0.65vw + 11px, 17px);
  -webkit-text-size-adjust: 100%;
}


/* ════════════════════════════════════════════════════════════════
   SHARED NAV (marketplace + messaging both use nav.top-bar)
════════════════════════════════════════════════════════════════ */
nav.top-bar {
  padding-left:  clamp(14px, 3vw, 60px) !important;
  padding-right: clamp(14px, 3vw, 60px) !important;
}

@media (max-width: 600px) {
  nav.top-bar { padding: 10px 14px !important; }
  .nav-links a { margin-left: 10px !important; font-size: 0.68rem !important; }
}


/* ════════════════════════════════════════════════════════════════
   MARKETPLACE
════════════════════════════════════════════════════════════════ */
/* Wider content on big screens */
@media (min-width: 1280px) {
  .content { max-width: 1500px !important; }
  .tab-bar  { max-width: none !important; }
}
@media (min-width: 1600px) {
  .content { max-width: 1800px !important; }
}
@media (min-width: 1920px) {
  .content { max-width: 2100px !important; padding: 30px 40px !important; }
}

/* NFT grid — responsive columns */
.nft-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
}
@media (min-width: 1440px) {
  .nft-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important; }
}
@media (min-width: 1920px) {
  .nft-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important; }
}
@media (max-width: 600px) {
  .nft-grid {
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)) !important;
    gap: 12px !important;
  }
}
@media (max-width: 380px) {
  .nft-grid { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
}


/* ════════════════════════════════════════════════════════════════
   MESSAGING
════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .msg-bubble { max-width: 88% !important; }

  /* Stack sidebar + chat vertically on narrow phones */
  .app-body {
    flex-direction: column !important;
    overflow: auto !important;
  }
  .sidebar {
    width: 100% !important;
    max-width: none !important;
    height: 200px !important;
    overflow-y: auto !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border) !important;
  }
  .chat-area {
    flex: 1 !important;
    height: auto !important;
    min-height: 300px !important;
  }
}

/* Wider conversation list on big screens */
@media (min-width: 1280px) {
  .sidebar { width: 320px !important; }
}
@media (min-width: 1920px) {
  .sidebar { width: 380px !important; }
}


/* ════════════════════════════════════════════════════════════════
   PASSPORT PAGE
════════════════════════════════════════════════════════════════ */
@media (min-width: 1280px) {
  .page-wrap { max-width: 1050px !important; }
}
@media (min-width: 1600px) {
  .page-wrap { max-width: 1200px !important; }
}

/* Stamp grid — more columns on wide screens */
@media (min-width: 1280px) {
  .stamp-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important; }
  #zoraGrid   { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important; }
}
@media (max-width: 480px) {
  .stamp-grid     { grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)) !important; }
  .cover-data     { grid-template-columns: 1fr !important; }
  .admin-form-grid{ grid-template-columns: 1fr !important; }
  #zoraGrid       { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important; }
}


/* ════════════════════════════════════════════════════════════════
   INDEX.HTML — MAIN TRANSLATOR
════════════════════════════════════════════════════════════════ */

/* Phone landscape — true edge-to-edge 2-column layout */
@media (max-height: 500px) and (orientation: landscape) {
  /* Container: remove ALL padding so content fills edge-to-edge */
  .container {
    height: 100dvh !important;
    overflow: hidden !important;
    padding: 0 !important;
    /* Honor notch safe areas on notched phones */
    padding-left:   env(safe-area-inset-left,  0px) !important;
    padding-right:  env(safe-area-inset-right,  0px) !important;
    padding-top:    calc(env(safe-area-inset-top, 0px) + 0px) !important;
  }
  /* Header stays thin */
  .header {
    padding: 2px 10px !important;
    min-height: 0 !important;
    height: 42px !important;
    box-sizing: border-box !important;
  }
  .logo { font-size: 0.82rem !important; }
  /* Compact header buttons */
  .hdr-sq-btn { height: 28px !important; min-width: 28px !important; font-size: 0.58rem !important; }
  .hdr-sq-btn.icon-only { width: 28px !important; padding: 0 !important; }
  .hdr-sq-btn .btn-label { display: none !important; }
  /* Main container: truly full-width, 2 columns, no side margins */
  .main-container,
  .main-container.pre-interaction {
    grid-template-columns: 1fr 1fr !important;
    height: calc(100dvh - 42px) !important;
    min-height: 0 !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 4px !important;
    gap: 6px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }
  /* Force right column visible before first interaction */
  .main-container.pre-interaction .right-column {
    display: flex !important;
  }
  .text-input textarea { min-height: 50px !important; font-size: 13px !important; }
  /* Hide bottom nav in landscape (no room) */
  .bottom-nav { display: none !important; }
}

/* Tablet (769 – 1024px): expand to use full width */
@media (min-width: 769px) and (max-width: 1024px) {
  .main-container {
    max-width: 100% !important;
    padding: 12px 16px !important;
    gap: 14px !important;
  }
}

/* Standard laptop / MacBook 13" (1025 – 1279px) */
@media (min-width: 1025px) and (max-width: 1279px) {
  .main-container {
    max-width: 100% !important;
    padding: 16px 24px !important;
    gap: 20px !important;
  }
}

/* MacBook 14-15" / large laptop (1280 – 1599px) */
@media (min-width: 1280px) and (max-width: 1599px) {
  .main-container {
    max-width: 1560px !important;
    padding: 20px 36px !important;
    gap: 28px !important;
  }
}

/* Large desktop / iMac / external monitor (1600 – 1919px) */
@media (min-width: 1600px) and (max-width: 1919px) {
  .main-container {
    max-width: 1800px !important;
    padding: 24px 56px !important;
    gap: 36px !important;
    height: calc(100vh - 100px) !important;
  }
  .results      { font-size: 1rem !important; }
  .text-input textarea { font-size: 1rem !important; min-height: 200px !important; }
}

/* 4K / Smart TV (≥ 1920px) */
@media (min-width: 1920px) {
  html { font-size: 16px; }
  .main-container {
    max-width: 2100px !important;
    padding: 28px 80px !important;
    gap: 44px !important;
    height: calc(100vh - 110px) !important;
  }
  .results      { font-size: 1.05rem !important; line-height: 1.8 !important; }
  .text-input textarea { font-size: 1.05rem !important; min-height: 220px !important; }
  .header       { padding: 10px 80px !important; }
}


/* ════════════════════════════════════════════════════════════════
   GAME CENTER MODAL (index.html)
════════════════════════════════════════════════════════════════ */
.gc-modal {
  max-width: clamp(340px, 90vw, 520px) !important;
}
@media (min-width: 1280px) {
  .gc-modal { max-width: 600px !important; }
  /* Two-column card layout on wide screens */
  .gc-cards {
    grid-template-columns: 1fr 1fr !important;
    gap: 4px !important;
  }
}
@media (min-width: 1920px) {
  .gc-modal { max-width: 700px !important; }
}
@media (max-width: 480px) {
  .gc-modal { max-width: 98vw !important; border-radius: 14px !important; }
}

/* ── Landscape on phones & tablets: everything full-width ─────── */
@media (orientation: landscape) and (max-width: 1024px) {
  /* Main layout: no side margins, no max-width cap */
  .container {
    padding-left: env(safe-area-inset-left, 4px) !important;
    padding-right: env(safe-area-inset-right, 4px) !important;
  }
  .main-container,
  .main-container.pre-interaction {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }
  /* Game Center: stretch to full viewport */
  .gc-overlay {
    align-items: stretch !important;
    justify-content: stretch !important;
    padding: 0 !important;
  }
  .gc-modal {
    max-width: 100vw !important;
    width: 100vw !important;
    min-height: 100dvh !important;
    border-radius: 0 !important;
    max-height: 100dvh !important;
  }
  .gc-modal .gc-cards {
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
  }
  /* All other overlay modals: full-width */
  .overlay-modal {
    padding: 0 !important;
    align-items: stretch !important;
  }
  .modal-box, .modal-content, .lb-modal-box {
    max-width: 100vw !important;
    width: 100vw !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }
}


/* ════════════════════════════════════════════════════════════════
   MODALS (all pages)
════════════════════════════════════════════════════════════════ */
.modal-box, .modal-content {
  width: min(92vw, 500px) !important;
  max-height: 92dvh !important;
  overflow-y: auto !important;
}
@media (max-width: 480px) {
  .modal-box, .modal-content {
    width: 96vw !important;
    padding: 18px 14px !important;
    border-radius: 12px !important;
  }
}


/* ════════════════════════════════════════════════════════════════
   TYPOGRAPHY SCALING
════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  h1 { font-size: clamp(1.25rem, 5vw, 1.7rem) !important; }
  h2 { font-size: clamp(1.05rem, 4vw, 1.35rem) !important; }
  h3 { font-size: clamp(0.9rem, 3.5vw, 1.15rem) !important; }
}


/* ════════════════════════════════════════════════════════════════
   GLOBAL LIGHT MODE — readable text on every section / modal / button
   Activated by `body.light-mode` (manual toggle) AND
   `@media (prefers-color-scheme: light)` (system preference, when the
   user hasn't explicitly chosen dark via `body.dark-mode`).
   The rules force dark navy text (#1a2333) on light surfaces and
   keep contrast on otherwise-styled inline white text.
════════════════════════════════════════════════════════════════ */
body.light-mode .modal-box,
body.light-mode .modal-content,
body.light-mode .gc-modal,
body.light-mode .lb-modal-box,
body.light-mode .overlay-modal {
  background: #f4f7fb !important;
  border-color: #c8d6e5 !important;
  color: #1a2333 !important;
}
body.light-mode .modal-box *,
body.light-mode .modal-content *,
body.light-mode .gc-modal *,
body.light-mode .lb-modal-box * {
  color: #1a2333 !important;
}
body.light-mode .modal-box h1, body.light-mode .modal-content h1, body.light-mode .gc-modal h1,
body.light-mode .modal-box h2, body.light-mode .modal-content h2, body.light-mode .gc-modal h2,
body.light-mode .modal-box h3, body.light-mode .modal-content h3, body.light-mode .gc-modal h3,
body.light-mode .modal-box h4, body.light-mode .modal-content h4, body.light-mode .gc-modal h4 {
  color: #0d1320 !important;
}
body.light-mode .modal-box button,
body.light-mode .modal-content button,
body.light-mode .gc-modal button,
body.light-mode .lb-modal-box button {
  color: #1a2333 !important;
}
/* Inline white text frequently appears via style="color:#fff" — force dark */
body.light-mode .modal-box [style*="color:#fff"],
body.light-mode .modal-box [style*="color: #fff"],
body.light-mode .modal-box [style*="color:rgba(255,255,255"],
body.light-mode .modal-content [style*="color:#fff"],
body.light-mode .modal-content [style*="color: #fff"],
body.light-mode .modal-content [style*="color:rgba(255,255,255"],
body.light-mode .gc-modal [style*="color:#fff"],
body.light-mode .gc-modal [style*="color: #fff"],
body.light-mode .gc-modal [style*="color:rgba(255,255,255"] {
  color: #1a2333 !important;
}
/* Keep accent badges legible (purple/pink/green on light bg) */
body.light-mode .badge,
body.light-mode .stat-pill,
body.light-mode .auth-badge {
  color: #1a2333 !important;
  background: rgba(124,58,237,0.10) !important;
  border-color: rgba(124,58,237,0.35) !important;
}

/* System-level light preference — apply ONLY when user hasn't forced dark */
@media (prefers-color-scheme: light) {
  body:not(.dark-mode) .modal-box,
  body:not(.dark-mode) .modal-content,
  body:not(.dark-mode) .gc-modal,
  body:not(.dark-mode) .lb-modal-box {
    background: #f4f7fb !important;
    color: #1a2333 !important;
  }
  body:not(.dark-mode) .modal-box *,
  body:not(.dark-mode) .modal-content *,
  body:not(.dark-mode) .gc-modal *,
  body:not(.dark-mode) .lb-modal-box * {
    color: #1a2333 !important;
  }
  body:not(.dark-mode) .modal-box [style*="color:#fff"],
  body:not(.dark-mode) .modal-box [style*="color:rgba(255,255,255"],
  body:not(.dark-mode) .modal-content [style*="color:#fff"],
  body:not(.dark-mode) .modal-content [style*="color:rgba(255,255,255"],
  body:not(.dark-mode) .gc-modal [style*="color:#fff"],
  body:not(.dark-mode) .gc-modal [style*="color:rgba(255,255,255"] {
    color: #1a2333 !important;
  }
}


/* ════════════════════════════════════════════════════════════════
   SCROLLBAR — subtler on non-mobile
════════════════════════════════════════════════════════════════ */
@media (pointer: fine) {
  ::-webkit-scrollbar       { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.35);
    border-radius: 3px;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: rgba(124, 58, 237, 0.6);
  }
}
