/* ========================================================
   DATIGAMING — phones & tablets
   Loaded LAST on every page (after each page's own <style>),
   so these rules win over page-level overrides.
   Breakpoints: ≤1420 (no side banners) · ≤1024 tablet · ≤768 phone/small tablet · ≤480 phone · ≤360 small phone
   ======================================================== */

/* iOS: don't inflate text in landscape; smooth momentum scrolling everywhere. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  overflow-x: hidden; /* safety net: nothing may widen the page on phones */
}

/* Side video banners need ~1500px of width; below that they are hidden (and their videos never load). */
@media (max-width: 1420px) {
  .dg-tall-card {
    display: none !important;
  }
}

/* Touch screens: no "sticky" hover lifts, bigger hit areas. */
@media (hover: none) {
  .game-card:hover,
  .nav-auth-btn:hover,
  .btn-drawer-submit:hover,
  .btn-delete-comment:hover {
    transform: none !important;
  }
}

/* ================= TABLET (≤1024) ================= */
@media (max-width: 1024px) {
  .container,
  .dg-top-wrap {
    padding-left: 20px;
    padding-right: 20px;
  }
  .nav-menu {
    gap: 6px;
  }
  .nav-link {
    padding: 5px 8px;
  }
}

/* ================= PHONE & SMALL TABLET (≤768) ================= */
@media (max-width: 768px) {
  /* ---- Header & slide-down menu ---- */
  .navbar {
    height: 56px;
  }
  .mobile-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
  }
  .nav-menu {
    top: 56px !important;
    align-items: stretch !important;
    gap: 2px !important;
    padding: 8px 16px 16px !important;
    max-height: calc(100vh - 56px);
    max-height: calc(100dvh - 56px);
    overflow-y: auto;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  }
  .nav-menu > li {
    width: 100%;
  }
  .nav-menu .nav-link {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 14px;
    font-size: 1rem;
    border-radius: 10px;
  }
  /* Sign-in / profile and the language flags sit in one row at the bottom of the menu. */
  .nav-menu > li#authContainer,
  .nav-menu > li#langContainer {
    display: flex;
    justify-content: flex-start;
    padding-top: 10px;
  }
  .nav-menu > li#authContainer {
    margin-top: 6px;
    border-top: 1px solid var(--border-light);
  }
  .nav-auth-btn {
    min-height: 44px;
    padding: 0 16px;
    font-size: 0.95rem;
  }
  .user-auth-pill {
    padding: 6px 12px 6px 8px;
  }
  .user-auth-name,
  .user-auth-username {
    max-width: 160px !important;
  }
  .btn-logout-mini {
    min-width: 36px;
    min-height: 36px;
    justify-content: center;
  }
  .lang-toggle-pill {
    padding: 4px 5px;
  }
  .lang-opt {
    padding: 6px 8px;
  }
  .lang-flag {
    width: 26px;
    height: 18px;
  }

  /* ---- Hero ---- */
  .hero {
    padding: 28px 0 20px;
  }
  /* MS Block is wide: "საქართველოში" measures 13.2em. Size the title so that word always fits on one line
     (container ≈ 100vw − 60px), capped at the desktop size on tablets. */
  .hero-title {
    font-size: min(calc((100vw - 60px) / 13.6), 2.2rem) !important;
    letter-spacing: 0 !important;
    line-height: 1.3;
    overflow-wrap: anywhere; /* last-resort safety: never widen the page */
  }
  .hero-desc {
    font-size: 0.92rem;
    padding: 0 4px;
  }
  .btn-group .btn-glass {
    min-height: 44px;
  }

  /* ---- Top logo banner: show the whole logo instead of cropping it ---- */
  .dg-top-wrap {
    margin-top: 12px;
  }
  .dg-wide-card {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 !important;
  }
  .dg-wide-card img {
    height: auto !important;
    object-fit: contain !important;
  }

  /* ---- Sections & headings ---- */
  .section {
    padding: 22px 0;
  }
  .section-header {
    flex-wrap: wrap;
    gap: 10px;
  }
  .section-title {
    font-size: 1.15rem;
  }
  .btn-rotate-manual {
    min-height: 34px;
    padding: 0 12px;
  }

  /* ---- Game cards ---- */
  .grid-games {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .game-card-body {
    padding: 12px;
  }
  .game-title {
    font-size: 0.95rem;
  }
  .game-card-footer {
    flex-wrap: wrap;
    gap: 8px;
  }
  .btn-steam {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
  }

  /* ---- Games catalog (games page) ---- */
  .steam-catalog-head {
    align-items: center;
  }
  .steam-refresh {
    min-height: 40px;
  }
  .steam-tabs {
    gap: 18px;
  }
  .steam-tab {
    padding: 12px 0;
  }
  #steamMoreBtn {
    min-height: 44px;
    padding: 0 22px;
  }

  /* ---- Forum: category chips on top, topics next, rules last ---- */
  .forum-layout {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
  .forum-sidebar {
    display: contents;
  }
  .forum-layout .category-list {
    order: 1;
    display: flex !important;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 2px 0 !important;
    background: none !important;
    border: none !important;
    -webkit-overflow-scrolling: touch;
  }
  .forum-layout .category-list::-webkit-scrollbar {
    display: none;
  }
  .forum-layout .category-item {
    flex-shrink: 0;
  }
  .forum-layout .category-item a {
    min-height: 40px;
    gap: 8px;
    padding: 0 14px !important;
    white-space: nowrap;
    border-radius: 999px !important;
    border: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.03);
  }
  .forum-layout > div:last-child {
    order: 2;
    min-width: 0;
  }
  .forum-layout .rules-card {
    order: 3;
    margin-top: 0 !important;
  }
  .forum-topic-card {
    padding: 12px !important;
    gap: 10px !important;
  }
  .vote-box {
    min-width: 36px !important;
  }
  .vote-btn {
    min-width: 34px;
    min-height: 30px;
  }
  .topic-meta {
    gap: 8px !important;
  }
  .comment-form .cyber-input {
    min-width: 0;
    flex: 1;
  }
  .comment-attach {
    width: 40px;
    height: 40px;
  }
  .forum-photos,
  .forum-photos-comment {
    max-width: 100%;
  }

  /* ---- Footer: bigger tap targets ---- */
  .footer a {
    display: inline-block;
    padding: 6px 0;
  }

  /* ---- Visitor counter: part of the page end, not floating over content ---- */
  .dg-visitors {
    position: static !important;
    display: flex !important;
    width: max-content;
    max-width: calc(100% - 32px);
    margin: 0 auto 18px;
    transform: none !important;
  }

  /* ---- iPhone: inputs under 16px make Safari zoom in on focus ---- */
  input[type="text"],
  input[type="search"],
  input[type="email"],
  input:not([type]),
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* ================= PHONE (≤480) ================= */
@media (max-width: 480px) {
  .container,
  .dg-top-wrap {
    padding-left: 16px;
    padding-right: 16px;
  }
  .grid-games {
    grid-template-columns: 1fr;
  }
  .btn-group {
    gap: 8px;
  }
  .btn-group .btn-glass {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
  }
  .btn-group .btn-glass:first-child {
    flex-basis: 100%;
  }
  .section-header > a {
    font-size: 0.85rem;
  }
  .steam-catalog-head {
    flex-wrap: wrap;
  }
  .steam-catalog-sub {
    font-size: 0.8rem;
  }
  .steam-tabs {
    gap: 16px;
  }
  .steam-tab {
    font-size: 0.82rem;
  }
  .drawer-actions {
    width: 100%;
  }
  .topic-title a {
    font-size: 0.95rem !important;
  }
}

/* ================= SMALL PHONE (≤360) ================= */
@media (max-width: 360px) {
  .container,
  .dg-top-wrap {
    padding-left: 12px;
    padding-right: 12px;
  }
  .logo span:not(.logo-badge) {
    font-size: 0.92rem;
  }
  .steam-tabs {
    gap: 12px;
  }
  .steam-tab {
    font-size: 0.78rem;
  }
}
