/* ==========================================================================
   responsive.css — layout overrides for tablet and mobile
   Breakpoint contract: 700px (mirrors the matchMedia call in JS)
   ========================================================================== */

/* ==========================================================================
   WIDE SCREEN (≥701px)
   ========================================================================== */
@media (min-width: 701px) {
  /* Exam choices: 2-column grid */
  .exam-body.mode-choice,
  .exam-body.mode-tf {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 8px;
  }

  .exam-body.mode-tf > .tf-statement {
    grid-column: 1 / -1;
    margin: 0;
  }

  .exam-body.mode-choice .answer-btn,
  .exam-body.mode-tf .answer-btn {
    margin-bottom: 0;
  }
}

/* ==========================================================================
   MOBILE (≤700px)
   ========================================================================== */
@media (max-width: 700px) {

  /* ─── Top Bar ─── */
  .top-sticky-bar {
    height: 48px;
    padding: 0 14px;
  }
  .top-sticky-bar .brand {
    font-size: 18px;
  }

  /* ─── Master Layout ─── */
  .app-shell {
    overflow: visible !important; /* Allow popups to escape */
  }
  .app-layout-container,
  .sidebar-wrapper {
    flex-direction: column;
  }

  /* ─── Sidebar (Full-height overlay) ─── */
  .controls-sidebar {
    width: 100% !important;
    position: absolute;
    inset: 0 0 auto 0;
    height: 100%;
    z-index: var(--z-sidebar);
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden !important;
    transition: height var(--dur-slow) var(--ease), border-bottom-width var(--dur-slow) var(--ease);
  }
  .sidebar-scrollable-content {
    width: 100%;
    min-width: 0;
    padding: 12px;
  }

  /* ─── Workspace ─── */
  .input-workspace {
    padding: 12px;
    padding-bottom: 60px; /* Clear fixed playback bar */
    overflow: hidden;
    min-height: 0;
  }

  /* ─── Onboarding Hint ─── */
  .hint-card {
    max-height: 30vh;
    overflow-y: auto;
    flex-shrink: 0;
    margin-bottom: 12px;
  }

  /* ─── Grid ─── */
  .spreadsheet-grid,
  #spreadsheet-container.spreadsheet-grid {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    max-height: none;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .header-cell {
    position: sticky;
    top: 0;
    z-index: 2;
  }
  .grid-footer {
    padding: 6px 0 4px;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    background: var(--bg-app);
    z-index: var(--z-sticky);
  }

  /* ─── Notes ─── */
  #note-area {
    width: 100%;
    min-width: 0;
    max-height: 46vh;
  }

  /* ─── Exam Viewer ─── */
  #recall-viewer.exam-active {
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }

  /* ─── Analytics ─── */
  #analytics-workspace {
    overflow-x: hidden;
    max-height: 60vh;
  }

  /* ─── Privacy ─── */
  [data-view-mode="privacy"] #privacy-workspace {
    display: flex;
    flex: 1 1 0;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ─── Hide desktop-only elements ─── */
  #launcher-sidebar {
    display: none;
  }

  /* ─── Playback Bar (Mobile fixed to bottom) ─── */
  .mobile-playback-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100vw;
    height: 40px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    z-index: var(--z-topbar);
  }

  /* Hide the role text on mobile to save space */
  #account-role-label {
    display: none !important;
  }
  
  /* Keep the pill shape compact just for the icon */
  .account-btn {
    padding: 4px 8px !important;
  }

}
