/* V2.9 desktop-parity UI layer: viewport workspace, font controls and true Word Mode. */
:root{--practice-font-size:19px}

/* Keep the active test inside the available browser viewport so the footer never falls below it. */
body.practice-active{overflow:hidden}
body.practice-active .practice-container{
  width:min(1500px,calc(100% - 24px));
  height:calc(100dvh - var(--mc-topbar-height,74px));
  max-height:calc(100dvh - var(--mc-topbar-height,74px));
  padding:9px 0;
  overflow:hidden;
}
body.practice-active #portalView,
body.practice-active #practiceView{height:100%;min-height:0}
body.practice-active #practiceView:not(.hidden){
  display:grid;
  grid-template-rows:auto auto minmax(0,1fr) 54px;
  gap:8px;
  overflow:hidden;
}
body.practice-active .practice-head{margin:0;align-items:center;gap:12px}
body.practice-active .practice-head h1{
  margin:2px 0 5px;
  font-size:clamp(24px,2vw,32px)!important;
  line-height:1.08;
  letter-spacing:-.015em;
}
body.practice-active .practice-head .eyebrow{font-size:10px}
body.practice-active .practice-head .chips{gap:6px}
body.practice-active .workspace{height:100%;min-height:0;gap:10px}
body.practice-active .typing-panel{height:100%;min-height:0;min-width:0}
body.practice-active .question-box,
body.practice-active .answer-panel textarea{height:100%;min-height:0;overflow-y:auto;scrollbar-gutter:stable}

/* Desktop V2.9 typography. */
.question-box,
.answer-panel textarea,
.desktop-word-page-text,
.desktop-word-measure-text{
  font-family:Arial,sans-serif!important;
  font-size:var(--practice-font-size)!important;
  line-height:1.58!important;
  tab-size:8;
  -moz-tab-size:8;
}

/* Header-integrated A-/A+ font controls matching the desktop application. */
.panel-title{display:flex;align-items:center;justify-content:space-between;gap:8px}
.desktop-panel-font-controls{display:inline-flex;align-items:center;gap:4px;flex:0 0 auto;margin-left:auto}
.desktop-panel-font-controls button{
  width:31px;min-width:31px;height:29px;padding:0;border:1px solid #a9b7c4;border-radius:6px;
  background:#fff;color:#19334a;font:700 13px Arial,sans-serif;cursor:pointer
}
.desktop-panel-font-controls button:disabled{opacity:.45;cursor:not-allowed}
.desktop-font-value{min-width:43px;text-align:center;font-size:10px;font-weight:900;color:#17344e}

/* Footer is a real viewport row, as in the desktop app. */
body.practice-active .practice-footer{
  min-height:54px;height:54px;margin:0;padding:7px 10px;
  background:#fff;border:1px solid #d6e0e8;border-radius:9px;
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  position:relative;z-index:20;overflow:hidden
}
body.practice-active #typingStatus{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body.practice-active #submitBtn{min-width:150px;flex:0 0 auto}

/* TRUE DESKTOP WORD MODE: hard-copy question + one Word/A4 answer workspace only. */
.desktop-word-mode-panel{display:none;min-width:0;min-height:0;height:100%;grid-template-rows:50px minmax(0,1fr);background:#d9dde1;border:1px solid #ccd9e2;border-radius:10px;overflow:hidden;box-shadow:0 1px 3px rgba(0,0,0,.07)}
body.word-mode-active .workspace.layout-word{grid-template-columns:minmax(0,1fr)!important;grid-template-rows:minmax(0,1fr)!important;min-height:0}
body.word-mode-active .workspace.layout-word .question-panel{display:none!important}
body.word-mode-active .workspace.layout-word .answer-panel{
  position:fixed!important;left:-12000px!important;top:0!important;width:4px!important;height:4px!important;
  opacity:.001!important;pointer-events:none!important;overflow:hidden!important;border:0!important;box-shadow:none!important
}
body.word-mode-active .workspace.layout-word .answer-panel .panel-title{display:none!important}
body.word-mode-active .workspace.layout-word #answerBox{width:2px!important;height:2px!important;min-width:2px!important;min-height:2px!important;padding:0!important;overflow:hidden!important}
body.word-mode-active .desktop-word-mode-panel{display:grid}
body.word-mode-active .practice-head h1{font-size:clamp(21px,1.65vw,27px)!important}

.desktop-word-mode-head{
  padding:7px 11px 7px 13px;background:#e5ebf1;border-bottom:1px solid #ccd9e2;
  display:flex;justify-content:space-between;align-items:center;gap:8px;color:#24394d;font-size:13px;font-weight:800
}
.desktop-word-head-right{min-width:0;display:flex;align-items:center;justify-content:flex-end;gap:9px}
.desktop-word-hint{font-size:11px;font-weight:400;color:#667582;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.desktop-word-scroll-area{min-height:0;overflow:auto;background:#d5d9dd;padding:30px 0 58px;scroll-behavior:auto;cursor:text}
.desktop-word-pages{width:100%;display:flex;flex-direction:column;align-items:center;gap:30px}
.desktop-word-page{
  width:72vw;aspect-ratio:210/297;box-sizing:border-box;
  padding:clamp(66px,5.2vw,104px) clamp(72px,5.7vw,114px);
  background:#fff;border:1px solid #c8c8c8;box-shadow:0 2px 10px rgba(0,0,0,.18);flex:0 0 auto
}
.desktop-word-page-text{width:100%;height:100%;overflow:hidden;white-space:pre-wrap;overflow-wrap:anywhere;color:#111;user-select:none;cursor:text}
.desktop-word-caret{display:inline-block;width:1.5px;height:1.15em;margin-left:1px;background:#111;vertical-align:-.18em;animation:desktopWordCaretBlink 1.05s steps(1,end) infinite}
@keyframes desktopWordCaretBlink{0%,48%{opacity:1}49%,100%{opacity:0}}
.desktop-word-measure-page{position:fixed;left:-200vw;top:0;visibility:hidden;pointer-events:none;z-index:-1;box-shadow:none}

/* Smaller laptop refinements. */
@media(max-width:1100px){
  body.practice-active .practice-head h1{font-size:clamp(22px,2.4vw,28px)!important}
  .desktop-word-hint{max-width:360px}
}
@media(max-width:900px){
  body.practice-active .practice-head h1{font-size:24px!important}
  body.practice-active .practice-actions-top{gap:6px}
  body.practice-active .timer-card{min-width:132px}
  .desktop-word-page{width:82vw}
  .desktop-word-hint{display:none}
}
@media(max-width:720px){
  body.practice-active{overflow:auto}
  body.practice-active .practice-container{height:auto;max-height:none;overflow:visible;padding:8px 0}
  body.practice-active #practiceView:not(.hidden){display:block;overflow:visible}
  body.practice-active .workspace{height:auto;min-height:0}
  body.practice-active .workspace.layout-vertical{grid-template-columns:1fr}
  body.practice-active .typing-panel{height:400px;margin-bottom:10px}
  body.practice-active .practice-footer{position:sticky;bottom:6px;height:auto;min-height:54px;margin-top:8px;box-shadow:0 3px 18px rgba(17,39,59,.16)}
  body.practice-active #submitBtn{min-width:128px}
  .desktop-word-mode-panel{height:620px;margin-bottom:10px}
  .desktop-word-page{width:92vw;padding:48px 42px}
}
