.btn:disabled,
.notes-nav-btn:disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

#addNoteButton {
    min-width: 32px;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 700;
    line-height: 1;
    border-radius: 8px;
    background: var(--black-100);
    border-color: var(--black-100);
    color: var(--white-200);
}

#addNoteButton:hover {
    background: var(--black-200);
    border-color: var(--black-200);
    color: var(--white-200);
}

.dark-mode #addNoteButton {
    background: var(--white-200);
    border-color: var(--white-200);
    color: var(--black-100);
}

.notes-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.notes-nav-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Material Icons';
    font-size: 18px;
    line-height: 1;
    border-radius: 8px;
    border-color: var(--grey-195);
    color: var(--grey-300);
}

body[data-notes-mode="list"] #notesNavPrev,
body[data-notes-mode="list"] #notesNavNext,
body[data-notes-mode="replace"] #notesNavUp,
body[data-notes-mode="replace"] #notesNavDown {
    display: none;
}

body.notes-hidden .notes-container {
    visibility: hidden;
    pointer-events: none;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

.notes-list-pin-spacer {
    flex: 0 0 auto;
    pointer-events: none;
}

.notes-empty {
    color: var(--sections-label-color-light);
    font-size: 13px;
    padding: 12px 0;
}

.dark-mode .notes-empty {
    color: var(--sections-label-color-dark);
}

.note-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    border: 1.5px solid transparent;
    border-radius: var(--card-radius);
    padding: 14px 36px 14px 16px;
    box-sizing: border-box;
    background: var(--note-card-bg-light);
    opacity: 0.6;
    color: var(--ink-200);
    transition: opacity 0.2s ease-in-out, background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

.dark-mode .note-card {
    background: var(--note-card-bg-dark);
    color: var(--body-text-dark);
}

/* Small colored bar tying the note back to its section, even when dimmed. */
.note-accent-bar {
    width: 4px;
    align-self: stretch;
    border-radius: 2px;
    flex-shrink: 0;
    background: var(--note-accent, currentColor);
}

.note-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* The note under the playhead: full opacity, tinted by its section color. */
.note-card.is-active {
    opacity: 1;
    background: color-mix(in srgb, var(--note-accent, currentColor) var(--note-card-active-bg-alpha), var(--body-background-light));
    border-color: color-mix(in srgb, var(--note-accent, currentColor) var(--note-card-active-ring-alpha), transparent);
    color: var(--heading-color-light);
}

.dark-mode .note-card.is-active {
    background: color-mix(in srgb, var(--note-accent, currentColor) var(--note-card-active-bg-alpha), var(--body-background-dark));
}

.note-card.is-fading-in {
    animation: note-replace-fade 0.45s ease;
}

@keyframes note-replace-fade {
    from {
        opacity: 0.4;
    }
    to {
        opacity: 1;
    }
}

.note-card-meta {
    margin-bottom: 0;
}

.note-card-kicker,
.note-card-playing {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--note-accent, currentColor);
}

.note-card-playing {
    display: none;
}

body.is-audio-playing .note-card.is-active .note-card-playing {
    display: inline;
}

.note-card-title {
    font-size: 14px;
    font-weight: bold;
}

.note-card-range {
    font-size: 12px;
    opacity: 0.75;
}

.note-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    font-size: 22px;
    line-height: 28px;
    cursor: pointer;
    opacity: 0;
}

.note-card:hover .note-delete-btn,
.note-card-modal .note-delete-btn {
    opacity: 0.7;
}

.note-timecodes {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.note-timecodes label {
    flex: 1;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.note-text,
.note-timecodes input {
    width: 100%;
    box-sizing: border-box;
    border: none;
    border-radius: 0;
    padding: 4px 0;
    background: transparent;
    color: inherit;
    font: inherit;
}

.note-text::placeholder,
.note-timecodes input::placeholder {
    color: inherit;
    opacity: 0.55;
}

.note-text:focus,
.note-timecodes input:focus {
    outline: none;
}

.note-timecodes input:disabled {
    opacity: 0.55;
}

.note-text {
    resize: none;
    min-height: 0;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--ink-200);
}

.note-card.is-active .note-text {
    font-weight: 600;
    color: var(--heading-color-light);
}

.note-card-modal .note-text {
    resize: vertical;
    min-height: 72px;
}

.section-block.is-selected {
    box-shadow: 0 0 0 2px var(--white-200), 0 0 0 4px var(--grey-400);
}

body.highlight-active-block .section-block,
body.highlight-active-block .section-dot,
body.highlight-active-block .section-line,
body.highlight-active-block .section-overlay,
body.highlight-active-block .handle {
    transition: opacity 0.18s ease-in-out;
}

body.highlight-active-block.is-audio-playing .section-block,
body.highlight-active-block.is-audio-playing .section-dot,
body.highlight-active-block.is-audio-playing .section-line,
body.highlight-active-block.is-audio-playing .section-overlay,
body.highlight-active-block.is-audio-playing .handle {
    opacity: 0.18;
}

body.highlight-active-block.is-audio-playing .section-block.is-playhead-active,
body.highlight-active-block.is-audio-playing .section-dot.is-playhead-active,
body.highlight-active-block.is-audio-playing .section-line.is-playhead-active,
body.highlight-active-block.is-audio-playing .handle.is-playhead-active {
    opacity: 1;
}

body.highlight-active-block.is-audio-playing .section-overlay.is-playhead-active {
    opacity: 0.2;
}

.modal-content.modal-wide {
    width: 460px;
}

.modal-content.modal-help {
    width: min(560px, 92vw);
    max-height: min(80vh, 720px);
    margin: 6vh auto;
    display: flex;
    flex-direction: column;
}

.help-lead {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.45;
    opacity: 0.8;
}

.help-body {
    overflow: auto;
    padding-right: 6px;
    font-size: 14px;
    line-height: 1.5;
}

.help-body h4 {
    margin: 18px 0 6px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.help-body h4:first-child {
    margin-top: 0;
}

.help-body p,
.help-body ul,
.help-body ol {
    margin: 0 0 10px;
}

.help-body ul,
.help-body ol {
    padding-left: 1.2em;
}

.help-body li + li {
    margin-top: 4px;
}

.help-body code {
    font-size: 12px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 12px 0;
}

.settings-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    font-size: 14px;
}

.settings-row-stack {
    flex-direction: column;
    align-items: stretch;
}

.settings-choices {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-choices label,
.settings-row > label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-content input[type="checkbox"],
.modal-content input[type="radio"] {
    width: auto;
    margin: 0;
}

.section-notes-heading {
    margin-top: 14px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: bold;
}

#section-notes-editor {
    max-height: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* --- Focus mode: nothing moves, most things just fade out --- */
/* Kept reachable, only dimmed: the focus toggle itself and the theme switch. */
body.focus-mode #themeToggleButton,
body.focus-mode #focusModeButton {
    opacity: var(--button-dimmed-opacity);
}

/* Fully hidden: chrome that isn't the waveform, the current block, or the current note. */
body.focus-mode .app-titles,
body.focus-mode #addSectionButton,
body.focus-mode .more-menu-wrap,
body.focus-mode #dots-container,
body.focus-mode .section-line,
body.focus-mode #timeline,
body.focus-mode .file-history,
body.focus-mode .footer,
body.focus-mode .help-text,
body.focus-mode .handle,
body.focus-mode .section-edit-btn {
    opacity: 0;
    pointer-events: none;
}

/* Only the section currently under the playhead stays lit on the waveform
   and in the sections bar; everything else fades - reusing the same
   .is-playhead-active tracking the "highlight active block" setting uses. */
body.focus-mode .section-block:not(.is-playhead-active),
body.focus-mode .section-overlay:not(.is-playhead-active) {
    opacity: 0;
    pointer-events: none;
}

/* Only the note under the playhead stays visible; others fade in place
   (their slot in the list stays reserved, nothing reflows). */
body.focus-mode .note-card:not(.is-active) {
    opacity: 0;
    pointer-events: none;
}

/* Transport stays, just dimmed - still usable mid-presentation. */
body.focus-mode .play-controls {
    opacity: var(--transport-dim-opacity);
}
