/* Scoped to the active writing workspace; the homepage and existing sidebar keep their styles. */
body[data-mock-view="exam"][data-mock-section="writing"] .shell-main { display: block; }
body[data-mock-view="exam"][data-mock-section="writing"] .page-frame { padding: 18px 28px 90px; }
body[data-mock-view="exam"][data-mock-section="writing"] .workspace-card { background: transparent; border: 0; box-shadow: none; overflow: visible; border-radius: 0; gap: 0; }
body[data-mock-view="exam"][data-mock-section="writing"] .page-header { width: 100%; grid-template-columns: minmax(0,1fr); justify-content: stretch; padding: 0; background: transparent; border: 0; box-shadow: none; border-radius: 0; }
body[data-mock-view="exam"][data-mock-section="writing"] .page-body { padding: 0; min-height: 0; }
body[data-mock-view="exam"][data-mock-section="writing"] .page-footer { position: fixed; left: var(--sidebar-collapsed-width); right: 0; bottom: var(--ww-keyboard-bottom,0px); z-index: 12; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin: 0; padding: 14px 28px max(14px,env(safe-area-inset-bottom)); background: var(--surface-soft-strong); border: 0; border-top: 1px solid var(--card-border); border-radius: 0; box-shadow: none; backdrop-filter: blur(20px); }
body[data-mock-view="exam"][data-mock-section="writing"] .official-site-footer { display: none; }
.ww-session { display: flex; align-items: center; gap: 24px; border: 1px solid var(--card-border); border-radius: 24px; padding: 18px 24px; background: var(--card-surface); box-shadow: var(--shadow-card); }
.ww-session-title { flex: 0 0 auto; }
.ww-session-title h1 { margin: 0; color: var(--ink-strong); font-size: 26px; font-weight: 750; letter-spacing: -.04em; line-height: 1.2; }
.ww-session-title p { font-size: 13px; color: var(--muted); margin: 5px 0 0; }
.ww-tasks { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ww-tasks .part-chip { padding: 10px 19px; border-radius: 999px; font-size: 14px; }
.ww-tasks .part-chip span { margin-left: 6px; }
.ww-session-actions { margin-left: auto; display: flex; gap: 16px; align-items: center; }
.ww-session .timer-badge { display: flex; align-items: center; gap: 12px; font-size: 12px; padding: 9px 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ww-session .timer-badge strong { color: var(--ink-strong); font-size: 26px; line-height: 1.1; }
.ww-session .timer-badge--urgent strong,.ww-session .timer-badge--critical strong { color: var(--red); }
.ww-pill { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 7px 14px; border: 1px solid var(--pill-border); border-radius: 999px; background: var(--card-surface-soft); color: var(--ink); font: inherit; font-size: 13px; line-height: 1.3; cursor: pointer; box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 3px 8px rgba(77,54,34,.035); white-space: nowrap; }
.ww-pill:hover { background: var(--sidebar-button-hover-bg); border-color: var(--button-light); }
.ww-pill[aria-pressed="true"] { color: var(--sidebar-button-active-text); border-color: var(--button-light); background: var(--sidebar-button-hover-bg); }
.ww-pill:disabled { opacity: .45; cursor: default; }
.ww-pill svg { width: 16px; height: 16px; flex-shrink: 0; }
.ww-pill:focus-visible,.ww-workspace input:focus-visible,.ww-workspace summary:focus-visible,.ww-divider:focus-visible { outline: 2px solid var(--button); outline-offset: 3px; }
.ww-workspace { display: grid; grid-template-columns: minmax(0,var(--ww-prompt-ratio)) 20px minmax(0,1fr); gap: 0; margin: 18px 0 16px; align-items: stretch; }
.ww-panel { min-width: 0; border: 1px solid var(--card-border); border-radius: 22px; background: var(--card-surface); box-shadow: var(--shadow-card); overflow: hidden; }
.ww-prompt { display: flex; flex-direction: column; }
.ww-panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 17px 22px; border-bottom: 1px solid var(--line); }
.ww-panel h2 { color: var(--ink-strong); font-size: 18px; margin: 0; font-weight: 750; line-height: 1.35; }
.ww-prompt-content { padding: 0 22px 20px; }
.ww-prompt-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 14px 0; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.ww-font,.ww-translation { display: flex; align-items: center; gap: 8px; color: var(--ink-strong); font-size: 12px; }
.ww-font > span,.ww-translation > span { white-space: nowrap; }
.ww-font-buttons,.ww-segment { display: flex; gap: 3px; align-items: center; }
.ww-font .ww-pill { padding: 6px 10px; min-width: 34px; min-height: 32px; font-size: 13px; }
.ww-font output { min-width: 24px; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.ww-segment { border: 1px solid var(--pill-border); border-radius: 999px; gap: 0; }
.ww-segment .ww-pill { min-height: 32px; border-color: transparent; box-shadow: none; background: transparent; padding: 5px 11px; }
.ww-segment .ww-pill[aria-pressed="true"] { border-color: var(--button-light); background: var(--sidebar-button-hover-bg); }
.ww-source { font-size: var(--ww-prompt-size); line-height: 1.65; overflow-wrap: anywhere; }
.ww-source p { margin: 0 0 15px; }
.ww-source > h3 { color: var(--ink-strong); font-size: calc(var(--ww-prompt-size) * 1.2); margin: 0 0 12px; line-height: 1.4; }
.ww-source .ww-helper { color: var(--muted); margin: 4px 0 14px; font-size: .94em; line-height: 1.7; }
.ww-check .ww-helper,.ww-choice .ww-helper { margin-bottom: 0; }
.ww-original { white-space: pre-wrap; }
.ww-prompt-heading { padding-top: 4px; }
.ww-prompt-heading > p { font-weight: 600; }
.ww-requirements { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.ww-section-label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ww-section-label h3 { margin: 0; font-size: 16px; color: var(--ink-strong); }
.ww-section-label > span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.ww-check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; cursor: pointer; }
.ww-check input,.ww-choice input { accent-color: var(--green); margin: 4px 0 0; width: 18px; height: 18px; flex-shrink: 0; }
.ww-small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.ww-source .ww-small { margin: 14px 0 0; }
.ww-word-guidance { color: var(--muted); font-size: .87em; }
.ww-options { margin: 16px 0; padding: 16px 0 0; border: 0; border-top: 1px solid var(--line); min-width: 0; }
.ww-options legend { padding: 0 8px 0 0; color: var(--ink-strong); font-size: 15px; font-weight: 700; }
.ww-choice { display: flex; align-items: flex-start; gap: 10px; padding: 13px; margin: 8px 0; border: 1px solid var(--pill-border); border-radius: 14px; cursor: pointer; }
.ww-choice:has(input:checked) { border-color: var(--button-light); background: var(--sidebar-button-hover-bg); }
.ww-plan { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.ww-plan summary { cursor: pointer; color: var(--ink-strong); font-size: 15px; font-weight: 650; }
.ww-plan summary span { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 10px; }
.ww-plan textarea { width: 100%; min-height: 100px; padding: 12px; resize: vertical; color: var(--ink); background: var(--surface-soft); border: 1px solid var(--pill-border); border-radius: 12px; font: inherit; font-size: 14px; line-height: 1.55; margin-top: 12px; }
.ww-plan textarea:focus-visible { outline: 2px solid var(--button); outline-offset: -2px; }
.ww-divider { display: grid; place-items: center; color: var(--muted); cursor: col-resize; touch-action: none; user-select: none; font-size: 22px; }
.ww-divider:hover { color: var(--button); }
.ww-answer { display: flex; flex-direction: column; min-height: 580px; }
.ww-answer-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 17px 22px; border-bottom: 1px solid var(--line); }
.ww-answer-heading > div:first-child { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; }
.ww-save { font-size: 11px; color: var(--muted); }
.ww-save::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 100%; background: var(--status-ok); margin-right: 7px; vertical-align: 1px; }
.ww-save[data-error="true"],.ww-error { color: var(--status-error); }
.ww-save[data-error="true"]::before { background: var(--status-error); }
.ww-answer-tools { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.ww-editor { flex: 1; display: flex; flex-direction: column; min-height: 340px; padding: 16px 22px 0; }
.ww-editor .writing-textarea { display: block; width: 100%; flex: 1; min-height: 420px; resize: vertical; border: 0; border-radius: 4px; box-shadow: none; background: transparent; color: var(--ink-strong); padding: 4px 0 16px; font-family: var(--body-font); font-size: var(--ww-answer-size); line-height: 1.75; }
.ww-editor .writing-textarea:focus { outline: 0; }
.ww-editor:focus-within { box-shadow: inset 3px 0 0 var(--button-light); }
.ww-editor .writing-spell-shell { display: flex; flex: 1; min-height: 0; background: transparent; border-radius: 0; }
.ww-editor .writing-spell-mirror { border-radius: 0; }
.ww-editor-status { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 10px 16px; padding: 12px 22px; border-top: 1px solid var(--line); }
.ww-editor-status [data-ww-word-status] { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-left: auto; }
.ww-count { color: var(--ink-strong); font-size: 14px; }
.ww-count strong { font-size: 18px; }
.ww-count-state { color: var(--amber); font-size: 11px; }
.ww-count.is-good ~ .ww-count-state { color: var(--status-ok); }
.ww-editor-status .writing-spell-tools { margin: 0; gap: 8px; font-size: 11px; }
.ww-editor-status .writing-spell-tools button { border-radius: 999px; padding: 6px 12px; min-height: 34px; background: var(--card-surface); color: var(--ink); }
.ww-editor-status .writing-spell-tools > span { max-width: 190px; font-size: 10px; line-height: 1.4; }
.ww-footer-note { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--ink); }
.ww-footer-note svg { width: 24px; height: 24px; }
.ww-footer-note small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.ww-footer-note [data-ww-saved] { font-weight: 600; }
body[data-mock-view="exam"][data-mock-section="writing"] .footer-actions { display: flex; flex-wrap: nowrap; width: auto; gap: 12px; }
body[data-mock-view="exam"][data-mock-section="writing"] .footer-actions .ww-pill { min-height: 44px; padding-inline: 24px; font-size: 14px; }
body[data-mock-view="exam"][data-mock-section="writing"] .footer-actions .control-button { width: auto; min-height: 44px; font-size: 14px; padding-inline: 26px; }
.ww-notice,.ww-recovery { font-size: 13px; padding: 10px 12px; background: var(--surface-soft); border: 1px solid var(--pill-border); border-radius: 12px; }
.ww-recovery { margin: 12px 22px 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ww-instructions { margin-top: 10px; padding: 16px 22px; border: 1px solid var(--pill-border); border-radius: 18px; background: var(--card-surface); font-size: 14px; line-height: 1.65; }
.ww-instructions p { margin: 0 0 8px; }
body[data-mock-view="exam"][data-mock-section="writing"] .toast-stack { bottom: calc(90px + var(--ww-keyboard-bottom,0px)); left: calc(var(--sidebar-collapsed-width) + 20px); right: 20px; max-width: 460px; }
.ww-mobile-switch,.ww-mobile-peek,.ww-mobile-settings { display: none; }
.ww-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.ww-workspace[data-ww-collapsed="true"] .ww-prompt-content { display: none; }
.ww-workspace[data-ww-focus="true"] { grid-template-columns: 1fr; }
.ww-workspace[data-ww-focus="true"] .ww-prompt,.ww-workspace[data-ww-focus="true"] .ww-divider { display: none; }
.ww-workspace[data-ww-focus="true"] .ww-editor { min-height: 60dvh; }
:is(.ww-instructions,.ww-mobile-settings)[hidden] { display: none !important; }

@media (min-width: 1081px) {
  .ww-workspace { height: max(460px,calc(100dvh - 280px)); }
  .ww-prompt-content { overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .ww-answer { min-height: 0; }
  .ww-editor { min-height: 0; }
  .ww-editor .writing-textarea { min-height: 0; resize: none; height: 100%; }
  .ww-prompt .ww-panel-heading > button { display: none; }
  .ww-workspace[data-ww-collapsed="true"] .ww-prompt-content { display: block; }
}
@media (min-width: 721px) and (max-width: 1080px) {
  body[data-mock-view="exam"][data-mock-section="writing"] .topbar { padding: 16px 20px 0; }
  body[data-mock-view="exam"][data-mock-section="writing"] .topbar-meta { gap: 10px; flex-wrap: wrap; }
  body[data-mock-view="exam"][data-mock-section="writing"] .page-frame { padding: 16px 20px 90px; }
  body[data-mock-view="exam"][data-mock-section="writing"] .page-footer { padding-inline: 20px; }
  .ww-session { flex-wrap: wrap; gap: 12px; padding: 16px 20px; }
  .ww-session-title h1 { font-size: 23px; }
  .ww-session-actions { gap: 8px; }
  .ww-session-actions > .ww-pill { display: none; }
  .ww-session .timer-badge { flex-direction: column; gap: 2px; padding: 8px 13px; }
  .ww-workspace { grid-template-columns: 1fr; grid-template-rows: minmax(180px,.9fr) minmax(260px,1fr); gap: 14px; height: max(600px,calc(100dvh - 275px)); }
  .ww-divider { display: none; }
  .ww-prompt-content { padding: 0 20px 16px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .ww-panel-heading,.ww-answer-heading { padding: 14px 20px; }
  .ww-source { line-height: 1.6; }
  .ww-source p { margin-bottom: 10px; }
  .ww-requirements { margin-top: 12px; padding-top: 12px; }
  .ww-check { margin: 7px 0; }
  .ww-plan { margin-top: 12px; padding-top: 10px; }
  .ww-answer { min-height: 0; }
  .ww-editor { min-height: 0; }
  .ww-editor .writing-textarea { min-height: 0; height: 100%; resize: none; }
  .ww-workspace[data-ww-collapsed="true"] { grid-template-rows: auto minmax(300px,1fr); }
  .ww-workspace[data-ww-focus="true"] { grid-template-rows: minmax(300px,1fr); }
  .ww-footer-note { max-width: 35%; }
  .ww-footer-note svg { display: none; }
}
@media (max-width: 720px) {
  body[data-mock-view="exam"][data-mock-section="writing"] .topbar { padding: 10px 12px 0; }
  body[data-mock-view="exam"][data-mock-section="writing"] .topbar-meta { width: 100%; gap: 8px; flex-wrap: nowrap; }
  body[data-mock-view="exam"][data-mock-section="writing"] .topbar-label { display: inline-flex; min-width: 0; font-size: 11px; padding: 8px 10px; white-space: nowrap; }
  body[data-mock-view="exam"][data-mock-section="writing"] .topbar-product { display: none; }
  body[data-mock-view="exam"][data-mock-section="writing"] .topbar-leave-button { margin-left: auto; order: 3; width: auto; min-width: 0; padding: 8px 12px; font-size: 12px; }
  body[data-mock-view="exam"][data-mock-section="writing"] .sidebar-toggle { width: 38px; height: 38px; border-radius: 14px; flex-shrink: 0; }
  body[data-mock-view="exam"][data-mock-section="writing"] .page-frame { padding: 12px 12px 80px; }
  body[data-mock-view="exam"][data-mock-section="writing"] .page-footer { left: 0; padding: 10px 12px max(10px,env(safe-area-inset-bottom)); gap: 8px; }
  .ww-session { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 14px 16px; border-radius: 20px; }
  .ww-session-title h1 { font-size: 23px; }
  .ww-session-title p { font-size: 12px; }
  .ww-session-actions { grid-column: 2; grid-row: 1; margin: 0; }
  .ww-session-actions > .ww-pill { display: none; }
  .ww-session .timer-badge { flex-direction: column; gap: 3px; padding: 6px 12px; font-size: 10px; }
  .ww-session .timer-badge strong { font-size: 24px; }
  .ww-tasks { grid-column: 1/-1; display: flex; gap: 8px; }
  .ww-tasks .part-chip { flex: 1; min-height: 40px; padding: 9px 12px; font-size: 14px; }
  .ww-workspace { grid-template-columns: minmax(0,1fr); gap: 12px; margin: 12px 0; }
  .ww-mobile-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; border: 1px solid var(--pill-border); background: var(--card-surface); padding: 3px; border-radius: 999px; }
  .ww-mobile-switch .ww-pill { font-size: 14px; min-height: 40px; border-color: transparent; background: transparent; box-shadow: none; }
  .ww-mobile-switch .ww-pill[aria-pressed="true"] { background: var(--sidebar-button-hover-bg); border-color: var(--button-light); }
  .ww-mobile-peek { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
  .ww-mobile-peek .ww-pill { font-size: 11px; padding: 6px 10px; min-height: 36px; }
  .ww-mobile-peek .ww-pill svg { width: 13px; }
  .ww-mobile-settings { display: grid; gap: 10px; border: 1px solid var(--pill-border); border-radius: 18px; padding: 12px; background: var(--card-surface); }
  .ww-mobile-settings > div:first-child { display: flex; flex-wrap: wrap; gap: 10px 14px; }
  .ww-mobile-settings .ww-font { font-size: 11px; gap: 4px; }
  .ww-mobile-settings .ww-font .ww-pill { min-width: 30px; padding: 6px; }
  .ww-mobile-settings .ww-font output { min-width: 18px; }
  .ww-mobile-settings .ww-translation { padding-top: 10px; border-top: 1px solid var(--line); }
  .ww-panel { border-radius: 20px; }
  .ww-workspace[data-ww-pane="answer"] .ww-prompt { display: none; }
  .ww-workspace[data-ww-pane="prompt"] .ww-answer { display: none; }
  .ww-workspace[data-ww-pane="prompt"] .ww-mobile-peek > button:first-child { visibility: hidden; width: 0; padding: 0; }
  .ww-divider { display: none; }
  .ww-panel-heading { padding: 14px 16px; }
  .ww-panel-heading > button { display: none; }
  .ww-prompt-content { padding: 0 16px 16px; }
  .ww-workspace .ww-prompt-content { display: block; }
  .ww-prompt-tools { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 0; }
  .ww-prompt-tools .ww-translation { width: 100%; }
  .ww-panel h2 { font-size: 17px; }
  .ww-answer { height: max(300px,calc(100dvh - 400px)); min-height: 0; }
  .ww-workspace:has(.ww-mobile-settings:not([hidden])) .ww-answer { height: max(292px,calc(100dvh - 518px)); }
  .ww-answer-heading { padding: 13px 16px; flex-wrap: nowrap; align-items: flex-start; }
  .ww-answer-heading > div:first-child { gap: 4px; flex-direction: column; align-items: flex-start; }
  .ww-answer-heading .ww-save { font-size: 10px; }
  .ww-answer-tools { gap: 6px; }
  .ww-answer-tools .ww-font { display: none; }
  .ww-answer-tools .ww-pill { padding: 7px 10px; font-size: 12px; min-height: 36px; }
  .ww-editor { padding: 12px 16px 0; min-height: 0; }
  .ww-editor .writing-textarea { min-height: 0; height: 100%; resize: none; }
  .ww-editor-status { padding: 10px 14px; gap: 8px; }
  .ww-editor-status .writing-spell-tools > span { display: none; }
  .ww-editor-status [data-ww-word-status] { gap: 4px 8px; }
  .ww-editor-status .ww-count-state { display: none; }
  .ww-editor-status .ww-small { font-size: 10px; }
  .ww-count strong { font-size: 16px; }
  .ww-footer-note { display: none; }
  body[data-mock-view="exam"][data-mock-section="writing"]:has(.celpip-analytics-settings) .page-footer { padding-left: 96px; }
  body[data-mock-view="exam"][data-mock-section="writing"] .celpip-analytics-settings { width: 76px; padding-inline: 6px; font-size: 10px; bottom: calc(8px + var(--ww-keyboard-bottom,0px)); }
  body[data-mock-view="exam"][data-mock-section="writing"] .footer-actions { width: 100%; gap: 10px; }
  body[data-mock-view="exam"][data-mock-section="writing"] .footer-actions > button { flex: 1; min-width: 0; min-height: 46px; padding-inline: 12px; font-size: 14px; }
  .ww-workspace[data-ww-focus="true"] .ww-mobile-peek,.ww-workspace[data-ww-focus="true"] .ww-mobile-settings { display: none; }
  .ww-workspace[data-ww-focus="true"] .ww-answer { display: flex; }
  .ww-instructions { font-size: 13px; padding: 14px; }
  .ww-recovery { margin-inline: 16px; }
  body[data-mock-view="exam"][data-mock-section="writing"] .toast-stack { left: 12px; right: 12px; bottom: calc(78px + var(--ww-keyboard-bottom,0px)); max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .ww-workspace *, .ww-session * { transition: none !important; } }
