/* Aethelgaard MUD — Mobile & Touch Interface Styles */

/* Hide mobile nav bar on desktop */
.mobile-nav-bar {
  display: none;
}

/* Touch controls on terminal */
.touch-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.6rem;
  background: rgba(10, 12, 16, 0.95);
  border-top: 1px solid var(--borderGothic);
  border-bottom: 1px solid var(--borderGothic);
  gap: 0.6rem;
}

/* D-Pad Compass Controller (Reduced & Compact) */
.dpad-container {
  display: grid;
  grid-template-columns: repeat(3, 25px);
  grid-template-rows: repeat(3, 25px);
  gap: 2px;
  width: 79px;
  height: 79px;
  flex-shrink: 0;
}

.dpad-btn {
  background: rgba(20, 25, 35, 0.9);
  border: 1px solid var(--borderGothic);
  color: var(--accentGold);
  font-family: var(--fontHeading);
  font-size: 0.72rem;
  font-weight: bold;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  user-select: none;
  transition: all 0.15s ease;
}

.dpad-btn:hover {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--accentGold);
}

.dpad-btn:active {
  background: var(--accentGold);
  color: #000;
  transform: scale(0.92);
}

.dpad-n { grid-column: 2; grid-row: 1; }
.dpad-w { grid-column: 1; grid-row: 2; }
.dpad-e { grid-column: 3; grid-row: 2; }
.dpad-s { grid-column: 2; grid-row: 3; }
.dpad-u { grid-column: 1; grid-row: 1; background: rgba(30, 40, 55, 0.95); color: var(--accentAurora); font-size: 0.65rem; }
.dpad-d { grid-column: 3; grid-row: 3; background: rgba(30, 40, 55, 0.95); color: var(--accentAurora); font-size: 0.65rem; }

/* Quick Action Buttons (Compact & Sleek) */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem 0.35rem;
  flex: 1;
  max-width: 320px;
}

.action-btn {
  background: rgba(25, 30, 40, 0.85);
  border: 1px solid var(--borderGothic);
  color: var(--textPrimary);
  font-family: var(--fontHeading);
  font-size: 0.73rem;
  font-weight: 500;
  padding: 0.25rem 0.3rem;
  border-radius: 3px;
  cursor: pointer;
  text-align: center;
  touch-action: manipulation;
  user-select: none;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.action-btn:hover {
  background: rgba(40, 50, 65, 0.9);
  border-color: var(--accentAurora);
  color: #fff;
}

.action-btn:active {
  background: var(--accentCrimson);
  color: #fff;
  transform: scale(0.94);
}

.action-danger {
  border-color: rgba(230, 57, 70, 0.5);
  color: #ff8888;
}

.action-danger:hover {
  background: rgba(230, 57, 70, 0.25);
  border-color: var(--accentCrimson);
  color: #ffffff;
}

.btn-send-cmd {
  display: none;
  background: var(--accentGold);
  color: #000;
  border: none;
  font-family: var(--fontHeading);
  font-weight: bold;
  padding: 0 1rem;
  height: 38px;
  border-radius: 4px;
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════ */
/* MOBILE RESPONSIVE MEDIA QUERIES (max-width: 768px) */
/* ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  #view-game {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }

  .mobile-nav-bar {
    display: flex;
    height: 48px;
    background: rgba(10, 12, 16, 0.98);
    border-bottom: 2px solid var(--borderGothic);
    flex-shrink: 0;
    z-index: 100;
  }

  .mobile-nav-btn {
    flex: 1;
    background: none;
    border: none;
    border-right: 1px solid var(--borderGothic);
    color: var(--textMuted);
    font-family: var(--fontHeading);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.2s ease;
  }

  .mobile-nav-btn:last-child {
    border-right: none;
  }

  .mobile-nav-btn.active {
    color: var(--accentGold);
    background: rgba(212, 175, 55, 0.12);
    border-bottom: 3px solid var(--accentGold);
  }

  .game-grid {
    display: block;
    flex: 1;
    height: calc(100vh - 48px);
    position: relative;
    width: 100vw;
    background: var(--bgPrimary);
    overflow: hidden;
  }

  .panel {
    display: none !important;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background: var(--bgPanel);
    z-index: 10;
  }

  .panel.mobile-active {
    display: flex !important;
  }

  .panel-terminal {
    flex-direction: column;
  }

  .terminal-output {
    flex: 1;
    font-size: 0.9rem;
    padding: 0.75rem;
  }

  .input-row {
    padding: 0.5rem;
    background: #000;
    border-top: 1px solid var(--borderGothic);
    position: sticky;
    bottom: 0;
    z-index: 50;
  }

  .cmd-input {
    font-size: 16px !important;
    height: 40px;
  }

  .btn-send-cmd {
    display: block;
    margin-left: 0.5rem;
  }

  .panel-right {
    padding-bottom: 2rem;
  }

  .map-canvas {
    width: 100% !important;
    max-width: 320px;
    height: auto !important;
    margin: 0 auto;
  }

  #view-login {
    padding: 1rem 0.75rem 2rem 0.75rem;
  }

  .login-container {
    max-width: 100%;
    margin: 0 auto;
  }

  .world-title {
    font-size: 2.2rem;
  }

  .game-logo-img {
    max-width: 180px;
  }

  #view-charcreate {
    padding: 0.5rem;
  }

  .charcreate-container {
    padding: 1.25rem;
  }

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

  .traits-grid, .branches-grid {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════════════ */
/* PURE MOBILE PORTRAIT TELNET MODE (max-width: 600px, portrait) */
/* Gives mobile phone portrait users 100% full-screen Telnet mode */
/* ═══════════════════════════════════════════════════════════════ */
@media (max-width: 600px) and (orientation: portrait) {
  /* Hide mobile top navigation bar, touch action/D-pad buttons & ambient music player */
  .mobile-nav-bar,
  .touch-controls,
  #fantasy-music-player,
  .fantasy-music-player {
    display: none !important;
  }

  /* Full screen game container without nav header offset */
  .game-grid {
    height: 100vh !important;
    max-height: 100vh !important;
  }

  /* Hide stats and map side panels */
  #panel-stats,
  #panel-right {
    display: none !important;
  }

  /* Force terminal panel to 100% full screen */
  #panel-terminal {
    display: flex !important;
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    flex-direction: column !important;
    z-index: 20 !important;
  }

  .terminal-output {
    flex: 1 !important;
    padding: 0.75rem !important;
    font-size: 0.95rem !important;
    line-height: 1.4 !important;
  }

  .input-row {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 100 !important;
    padding: 0.6rem 0.5rem !important;
    background: #000000 !important;
  }
}
