/* LV Typing Suite 6.1.23 — mobile typing focus only.
 *
 * Hard safety boundary:
 * - Applies only to touch/coarse-pointer viewports up to 1024 CSS px.
 * - Desktop/laptop presentation remains exactly on the existing styles.
 */

@media (max-width:1024px) and (hover:none) and (pointer:coarse) {

  /* -------------------------------------------------------
   * General Practice / Fresh Practice.
   * Activated only after JS adds lvts-mobile-typing-focus.
   * ------------------------------------------------------- */
  body.lvts-mobile-typing-focus{
    overflow:hidden!important;
    overscroll-behavior:none;
  }

  body.lvts-mobile-typing-focus .lv50-general-run{
    position:fixed!important;
    inset:0!important;
    z-index:2147482500!important;
    width:100%!important;
    max-width:none!important;
    height:100vh!important;
    height:100dvh!important;
    min-height:0!important;
    margin:0!important;
    padding:8px 10px 10px!important;
    border:0!important;
    border-radius:0!important;
    box-shadow:none!important;
    background:#fff!important;
    display:flex!important;
    flex-direction:column!important;
    overflow:hidden!important;
  }

  /* Hide only non-essential runner chrome during focus mode. */
  body.lvts-mobile-typing-focus .lv50-general-run .lv50-run-top{
    display:none!important;
  }
  body.lvts-mobile-typing-focus .lv50-general-run .lv50-lesson-top{
    display:flex!important;
    min-height:34px!important;
    margin:0 0 5px!important;
    padding:0!important;
    align-items:center!important;
    justify-content:flex-end!important;
  }
  body.lvts-mobile-typing-focus .lv50-general-run .lv50-lesson-top>div{
    display:none!important;
  }
  body.lvts-mobile-typing-focus .lv50-general-run .lv50-time-pill{
    margin:0!important;
    padding:6px 10px!important;
    font-size:12px!important;
    line-height:1.15!important;
  }
  body.lvts-mobile-typing-focus .lv50-general-run .lv50-live-stats{
    display:none!important;
  }

  body.lvts-mobile-typing-focus .lv50-general-run .lv50-run-work{
    flex:1 1 auto!important;
    min-height:0!important;
    width:100%!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    grid-template-rows:minmax(105px,42%) minmax(125px,1fr)!important;
    gap:7px!important;
    overflow:hidden!important;
  }

  body.lvts-mobile-typing-focus .lv50-general-run .lv50-run-work>section{
    min-width:0!important;
    min-height:0!important;
    width:100%!important;
    display:flex!important;
    flex-direction:column!important;
    overflow:hidden!important;
  }

  body.lvts-mobile-typing-focus .lv50-general-run .lv50-run-work label{
    flex:0 0 auto!important;
    margin:0 0 3px!important;
    font-size:10.5px!important;
    line-height:1.2!important;
  }

  body.lvts-mobile-typing-focus .lv50-general-run .lv50-run-source,
  body.lvts-mobile-typing-focus .lv50-general-run .lv50-run-input,
  body.lvts-mobile-typing-focus .lv50-general-run .lv50-kruti-preview{
    flex:1 1 auto!important;
    width:100%!important;
    height:auto!important;
    min-height:0!important;
    max-height:none!important;
    margin:0!important;
    padding:10px 12px!important;
    box-sizing:border-box!important;
    overflow:auto!important;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
    resize:none!important;
  }

  body.lvts-mobile-typing-focus .lv50-general-run .lv50-run-source{
    font-size:clamp(14px,3.7vw,18px)!important;
    line-height:1.48!important;
  }

  body.lvts-mobile-typing-focus .lv50-general-run .lv50-run-input,
  body.lvts-mobile-typing-focus .lv50-general-run .lv50-kruti-preview{
    font-size:clamp(15px,3.9vw,18px)!important;
    line-height:1.5!important;
  }

  body.lvts-mobile-typing-focus .lv50-general-run .lv50-kruti-help,
  body.lvts-mobile-typing-focus .lv50-general-run .lv580-kd-note{
    display:none!important;
  }

  body.lvts-mobile-typing-focus .lv50-general-run .lv50-actions{
    flex:0 0 auto!important;
    margin:6px 0 0!important;
    padding:0!important;
    min-height:42px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    gap:7px!important;
  }

  body.lvts-mobile-typing-focus .lv50-general-run .lv50-actions button{
    min-height:38px!important;
    padding:8px 12px!important;
    font-size:12px!important;
  }

  /* -------------------------------------------------------
   * Exam workspace: it already owns the full viewport.
   * Only mobile vertical geometry is compacted.
   * ------------------------------------------------------- */
  body.lvt-exam-running>.lvt-ws-root[data-lvt-ws]{
    height:100vh!important;
    height:100dvh!important;
    min-height:0!important;
    overflow-y:auto!important;
  }

  body.lvt-exam-running>.lvt-ws-root[data-lvt-ws] .lvt-exam-titlebar{
    min-height:31px!important;
    height:auto!important;
    padding:5px 9px!important;
    font-size:14px!important;
    line-height:1.2!important;
  }

  body.lvt-exam-running>.lvt-ws-root[data-lvt-ws] .lvt-exam-blackbar{
    min-height:24px!important;
    padding:4px 8px!important;
    font-size:12px!important;
    line-height:1.25!important;
  }

  body.lvt-exam-running>.lvt-ws-root[data-lvt-ws] .lvt-exam-controlrow{
    min-height:52px!important;
    padding:5px 10px!important;
    gap:8px!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    align-items:center!important;
  }

  body.lvt-exam-running>.lvt-ws-root[data-lvt-ws] .lvt-candidate-chip{
    display:none!important;
  }

  body.lvt-exam-running>.lvt-ws-root[data-lvt-ws] .lvt-font-controls button{
    padding:6px 8px!important;
    font-size:13px!important;
  }

  body.lvt-exam-running>.lvt-ws-root[data-lvt-ws] .lvt-exam-timer{
    font-size:15px!important;
  }

  body.lvt-exam-running>.lvt-ws-root[data-lvt-ws] .lvt-keyboard-strip{
    min-height:30px!important;
    height:auto!important;
    padding:5px 9px!important;
    gap:12px!important;
    font-size:12px!important;
    line-height:1.2!important;
  }

  body.lvt-exam-running>.lvt-ws-root[data-lvt-ws] .lvt-exam-source{
    width:calc(100% - 12px)!important;
    max-width:calc(100% - 12px)!important;
    height:clamp(145px,38dvh,250px)!important;
    min-height:145px!important;
    max-height:38dvh!important;
    margin:6px 6px 0!important;
    padding:8px 10px!important;
    font-size:clamp(15px,3.5vw,18px)!important;
    line-height:1.38!important;
    overflow-y:auto!important;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
  }

  body.lvt-exam-running>.lvt-ws-root[data-lvt-ws] .lvt-exam-input{
    width:calc(100% - 12px)!important;
    max-width:calc(100% - 12px)!important;
    height:clamp(135px,31dvh,210px)!important;
    min-height:135px!important;
    max-height:31dvh!important;
    margin:8px 6px 0!important;
    padding:10px 11px!important;
    font-size:clamp(15px,3.6vw,18px)!important;
    line-height:1.48!important;
    resize:none!important;
  }

  body.lvt-exam-running>.lvt-template-up_police .lvt-exam-input,
  body.lvt-exam-running>.lvt-template-upsssc .lvt-exam-input,
  body.lvt-exam-running>.lvt-template-ahc .lvt-exam-input{
    height:clamp(135px,31dvh,210px)!important;
    min-height:135px!important;
    max-height:31dvh!important;
    margin-top:8px!important;
  }

  body.lvt-exam-running>.lvt-ws-root[data-lvt-ws] .lvt-exam-actions{
    margin:8px auto 0!important;
    padding:0 10px 8px!important;
    gap:8px!important;
  }

  body.lvt-exam-running>.lvt-ws-root[data-lvt-ws] .lvt-exam-cancel,
  body.lvt-exam-running>.lvt-ws-root[data-lvt-ws] .lvt-exam-submit{
    padding:9px 14px!important;
    font-size:13px!important;
  }

  /* Kruti overlay inherits the same compact answer area. */
  body.lvt-exam-running>.lvt-ws-root[data-lvt-ws].lvt-kruti-mode .lvt-kruti-overlay{
    width:calc(100% - 12px)!important;
    max-width:calc(100% - 12px)!important;
    height:clamp(135px,31dvh,210px)!important;
    min-height:135px!important;
    max-height:31dvh!important;
    margin:8px 6px 0!important;
  }
}

/* Slightly smaller phone portrait: give Target enough reading space but never
 * allow it to push the answer area below the viewport. */
@media (max-width:600px) and (orientation:portrait) and (hover:none) and (pointer:coarse) {
  body.lvts-mobile-typing-focus .lv50-general-run .lv50-run-work{
    grid-template-rows:minmax(115px,39%) minmax(150px,1fr)!important;
  }

  body.lvt-exam-running>.lvt-ws-root[data-lvt-ws] .lvt-exam-source{
    height:clamp(155px,35dvh,230px)!important;
    max-height:35dvh!important;
  }

  body.lvt-exam-running>.lvt-ws-root[data-lvt-ws] .lvt-exam-input,
  body.lvt-exam-running>.lvt-template-up_police .lvt-exam-input,
  body.lvt-exam-running>.lvt-template-upsssc .lvt-exam-input,
  body.lvt-exam-running>.lvt-template-ahc .lvt-exam-input,
  body.lvt-exam-running>.lvt-ws-root[data-lvt-ws].lvt-kruti-mode .lvt-kruti-overlay{
    height:clamp(150px,30dvh,205px)!important;
    min-height:150px!important;
    max-height:30dvh!important;
  }
}

/* Phone/tablet landscape focus:
 * Use horizontal space instead of competing for scarce vertical height.
 * Target stays visible on the left; typing area stays visible on the right.
 * This overrides only the General/Fresh/Speed focus surface.
 */
@media (max-width:1024px) and (orientation:landscape) and (hover:none) and (pointer:coarse) {
  body.lvts-mobile-typing-focus .lv50-general-run{
    height:var(--lvts-mobile-focus-height,100dvh)!important;
    max-height:var(--lvts-mobile-focus-height,100dvh)!important;
    padding:6px 8px 7px!important;
  }

  body.lvts-mobile-typing-focus .lv50-general-run .lv50-lesson-top{
    min-height:27px!important;
    margin-bottom:4px!important;
  }

  body.lvts-mobile-typing-focus .lv50-general-run .lv50-time-pill{
    padding:4px 8px!important;
    font-size:11px!important;
  }

  body.lvts-mobile-typing-focus .lv50-general-run .lv50-run-work{
    grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
    grid-template-rows:minmax(0,1fr)!important;
    gap:8px!important;
    min-height:0!important;
  }

  body.lvts-mobile-typing-focus .lv50-general-run .lv50-run-work>section{
    min-height:0!important;
    height:100%!important;
  }

  body.lvts-mobile-typing-focus .lv50-general-run .lv50-run-source,
  body.lvts-mobile-typing-focus .lv50-general-run .lv50-run-input,
  body.lvts-mobile-typing-focus .lv50-general-run .lv50-kruti-preview{
    height:100%!important;
    min-height:0!important;
    max-height:none!important;
    overflow:auto!important;
  }

  body.lvts-mobile-typing-focus .lv50-general-run .lv50-run-source{
    font-size:clamp(13px,2.15vw,17px)!important;
    line-height:1.4!important;
  }

  body.lvts-mobile-typing-focus .lv50-general-run .lv50-run-input,
  body.lvts-mobile-typing-focus .lv50-general-run .lv50-kruti-preview{
    font-size:clamp(14px,2.3vw,17px)!important;
    line-height:1.45!important;
  }

  body.lvts-mobile-typing-focus .lv50-general-run .lv50-actions{
    min-height:34px!important;
    margin-top:5px!important;
  }

  body.lvts-mobile-typing-focus .lv50-general-run .lv50-actions button{
    min-height:32px!important;
    padding:6px 10px!important;
    font-size:11px!important;
  }
}

