.scene-shell h1 { font-size: 18px; margin: 16px 0; }
.scene-form, .scene-tools, .scene-library-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0; }
.scene-form input, .scene-form select { min-width: 0; flex: 1; width: 180px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-raised); color: var(--ink); font-size: 16px; }
.scene-library-tools .scene-form { flex: 1; margin: 0; }
.scene-list, .scene-expressions { padding: 0; list-style: none; }
.scene-list li, .scene-expressions > li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.scene-list a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; color: var(--ink); text-decoration: none; }
.scene-list small, .scene-meaning { color: var(--muted); }
.scenes-page .scene-expressions > li { position: relative; padding: 8px 0; }
.scenes-page .scene-expressions .scene-meaning { padding-right: 44px; }
.scene-entry-menu { margin: 0; }
.scene-entry-menu > summary { display: flex; align-items: center; justify-content: center; width: 44px; min-height: 32px; margin-left: auto; color: var(--muted); cursor: pointer; list-style: none; border-radius: 4px; }
.scene-entry-menu > summary::-webkit-details-marker { display: none; }
.scene-entry-menu:not([open]) > summary { position: absolute; right: 0; bottom: 4px; }
.scene-entry-menu > summary svg { transition: transform 140ms ease; }
.scene-entry-menu[open] > summary svg { transform: rotate(180deg); }
.scene-expressions p { margin: 4px 0; font-size: 14px; line-height: 1.5; }
.scene-entry-actions, .scene-sort-actions { display: flex; gap: 12px; align-items: center; }
.scene-shell .inline-action, .scene-add-action, .scene-library-tools .inline-action, .scene-picker .inline-action { font-size: 12px; }
.scene-expressions .text-danger { font-size: 12px; min-height: 44px; }
.scene-add-action { margin: 6px 0 0; }
.scene-manage summary { min-height: 44px; padding: 12px 0; cursor: pointer; }
.scene-drag { touch-action: none; min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: transparent; cursor: grab; }
.scene-expressions .is-dragging { background: var(--blue-soft); outline: 1px solid var(--blue); }
.scene-shell [data-scene-feedback]:empty, .scene-picker [data-picker-feedback]:empty { display: none; }
.history-extras { position: relative; margin-top: 4px; min-height: 44px; }
.history-learning summary { display: flex; align-items: center; width: fit-content; max-width: calc(100% - 90px); min-height: 44px; color: var(--blue-dark); font-size: 12px; cursor: pointer; list-style: none; }
.history-learning summary::-webkit-details-marker { display: none; }
.history-learning .when-open, .history-learning[open] .when-closed { display: none; }
.history-learning[open] .when-open { display: inline; }
.history-scene-button { position: absolute; top: 0; right: 0; display: flex; align-items: center; min-height: 44px; padding: 0; background: transparent; border: 0; color: var(--blue-dark); font: inherit; cursor: pointer; }
.history-scene-button span { display: inline-block; padding: 3px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; line-height: 20px; }
.recent-list .history-scene-button span, .recent-list .history-learning summary span { color: var(--blue-dark); font-size: 12px; }
.history-learning-content { padding: 4px 0 8px; }
.history-point { margin-top: 12px; }
.history-learning-content h3 { margin: 0 0 4px; font-size: 14px; line-height: 1.5; }
.history-learning-content p, .recent-list .history-learning-content p { margin: 4px 0; font-size: 14px; line-height: 1.5; }
.history-learning summary { gap: 5px; }
.history-chevron { flex: 0 0 14px; }
.history-learning[open] .history-chevron { transform: rotate(180deg); }
.history-learning-content .history-point h3 { color: #102039; font-weight: 750; }
.history-learning-content .history-example p { color: #59677a; }
.history-learning-content .lookup-word { color: inherit; font: inherit; }
.expression-page .composer-actions > div { margin-left: auto; justify-content: flex-end; }
/* Bottom clearance is shared by every page through .app-main. */
.history-footer { margin-top: 20px; padding-bottom: 0; }
.history-footer > a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.history-pagination { margin-top: 20px; padding-bottom: 0; }
.history-pagination-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.history-pagination :is(a, [aria-current="page"], .is-disabled) { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--blue-dark); background: var(--paper-raised); text-decoration: none; font-size: 13px; }
.history-pagination .is-disabled { color: var(--muted); background: transparent; border-color: transparent; }
.history-pagination-count, .history-pagination-hint { color: var(--muted); font-size: 12px; }
.history-pagination-numbers { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; margin-top: 10px; }
.history-pagination [aria-current="page"] { background: var(--blue); border-color: var(--blue); color: white; font-weight: 700; }
.pagination-ellipsis { color: var(--muted); padding-inline: 3px; }
.history-pagination-hint { margin: 8px 0 0; text-align: center; }
.scene-sort-hint { margin: 8px 0; color: var(--muted); font-size: 11px; }
.scenes-page .scene-expressions { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.app-header .header-page-title { font-size: 16px; line-height: 1.4; margin: 0 auto 0 12px; white-space: nowrap; }
.app-header:has(.header-page-title) .wordmark strong { display: none; }
.reviews-page .app-main, .review-card-page .app-main { padding-top: 10px; }
.review-practice > .back-link { min-height: 36px; margin: 0; }
.review-practice .recall-progress { margin: 6px 0 14px; padding-top: 8px; }
.review-practice .review-complete .back-link { margin-left: 12px; }
.review-practice .practice-history { margin-top: 12px; }
.review-practice .practice-history-entry { padding: 8px 0; border-bottom: 1px solid var(--line); }
.review-practice .practice-history-entry small { font-size: 11px; color: var(--muted); }
.learning-page .library-summary { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.learning-page .library-summary > button, .learning-page .library-summary > a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-width: 0; min-height: 60px; padding: 8px 2px; font-size: 12px; text-align: center; text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; background: transparent; }
.learning-page .library-summary > button[aria-pressed="true"] { background: var(--blue-soft); border-color: var(--blue); color: var(--blue-dark); }
.learning-page .library-summary strong { font-size: 14px; }
.learning-page .learning-card-topline .learning-actions { margin-left: auto; justify-content: flex-end; }
.library-scene-filter { margin: 8px 0 16px; }
.library-scene-filter > summary { font-size: 12px; color: var(--muted); cursor: pointer; min-height: 32px; padding: 6px 0; }
.scenes-page .app-main { padding-top: 10px; }
.scenes-page .scene-shell > .back-link { margin: 0; min-height: 36px; display: inline-flex; align-items: center; }
.scenes-page .scene-shell h1 { margin: 4px 0 10px; font-size: 17px; line-height: 1.4; }
.scenes-page .scene-tools { gap: 8px; margin: 8px 0; }
.scenes-page .scene-shell .inline-action { display: inline-flex; align-items: center; justify-content: center; padding: 6px 10px; min-height: 36px; border-radius: 6px; text-decoration: none; line-height: 20px; }
.scenes-page .scene-shell .scene-primary { background: var(--blue); border-color: var(--blue); color: white; }
.scenes-page .scene-form { gap: 8px; margin: 8px 0; }
.scenes-page .scene-form input { min-height: 38px; padding: 6px 10px; border-radius: 6px; box-shadow: none; }
.scenes-page .scene-list { margin: 12px 0; }
.scenes-page .scene-list li { padding: 6px 0; }
.scenes-page .scene-entry-actions, .scenes-page .scene-sort-actions { justify-content: flex-end; gap: 8px; margin: 6px 0; }
.scenes-page .scene-drag { min-width: 36px; min-height: 36px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; }
.scene-return-link { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 6px; color: var(--blue-dark); font-size: 13px; text-decoration: none; }
.speech-controls .speech-speed-row { gap: 12px; align-items: center; }
.speech-controls .speech-speed-stepper { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 6px; }
.speech-controls .speech-speed-stepper output { min-width: 38px; }
.confirm-dialog { width: min(320px, calc(100vw - 40px)); padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-raised); color: var(--ink); margin: auto; box-sizing: border-box; }
.confirm-dialog::backdrop { background: rgb(23 37 61 / 32%); }
.confirm-dialog h2 { margin: 0 0 10px; font-size: 16px; line-height: 1.5; }
.confirm-dialog p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--muted); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.confirm-actions button { min-height: 44px; padding: 6px 16px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; color: var(--ink); background: transparent; cursor: pointer; }
.confirm-actions .confirm-danger { background: var(--danger); border-color: var(--danger); color: white; }
.confirm-actions button:active { filter: brightness(.9); }
.learning-page .library-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 10px; }
.learning-page .library-summary > button, .learning-page .library-summary > a { min-height: 44px; padding: 5px 2px; gap: 1px; border-radius: 6px; }
.learning-page .library-summary > :nth-child(1) { background: #edf0f7; }
.learning-page .library-summary > :nth-child(2) { background: #eaf2ee; }
.learning-page .library-summary > :nth-child(3) { background: #f4eee5; }
.learning-page .library-summary > :nth-child(4) { background: #efedf5; }
.learning-page .library-summary > button[aria-pressed="true"] { background: #dbe6fc; border-color: var(--blue); }
.learning-page .library-summary > :active { filter: brightness(.92); }
.library-status-filters { display: flex; gap: 12px; margin: 0 0 16px; }
.library-status-filters button { min-height: 40px; padding: 4px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.library-status-filters button[aria-pressed="true"] { color: var(--blue-dark); background: var(--blue-soft); }
.status-completed { background: #eaf2ee; color: var(--success); }
.review-practice .recall-prompt { padding: 0; border: 0; }
.review-practice h1, .review-practice h2 { font-size: 16px; margin: 12px 0 8px; }
.review-practice p { font-size: 14px; line-height: 1.6; margin: 6px 0; white-space: pre-wrap; }
.review-practice .practice-target { font-weight: 700; color: var(--blue-dark); }
.practice-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0; margin: 6px 0; }
.practice-actions > [data-toggle-original] { padding-inline: 4px; }
.review-practice .practice-actions > .speaker-button { display: inline-flex; align-items: center; justify-content: flex-start; padding-left: 4px; }
.review-practice .inline-action, .review-practice .primary-button { font-size: 12px; border-radius: 6px; }
.review-practice summary { font-size: 12px; color: var(--muted); min-height: 36px; padding: 8px 0; cursor: pointer; }
.practice-application { border-top: 1px solid var(--line); margin: 16px 0; padding-top: 6px; }
.review-practice textarea { width: 100%; box-sizing: border-box; font-size: 16px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-raised); }
.review-practice .rating-fieldset button { font-size: 12px; border-radius: 6px; }
.review-practice [data-critique-status]:empty { display: none; }
.review-practice mark { background: var(--blue-soft); color: var(--blue-dark); font-weight: 700; border-radius: 2px; }
.scenes-page .scene-shell .scene-entry-actions { margin: 0; gap: 12px; justify-content: flex-end; }
.scenes-page .scene-shell .scene-entry-actions > button { min-height: 32px; padding: 3px 4px; border: 0; border-radius: 4px; background: transparent; font-size: 11px; line-height: 18px; font-weight: 400; color: var(--muted); box-shadow: none; }
.scenes-page .scene-shell .scene-entry-actions > button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.scenes-page .scene-tools, .scenes-page .scene-form { justify-content: flex-end; }
.scenes-page [data-delete-scene] { display: block; margin-left: auto; }
.scene-expressions { position: relative; }
.scene-expressions > li { position: relative; }
.scene-expressions > li.is-dragging { z-index: 5; background: var(--paper-raised); box-shadow: 0 5px 15px rgb(23 37 61 / 12%); pointer-events: none; }
.scene-drag, .scene-drag * { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.scenes-page button, .scenes-page a.inline-action { transition: transform 100ms ease-out, filter 100ms ease-out; }
.scenes-page button:active, .scenes-page a.inline-action:active { transform: scale(.96); filter: brightness(.9); }
@media (prefers-reduced-motion: reduce) {
    .scenes-page button, .scenes-page a.inline-action { transition: none; }
    .scenes-page button:active, .scenes-page a.inline-action:active { transform: none; }
}

.scene-list[data-scene-order], .scene-list[data-scene-order] > li { position: relative; }
.scenes-page .scene-drag-layer > .scene-drag-preview { cursor: grabbing; }
.scene-drag-cue { position: absolute; top: -26px; left: 10px; padding: 3px 8px; border-radius: 5px; font-size: 11px; line-height: 18px; color: #fff; background: #315d91; box-shadow: 0 3px 8px rgb(0 0 0 / 16%); }

/* A bounded wheel keeps every scene reachable inside the dialog. */
.scene-picker.word-sheet .scene-form { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.scene-wheel { height: 168px; flex: none; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; scroll-snap-type: y mandatory; scrollbar-width: none; padding-block: 56px; box-sizing: border-box; border-radius: 10px; background: linear-gradient(to bottom, transparent 56px, var(--blue-soft) 56px, var(--blue-soft) 112px, transparent 112px); }
.scene-wheel::-webkit-scrollbar { display: none; }
.scene-wheel-option { height: 56px; box-sizing: border-box; padding: 0 12px; display: flex; align-items: center; justify-content: center; text-align: center; scroll-snap-align: center; color: var(--muted); }
.scene-wheel-option span { font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; opacity: calc(1 - var(--wheel-depth, 0) * .22); transform: scale(calc(1 - var(--wheel-depth, 0) * .06)); }
.scene-wheel-option[aria-selected="true"] { color: var(--ink); font-weight: 600; }
.scene-wheel:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.scene-wheel[inert] { opacity: .6; }
@media (prefers-reduced-motion: reduce) { .scene-wheel-option span { transform: none; } }

.scene-picker.word-sheet .scene-form button { min-height: 44px; align-self: flex-end; min-width: 80px; color: var(--paper); background: var(--blue-dark); }
.scene-picker.word-sheet .scene-form button:disabled { color: var(--muted); background: var(--blue-soft); }
.scene-wheel-option span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.scene-wheel-name { margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }
