/* =========================================================
   Mobile Terminal Optimization (v4 - Force Reset)
   ========================================================= */
@media (max-width: 768px) {
  /* Kill everything desktop-related */
  .frame, .tick-rail, .toplabel, .rail, .footstrip, .term-head, .lights {
    display: none !important;
  }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    height: 100% !important;
    width: 100% !important;
    background: #000 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
  }

  /* Reset the main app container to the absolute top-left */
  .app {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    border: none !important;
    display: flex !important;
    flex-direction: column !important;
    background: #060606 !important;
    box-shadow: none !important;
    transform: none !important;
  }

  /* Force terminal to fill the app exactly */
  .term {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    border: none !important;
    background: transparent !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: 100% !important;
  }

  .term-body {
    padding: 10px !important;
    flex: 1 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* ASCII Font Scaling - Keeping it small to prevent overflow */
  .ascii-player, .banner, pre {
    font-size: 1.1vw !important; 
    line-height: 1.1 !important;
    width: 100% !important;
    overflow-x: hidden !important;
    white-space: pre !important;
    margin: 0 !important;
  }

  .out, .cmd-line {
    font-size: 12px !important;
    line-height: 1.4 !important;
  }

  /* Command buttons at the bottom */
  .hints {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 4px !important;
    padding: 8px !important;
    background: #0a0a0a !important;
    border-top: 1px solid var(--red-dim) !important;
    padding-bottom: env(safe-area-inset-bottom, 12px) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .hint {
    padding: 12px 0 !important;
    font-size: 11px !important;
    background: rgba(var(--red-rgb), 0.1) !important;
    border: 1px solid var(--red-dim) !important;
    color: var(--red) !important;
    text-align: center !important;
    text-transform: uppercase;
  }

  .hint .k { display: none !important; }

  /* Ensure scanlines cover the whole screen correctly */
  .scanlines, .scan-sweep {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 1000 !important;
    margin: 0 !important;
    pointer-events: none !important;
  }
}
