/* ═══════════════════════════════════════════════════
   HORIZON FORGE — UNIVERSAL MOBILE/OVERLAY CSS
   Landscape lock, log overlay (all platforms), lobby
   ═══════════════════════════════════════════════════ */

/* ── Rotate overlay (landscape block) ── */
#mobile-rotate-msg {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #060310;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #dde2ff;
  font-family: "Exo 2", system-ui, sans-serif;
  text-align: center;
  padding: 32px;
}

#mobile-rotate-msg .mrm-icon {
  font-size: 48px;
  animation: mrm-spin 2s ease-in-out infinite;
}

#mobile-rotate-msg p {
  font-size: 16px;
  font-weight: 600;
  color: rgba(200, 185, 245, 0.9);
  max-width: 220px;
  line-height: 1.5;
}

@keyframes mrm-spin {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(90deg); }
}

/* Show overlay + hide game in landscape on touch devices */
@media (orientation: landscape) and (max-width: 900px) and (pointer: coarse) {
  #mobile-rotate-msg { display: flex; }
  #game, #duel-result, #quit-overlay { display: none !important; }
}

/* ══════════════════════════════════════════
   LOG OVERLAY — all platforms (universal)
   Bottom-sheet slide-up containing #log
   ══════════════════════════════════════════ */

#mobile-log-overlay {
  position: fixed;
  top: auto;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60dvh;
  z-index: 5000;
  background: rgba(6, 3, 20, 0.98);
  display: flex;
  flex-direction: column;
  border-radius: 16px 16px 0 0;
  border-top: 1px solid rgba(180, 130, 255, 0.2);
  box-shadow: 0 -6px 32px rgba(0, 0, 0, 0.6);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.22, 0.68, 0, 1.1);
}

#mobile-log-overlay.open {
  transform: translateY(0);
}

#mobile-log-overlay #log {
  display: flex !important;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  border-radius: 0;
  border: none !important;
  font-size: 11px !important;
  overflow-y: auto !important;
}

.mlo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mlo-title {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
  font-family: "Exo 2", system-ui, sans-serif;
}

#mobile-log-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.55);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

/* ── Log toggle button (injected into #hdr by mobile.js) ── */
#mobile-log-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  font-family: "Exo 2", system-ui, sans-serif;
}

/* ── Tap-select highlight classes (applied by mobile.js on touch) ── */
.m-selected {
  border: 2px solid #ffd700 !important;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.5) !important;
}

.m-valid-drop {
  background: rgba(100, 200, 100, 0.2) !important;
  border: 2px solid rgba(100, 200, 100, 0.5) !important;
}

/* ══════════════════════════════════════════
   TOUCH-SPECIFIC OVERRIDES
   Only applies to real touch devices
   ══════════════════════════════════════════ */

@media (pointer: coarse) {
  /* Kill hover tooltips (stuck on touch devices) */
  .skill-tip { display: none !important; }

  /* Safe-area top padding */
  #game {
    padding-top: env(safe-area-inset-top);
  }
}

/* ══════════════════════════════════════════
   SMALL SCREEN ADJUSTMENTS (≤ 380px)
   Only for very small phones
   ══════════════════════════════════════════ */

@media (max-width: 380px) {
  :root {
    --s: 0.82;
  }

  #bottom-zone {
    max-height: clamp(190px, 34dvh, 270px) !important;
  }
}

/* ══════════════════════════════════════════
   DUEL RESULT — mobile adjustments
   ══════════════════════════════════════════ */

@media (max-width: 480px) and (pointer: coarse) {
  #duel-result {
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-y: auto;
  }

  #dr-box {
    width: calc(100vw - 24px);
    margin: 0 auto;
    padding-top: calc(env(safe-area-inset-top) + 16px);
    padding-bottom: calc(env(safe-area-inset-bottom) + 16px);
    max-height: 100dvh;
    overflow-y: auto;
  }
}

/* ══════════════════════════════════════════
   LOBBY MOBILE OVERRIDES
   ══════════════════════════════════════════ */

/* Bottom tabs: hidden by default (desktop) */
.mobile-bottom-tabs { display: none; }

@media (max-width: 480px) and (pointer: coarse) {

  /* ── TopNav: hide center and right ── */
  .topnav .nav-center,
  .topnav .hive-bal,
  .topnav .btn-exit {
    display: none !important;
  }

  .topnav {
    padding: 0 14px;
    justify-content: space-between;
  }

  /* ── Bottom Tabs ── */
  .mobile-bottom-tabs {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: rgba(6, 3, 20, 0.97);
    border-top: 1px solid rgba(180, 130, 255, 0.14);
    backdrop-filter: blur(18px);
    z-index: 99;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    align-items: stretch;
  }

  .mbt-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    padding: 4px 0;
  }

  .mbt-ico {
    font-size: 18px;
  }

  .mbt-lbl {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(190, 170, 240, 0.45);
    font-family: "Exo 2", system-ui, sans-serif;
  }

  .mbt-tab.active .mbt-lbl {
    color: #ffd700;
  }

  .mbt-tab.active .mbt-ico {
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.55));
  }

  /* ── Lobby wrap: padding for bottom tabs ── */
  .lobby-wrap {
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  }

  /* ── Banner expand: always visible ── */
  .banner-expand {
    max-height: none !important;
    opacity: 1 !important;
    overflow: visible !important;
  }

  /* ── Disable hover transform on touch ── */
  .banner-ai:hover,
  .banner-pvp:hover {
    transform: none !important;
    box-shadow: none !important;
  }

  /* ── Smaller sphere ── */
  .banner-sphere {
    width: 80px !important;
    height: 80px !important;
    margin-bottom: 12px !important;
  }

  .banner-ai .sph-ring.r1,
  .banner-pvp .sph-ring.r1 {
    width: 80px !important;
    height: 80px !important;
    margin: -40px 0 0 -40px !important;
  }

  .banner-ai .sph-ring.r2,
  .banner-pvp .sph-ring.r2 {
    width: 60px !important;
    height: 60px !important;
    margin: -30px 0 0 -30px !important;
  }

  .banner-ai .sph-ring.r3,
  .banner-pvp .sph-ring.r3 {
    width: 40px !important;
    height: 40px !important;
    margin: -20px 0 0 -20px !important;
  }

  .banner-sphere .sph-core {
    font-size: 22px !important;
  }
}
