/* ================================================================
   ZERO MC SERVER — ENHANCED MOBILE RESPONSIVE STYLES
   ================================================================ */

/* ── Mobile Breakpoints ── */
/* Touch device overrides */
.touch-device .card:hover,
.touch-device .achv-card:hover,
.touch-device .system-detail:hover,
.touch-device .pet-card:hover,
.touch-device .pet-hl-card:hover,
.touch-device .coming-soon-card:hover,
.touch-device .penalty-card:hover,
.touch-device .skill-card:hover {
  transform: none;
}

.touch-device .nav-submenu {
  /* Keep click-based open on touch */
}

/* ── Tablet: 601px - 900px ── */
@media (max-width: 900px) {
  .nav {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 16px;
  }

  .nav-links {
    order: 3;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    display: none;
    padding-top: 12px;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  .nav-submenu {
    position: static;
    box-shadow: none;
    border: none;
    padding: 0 0 0 16px;
    min-width: auto;
    background: transparent;
  }

  .nav-dropdown:hover .nav-submenu {
    display: none;
  }

  .nav-submenu.open {
    display: block;
  }

  .nav-submenu a {
    padding: 12px 16px !important;
    font-size: 0.9rem !important;
    min-height: 44px;
  }

  .nav-dropdown > a {
    justify-content: space-between;
  }

  .nav-arrow {
    font-size: 0.65rem;
  }

  .nav-dl-btn {
    justify-content: center !important;
    margin: 4px 0 !important;
  }

  .nav-toggle {
    display: flex;
  }

  /* Stats row 4col → 2col on tablet */
  .stats-row {
    grid-template-columns: 1fr 1fr;
  }

  /* Hero actions stack */
  .hero {
    padding: 48px 16px 40px;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .hero-actions .btn-download {
    width: 100%;
    max-width: 320px;
    justify-content: center;
  }

  /* Download cards stack */
  .download-cards {
    grid-template-columns: 1fr;
  }

  /* Cards grid 1col */
  .cards-grid {
    grid-template-columns: 1fr;
  }

  /* System detail stack */
  .system-detail {
    flex-direction: column;
    padding: 24px 18px;
  }

  .system-visual {
    order: -1;
  }

  .emoji-display {
    font-size: 3.5rem;
  }

  .system-detail.highlight-new::before {
    top: 8px;
    right: 12px;
  }

  /* Achievement grid 1col */
  .achv-grid {
    grid-template-columns: 1fr;
  }

  .achv-card {
    padding: 16px 14px;
  }

  /* Coming soon 2col */
  .coming-soon-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  /* Pet grid smaller */
  .pet-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
  }

  .pet-card {
    padding: 12px 8px;
  }

  .pet-card .pet-icon {
    font-size: 2rem;
  }

  /* Skill tree 1col */
  .skill-tree-grid {
    grid-template-columns: 1fr;
  }

  /* Penalty 2col */
  .penalty-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  /* Pet highlight 2col */
  .pet-highlight-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* Commands 3col → 1col */
  .section .cards-grid {
    grid-template-columns: 1fr;
  }

  /* Live status 2col */
  .live-status-grid {
    grid-template-columns: 1fr 1fr;
  }

  .server-ip {
    font-size: 1.1rem;
    padding: 12px 24px;
  }

  .section {
    padding: 40px 16px;
  }

  .qq-float-btn {
    bottom: 80px;
    right: 16px;
    width: 46px;
    height: 46px;
  }

  .color-picker {
    bottom: 16px;
    right: 16px;
  }
}

/* ── Mobile Phone: max-width 600px ── */
@media (max-width: 600px) {
  .nav-toggle {
    display: flex;
  }

  .hero {
    padding: 36px 12px 30px;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .subtitle {
    font-size: 0.9rem;
  }

  .hero-actions .btn-download {
    font-size: 0.9rem;
    padding: 12px 20px;
  }

  /* Stats 2col */
  .stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .stat-num {
    font-size: 1.4rem;
  }

  .stat-label {
    font-size: 0.75rem;
  }

  /* Sections */
  .section {
    padding: 32px 12px;
  }

  .section-title {
    font-size: 1.3rem;
  }

  /* Cards full width */
  .cards-grid {
    grid-template-columns: 1fr;
  }

  /* Pet grid 3col */
  .pet-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
  }

  .pet-card {
    padding: 10px 6px;
  }

  .pet-card .pet-icon {
    font-size: 1.6rem;
  }

  .pet-card .pet-name {
    font-size: 0.9rem;
  }

  .pet-card .pet-desc {
    font-size: 0.72rem;
  }

  /* Coming soon 2col */
  .coming-soon-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
  }

  .coming-soon-card {
    padding: 20px 14px;
  }

  .coming-soon-card .cs-icon {
    font-size: 2rem;
  }

  /* Penalty 1col */
  .penalty-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .penalty-card {
    padding: 16px 12px;
  }

  /* System detail */
  .system-detail {
    padding: 18px 14px;
  }

  .system-info h2 {
    font-size: 1.2rem;
  }

  /* Achievement cards */
  .achv-card {
    flex-direction: column;
    text-align: center;
    padding: 16px 12px;
  }

  .achv-icon {
    margin: 0 auto;
  }

  /* Leaderboard */
  .lb-tabs {
    gap: 4px;
  }

  .lb-tab {
    padding: 8px 12px;
    font-size: 0.78rem;
  }

  .lb-row, .lb-header-row {
    padding: 10px 12px;
  }

  .lb-rank-h, .lb-rank {
    width: 40px;
  }

  .lb-score-h, .lb-score {
    width: 50px;
  }

  /* Live status 1col */
  .live-status-grid {
    grid-template-columns: 1fr;
  }

  .live-big-num {
    font-size: 1.6rem;
  }

  /* Server IP */
  .server-ip {
    font-size: 1rem;
    padding: 10px 16px;
  }

  /* Footer */
  .footer {
    padding: 24px 12px;
    font-size: 0.8rem;
  }

  /* Toast */
  .toast {
    left: 12px;
    right: 12px;
    transform: none;
    text-align: center;
    font-size: 0.82rem;
    border-radius: 12px;
  }

  /* Tables scrollable */
  .cmd-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .cmd-table thead,
  .cmd-table tbody,
  .cmd-table tr,
  .cmd-table th,
  .cmd-table td {
    white-space: nowrap;
  }

  .cmd-table td:first-child {
    min-width: 120px;
  }

  /* Buttons full width */
  .btn-download {
    font-size: 0.9rem;
    padding: 12px 24px;
  }

  .note-box {
    padding: 14px 16px;
    font-size: 0.85rem;
  }

  /* QQ float button */
  .qq-float-btn {
    bottom: 76px;
    right: 12px;
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
  }

  /* Admin panel */
  #adminPanel {
    top: 60px;
    right: 8px;
    max-width: 320px;
    padding: 14px;
  }

  /* Announcement popup */
  .ann-popup {
    width: 88vw;
    max-width: 88vw;
    border-radius: 14px;
  }

  .ann-popup-header {
    padding: 13px 16px;
  }

  .ann-popup-header h3 {
    font-size: 0.95rem;
  }

  .ann-popup-body {
    padding: 18px 14px;
  }

  .ann-popup-body p {
    font-size: 0.88rem;
    line-height: 1.65;
    text-align: left;
  }

  .ann-popup-footer {
    padding: 8px 14px 14px;
  }

  .ann-btn-ok {
    padding: 10px 28px;
    font-size: 0.9rem;
    width: 100%;
    max-width: 260px;
  }
}

/* ── Very Small: max-width 380px ── */
@media (max-width: 380px) {
  .pet-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .penalty-grid {
    grid-template-columns: 1fr;
  }

  .lb-tab {
    padding: 6px 10px;
    font-size: 0.7rem;
    border-radius: 16px;
  }

  .nav-logo {
    font-size: 1.1rem;
  }

  .logo-icon {
    width: 30px;
    height: 30px;
  }
}

/* ── Landscape phone ── */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    padding: 20px 16px 24px;
  }

  .hero h1 {
    font-size: 1.6rem;
  }

  .subtitle {
    margin: 8px 0 16px;
    font-size: 0.85rem;
  }

  .hero-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* ── High-DPI / Retina ── */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  body::before {
    background-size: 50% 50%;
  }
}

/* ── Print Styles ── */
@media print {
  .header, .footer, .qq-float-btn, .color-picker, .toast, .nav-toggle {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
  }

  .card, .achv-card, .system-detail {
    border: 1px solid #ccc !important;
    break-inside: avoid;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.75em;
    color: #666;
  }
}
