.study-mode-controls { display: flex; align-items: center; gap: 20px; padding: 12px 0; min-width: 0; }
.study-mode-controls .segmented { flex-shrink: 0; }
.study-mode-controls button { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.study-mode-controls svg { width: 18px; height: 18px; }
#copywork-heading { font: 600 16px/1.5 var(--body); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#copywork[hidden], #copywork [hidden], .study-workspace[hidden], #copywork-heading[hidden] { display: none !important; }
body.copywork-focus { background: #f2f4f2; overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
body.copywork-focus button, body.copywork-focus input, body.copywork-focus select, body.copywork-focus summary { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
body.copywork-focus .app-shell { width: 100%; max-width: 1920px; padding: 0 20px; }
body.copywork-focus .study-page-head { min-height: 0; padding: 8px 0; margin: 0; border: 0; }
body.copywork-focus .study-page-title > div, body.copywork-focus .study-page-actions { display: none; }
body.copywork-focus .study-page-title { gap: 0; }
body.copywork-focus .study-page-head { position: absolute; left: 20px; top: 8px; z-index: 2; }
body.copywork-focus .study-mode-controls { height: 76px; padding-left: 56px; padding-block: 12px; }
.copywork-focus .study-workspace { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); grid-template-rows: auto auto minmax(0, 1fr); height: calc(100dvh - 92px); column-gap: 24px; row-gap: 0; align-items: stretch; }
.copywork-focus #copywork, .copywork-focus .copywork-workspace, .copywork-focus .copywork-reader, .copywork-focus .study-video-panel { display: contents; }
.copywork-focus .study-script-panel, .copywork-focus .study-vocab-panel, .copywork-focus #study-ai-panel, .copywork-focus .study-stage-strip { display: none; }
.copywork-writer { min-height: 0; min-width: 0; display: flex; flex-direction: column; border: 0; grid-column: 2; grid-row: 1 / 4; }
.copywork-source-head { grid-column: 1; grid-row: 1; border-top: 3px solid var(--forest); }
#copywork-source, #copywork-covered { grid-column: 1; grid-row: 3; }
.copywork-source-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding-block: 8px; gap: 8px; }
.copywork-source-head h2 { margin: 0; font-size: 17px; font-family: var(--body); }
.copywork-source-head > div { display: flex; gap: 4px; }
#copywork .icon-button, #copywork .copywork-swatch, .copywork-focus .study-page-title .icon-button { width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 10px; border-radius: 4px; background: transparent; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer; }
#copywork .icon-button svg { width: 20px; height: 20px; }
#copywork button:hover:not(:disabled), #copywork summary:hover { background-color: #e1e7e2; }
#copywork button:focus-visible, #copywork summary:focus-visible, #copywork select:focus-visible { outline: 2px solid #32647a; outline-offset: 2px; }
#copywork .icon-button.active { background: var(--forest); color: #fff; }
#copywork button:disabled { opacity: .35; cursor: default; }
.copywork-focus #study-video-pane { min-width: 0; grid-column: 1; grid-row: 2; padding-block: 12px; }
.copywork-focus #study-video-pane[hidden] { display: none; }
.copywork-focus #study-video-pane .study-video { max-height: 24dvh; margin: 0; background: #171914; }
.copywork-focus #study-video-pane video, .copywork-focus #study-video-pane iframe { max-height: 24dvh; object-fit: contain; }
.copywork-focus #study-video-pane .video-sound-row, .copywork-focus #study-video-pane .study-text { display: none; }
.copywork-focus #study-video-pane .video-source-bar { margin: 0 0 8px; }
#copywork-source { min-height: 0; flex: 1; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 0 12px 64px 0; }
.copywork-paragraph { display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: start; gap: 6px 14px; padding: 22px 12px 22px 4px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid #d5ddd7; background: transparent; color: var(--ink); cursor: pointer; border-radius: 0; }
.copywork-paragraph-number { font: 600 11px/2.2 var(--body); color: var(--muted); }
.copywork-english { font: 400 21px/1.85 Georgia, serif; overflow-wrap: anywhere; }
.copywork-bookmark-label { grid-column: 2; font-size: 12px; color: var(--oxblood); visibility: hidden; }
.copywork-paragraph.is-bookmarked { box-shadow: inset 3px 0 var(--oxblood); background: #e8eee9; }
.is-bookmarked .copywork-bookmark-label { visibility: visible; }
#copywork .is-speaking { background: #efe4b6; }
#copywork-covered { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--muted); }
.copywork-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.copywork-tool-group { display: flex; align-items: center; gap: 0; padding-right: 6px; margin-right: 2px; border-right: 1px solid var(--line); }
#copywork .copywork-swatch { width: 44px; position: relative; }
.copywork-swatch::before { content: ''; width: 18px; height: 18px; border-radius: 50%; background: var(--ink-color); }
#copywork .copywork-swatch[aria-pressed="true"] { border-color: var(--ink-color); }
.copywork-size { display: flex; align-items: center; gap: 8px; margin: 0; min-height: 44px; font-size: 12px; color: var(--muted); }
.copywork-size input { width: 76px; padding: 0; accent-color: var(--forest); min-height: 44px; }
.copywork-more { margin-left: auto; position: relative; }
.copywork-more summary { list-style: none; }
.copywork-more summary::-webkit-details-marker { display: none; }
.copywork-menu { position: absolute; right: 0; top: 48px; width: 236px; padding: 12px; background: #fffefa; border: 1px solid var(--line); border-radius: 4px; z-index: 5; box-shadow: 0 8px 24px #17191418; }
.copywork-menu label { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; font-size: 13px; }
.copywork-menu select { width: 146px; margin-left: auto; min-height: 44px; background: transparent; padding: 8px; border: 1px solid var(--line); border-radius: 4px; }
.copywork-menu button { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; background: transparent; text-align: left; cursor: pointer; font-size: 13px; }
.copywork-menu svg { width: 18px; height: 18px; }
.copywork-danger { color: var(--oxblood); }
.copywork-statusbar { min-height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); }
#copywork-save[data-state="saved"]::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #557447; margin-right: 8px; }
#copywork-save[data-state="error"] { color: var(--oxblood); font-weight: 700; }
#copywork-error { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; padding: 8px 12px; background: #f4e5e2; color: #7a3031; font-size: 12px; }
#copywork-error span { flex-basis: 100%; overflow-wrap: anywhere; }
#copywork-error button { min-height: 44px; border: 0; background: transparent; text-decoration: underline; cursor: pointer; color: inherit; }
#copywork-viewport { position: relative; flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0; background: transparent; border: 0; touch-action: none; scrollbar-width: thin; }
#copywork-page-stack { min-width: 0; padding: 0 20px 24px 0; touch-action: none; }
#copywork-canvas { display: block; max-width: none; background: #fffefa; box-shadow: none; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.copywork-paper { display: block; max-width: none; background: #fffefa; box-shadow: none; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.copywork-footer { display: flex; align-items: center; gap: 6px; padding-top: 8px; min-height: 52px; }
.copywork-footer label { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; color: var(--muted); }
.copywork-footer select { width: 56px; min-height: 44px; padding: 8px; border-radius: 4px; border: 1px solid var(--line); background: transparent; }
.copywork-footer-space { flex: 1; }
.copywork-empty { padding: 24px 0; color: var(--muted); }
@media (max-width: 1100px) { .copywork-focus .study-workspace { column-gap: 16px; } .copywork-english { font-size: 19px; } }
@media (orientation: portrait), (max-width: 760px) {
  body.copywork-focus .app-shell { padding: 0 12px; }
  body.copywork-focus .study-page-head { left: 12px; }
  body.copywork-focus .study-mode-controls { gap: 10px; height: 72px; }
  #copywork-heading { font-size: 13px; }
  .copywork-focus .study-workspace { height: calc(100dvh - 84px); grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(60px, .27fr) minmax(0, .73fr); gap: 8px 0; }
  #copywork-source, #copywork-covered { grid-row: 2; }
  .copywork-writer { grid-column: 1; grid-row: 3; }
  .copywork-source-head { padding-block: 0; }
  .copywork-focus #study-video-pane { position: absolute; top: 120px; left: 12px; right: 12px; background: #f2f4f2; z-index: 3; padding: 8px; border: 1px solid var(--line); }
  .copywork-focus #study-video-pane .study-video, .copywork-focus #study-video-pane video, .copywork-focus #study-video-pane iframe { max-height: 28dvh; }
  .copywork-paragraph { padding-block: 12px; gap: 2px 10px; }
  .copywork-english { font-size: 18px; line-height: 1.65; }
  .copywork-toolbar { gap: 2px; padding-block: 4px; }
  .copywork-tool-group { padding-right: 2px; margin-right: 0; }
  .copywork-statusbar { min-height: 26px; }
  .copywork-footer { padding-top: 4px; min-height: 48px; }
  #copywork-covered { flex-direction: row; gap: 12px; }
}

/* The writing surface reaches the right and bottom edges of the viewport. */
body.copywork-focus .app-shell { width: 100%; max-width: none; padding: 0; }
body.copywork-focus .study-mode-controls { height: 64px; padding: 8px 12px 8px 64px; margin: 0; }
body.copywork-focus .study-workspace { position: fixed; inset: 64px 0 0; height: auto; margin: 0; grid-template-columns: minmax(0, .36fr) minmax(0, .64fr); gap: 0; }
body.copywork-focus .copywork-writer { background: #fffefa; padding: 0; margin: 0; border: 0; overflow: hidden; }
body.copywork-focus .copywork-source-head, body.copywork-focus #copywork-source, body.copywork-focus #copywork-covered, body.copywork-focus #study-video-pane { margin-inline: 16px; }
body.copywork-focus .copywork-source-head { border-top: 0; }
.copywork-toolbar { padding: 4px 8px; }
.copywork-statusbar { padding-inline: 12px; }
#copywork-viewport { background: #fffefa; scrollbar-width: none; overflow-anchor: none; }
#copywork-viewport::-webkit-scrollbar { display: none; }
#copywork-page-stack { position: relative; padding: 0; }
.copywork-paper + .copywork-paper { border-top: 1px dashed #b8c2ba; box-sizing: content-box; }
.copywork-footer { padding: 0 8px; min-height: 44px; border-top: 1px solid var(--line); }
.copywork-footer-space { font-size: 11px; color: var(--muted); text-align: center; }
.copywork-save-button { display: inline-flex; align-items: center; gap: 4px; }
.copywork-save-button svg { width: 18px; height: 18px; }
body.copywork-paper-only .copywork-writer { grid-column: 1 / -1; grid-row: 1 / 4; }
body.copywork-paper-only .copywork-source-head, body.copywork-paper-only #copywork-source, body.copywork-paper-only #copywork-covered, body.copywork-paper-only #study-video-pane { display: none !important; }
@media (orientation: portrait), (max-width: 760px) {
  body.copywork-focus .study-workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(40px,.22fr) minmax(0,.78fr); gap: 0; }
  .copywork-footer-space { max-width: 120px; }
  body.copywork-paper-only .copywork-writer { grid-row: 1 / -1; }
}
