.custom-modal-overlay {
    position: fixed; inset: 0;
    background: var(--modal-overlay-bg, rgba(0,0,0,0.45));
    display: flex; justify-content: center; align-items: center;
    z-index: 9999; 
}
.custom-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,1.6);
    padding: 20px;
    width: fit-content;
    min-width: 420px;
    max-width: min-content;
    font-family: sans-serif;
    position: relative;
    animation: fadeIn 0.2s ease;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    gap: 4px;
}

/* Draggable modals (confirm) */
.custom-modal.is-draggable .custom-modal-title,
.custom-modal.is-draggable .custom-modal-content {
    cursor: grab;
}
body.modal-dragging {
    user-select: none;
}
body.modal-dragging .custom-modal.is-draggable .custom-modal-title,
body.modal-dragging .custom-modal.is-draggable .custom-modal-content {
    cursor: grabbing;
}
.custom-modal h3 {
    margin: 0 0 10px;
    font-size: 18px;
}
.custom-modal.error h3 { color: #c62828; }

.custom-modal-title {
    max-width: 30%;
    display: grid;
    flex: 0 0 auto;
    padding: 10px;
    align-items: center;
    justify-content: center;
}

.custom-modal-title img, .custom-modal-title svg {
    max-width: 100%;
    max-height: 64px;
    object-fit: contain;
}
.custom-modal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.custom-modal-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.custom-modal-body p {
    margin: 0;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: normal;
}

/* ============================
   New Year greeting (dashboard)
   ============================ */

.custom-modal.ny2025-modal {
    width: min(480px, 90vw);
    max-width: 90vw;
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    flex-direction: column;
    gap: 0;
    animation: nyPop 0.22s ease-out;
}

.custom-modal.ny2025-modal .custom-modal-title {
    max-width: none;
    width: 100%;
    padding: 18px 18px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-modal.ny2025-modal .custom-modal-content {
    padding: 0 18px 16px;
}

.custom-modal.ny2025-modal .custom-modal-body p {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.custom-modal.ny2025-modal .ny2025-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.2px;
    text-align: center;
}

.custom-modal.ny2025-modal .ny2025-text {
    font-size: 14px;
    color: #374151;
    text-align: center;
}

.custom-modal.ny2025-modal .ny2025-illustration {
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    border-radius: 12px;
    background: radial-gradient(circle at 20% 20%, rgba(99,102,241,0.16), rgba(255,255,255,0) 55%),
                radial-gradient(circle at 80% 30%, rgba(16,185,129,0.16), rgba(255,255,255,0) 55%),
                linear-gradient(180deg, rgba(59,130,246,0.10), rgba(255,255,255,0));
    padding: 10px 10px;
}

.custom-modal.ny2025-modal .custom-modal-buttons {
    justify-content: center;
}

.custom-modal.ny2025-modal .btn-ok {
    min-width: 200px;
}

@keyframes nyPop {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

/* Feedback thread timestamps */
.fb-thread-author {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}
.fb-thread-time {
    font-size: 11px;
    color: #6b7280;
    font-weight: 500;
}
.custom-modal-body input.modalInput:not([type="checkbox"]),
.custom-modal-body textarea.modalInput {
    width: 100%;
    height: 40px;
    padding: 8px;
    font-size: 15px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    font-family: inherit;
}
.custom-modal-body select.modalInput {
    width: 100%;
    padding: 8px;
    font-size: 15px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    font-family: inherit;
    background: #fff;
}
.custom-modal-body textarea.modalInput {
    resize: vertical;
    min-height: 80px;
}

/* Lesson editor: add text modal */
.custom-modal.add-text-modal {
    width: min(720px, 92vw);
}

.custom-modal.add-text-modal .custom-modal-title img {
    width: 40px;
    height: 40px;
}

.custom-modal.add-text-modal .custom-modal-body {
    gap: 16px;
}

.custom-modal.add-text-modal textarea.modalInput {
    min-height: 148px;
    resize: vertical;
    line-height: 1.45;
    tab-size: 4;
}

.custom-modal.add-text-modal .modal-field {
    display: grid;
    gap: 8px;
}

.custom-modal.add-text-modal .modal-field__label {
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

.modal-switch {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: var(--bg-panel, #ffffff);
    color: var(--text-primary, #0f172a);
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
}

.modal-switch:hover {
    border-color: var(--border-strong, #cbd5e1);
    background: var(--accent-soft, #eff6ff);
}

.modal-switch.is-disabled {
    cursor: not-allowed;
    opacity: 0.55;
    background: var(--bg-app, #f8fafc);
}

.modal-switch__copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.modal-switch__label {
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}

.modal-switch__hint {
    color: var(--text-secondary, #475569);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
}

.modal-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.modal-switch__track {
    position: relative;
    width: 52px;
    height: 30px;
    flex: 0 0 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong, #cbd5e1);
    border-radius: 999px;
    background: #e2e8f0;
    transition: background-color 0.18s ease, border-color 0.18s ease;
}

.modal-switch__track::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
    transform: translateY(-50%);
    transition: left 0.18s ease;
    z-index: 1;
}

.modal-switch input:checked + .modal-switch__track {
    border-color: var(--accent-primary, #2563eb);
    background: var(--accent-primary, #2563eb);
}

.modal-switch input:checked + .modal-switch__track::after {
    left: 23px;
}

.modal-switch input:focus-visible + .modal-switch__track {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 2px;
}

.modal-switch__icons {
    position: relative;
    z-index: 2;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 7px;
    box-sizing: border-box;
}

.modal-switch__icons img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    opacity: 0.74;
}

.modal-switch input:checked + .modal-switch__track .modal-switch__icons img {
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

.modal-segmented {
    display: grid;
    gap: 8px;
}

.modal-segmented__label {
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}

.modal-segmented__track {
    --modal-segment-count: 3;
    --modal-segment-index: 0;
    --modal-segment-gap: 4px;
    position: relative;
    display: grid;
    grid-template-columns: repeat(var(--modal-segment-count), minmax(0, 1fr));
    gap: var(--modal-segment-gap);
    padding: 4px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: var(--bg-app, #f8fafc);
    box-sizing: border-box;
}

.modal-segmented__track::before {
    content: "";
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc((100% - 8px - ((var(--modal-segment-count) - 1) * var(--modal-segment-gap))) / var(--modal-segment-count));
    border-radius: 10px;
    background: var(--bg-panel, #ffffff);
    border: 1px solid var(--accent-primary, #2563eb);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.10);
    transform: translateX(calc(var(--modal-segment-index) * (100% + var(--modal-segment-gap))));
    transition: transform 0.18s ease;
    box-sizing: border-box;
    z-index: 0;
}

.modal-segmented__option {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.modal-segmented__option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.modal-segmented__button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
    transition: color 0.18s ease, background-color 0.18s ease;
}

.modal-segmented__button:hover {
    color: var(--text-primary, #0f172a);
    background: var(--accent-soft, #eff6ff);
}

.modal-segmented__button img {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    object-fit: contain;
    opacity: 0.82;
}

.modal-segmented__option input:checked + .modal-segmented__button {
    color: var(--text-primary, #0f172a);
}

.modal-segmented__option input:checked + .modal-segmented__button img {
    opacity: 1;
}

.modal-segmented__option input:focus-visible + .modal-segmented__button {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 2px;
}
.custom-modal.board-editor-modal {
    width: min(640px, 92vw);
    min-width: min(420px, 92vw);
    max-width: 92vw;
    border-radius: 22px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.16);
    padding: 0;
    overflow: hidden;
    gap: 0;
}

.custom-modal.board-editor-modal.add-text-modal {
    width: min(720px, 92vw);
}

.custom-modal.board-editor-modal .custom-modal-title {
    max-width: none;
    width: 96px;
    padding: 20px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.96), rgba(248, 250, 252, 0.96));
    border-right: 1px solid var(--border-default, #dbe5f0);
}

.custom-modal.board-editor-modal .custom-modal-title img,
.custom-modal.board-editor-modal .custom-modal-title svg {
    width: 64px;
    height: 64px;
    max-width: none;
    max-height: none;
    object-fit: contain;
}

.custom-modal.board-editor-modal .custom-modal-content {
    padding: 20px 20px 18px;
    gap: 18px;
    position: static;
}

.custom-modal.board-editor-modal .custom-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-secondary, #475569);
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    z-index: 2;
    font-size: 0;
    line-height: 0;
}

.custom-modal.board-editor-modal .custom-modal-close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.18s ease;
}

.custom-modal.board-editor-modal .custom-modal-close:hover {
    background: var(--bg-app, #f8fafc);
    border-color: #cbd5e1;
}

.custom-modal.board-editor-modal .custom-modal-close:hover img,
.custom-modal.board-editor-modal .custom-modal-close:focus-visible img {
    transform: rotate(90deg);
}

.custom-modal.board-editor-modal .custom-modal-close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.custom-modal.board-editor-modal .custom-modal-body {
    gap: 14px;
}

.custom-modal.board-editor-modal .custom-modal-body > p:first-child {
    margin: 0;
    padding-right: 52px;
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.board-editor-modal h3 {
    margin: 0;
    padding-right: 52px;
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.board-editor-modal .custom-modal-body input.modalInput:not([type="checkbox"]),
.custom-modal.board-editor-modal .custom-modal-body textarea.modalInput,
.custom-modal.board-editor-modal .custom-modal-body select.modalInput {
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
}

.custom-modal.board-editor-modal .custom-modal-body input.modalInput:not([type="checkbox"]),
.custom-modal.board-editor-modal .custom-modal-body select.modalInput {
    height: 46px;
    padding: 0 14px;
}

.custom-modal.board-editor-modal .custom-modal-body textarea.modalInput {
    min-height: 80px;
    max-height: 240px;
    padding: 12px 14px;
}

.custom-modal.board-editor-modal .custom-modal-body .modal-radio-group {
    gap: 12px;
    margin: 0;
}

.custom-modal.board-editor-modal .custom-modal-body .modal-radio-group__label {
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.custom-modal.board-editor-modal .custom-modal-body .modal-radio {
    padding: 12px 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: #ffffff;
}

.custom-modal.board-editor-modal .custom-modal-buttons {
    margin-top: 0;
    justify-content: flex-end;
}

.custom-modal.board-editor-modal .custom-modal-buttons button {
    min-width: 112px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
}

.custom-modal.board-editor-modal .btn-cancel {
    border: 1px solid rgba(203, 213, 225, 0.96);
}

.custom-modal.graph-settings-modal {
    width: min(880px, 94vw);
    min-width: min(720px, 94vw);
    max-height: 88vh;
}

.custom-modal.graph-settings-modal,
.custom-modal.graph-settings-modal * {
    box-sizing: border-box;
}

.custom-modal.graph-settings-modal .custom-modal-title {
    width: 128px;
    padding: 20px 14px;
    flex-direction: column;
    gap: 12px;
}

.custom-modal.graph-settings-modal .custom-modal-title img {
    width: 32px;
    height: 32px;
}

.custom-modal.graph-settings-modal .custom-modal-content {
    width: 100%;
    min-width: 0;
    max-height: 88vh;
}

.custom-modal.graph-settings-modal .graph-settings__rail-icon {
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: var(--bg-panel, #ffffff);
}

.custom-modal.graph-settings-modal .graph-settings__rail-title {
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
}

.custom-modal.graph-settings-modal .graph-settings__form {
    max-height: min(620px, calc(88vh - 116px));
    overflow: auto;
    padding-right: 10px;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong, #94a3b8) var(--bg-app, #f8fafc);
}

.custom-modal.graph-settings-modal .graph-settings__form::-webkit-scrollbar {
    width: 10px;
}

.custom-modal.graph-settings-modal .graph-settings__form::-webkit-scrollbar-track {
    border-radius: 999px;
    background: var(--bg-app, #f8fafc);
}

.custom-modal.graph-settings-modal .graph-settings__form::-webkit-scrollbar-thumb {
    border: 2px solid var(--bg-app, #f8fafc);
    border-radius: 999px;
    background: var(--border-strong, #94a3b8);
}

.custom-modal.graph-settings-modal .graph-settings__form::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary, #475569);
}

.custom-modal.graph-settings-modal .graph-settings__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding-right: 46px;
}

.custom-modal.graph-settings-modal .graph-settings__section {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: var(--bg-panel, #ffffff);
}

.custom-modal.graph-settings-modal .graph-settings__section-title {
    margin: 0 0 12px;
    padding: 0;
    color: var(--text-primary, #0f172a);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
}

.custom-modal.graph-settings-modal .graph-settings__section-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.custom-modal.graph-settings-modal .graph-settings__fields-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.custom-modal.graph-settings-modal .graph-settings__field {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.custom-modal.graph-settings-modal .graph-settings__label {
    color: var(--text-secondary, #475569);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
}

.custom-modal.graph-settings-modal .graph-settings__input {
    width: 100%;
    min-width: 0;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: var(--bg-panel, #ffffff);
    color: var(--text-primary, #0f172a);
    font: inherit;
    font-size: 14px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.custom-modal.graph-settings-modal .graph-settings__input[type="color"] {
    padding: 4px;
}

.custom-modal.graph-settings-modal .graph-settings__input:focus {
    border-color: var(--accent-primary, #2563eb);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.custom-modal.graph-settings-modal .graph-settings__toggle-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.custom-modal.graph-settings-modal .graph-settings__toggle {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: var(--bg-app, #f8fafc);
    cursor: pointer;
}

.custom-modal.graph-settings-modal .graph-settings__toggle-copy {
    min-width: 0;
    color: var(--text-primary, #0f172a);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
}

.custom-modal.graph-settings-modal .graph-settings__toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.custom-modal.graph-settings-modal .graph-settings__toggle-track {
    position: relative;
    flex: 0 0 auto;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: var(--border-strong, #cbd5e1);
    transition: background-color 0.18s ease, box-shadow 0.18s ease;
}

.custom-modal.graph-settings-modal .graph-settings__toggle-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.22);
    transition: transform 0.18s ease;
}

.custom-modal.graph-settings-modal .graph-settings__toggle input:checked + .graph-settings__toggle-track {
    background: var(--accent-primary, #2563eb);
}

.custom-modal.graph-settings-modal .graph-settings__toggle input:checked + .graph-settings__toggle-track::after {
    transform: translateX(18px);
}

.custom-modal.graph-settings-modal .graph-settings__toggle input:focus-visible + .graph-settings__toggle-track {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

@media (max-width: 760px) {
    .custom-modal.graph-settings-modal {
        min-width: min(420px, 94vw);
    }

    .custom-modal.graph-settings-modal .custom-modal-title {
        width: auto;
        min-height: 86px;
        flex-direction: row;
        justify-content: flex-start;
    }

    .custom-modal.graph-settings-modal .graph-settings__rail-title {
        text-align: left;
    }

    .custom-modal.graph-settings-modal .graph-settings__grid {
        grid-template-columns: 1fr;
        padding-right: 0;
    }

    .custom-modal.graph-settings-modal .graph-settings__fields-2 {
        grid-template-columns: 1fr;
    }
}

.custom-modal.wordpoint-check-mode-modal {
    width: min(520px, 92vw);
    min-width: min(420px, 92vw);
    max-width: 92vw;
    border-radius: 22px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.16);
    padding: 0;
    overflow: hidden;
    flex-direction: column;
    gap: 0;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-title {
    max-width: none;
    width: 100%;
    padding: 20px 20px 0;
    display: block;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-content {
    padding: 12px 20px 20px;
    gap: 18px;
    position: static;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-secondary, #475569);
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    z-index: 2;
    font-size: 0;
    line-height: 0;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.18s ease;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-close:hover {
    background: var(--bg-app, #f8fafc);
    border-color: #cbd5e1;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-close:hover img,
.custom-modal.wordpoint-check-mode-modal .custom-modal-close:focus-visible img {
    transform: rotate(90deg);
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.custom-modal.wordpoint-check-mode-modal .wordpoint-check-mode-modal__header {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding-right: 52px;
}

.custom-modal.wordpoint-check-mode-modal .wordpoint-check-mode-modal__icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    border: 1px solid rgba(191, 219, 254, 0.95);
    background: rgba(239, 246, 255, 0.96);
}

.custom-modal.wordpoint-check-mode-modal .wordpoint-check-mode-modal__icon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.custom-modal.wordpoint-check-mode-modal .wordpoint-check-mode-modal__title-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.custom-modal.wordpoint-check-mode-modal .wordpoint-check-mode-modal__eyebrow {
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.custom-modal.wordpoint-check-mode-modal .wordpoint-check-mode-modal__headline {
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-body {
    gap: 16px;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-body > p:first-child {
    margin: 0;
    color: var(--text-secondary, #475569);
    font-size: 15px;
    line-height: 1.55;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-body .modal-radio-group {
    gap: 12px;
    margin: 0;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-body .modal-radio-group__label {
    color: var(--text-primary, #0f172a);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    text-transform: none;
    letter-spacing: 0;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-body .modal-radio {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-body .modal-radio:hover {
    border-color: #bfdbfe;
    background: rgba(248, 250, 252, 0.96);
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-body .modal-radio:has(input[type="radio"]:checked) {
    border-color: var(--accent-primary, #2563eb);
    background: rgba(239, 246, 255, 0.96);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-body .modal-radio input[type="radio"] {
    margin-top: 1px;
    flex: 0 0 auto;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-body .modal-radio span {
    color: var(--text-primary, #0f172a);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-buttons {
    margin-top: 0;
    gap: 10px;
    justify-content: flex-end;
}

.custom-modal.wordpoint-check-mode-modal .custom-modal-buttons button {
    min-width: 112px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid transparent;
    box-shadow: none;
}

.custom-modal.wordpoint-check-mode-modal .btn-cancel {
    background: #ffffff;
    color: #334155;
    border-color: #dbe4ee;
}

.custom-modal.wordpoint-check-mode-modal .btn-cancel:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.custom-modal.wordpoint-check-mode-modal .btn-ok {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.custom-modal.wordpoint-check-mode-modal .btn-ok:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

@media (max-width: 640px) {
    .custom-modal.wordpoint-check-mode-modal {
        min-width: min(340px, calc(100vw - 24px));
    }

    .custom-modal.wordpoint-check-mode-modal .custom-modal-title {
        padding: 18px 18px 0;
    }

    .custom-modal.wordpoint-check-mode-modal .custom-modal-content {
        padding: 10px 18px 18px;
    }

    .custom-modal.wordpoint-check-mode-modal .wordpoint-check-mode-modal__header {
        align-items: flex-start;
    }

    .custom-modal.wordpoint-check-mode-modal .custom-modal-buttons {
        flex-wrap: wrap;
    }

.custom-modal.wordpoint-check-mode-modal .custom-modal-buttons button {
    flex: 1 1 160px;
}
}

.custom-modal.crossword-warning-modal {
    width: min(500px, 92vw);
    min-width: min(380px, 92vw);
    max-width: 92vw;
    border-radius: 22px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.16);
    padding: 0;
    overflow: hidden;
    flex-direction: column;
    gap: 0;
}

.custom-modal.crossword-warning-modal .custom-modal-title {
    max-width: none;
    width: 100%;
    padding: 20px 20px 0;
    display: block;
}

.custom-modal.crossword-warning-modal .custom-modal-content {
    padding: 12px 20px 20px;
    gap: 18px;
    position: static;
}

.custom-modal.crossword-warning-modal .custom-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-secondary, #475569);
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    z-index: 2;
    font-size: 0;
    line-height: 0;
}

.custom-modal.crossword-warning-modal .custom-modal-close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.18s ease;
}

.custom-modal.crossword-warning-modal .custom-modal-close:hover {
    background: var(--bg-app, #f8fafc);
    border-color: #cbd5e1;
}

.custom-modal.crossword-warning-modal .custom-modal-close:hover img,
.custom-modal.crossword-warning-modal .custom-modal-close:focus-visible img {
    transform: rotate(90deg);
}

.custom-modal.crossword-warning-modal .custom-modal-close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.custom-modal.crossword-warning-modal .crossword-warning-modal__header {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding-right: 52px;
}

.custom-modal.crossword-warning-modal .crossword-warning-modal__icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    border: 1px solid rgba(253, 230, 138, 0.95);
    background: rgba(255, 251, 235, 0.98);
}

.custom-modal.crossword-warning-modal .crossword-warning-modal__icon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.custom-modal.crossword-warning-modal .crossword-warning-modal__title-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.custom-modal.crossword-warning-modal .crossword-warning-modal__eyebrow {
    color: var(--warning, #d97706);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.custom-modal.crossword-warning-modal .crossword-warning-modal__headline {
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.crossword-warning-modal .custom-modal-body {
    gap: 0;
}

.custom-modal.crossword-warning-modal .custom-modal-body > p:first-child {
    margin: 0;
    color: var(--text-secondary, #475569);
    font-size: 15px;
    line-height: 1.55;
}

.custom-modal.crossword-warning-modal .custom-modal-buttons {
    margin-top: 0;
    gap: 10px;
    justify-content: flex-end;
}

.custom-modal.crossword-warning-modal .custom-modal-buttons .btn-ok {
    min-width: 112px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    border: 1px solid var(--accent-primary, #2563eb);
    background: var(--accent-primary, #2563eb);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    box-shadow: none;
}

.custom-modal.crossword-warning-modal .custom-modal-buttons .btn-ok:hover {
    background: var(--accent-primary-hover, #1d4ed8);
    border-color: var(--accent-primary-hover, #1d4ed8);
}

.custom-modal.crossword-create-modal {
    width: min(520px, 92vw);
    min-width: min(420px, 92vw);
    max-width: 92vw;
    border-radius: 22px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.16);
    padding: 0;
    overflow: hidden;
    flex-direction: column;
    gap: 0;
}

.custom-modal.crossword-create-modal .custom-modal-title {
    max-width: none;
    width: 100%;
    padding: 20px 20px 0;
    display: block;
}

.custom-modal.crossword-create-modal .custom-modal-content {
    padding: 12px 20px 20px;
    gap: 18px;
    position: static;
}

.custom-modal.crossword-create-modal .custom-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-secondary, #475569);
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    z-index: 2;
    font-size: 0;
    line-height: 0;
}

.custom-modal.crossword-create-modal .custom-modal-close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.18s ease;
}

.custom-modal.crossword-create-modal .custom-modal-close:hover {
    background: var(--bg-app, #f8fafc);
    border-color: #cbd5e1;
}

.custom-modal.crossword-create-modal .custom-modal-close:hover img,
.custom-modal.crossword-create-modal .custom-modal-close:focus-visible img {
    transform: rotate(90deg);
}

.custom-modal.crossword-create-modal .custom-modal-close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.custom-modal.crossword-create-modal .crossword-create-modal__header {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding-right: 52px;
}

.custom-modal.crossword-create-modal .crossword-create-modal__icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    border: 1px solid rgba(191, 219, 254, 0.95);
    background: rgba(239, 246, 255, 0.96);
}

.custom-modal.crossword-create-modal .crossword-create-modal__icon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.custom-modal.crossword-create-modal .crossword-create-modal__title-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.custom-modal.crossword-create-modal .crossword-create-modal__eyebrow {
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.custom-modal.crossword-create-modal .crossword-create-modal__headline {
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.crossword-create-modal .custom-modal-body {
    gap: 16px;
}

.custom-modal.crossword-create-modal .custom-modal-body > p:first-child {
    margin: 0;
    color: var(--text-secondary, #475569);
    font-size: 15px;
    line-height: 1.55;
}

.custom-modal.crossword-create-modal .custom-modal-body .modal-radio-group {
    gap: 12px;
    margin: 0;
}

.custom-modal.crossword-create-modal .custom-modal-body .modal-radio-group__label {
    color: var(--text-primary, #0f172a);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    text-transform: none;
    letter-spacing: 0;
}

.custom-modal.crossword-create-modal .custom-modal-body .modal-radio {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.custom-modal.crossword-create-modal .custom-modal-body .modal-radio:hover {
    border-color: #bfdbfe;
    background: rgba(248, 250, 252, 0.96);
}

.custom-modal.crossword-create-modal .custom-modal-body .modal-radio:has(input[type="radio"]:checked) {
    border-color: var(--accent-primary, #2563eb);
    background: rgba(239, 246, 255, 0.96);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.custom-modal.crossword-create-modal .custom-modal-body .modal-radio input[type="radio"] {
    margin-top: 2px;
    flex: 0 0 auto;
}

.custom-modal.crossword-create-modal .custom-modal-body .modal-radio span {
    color: var(--text-primary, #0f172a);
    font-size: 15px;
    line-height: 1.45;
}

.custom-modal.crossword-create-modal .custom-modal-buttons {
    margin-top: 0;
    justify-content: flex-end;
}

.custom-modal.crossword-create-modal .custom-modal-buttons button {
    min-width: 112px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
}

.custom-modal.crossword-create-modal .btn-cancel {
    border: 1px solid rgba(203, 213, 225, 0.96);
}

@media (max-width: 640px) {
    .custom-modal.crossword-warning-modal {
        min-width: min(340px, calc(100vw - 24px));
    }

    .custom-modal.crossword-warning-modal .custom-modal-title {
        padding: 18px 18px 0;
    }

    .custom-modal.crossword-warning-modal .custom-modal-content {
        padding: 10px 18px 18px;
    }

    .custom-modal.crossword-warning-modal .crossword-warning-modal__header {
        align-items: flex-start;
    }

    .custom-modal.crossword-create-modal {
        min-width: min(340px, calc(100vw - 24px));
    }

    .custom-modal.crossword-create-modal .custom-modal-title {
        padding: 18px 18px 0;
    }

    .custom-modal.crossword-create-modal .custom-modal-content {
        padding: 10px 18px 18px;
    }

    .custom-modal.crossword-create-modal .crossword-create-modal__header {
        align-items: flex-start;
    }
}

.custom-modal.wordpoint-finish-modal {
    width: min(500px, 92vw);
    min-width: min(400px, 92vw);
    max-width: 92vw;
    border-radius: 22px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.16);
    padding: 0;
    overflow: hidden;
    flex-direction: column;
    gap: 0;
}

.custom-modal.wordpoint-finish-modal .custom-modal-title {
    max-width: none;
    width: 100%;
    padding: 20px 20px 0;
    display: block;
}

.custom-modal.wordpoint-finish-modal .custom-modal-content {
    padding: 12px 20px 20px;
    gap: 18px;
    position: static;
}

.custom-modal.wordpoint-finish-modal .custom-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-secondary, #475569);
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    z-index: 2;
    font-size: 0;
    line-height: 0;
}

.custom-modal.wordpoint-finish-modal .custom-modal-close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.18s ease;
}

.custom-modal.wordpoint-finish-modal .custom-modal-close:hover {
    background: var(--bg-app, #f8fafc);
    border-color: #cbd5e1;
}

.custom-modal.wordpoint-finish-modal .custom-modal-close:hover img,
.custom-modal.wordpoint-finish-modal .custom-modal-close:focus-visible img {
    transform: rotate(90deg);
}

.custom-modal.wordpoint-finish-modal .custom-modal-close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.custom-modal.wordpoint-finish-modal .wordpoint-finish-modal__header {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding-right: 52px;
}

.custom-modal.wordpoint-finish-modal .wordpoint-finish-modal__icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    border: 1px solid rgba(191, 219, 254, 0.95);
    background: rgba(239, 246, 255, 0.96);
}

.custom-modal.wordpoint-finish-modal .wordpoint-finish-modal__icon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.custom-modal.wordpoint-finish-modal .wordpoint-finish-modal__title-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.custom-modal.wordpoint-finish-modal .wordpoint-finish-modal__eyebrow {
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.custom-modal.wordpoint-finish-modal .wordpoint-finish-modal__headline {
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.wordpoint-finish-modal .custom-modal-body {
    gap: 0;
}

.custom-modal.wordpoint-finish-modal .custom-modal-body > p:first-child {
    margin: 0;
    color: var(--text-secondary, #475569);
    font-size: 15px;
    line-height: 1.55;
}

.custom-modal.wordpoint-finish-modal .custom-modal-buttons {
    margin-top: 0;
    gap: 10px;
    justify-content: flex-end;
}

.custom-modal.wordpoint-finish-modal .custom-modal-buttons button {
    min-width: 112px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid transparent;
    box-shadow: none;
}

.custom-modal.wordpoint-finish-modal .btn-cancel {
    background: #ffffff;
    color: #334155;
    border-color: #dbe4ee;
}

.custom-modal.wordpoint-finish-modal .btn-cancel:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.custom-modal.wordpoint-finish-modal .btn-ok {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.custom-modal.wordpoint-finish-modal .btn-ok:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

@media (max-width: 640px) {
    .custom-modal.wordpoint-finish-modal {
        min-width: min(340px, calc(100vw - 24px));
    }

    .custom-modal.wordpoint-finish-modal .custom-modal-title {
        padding: 18px 18px 0;
    }

    .custom-modal.wordpoint-finish-modal .custom-modal-content {
        padding: 10px 18px 18px;
    }

    .custom-modal.wordpoint-finish-modal .wordpoint-finish-modal__header {
        align-items: flex-start;
    }

    .custom-modal.wordpoint-finish-modal .custom-modal-buttons {
        flex-wrap: wrap;
    }

    .custom-modal.wordpoint-finish-modal .custom-modal-buttons button {
        flex: 1 1 160px;
    }
}

.custom-modal.wordpoint-delete-modal {
    width: min(500px, 92vw);
    min-width: min(400px, 92vw);
    max-width: 92vw;
    border-radius: 22px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.16);
    padding: 0;
    overflow: hidden;
    flex-direction: column;
    gap: 0;
}

.custom-modal.wordpoint-delete-modal .custom-modal-title {
    max-width: none;
    width: 100%;
    padding: 20px 20px 0;
    display: block;
}

.custom-modal.wordpoint-delete-modal .custom-modal-content {
    padding: 12px 20px 20px;
    gap: 18px;
    position: static;
}

.custom-modal.wordpoint-delete-modal .custom-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-secondary, #475569);
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    z-index: 2;
    font-size: 0;
    line-height: 0;
}

.custom-modal.wordpoint-delete-modal .custom-modal-close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.18s ease;
}

.custom-modal.wordpoint-delete-modal .custom-modal-close:hover {
    background: var(--bg-app, #f8fafc);
    border-color: #cbd5e1;
}

.custom-modal.wordpoint-delete-modal .custom-modal-close:hover img,
.custom-modal.wordpoint-delete-modal .custom-modal-close:focus-visible img {
    transform: rotate(90deg);
}

.custom-modal.wordpoint-delete-modal .custom-modal-close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.custom-modal.wordpoint-delete-modal .wordpoint-delete-modal__header {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding-right: 52px;
}

.custom-modal.wordpoint-delete-modal .wordpoint-delete-modal__icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    border: 1px solid rgba(254, 205, 211, 0.96);
    background: rgba(254, 242, 242, 0.98);
}

.custom-modal.wordpoint-delete-modal .wordpoint-delete-modal__icon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.custom-modal.wordpoint-delete-modal .wordpoint-delete-modal__title-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.custom-modal.wordpoint-delete-modal .wordpoint-delete-modal__eyebrow {
    color: var(--danger, #dc2626);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.custom-modal.wordpoint-delete-modal .wordpoint-delete-modal__headline {
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.wordpoint-delete-modal .custom-modal-body {
    gap: 0;
}

.custom-modal.wordpoint-delete-modal .custom-modal-body > p:first-child {
    margin: 0;
    color: var(--text-secondary, #475569);
    font-size: 15px;
    line-height: 1.55;
}

.custom-modal.wordpoint-delete-modal .custom-modal-buttons {
    margin-top: 0;
    gap: 10px;
    justify-content: flex-end;
}

.custom-modal.wordpoint-delete-modal .custom-modal-buttons button {
    min-width: 112px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid transparent;
    box-shadow: none;
}

.custom-modal.wordpoint-delete-modal .btn-cancel {
    background: #ffffff;
    color: #334155;
    border-color: #dbe4ee;
}

.custom-modal.wordpoint-delete-modal .btn-cancel:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.custom-modal.wordpoint-delete-modal .btn-ok {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
}

.custom-modal.wordpoint-delete-modal .btn-ok:hover {
    background: #dc2626;
    border-color: #dc2626;
}

@media (max-width: 640px) {
    .custom-modal.wordpoint-delete-modal {
        min-width: min(340px, calc(100vw - 24px));
    }

    .custom-modal.wordpoint-delete-modal .custom-modal-title {
        padding: 18px 18px 0;
    }

    .custom-modal.wordpoint-delete-modal .custom-modal-content {
        padding: 10px 18px 18px;
    }

    .custom-modal.wordpoint-delete-modal .wordpoint-delete-modal__header {
        align-items: flex-start;
    }

    .custom-modal.wordpoint-delete-modal .custom-modal-buttons {
        flex-wrap: wrap;
    }

    .custom-modal.wordpoint-delete-modal .custom-modal-buttons button {
        flex: 1 1 160px;
    }
}

.custom-modal.snapshot-save-status-modal {
    width: min(560px, 92vw);
    min-width: min(420px, 92vw);
}

.custom-modal.snapshot-save-status-modal .custom-modal-title {
    width: 112px;
    padding: 20px 18px;
}

.custom-modal.snapshot-save-status-modal .snapshot-save-status-modal__icon-shell {
    width: 64px;
    height: 64px;
    padding: 4px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-default, #dbe5f0);
    background: var(--warning-bg, #fef3c7);
    box-sizing: border-box;
}

.custom-modal.snapshot-save-status-modal.snapshot-save-status-modal--forbidden .snapshot-save-status-modal__icon-shell {
    background: var(--accent-soft, #eff6ff);
}

.custom-modal.snapshot-save-status-modal .custom-modal-title img {
    width: 56px;
    height: 56px;
}

.custom-modal.snapshot-save-status-modal .custom-modal-content {
    padding: 22px 22px 20px;
    gap: 20px;
}

.custom-modal.snapshot-save-status-modal .custom-modal-body {
    gap: 0;
}

.custom-modal.snapshot-save-status-modal .custom-modal-body > p:first-child {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding-right: 52px;
}

.custom-modal.snapshot-save-status-modal .snapshot-save-status-modal__headline {
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.snapshot-save-status-modal .snapshot-save-status-modal__text {
    color: var(--text-secondary, #475569);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
}

.custom-modal.snapshot-save-status-modal .custom-modal-buttons {
    justify-content: flex-end;
}

.custom-modal.snapshot-save-status-modal .btn-ok {
    min-width: 112px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
}

@media (max-width: 640px) {
    .custom-modal.snapshot-save-status-modal {
        width: min(92vw, 560px);
        min-width: min(92vw, 420px);
    }

    .custom-modal.snapshot-save-status-modal .custom-modal-title {
        width: 96px;
        padding: 18px 14px;
    }

    .custom-modal.snapshot-save-status-modal .custom-modal-content {
        padding: 18px 18px 18px;
    }

    .custom-modal.snapshot-save-status-modal .snapshot-save-status-modal__headline {
        font-size: 18px;
    }
}

.custom-modal.shortcuts-help-modal {
    width: min(1080px, 96vw);
    min-width: min(920px, 96vw);
    max-width: 96vw;
    max-height: min(88vh, 920px);
}

.custom-modal.shortcuts-help-modal .custom-modal-title {
    width: 88px;
    padding: 24px 14px;
    align-items: flex-start;
}

.custom-modal.shortcuts-help-modal .custom-modal-title img,
.custom-modal.shortcuts-help-modal .custom-modal-title svg {
    width: 52px;
    height: 52px;
}

.custom-modal.shortcuts-help-modal .custom-modal-content {
    min-width: 0;
    min-height: 0;
    padding: 22px 22px 18px;
    gap: 18px;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__rail {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    align-items: center;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__rail-button {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-secondary, #475569);
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__rail-button:hover {
    background: var(--accent-soft, #eff6ff);
    border-color: #cbd5e1;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__rail-button.is-active {
    background: var(--accent-soft, #eff6ff);
    border-color: var(--accent-primary, #2563eb);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__rail-button:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 2px;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__rail-button img,
.custom-modal.shortcuts-help-modal .shortcuts-help-modal__rail-button svg {
    width: 24px;
    height: 24px;
    max-width: none;
    max-height: none;
}

.custom-modal.shortcuts-help-modal .custom-modal-body.shortcuts-help-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    gap: 18px;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__view {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    gap: 18px;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__header {
    display: grid;
    gap: 8px;
    padding-right: 52px;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__title {
    padding-right: 0;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__lead {
    color: var(--text-secondary, #475569);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__note {
    padding: 16px 18px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(255, 255, 255, 0.98));
    color: var(--text-secondary, #475569);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.55;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__sections {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 18px;
    min-height: 0;
    overflow: auto;
    padding-right: 6px;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__section {
    display: grid;
    gap: 12px;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__section--lifehacks {
    padding: 18px 20px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(255, 255, 255, 0.98));
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__section-title {
    margin: 0;
    color: var(--accent-primary, #2563eb);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__item {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: start;
    padding: 14px 16px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(255, 255, 255, 0.98));
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__combos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    align-content: flex-start;
    min-width: 0;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__combo {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__plus,
.custom-modal.shortcuts-help-modal .shortcuts-help-modal__or {
    color: var(--text-muted, #64748b);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__key {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: var(--bg-panel, #ffffff);
    color: var(--text-primary, #0f172a);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
    white-space: nowrap;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__copy {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__item-title {
    color: var(--text-primary, #0f172a);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__item-meta {
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__lifehack-subsections {
    display: grid;
    gap: 12px;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__lifehack-subsection {
    display: grid;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.94);
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__lifehack-subtitle {
    margin: 0;
    color: var(--text-primary, #0f172a);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__lifehack-text {
    margin: 0;
    color: var(--text-secondary, #475569);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.55;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__lifehack-list {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 10px;
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.55;
}

.custom-modal.shortcuts-help-modal .shortcuts-help-modal__lifehack-list--ordered {
    padding-left: 24px;
}

.custom-modal.shortcuts-help-modal .custom-modal-buttons.shortcuts-help-modal__footer {
    justify-content: flex-end;
}

@media (max-width: 960px) {
    .custom-modal.shortcuts-help-modal {
        width: min(96vw, 720px);
        min-width: 0;
    }

    .custom-modal.shortcuts-help-modal .shortcuts-help-modal__items {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .custom-modal.shortcuts-help-modal {
        flex-direction: column;
        max-height: min(92vh, 920px);
    }

    .custom-modal.shortcuts-help-modal .custom-modal-title {
        width: 100%;
        padding: 18px 20px 14px;
        justify-content: flex-start;
        border-right: 0;
        border-bottom: 1px solid var(--border-default, #dbe5f0);
    }

    .custom-modal.shortcuts-help-modal .shortcuts-help-modal__rail {
        flex-direction: row;
        justify-content: flex-start;
    }

    .custom-modal.shortcuts-help-modal .custom-modal-content {
        padding: 18px 18px 16px;
    }

    .custom-modal.shortcuts-help-modal .shortcuts-help-modal__header {
        padding-right: 44px;
    }

    .custom-modal.shortcuts-help-modal .shortcuts-help-modal__item {
        grid-template-columns: 1fr;
    }
}

.custom-modal.container-delete-modal {
    width: min(560px, 92vw);
    min-width: min(420px, 92vw);
}

.custom-modal.container-delete-modal .custom-modal-title {
    width: 88px;
    padding: 22px 14px;
}

.custom-modal.container-delete-modal .custom-modal-title img,
.custom-modal.container-delete-modal .custom-modal-title svg {
    width: 52px;
    height: 52px;
}

.custom-modal.container-delete-modal .custom-modal-content {
    padding: 22px 22px 18px;
    gap: 16px;
}

.custom-modal.container-delete-modal .custom-modal-body {
    gap: 16px;
}

.custom-modal.container-delete-modal .custom-modal-body > p:first-child {
    padding-right: 52px;
    display: grid;
    gap: 12px;
    font-size: 14px;
    line-height: 1.45;
}

.container-delete-modal__headline {
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.25;
}

.container-delete-modal__inside,
.container-delete-modal__note {
    display: block;
}

.container-delete-modal__inside {
    color: var(--text-primary, #0f172a);
    font-size: 15px;
    font-weight: 600;
}

.container-delete-modal__note {
    color: var(--text-secondary, #475569);
    font-size: 14px;
    font-weight: 500;
    padding: 12px 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.96));
}

.custom-modal.container-delete-modal .modal-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 14px 16px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 600;
}

.custom-modal.container-delete-modal .modal-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent-primary, #2563eb);
}

.custom-modal.container-delete-modal .custom-modal-buttons {
    margin-top: 4px;
}

@media (max-width: 640px) {
    .custom-modal.container-delete-modal {
        min-width: 0;
        width: min(92vw, 520px);
    }

    .custom-modal.container-delete-modal .custom-modal-title {
        width: 80px;
        padding: 18px 12px;
    }

    .custom-modal.container-delete-modal .custom-modal-content {
        padding: 18px 16px 16px;
    }

    .container-delete-modal__headline {
        font-size: 18px;
    }
}
.custom-modal.dice-faces-modal {
    width: min(1120px, 96vw);
    max-width: 96vw;
    padding: 0;
    border-radius: 22px;
    overflow: hidden;
    gap: 0;
}

.custom-modal.dice-faces-modal .custom-modal-title {
    max-width: none;
    width: 96px;
    padding: 20px 16px;
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.96), rgba(248, 250, 252, 0.96));
    border-right: 1px solid var(--border-default, #dbe5f0);
}

.custom-modal.dice-faces-modal .custom-modal-title img {
    width: 64px;
    height: 64px;
    max-width: none;
    max-height: none;
}

.custom-modal.dice-faces-modal .custom-modal-content {
    padding: 20px 20px 18px;
}

.custom-modal.dice-faces-modal .custom-modal-body {
    gap: 12px;
    max-height: min(76vh, 720px);
    overflow: auto;
    padding-right: 4px;
}

.dice-faces__head {
    display: grid;
    gap: 6px;
}

.dice-faces__title {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
}

.dice-faces__hint {
    font-size: 13px;
    color: #475569;
}

.dice-faces__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
}

.dice-faces__section-title {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    margin: 6px 0 8px;
}

.dice-faces__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    max-height: 52vh;
    overflow: auto;
    padding-right: 4px;
}

.dice-faces__item {
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    cursor: pointer;
    display: grid;
    grid-template-rows: 88px auto;
    transition: transform 0.08s ease, box-shadow 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
}

.dice-faces__item:hover {
    transform: translateY(-1px);
    border-color: rgba(59, 130, 246, 0.38);
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.10);
}

.dice-faces__item.is-used {
    opacity: 0.55;
}

.dice-faces__item.is-picked {
    border-color: rgba(59, 130, 246, 0.95);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.18);
}

.dice-faces__thumb {
    background: #f1f5f9;
    display: grid;
    place-items: center;
    padding: 6px;
}

.dice-faces__thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.dice-faces__thumb-text {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: pre-wrap;
    word-break: break-word;
    font-weight: 800;
    color: #0f172a;
    font-size: 14px;
    line-height: 1.12;
}

.dice-faces__meta {
    padding: 8px 10px 10px;
}

.dice-faces__meta-title {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
}

.dice-faces__faces {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.dice-faces__slot {
    border: 1px dashed rgba(148, 163, 184, 0.9);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 120px;
    min-width: 120px;
}

.dice-faces__slot.is-hot {
    border-color: rgba(59, 130, 246, 0.9);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.dice-faces__slot-head {
    padding: 8px 10px;
    background: #f8fafc;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    font-size: 12px;
    font-weight: 800;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    white-space: nowrap;
}
.dice-faces__slot-head > div {
    overflow: hidden;
    text-overflow: ellipsis;
}

.dice-faces__slot-remove {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.75);
    background: #fff;
    color: #0f172a;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}

.dice-faces__slot-remove:hover {
    background: #fee2e2;
    border-color: rgba(239, 68, 68, 0.65);
}

.dice-faces__slot-remove:active {
    transform: translateY(1px);
}

.dice-faces__slot-body {
    padding: 8px;
    display: grid;
    place-items: center;
}

.dice-faces__slot-empty {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    font-size: 12px;
    color: #64748b;
}

.dice-faces__slot-empty-text {
    max-width: 170px;
}

.dice-faces__builtin-face {
    --dice-size: 44px;
    --dice-dot-size: 7px;
    --dice-dot-inset: 10px;
    width: var(--dice-size);
    height: var(--dice-size);
    position: relative;
    border-radius: 12px;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12), 0 6px 16px rgba(2, 6, 23, 0.08);
    overflow: hidden;
}

.dice-faces__builtin-face .dot {
    position: absolute;
    width: var(--dice-dot-size);
    height: var(--dice-dot-size);
    background: #111;
    border-radius: 50%;
}
.dice-faces__builtin-face .top-left     { top: var(--dice-dot-inset); left: var(--dice-dot-inset); }
.dice-faces__builtin-face .top-right    { top: var(--dice-dot-inset); right: var(--dice-dot-inset); }
.dice-faces__builtin-face .mid-left     { top: calc(50% - (var(--dice-dot-size) / 2)); left: var(--dice-dot-inset); }
.dice-faces__builtin-face .mid-right    { top: calc(50% - (var(--dice-dot-size) / 2)); right: var(--dice-dot-inset); }
.dice-faces__builtin-face .bottom-left  { bottom: var(--dice-dot-inset); left: var(--dice-dot-inset); }
.dice-faces__builtin-face .bottom-right { bottom: var(--dice-dot-inset); right: var(--dice-dot-inset); }
.dice-faces__builtin-face .center       { top: calc(50% - (var(--dice-dot-size) / 2)); left: calc(50% - (var(--dice-dot-size) / 2)); }

.dice-faces__builtin-face--number .dice-face-builtin-number {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-weight: 900;
    color: #0f172a;
    font-size: 20px;
    line-height: 1;
}

.dice-faces__inline-editor {
    width: 100%;
    height: 100%;
    min-height: 88px;
    padding: 10px 10px;
    border-radius: 10px;
    border: 1px solid rgba(59, 130, 246, 0.45);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
    background: #fff;
    color: #0f172a;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    outline: none;
    white-space: pre-wrap;
    word-break: break-word;
    overflow: auto;
}

.dice-faces__slot-item {
    width: 100%;
    height: 100%;
    cursor: default;
    grid-template-rows: 1fr auto;
}

.dice-faces__slot-item .dice-faces__thumb {
    min-height: 64px;
}

.dice-faces__slot--add {
    cursor: pointer;
    border-style: solid;
    border-color: rgba(148, 163, 184, 0.55);
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.9), rgba(255, 255, 255, 1));
    min-height: 108px;
}

.dice-faces__slot--add .dice-faces__slot-head {
    justify-content: center;
    color: #334155;
}

.dice-faces__slot--add .dice-faces__slot-body {
    padding: 12px;
}

.dice-faces__slot-add-icon {
    width: 52px;
    height: 52px;
    opacity: 0.92;
    pointer-events: none;
    user-select: none;
    margin: 0 auto;
}

.dice-faces__controls {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.dice-faces__size {
    display: grid;
    grid-template-columns: auto 1fr 84px;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.dice-faces__size span {
    font-size: 12px;
    font-weight: 700;
    color: #334155;
}

.dice-faces__size-range {
    width: 100%;
}

.dice-faces__size-number {
    width: 48px;
    text-align: right;
    padding: 6px 8px;
    border: 1px solid rgba(148, 163, 184, 0.8);
    border-radius: 10px;
}

.dice-faces__clear {
    white-space: nowrap;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.9);
    background: #ffffff;
    color: #0f172a;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}

.dice-faces__clear:hover {
    background: #f8fafc;
    border-color: rgba(100, 116, 139, 0.9);
}

.dice-faces__clear:active {
    transform: translateY(1px);
}

@media (max-width: 860px) {
    .dice-faces__grid {
        grid-template-columns: 1fr;
    }
    .dice-faces__list {
        max-height: 32vh;
    }
}
.custom-modal-body .modal-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}
.custom-modal-body .modal-checkbox input {
    width: auto;
    padding: 0;
}

.custom-modal-body .modal-radio-group{
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 8px 0 12px;
}

.custom-modal-body .modal-radio-group__label{
    font-size: 14px;
    font-weight: 700;
    color: #222;
    margin-bottom: 2px;
}

.custom-modal-body .modal-radio{
    display: flex;
    align-items: center;
    gap: 10px;
    user-select: none;
    margin: 0;
    font-size: 14px;
}

.custom-modal-body .modal-radio input[type="radio"]{
    width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
}

/* ============================
   Memory Match settings modal
   ============================ */

.custom-modal.memory-settings-modal{
    width: min(720px, 92vw);
    max-width: 92vw;
    padding: 0;
    overflow: hidden;
    border-radius: 16px;
}

.custom-modal.memory-settings-modal .custom-modal-title{
    max-width: none;
    width: 84px;
    padding: 18px 12px;
    align-items: flex-start;
    justify-content: center;
    background: linear-gradient(180deg, rgba(59,130,246,0.10), rgba(255,255,255,0));
    border-right: 1px solid rgba(15,23,42,0.08);
}

.custom-modal.memory-settings-modal .custom-modal-content{
    padding: 18px 18px 14px;
}

.custom-modal.memory-settings-modal .custom-modal-close{
    display: block;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.06);
    font-size: 22px;
    line-height: 1;
    color: rgba(15, 23, 42, 0.7);
}
.custom-modal.memory-settings-modal .custom-modal-close:hover{
    background: rgba(15, 23, 42, 0.10);
    color: rgba(15, 23, 42, 0.9);
}

.memory-settings__head{
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 42px;
}
.memory-settings__title{
    font-size: 18px;
    font-weight: 800;
    color: #111827;
}
.memory-settings__sub{
    font-size: 12px;
    color: #6b7280;
}

.memory-settings__grid{
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.memory-settings__section{
    border: 1px solid rgba(15,23,42,0.10);
    border-radius: 14px;
    padding: 12px;
    background: rgba(249, 250, 251, 0.75);
}
.memory-settings__section--full{
    grid-column: 1 / -1;
}
.memory-settings__section-title{
    font-size: 13px;
    font-weight: 800;
    color: #111827;
    margin-bottom: 10px;
}
.memory-settings__fields{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.memory-settings__fields--cols{
    grid-template-columns: 1fr 1fr;
}
.memory-settings__field{
    display: grid;
    gap: 6px;
}
.memory-settings__field--full{
    grid-column: 1 / -1;
}
.memory-settings__field span{
    font-size: 12px;
    color: #374151;
    font-weight: 600;
}
.memory-settings__color-row{
    display: flex;
    align-items: center;
}
.memory-settings__color-btn{
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    cursor: pointer;
    padding: 0;
}
.memory-settings__hint{
    font-size: 12px;
    color: #6b7280;
    line-height: 1.35;
    margin-top: 8px;
}
.memory-settings__modes{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.memory-settings__mode-btn{
    min-height: 40px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-default, rgba(15,23,42,0.10));
    background: #ffffff;
    color: var(--text-primary, #111827);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.memory-settings__mode-btn:hover{
    background: var(--accent-soft, #eef6ff);
    border-color: var(--border-strong, #cbd5e1);
}
.memory-settings__mode-btn.is-active{
    background: var(--accent-soft, #eef6ff);
    border-color: var(--accent-primary, #1d4ed8);
    color: var(--accent-primary, #1d4ed8);
}

.deck-settings{
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.deck-settings__section{
    border: 1px solid rgba(15,23,42,0.10);
    border-radius: 14px;
    padding: 12px;
    background: rgba(249, 250, 251, 0.75);
}

.deck-settings__main-grid{
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.deck-settings__row{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.deck-settings__row input[type="number"]{
    width: 104px;
}

.deck-settings__row--gap{
    margin-top: 12px;
}

.deck-settings__row--toggle{
    margin-top: 6px;
}

.deck-toggle-group{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.deck-settings__animation-header{
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}

.deck-settings__animation-grid{
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.deck-settings__anim-group{
    display: grid;
    gap: 8px;
}

.deck-settings__anim-group > label{
    font-size: 12px;
    color: #374151;
    font-weight: 700;
}

.deck-settings__section--audio{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: center;
}

.deck-settings__section--audio input[type="range"]{
    width: 100%;
}

.deck-toggle{
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.deck-toggle input[type="checkbox"]{
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.deck-toggle__track{
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: #e5e7eb;
    border: 1px solid #cfd4dd;
    position: relative;
    transition: background 0.16s ease, border-color 0.16s ease;
}

.deck-toggle__thumb{
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    position: absolute;
    top: 2px;
    left: 2px;
    box-shadow: 0 2px 6px rgba(15,23,42,0.22);
    transition: left 0.16s ease, border-color 0.16s ease;
}

.deck-toggle input[type="checkbox"]:checked + .deck-toggle__track{
    background: #dbeafe;
    border-color: #93c5fd;
}

.deck-toggle input[type="checkbox"]:checked + .deck-toggle__track .deck-toggle__thumb{
    left: 22px;
    border-color: #93c5fd;
}

.deck-choice-group{
    display: grid;
    gap: 6px;
}

.deck-choice-group--4{
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.deck-choice-group--3{
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.deck-choice-group--2{
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.deck-choice{
    position: relative;
    display: block;
    user-select: none;
}

.deck-choice input[type="radio"]{
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.deck-choice span{
    display: inline-flex;
    width: 100%;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: #f8fafc;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.1;
    cursor: pointer;
    transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.deck-choice input[type="radio"]:checked + span{
    background: #dbeafe;
    border-color: #60a5fa;
    color: #0f172a;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.18);
}

.custom-modal.memory-settings-modal .custom-modal-buttons{
    margin-top: 14px;
}

.custom-modal.formula-dialog-modal{
    width: min(720px, 92vw);
    max-width: 92vw;
}

.custom-modal.formula-dialog-modal .custom-modal-title{
    display: flex;
    align-items: center;
}

.formula-dialog-modal__titleCopy{
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.formula-dialog-modal__eyebrow{
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}

.formula-dialog-modal__headline{
    font-size: 18px;
    line-height: 1.2;
    color: #0f172a;
}

.formula-dialog-modal__body{
    display: grid;
    gap: 14px;
}

.formula-dialog-modal__field{
    display: grid;
    gap: 6px;
}

.formula-dialog-modal__textarea{
    min-height: 108px;
    resize: vertical;
}

.formula-dialog-modal__grid{
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.formula-dialog-modal__previewWrap{
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    border-radius: 16px;
    background: #f8fafc;
}

.formula-dialog-modal__previewLabel{
    font-size: 12px;
    font-weight: 700;
    color: #475569;
}

.formula-dialog-modal__preview{
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border-radius: 12px;
    background: #ffffff;
}

.formula-dialog-modal__preview--block{
    min-height: 88px;
}

.formula-dialog-modal__preview[data-preview-align="left"]{
    justify-content: flex-start;
}

.formula-dialog-modal__preview[data-preview-align="right"]{
    justify-content: flex-end;
}

.formula-dialog-modal__error{
    font-size: 12px;
    font-weight: 600;
    color: #b91c1c;
}

@media (max-width: 680px){
    .formula-dialog-modal__grid{
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px){
    .custom-modal.memory-settings-modal{
        flex-direction: column;
    }
    .custom-modal.memory-settings-modal .custom-modal-title{
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(15,23,42,0.08);
        padding: 14px 12px;
        align-items: center;
    }
    .memory-settings__grid{
        grid-template-columns: 1fr;
    }
    .deck-choice-group--4,
    .deck-choice-group--3,
    .deck-choice-group--2{
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px){
    .custom-modal.board-editor-modal{
        min-width: 0;
        width: min(96vw, 420px);
        flex-direction: column;
    }
    .custom-modal.board-editor-modal .custom-modal-title{
        width: 100%;
        padding: 18px 18px 0;
        border-right: none;
        border-bottom: 1px solid var(--border-default, #dbe5f0);
        justify-content: flex-start;
        align-items: center;
    }
    .custom-modal.board-editor-modal .custom-modal-content{
        padding: 16px 16px 16px;
    }
    .custom-modal.board-editor-modal .custom-modal-buttons button{
        width: 100%;
    }
}

@media (max-width: 900px){
    .deck-settings__main-grid{
        grid-template-columns: 1fr;
    }
    .deck-settings__animation-grid{
        grid-template-columns: 1fr;
    }
    .deck-settings__section--audio{
        grid-template-columns: 1fr;
    }
}

.custom-modal-close {
    position: absolute; 
    top: -5px; 
    right: -5px;
    display: none;
    background: none; border: none; font-size: 26px;
    cursor: pointer; color: #777;
}
.custom-modal-close:hover { color: #000; }

.custom-modal-buttons {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
    gap: 8px;
}
.custom-modal-buttons button {
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 15px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-ok {
    background: #4caf50;
    color: white;
}
.btn-ok:hover { background: #45a049; }
.btn-cancel {
    background: #e0e0e0;
    color: #333;
}
.btn-cancel:hover { background: #d5d5d5; }

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

/* ===== Sets export modal ===== */
.custom-modal.sets-export-modal {
    width: min(520px, 92vw);
}
.custom-modal.sets-export-modal .menu-title {
    font-weight: 700;
    font-size: 16px;
}
.custom-modal.sets-export-modal .menu-subtitle {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 14px;
}
.custom-modal.sets-export-modal .menu-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #111;
}
.custom-modal.sets-export-modal .menu-field input[type="number"],
.custom-modal.sets-export-modal .menu-field select {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 6px 8px;
    width: 160px;
}
.custom-modal.sets-export-modal .menu-field.checkbox {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.custom-modal.sets-export-modal .menu-field.checkbox input {
    width: 16px;
    height: 16px;
}

.text-settings__title {
    font-size: 18px;
    font-weight: 700;
}
.text-settings__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    align-items: end;
}
.text-settings__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.text-settings__field--full {
    grid-column: 1 / -1;
}
.text-settings__label {
    font-size: 13px;
    color: #444;
}
.text-settings__sep {
    height: 1px;
    background: #eee;
    margin: 4px 0;
}
.text-settings__note {
    font-size: 12px;
    color: #666;
    background: #f7f7f7;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 8px 10px;
}

.custom-modal.text-settings-modal {
    width: min(1200px, 96vw);
    min-width: min(900px, 96vw);
    max-width: 96vw;
    max-height: min(88vh, 920px);
    padding: 0;
    gap: 0;
    overflow: hidden;
    border-radius: 22px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.16);
}

.custom-modal.text-settings-modal .custom-modal-content {
    min-width: 0;
    min-height: 0;
    padding: 0;
    position: relative;
    overflow: visible;
}

.custom-modal.text-settings-modal .custom-modal-body {
    min-height: 0;
    gap: 0;
    overflow: visible;
}

.custom-modal.text-settings-modal .text-settings__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    cursor: pointer;
    z-index: 2;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.custom-modal.text-settings-modal .text-settings__close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.18s ease;
}

.custom-modal.text-settings-modal .text-settings__close:hover {
    background: var(--bg-app, #f8fafc);
    border-color: #cbd5e1;
}

.custom-modal.text-settings-modal .text-settings__close:hover img,
.custom-modal.text-settings-modal .text-settings__close:focus-visible img {
    transform: rotate(90deg);
}

.custom-modal.text-settings-modal .text-settings__close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.custom-modal.text-settings-modal .text-settings__header {
    padding: 16px 16px 12px;
    padding-right: 72px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.custom-modal.text-settings-modal .text-settings__headMain {
    display: grid;
    gap: 14px;
}

.custom-modal.text-settings-modal .text-settings__titleRow {
    display: flex;
    align-items: center;
    gap: 14px;
}

.custom-modal.text-settings-modal .text-settings__titleIcon {
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(191, 219, 254, 0.96);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.96), rgba(248, 250, 252, 0.96));
}

.custom-modal.text-settings-modal .text-settings__titleIcon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.custom-modal.text-settings-modal .text-settings__title {
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.25;
}

.custom-modal.text-settings-modal .text-settings__previewBlock {
    display: grid;
    gap: 8px;
}

.custom-modal.text-settings-modal .text-settings__previewTitle {
    color: var(--text-secondary, #475569);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.custom-modal.text-settings-modal .text-settings__preview-list {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.custom-modal.text-settings-modal .text-settings__preview {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: var(--bg-app, #f8fafc);
}

.custom-modal.text-settings-modal .text-settings__preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
}

.custom-modal.text-settings-modal .text-settings__note {
    margin: 16px 24px 0;
    padding: 12px 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.96));
    color: var(--text-secondary, #475569);
    font-size: 13px;
    line-height: 1.45;
}

.custom-modal.text-settings-modal .text-settings__toolbar {
    padding: 8px 12px 0;
}

.custom-modal.text-settings-modal .text-inline-toolbar__surface.text-settings__toolbarSurface {
    width: 100%;
    min-height: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    padding: 4px 12px 6px;
    box-shadow: none;
    border-radius: 14px;
}

.custom-modal.text-settings-modal .text-settings__toolbar .text-inline-toolbar__sectionLabel {
    display: none;
}

.custom-modal.text-settings-modal .text-settings__toolbar .text-inline-toolbar__sectionBody {
    min-height: 40px;
}

.custom-modal.text-settings-modal .text-settings__toolbar .text-inline-toolbar__section--style {
    min-width: 0;
}

.custom-modal.text-settings-modal .text-settings__toolbar .text-inline-toolbar__section--display {
    margin-left: auto;
}

.custom-modal.text-settings-modal .text-settings__toolbar .text-settings__richToolbar {
    margin-bottom: 0;
}

.custom-modal.text-settings-modal .text-settings__toolbar .text-settings__richToolbarGroup {
    flex-wrap: nowrap;
}

.custom-modal.text-settings-modal .text-settings__toolbar .text-settings__font-picker--toolbar {
    width: min(280px, 100%);
}

.custom-modal.text-settings-modal .text-settings__toolbar .text-settings__font-size--toolbar {
    min-width: 124px;
}

.custom-modal.text-settings-modal .text-settings__toolbar .text-settings__colorRow--toolbar {
    display: inline-flex;
    align-items: center;
}

.custom-modal.text-settings-modal .text-settings__toolbar .text-settings__color-btn--toolbar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
}

.custom-modal.text-settings-modal .text-settings__toolbarDisplayGroup {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.custom-modal.text-settings-modal .text-settings__richAction--toolbar {
    min-width: 40px;
    width: 40px;
    height: 40px;
}

.custom-modal.text-settings-modal .text-settings__richMathGlyph {
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
}

.custom-modal.text-settings-modal .text-settings__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 16px 24px 24px;
    overflow: auto;
    min-height: 0;
}

.custom-modal.text-settings-modal .text-settings__layoutMain {
    display: grid;
    gap: 16px;
    align-content: start;
    min-width: 0;
}

.custom-modal.text-settings-modal .text-settings__footerControls {
    padding: 0 12px 8px;
    overflow: visible;
}

.custom-modal.text-settings-modal .text-inline-toolbar__surface.text-settings__footerControlsSurface {
    width: max-content;
    min-width: 100%;
    min-height: 56px;
    height: 56px;
    padding: 6px 12px 6px;
    box-sizing: border-box;
    box-shadow: none;
    border-radius: 14px;
    align-items: center;
}

.custom-modal.text-settings-modal .text-settings__footerControlsSection .text-inline-toolbar__sectionLabel {
    display: none;
}

.custom-modal.text-settings-modal .text-settings__footerControlsSection .text-inline-toolbar__sectionBody {
    min-height: 40px;
}

.custom-modal.text-settings-modal .text-settings__footerControls .text-inline-toolbar__frameWidthMenu,
.custom-modal.text-settings-modal .text-settings__footerControls .text-inline-toolbar__frameStyleMenu,
.custom-modal.text-settings-modal .text-settings__footerControls .text-inline-toolbar__frameRadiusMenu {
    top: auto;
    bottom: calc(100% + 10px);
}

.custom-modal.text-settings-modal .text-settings__footerControls .text-inline-toolbar__frameWidthTrigger::after,
.custom-modal.text-settings-modal .text-settings__footerControls .text-inline-toolbar__frameStyleTrigger::after {
    transform: translateY(-35%) rotate(-135deg);
}

.custom-modal.text-settings-modal .text-settings__footerControls .text-inline-toolbar__frameWidth.is-open .text-inline-toolbar__frameWidthTrigger::after,
.custom-modal.text-settings-modal .text-settings__footerControls .text-inline-toolbar__frameStyle.is-open .text-inline-toolbar__frameStyleTrigger::after {
    transform: translateY(-60%) rotate(45deg);
}

.custom-modal.text-settings-modal .text-settings__panel {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.94), rgba(255, 255, 255, 0.98));
}

.custom-modal.text-settings-modal .text-settings__panelTitle {
    color: var(--text-primary, #0f172a);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
}

.custom-modal.text-settings-modal .text-settings__panelGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
}

.custom-modal.text-settings-modal .text-settings__field {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.custom-modal.text-settings-modal .text-settings__field--full {
    grid-column: 1 / -1;
}

.custom-modal.text-settings-modal .text-settings__field--textarea {
    height: 100%;
}

.custom-modal.text-settings-modal .text-settings__label {
    display: none;
}

.custom-modal.text-settings-modal .text-settings__label--icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.custom-modal.text-settings-modal .text-settings__label--icon img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.custom-modal.text-settings-modal .modalInput {
    box-sizing: border-box;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    line-height: 1.2;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.custom-modal.text-settings-modal .modalInput:hover {
    border-color: #cbd5e1;
}

.custom-modal.text-settings-modal .modalInput:focus {
    outline: none;
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.custom-modal.text-settings-modal select.modalInput {
    min-height: 46px;
    padding: 0 14px;
}

.custom-modal.text-settings-modal .text-settings__textarea {
    width: 100%;
    min-height: 420px;
    height: 100%;
    max-height: min(62vh, 640px);
    padding: 16px 18px;
    resize: vertical;
    font-size: 15px;
    line-height: 1.5;
}

.custom-modal.text-settings-modal .text-settings__textarea--mirror[hidden] {
    display: none !important;
}

.custom-modal.text-settings-modal .text-settings__richToolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
}

.custom-modal.text-settings-modal .text-settings__richToolbarGroup {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.custom-modal.text-settings-modal .text-settings__richUnderlinePicker {
    position: relative;
}

.custom-modal.text-settings-modal .text-settings__richAction {
    width: 40px;
    min-width: 40px;
    height: 40px;
    border-radius: 12px;
}

.custom-modal.text-settings-modal [data-rich-underline-glyph] {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-decoration: none !important;
    text-underline-offset: 0;
    text-decoration-thickness: auto;
}

.custom-modal.text-settings-modal [data-rich-underline-glyph]::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -2px;
    width: 16px;
    height: 0;
    border-radius: 999px;
    background: currentColor;
    opacity: 0;
    transform: translateX(-50%);
}

.custom-modal.text-settings-modal [data-rich-underline-glyph].is-underline {
    text-decoration: none !important;
}

.custom-modal.text-settings-modal [data-rich-underline-glyph].is-underline::after {
    height: 2px;
    opacity: 1;
}

.custom-modal.text-settings-modal .text-settings__richAction--menu {
    min-width: 32px;
    width: 32px;
    padding: 0;
}

.custom-modal.text-settings-modal .text-settings__richAction--menu img {
    width: 16px;
    height: 16px;
    display: block;
    margin: 0 auto;
}

.custom-modal.text-settings-modal .text-settings__richUnderlineMenu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
}

.custom-modal.text-settings-modal .text-settings__richUnderlineMenu[hidden] {
    display: none !important;
}

.custom-modal.text-settings-modal .text-settings__richUnderlineOption {
    width: 64px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.text-settings-modal .text-settings__richUnderlineOption:hover,
.custom-modal.text-settings-modal .text-settings__richUnderlineOption.is-active {
    border-color: rgba(37, 99, 235, 0.42);
    background: rgba(239, 246, 255, 0.88);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}

.custom-modal.text-settings-modal .text-settings__richUnderlineOption:focus-visible {
    outline: none;
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.custom-modal.text-settings-modal .text-settings__richUnderlineOption img {
    width: 48px;
    height: 48px;
    display: block;
}

.custom-modal.text-settings-modal .text-settings__richEditor {
    width: 100%;
    min-height: 372px;
    height: 100%;
    max-height: min(62vh, 640px);
    overflow: auto;
    padding: 12px 14px;
    caret-color: currentColor;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.custom-modal.text-settings-modal .text-settings__richEditor .text-rich-segment {
    display: inline;
    line-height: inherit;
    white-space: pre-wrap;
}

.custom-modal.text-settings-modal .text-settings__richEditor .text-rich-tab {
    display: inline-block;
    width: 4ch;
    min-width: 4ch;
    white-space: pre;
    vertical-align: baseline;
    overflow: hidden;
}

.custom-modal.text-settings-modal .text-settings__richEditor .text-rich-segment--underline-solid[data-underline-style="solid"] {
    text-decoration-line: none !important;
    background-image: linear-gradient(to right, currentColor 0 100%);
    background-size: 100% 2px;
    background-position: 0 calc(100% - 2px);
    background-repeat: no-repeat;
    padding-bottom: 4px;
}

.custom-modal.text-settings-modal .text-settings__richEditor .text-rich-segment--underline-dashed[data-underline-style="dashed"] {
    text-decoration-line: none !important;
    background-image: linear-gradient(to right, currentColor 0 12px, transparent 12px 18px);
    background-size: 18px 2px;
    background-position: 0 calc(100% - 2px);
    background-repeat: repeat-x;
    padding-bottom: 4px;
}

.custom-modal.text-settings-modal .text-settings__richEditor .text-rich-segment--underline-dash-dot[data-underline-style="dash-dot"] {
    text-decoration-line: none !important;
    background-image: linear-gradient(
      to right,
      currentColor 0 10px,
      transparent 10px 14px,
      currentColor 14px 16px,
      transparent 16px 24px
    );
    background-size: 24px 2px;
    background-position: 0 calc(100% - 2px);
    background-repeat: repeat-x;
    padding-bottom: 4px;
}

.custom-modal.text-settings-modal .text-settings__colorRow {
    display: flex;
    align-items: center;
    gap: 10px;
}

.custom-modal.text-settings-modal .text-settings__color-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: #111111;
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.72);
    cursor: pointer;
    padding: 0;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.custom-modal.text-settings-modal .text-settings__color-btn:hover {
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.custom-modal.text-settings-modal .text-settings__color-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.custom-modal.text-settings-modal .text-settings__font-picker {
    position: relative;
}

.custom-modal.text-settings-modal .text-settings__font-picker .text-inline-toolbar__fontTrigger {
    min-height: 44px;
}

.custom-modal.text-settings-modal .text-settings__font-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    max-height: 280px;
    overflow: auto;
    padding: 8px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
    z-index: 12;
}

.custom-modal.text-settings-modal .text-settings__font-menu[hidden] {
    display: none !important;
}

.custom-modal.text-settings-modal .text-settings__font-option {
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: center;
    column-gap: 14px;
    text-align: left;
    cursor: pointer;
}

.custom-modal.text-settings-modal .text-settings__font-option:hover,
.custom-modal.text-settings-modal .text-settings__font-option.is-selected {
    background: #f8fafc;
}

.custom-modal.text-settings-modal .text-settings__font-option.is-selected {
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.custom-modal.text-settings-modal .text-settings__font-option-preview {
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
    color: var(--text-primary, #0f172a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.custom-modal.text-settings-modal .text-settings__font-option-name {
    font-size: 14px;
    font-style: italic;
    font-weight: 500;
    color: var(--text-secondary, #475569);
    line-height: 1.2;
    white-space: nowrap;
}

.custom-modal.text-settings-modal .text-settings__font-size {
    display: grid;
    gap: 12px;
}

.custom-modal.text-settings-modal .text-settings__size-picker {
    position: relative;
    min-width: 0;
}

.custom-modal.text-settings-modal .text-settings__size-picker .text-inline-toolbar__sizeTrigger {
    min-height: 44px;
}

.custom-modal.text-settings-modal .text-settings__choiceGroup {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.custom-modal.text-settings-modal .text-settings__inlineTools {
    display: grid;
    gap: 8px;
}

.custom-modal.text-settings-modal .text-settings__inlineToolsHead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.custom-modal.text-settings-modal .text-settings__inlineToolsBody {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.custom-modal.text-settings-modal .text-settings__inlineToolsBody .text-settings__choiceGroup {
    flex: 1 1 auto;
}

.custom-modal.text-settings-modal .text-settings__inlineColor {
    flex: 0 0 auto;
}

.custom-modal.text-settings-modal .text-settings__inlineColorLabel {
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

.custom-modal.text-settings-modal .text-settings__choiceButton {
    min-height: 40px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.text-settings-modal .text-settings__choiceButton--icon {
    width: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.custom-modal.text-settings-modal .text-settings__choiceButton--text {
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.custom-modal.text-settings-modal .text-settings__choiceButton:hover {
    border-color: #cbd5e1;
    background: var(--bg-app, #f8fafc);
}

.custom-modal.text-settings-modal .text-settings__choiceButton:disabled {
    opacity: 0.52;
    cursor: not-allowed;
    background: #f8fafc;
    transform: none;
}

.custom-modal.text-settings-modal .text-settings__choiceButton.is-active {
    border-color: rgba(37, 99, 235, 0.42);
    background: rgba(239, 246, 255, 0.88);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}

.custom-modal.text-settings-modal .text-settings__choiceButton:focus-visible {
    outline: none;
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.custom-modal.text-settings-modal .text-settings__choiceIcon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.custom-modal.text-settings-modal .text-settings__choiceText {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

.custom-modal.text-settings-modal .text-settings__switchList {
    display: grid;
    gap: 12px;
}

.custom-modal.text-settings-modal .text-settings__frameGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.7), rgba(255, 255, 255, 0.96));
}

.custom-modal.text-settings-modal .text-settings__numberInputWrap {
    position: relative;
}

.custom-modal.text-settings-modal .text-settings__numberInput {
    padding-right: 42px !important;
}

.custom-modal.text-settings-modal .text-settings__numberSuffix {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: var(--text-secondary, #475569);
    font-size: 12px;
    font-weight: 700;
    pointer-events: none;
}

.custom-modal.text-settings-modal .text-settings__switchRow {
    display: grid;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: #ffffff;
}

.custom-modal.text-settings-modal .text-settings__switchRowMain {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.custom-modal.text-settings-modal .text-settings__switchRow--color {
    grid-template-columns: 1fr auto;
    align-items: center;
    column-gap: 12px;
}

.custom-modal.text-settings-modal .text-settings__switchRow--color .text-settings__switchRowMain {
    min-width: 0;
}

.custom-modal.text-settings-modal .text-settings__switchLabel {
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

.custom-modal.text-settings-modal .text-settings__switch {
    position: relative;
    flex: 0 0 auto;
    width: 46px;
    height: 28px;
}

.custom-modal.text-settings-modal .text-settings__switchInput {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.custom-modal.text-settings-modal .text-settings__switchTrack {
    position: absolute;
    inset: 0;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 999px;
    background: var(--bg-app, #f8fafc);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
    transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.text-settings-modal .text-settings__switchTrack::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.14);
    transition: transform 0.16s ease;
}

.custom-modal.text-settings-modal .text-settings__switchInput:hover + .text-settings__switchTrack {
    border-color: #cbd5e1;
}

.custom-modal.text-settings-modal .text-settings__switchInput:focus-visible + .text-settings__switchTrack {
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.custom-modal.text-settings-modal .text-settings__switchInput:checked + .text-settings__switchTrack {
    border-color: rgba(37, 99, 235, 0.42);
    background: rgba(239, 246, 255, 0.92);
}

.custom-modal.text-settings-modal .text-settings__switchInput:checked + .text-settings__switchTrack::after {
    transform: translateX(18px);
}

.custom-modal.text-settings-modal .text-settings__switchInput:disabled + .text-settings__switchTrack {
    opacity: 0.55;
}

.custom-modal.text-settings-modal .custom-modal-buttons {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 0;
    padding: 16px 24px 20px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.92));
}

.custom-modal.text-settings-modal .text-settings__footerLeft,
.custom-modal.text-settings-modal .text-settings__footerRight {
    display: flex;
    align-items: center;
    gap: 10px;
}

.custom-modal.text-settings-modal .text-settings__footerLeft {
    margin-left: auto;
}

.custom-modal.text-settings-modal .text-settings__footerRight {
    margin-left: 0;
}

.custom-modal.text-settings-modal .custom-modal-buttons button {
    min-width: 120px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 700;
    box-shadow: none;
}

.custom-modal.text-settings-modal .btn-cancel {
    background: #ffffff;
    color: #334155;
    border-color: #dbe4ee;
}

.custom-modal.text-settings-modal .btn-cancel:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.custom-modal.text-settings-modal .btn-ok {
    background: var(--accent-primary, #2563eb);
    color: #ffffff;
    border-color: var(--accent-primary, #2563eb);
}

.custom-modal.text-settings-modal .btn-ok:hover {
    background: var(--accent-primary-hover, #1d4ed8);
    border-color: var(--accent-primary-hover, #1d4ed8);
}

@media (max-width: 960px) {
    .custom-modal.text-settings-modal {
        min-width: 0;
        width: min(96vw, 860px);
    }

    .custom-modal.text-settings-modal .text-settings__layout {
        grid-template-columns: 1fr;
    }

    .custom-modal.text-settings-modal .text-settings__textarea {
        min-height: 260px;
        max-height: none;
    }
}

@media (max-width: 720px) {
    .custom-modal.text-settings-modal .text-settings__header {
        padding: 20px 16px 14px;
        padding-right: 60px;
    }

    .custom-modal.text-settings-modal .text-settings__toolbar {
        padding: 14px 16px 0;
    }

    .custom-modal.text-settings-modal .text-settings__footerControls {
        padding: 0 16px 16px;
    }

    .custom-modal.text-settings-modal .text-settings__note {
        margin: 14px 16px 0;
    }

    .custom-modal.text-settings-modal .text-settings__layout {
        padding: 16px 16px 18px;
        gap: 16px;
    }

    .custom-modal.text-settings-modal .text-settings__panelGrid {
        grid-template-columns: 1fr;
    }

    .custom-modal.text-settings-modal .text-settings__inlineTools {
        gap: 10px;
    }

    .custom-modal.text-settings-modal .text-settings__inlineToolsHead,
    .custom-modal.text-settings-modal .text-settings__inlineToolsBody {
        align-items: stretch;
    }

    .custom-modal.text-settings-modal .text-settings__inlineColor {
        width: 100%;
    }

    .custom-modal.text-settings-modal .text-settings__switchRow--color {
        grid-template-columns: 1fr;
    }

    .custom-modal.text-settings-modal .text-settings__frameGrid {
        grid-template-columns: 1fr;
    }

    .custom-modal.text-settings-modal .text-inline-toolbar__sizeMenu {
        left: 0;
        min-width: 0;
    }

    .custom-modal.text-settings-modal .custom-modal-buttons {
        padding: 14px 16px 16px;
        flex-direction: column;
        align-items: stretch;
    }

    .custom-modal.text-settings-modal .text-settings__footerLeft,
    .custom-modal.text-settings-modal .text-settings__footerRight {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        margin-left: 0;
    }

    .custom-modal.text-settings-modal .custom-modal-buttons button {
        width: 100%;
    }
}

.custom-modal.text-edit-modal {
    max-width: 90vw;
}
.custom-modal.text-edit-modal textarea.modalInput {
    resize: both;
    min-height: 140px;
    width: 420px;
    max-width: 86vw;
}

.custom-modal.contacts-modal {
  max-width: min(720px, 92vw);
}

.custom-modal.contacts-modal .custom-modal-body p {
  font-size: 14px;
  line-height: 1.55;
}

/* --- Donation modal (global) --- */
.donation-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2147483647;
}

.donation-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(580px, 92vw);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 250, 255, 0.92));
  backdrop-filter: blur(18px);
  border-radius: 16px;
  border: 1px solid rgba(214, 225, 240, 0.85);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.donation-header {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: transparent;
  border-bottom: 1px solid rgba(230, 234, 242, 0.8);
  cursor: grab;
  user-select: none;
}

.donation-title {
  font-weight: 800;
  font-size: 20px;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 10px;
}

.donation-title__icon {
  width: 48px;
  height: 48px;
  display: block;
}

.donation-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #eef2f7;
  cursor: pointer;
  color: #111;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.donation-close img {
  width: 20px;
  height: 20px;
  display: block;
}

.donation-close:hover {
  background: #d7e0eb;
  border-color: #bfcada;
  transform: rotate(180deg);
}

.donation-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.donation-desc {
  color: #5f6b7a;
  font-size: 14px;
  line-height: 1.4;
}

.donation-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.donation-label {
  font-weight: 700;
  color: #111;
  font-size: 13px;
}

.donation-amounts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.donation-amount {
  height: 42px;
  border-radius: 12px;
  border: 1px solid #d9e2ef;
  background: linear-gradient(180deg, #fdfefe, #edf3fb);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -4px 12px rgba(191, 205, 224, 0.22);
  cursor: pointer;
  font-weight: 700;
  color: #0f172a;
}

.donation-amount:hover {
  background: linear-gradient(180deg, #ffffff, #e7effa);
}

.donation-amount.active {
  border-color: #6c8cff;
  background: linear-gradient(180deg, #f2f6ff, #dee8ff);
  color: #3053bf;
  font-size: larger;
}

.donation-other {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 8px;
  align-items: center;
}

.donation-other input {
  height: 42px;
  border-radius: 12px;
  border: 1px solid #d9e2ef;
  padding: 0 12px;
  font-size: larger;
  font-weight: 600;
  text-align: center;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -4px 12px rgba(191, 205, 224, 0.18);
}

.donation-other input:disabled {
  background: #f9fafc;
  color: #94a3b8;
}

.donation-payments {
  display: flex;
  flex-wrap: nowrap;
  gap: 20px;
  align-items: center;
  justify-content: space-evenly;
  padding-top: 4px;
}

.donation-payments img {
  height: 32px;
  opacity: 0.6;
  filter: grayscale(30%);
  user-select: none;
}

.donation-legal {
  color: #8a94a6;
  font-size: 12px;
  line-height: 1.35;
  border-top: 1px dashed #e6eaf2;
  padding-top: 10px;
  margin-top: 12px;
}

.donation-actions {
  padding: 16px 18px;
  display: flex;
  gap: 12px;
  justify-content: space-evenly;
  align-items: center;
  border-top: 1px solid rgba(230, 234, 242, 0.8);
  background: transparent;
}

.donation-provider {
  height: 32px;
}

.donation-action-btn {
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.donation-action-btn.donation-cancel {
  background: transparent;
  border: 1px solid #d3d9e6;
  color: #334155;
}

.donation-action-btn.donation-cancel:hover {
  background: #f8fafc;
}

.donation-action-btn.donation-support {
  border: 0;
  background: linear-gradient(135deg, #6c8cff, #4c6ef5);
  color: #fff;
  box-shadow: 0 10px 22px rgba(76, 110, 245, 0.25);
  min-width: 168px;
  height: 48px;
}

.donation-action-btn.donation-support:hover {
  filter: brightness(1.03);
}

.donation-action-btn.donation-support:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

/* --- Feedback modal (global) --- */
.feedback-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2048;
}

.feedback-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(760px, 92vw);
  max-height: 88vh;
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.feedback-header {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e6e9ef;
  background: #f8fafc;
  user-select: none;
  cursor: grab;
}

body.feedback-dragging .feedback-header {
  cursor: grabbing;
}

.feedback-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 18px;
  color: #111;
}

.feedback-icon {
  width: 32px;
  height: 32px;
  display: block;
}

.feedback-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #eef2f7;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.feedback-close img {
  width: 20px;
  height: 20px;
  display: block;
}

.feedback-close:hover {
  background: #d7e0eb;
  border-color: #bfcada;
  transform: rotate(180deg);
}

.feedback-body {
  padding: 12px 14px 14px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-x: hidden;
}

.feedback-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feedback-label {
  font-size: 13px;
  color: #334155;
  font-weight: 650;
}

.feedback-label .req {
  color: #dc2626;
}

.feedback-textarea {
  width: 100%;
  min-height: 120px;
  max-height: 360px;
  box-sizing: border-box;
  resize: none;
  padding: 10px 12px;
  border: 1px solid #d6dbe3;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.35;
  outline: none;
}

.feedback-textarea:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.feedback-drop {
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 12px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.feedback-drop.dragover {
  border-color: #60a5fa;
  background: #eff6ff;
}

.feedback-drop-hint {
  font-size: 13px;
  color: #475569;
}

.feedback-upload-btn {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.feedback-upload-btn:hover,
.feedback-upload-btn:focus-visible {
  background: #eff6ff;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
  transform: translateY(-1px);
}

.feedback-upload-btn img {
  width: 22px;
  height: 22px;
  display: block;
}

.feedback-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.fb-thumb {
  width: 86px;
  height: 64px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  background: #fff;
  position: relative;
}

.fb-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
}

.fb-thumb-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  line-height: 1;
}

.feedback-actions {
  padding: 12px 18px;
  border-top: 1px solid #e6e9ef;
  background: #f8fafc;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.feedback-actions-left {
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 220px;
  min-width: 0;
}

.feedback-action-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.feedback-action-icon:hover,
.feedback-action-icon:focus-visible {
  background: #eff6ff;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
  transform: translateY(-1px);
}

.feedback-action-icon:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.feedback-action-icon img {
  width: 22px;
  height: 22px;
  display: block;
}

.feedback-action-note {
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-action {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 10px;
  border: 1px solid #d7e3ff;
  cursor: pointer;
}

.feedback-action--primary {
  background: #2563eb;
  color: #fff;
  border-color: #1d4ed8;
}

.feedback-action--secondary {
  background: #eef2f7;
  color: #334155;
  border-color: #cbd5e1;
}

.feedback-action--primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.feedback-action.loading {
  opacity: 0.85;
  pointer-events: none;
}

.feedback-view .fb-view-message {
  white-space: pre-wrap;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  font-size: 14px;
  line-height: 1.4;
  color: #0f172a;
}

.fb-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.fb-thread-msg {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}

.fb-thread-msg.admin {
  background: #f6fbff;
  border-color: #d9ecff;
}

.fb-thread-author {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
}

/* --- Student modal (dashboard v2) --- */
.student-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.student-modal {
  background: #fff;
  width: min(540px, 94vw);
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: inherit;
}

.student-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #e6e9ef;
  background: #f8fafc;
}

.student-modal__title {
  font-size: 18px;
  font-weight: 900;
  color: #111;
  display: flex;
  align-items: center;
  gap: 10px;
}

.student-modal__title-icon {
  width: 32px;
  height: 32px;
  display: block;
}

.student-modal__body {
  padding: 16px 18px;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  overflow: auto;
}

.student-modal__avatar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: stretch;
}

.student-avatar-drop {
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  height: 100%;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.student-avatar-drop.dragover {
  border-color: #60a5fa;
  background: #eff6ff;
}

.student-avatar-preview {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  overflow: hidden;
  background: #e2e8f0;
  margin: 4px auto 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.student-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.student-avatar-fallback {
  font-weight: 800;
  font-size: 32px;
  color: #64748b;
}

.student-avatar-text {
  font-size: 13px;
  color: #334155;
  font-weight: 600;
  margin-bottom: 10px;
}

.student-avatar-sub {
  font-size: 12px;
  color: #64748b;
}

.student-avatar-error {
  font-size: 12px;
  color: #b91c1c;
}

.student-modal__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 360px;
  justify-self: stretch;
  width: 100%;
}

.student-modal__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.student-modal__label {
  font-size: 13px;
  color: #334155;
  font-weight: 650;
}

.student-modal__input {
  padding: 10px 12px;
  border: 1px solid #d6dbe3;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.35;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  background: #fff;
  font-family: inherit;
}

.student-modal__input:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.student-modal__footer {
  padding: 12px 18px;
  border-top: 1px solid #e6e9ef;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.student-modal__error {
  color: #b91c1c;
  font-size: 13px;
}

.student-modal__actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.student-modal__actions .btn {
  min-width: 140px;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 800;
  font-family: inherit;
  border: 1px solid #cbd5e1;
  background: #e2e8f0;
  color: #1f2937;
  box-shadow: 0 8px 18px rgba(100, 116, 139, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
}

.student-modal__actions .btn:hover {
  background: #d7e0eb;
  border-color: #bfcada;
}

.student-modal__actions .btn.primary {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #fff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.25);
}

.student-modal__actions .btn.primary:hover {
  background: #1d4ed8;
}

@media (max-width: 720px) {
  .student-modal__body {
    grid-template-columns: 1fr;
  }
}

.class-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 10000;
  padding: 56px 16px 24px;
  overflow-y: auto;
}

.class-modal {
  width: min(640px, 100%);
  max-height: calc(100dvh - 80px);
  border-radius: 12px;
  border: 1px solid #dbe5f0;
  background: #f8fafc;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: inherit;
}

.class-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid #dbe5f0;
  background: #f8fafc;
}

.class-modal__title {
  font-size: 18px;
  font-weight: 900;
  color: #111;
  display: flex;
  align-items: center;
  gap: 10px;
}

.class-modal__title-icon {
  width: 32px;
  height: 32px;
  display: block;
}

.student-modal__close,
.class-modal__close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #dbe5f0;
  background: #fff;
  cursor: pointer;
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.student-modal__close img,
.class-modal__close img {
  width: 20px;
  height: 20px;
  display: block;
  transition: transform 0.18s ease;
}

.student-modal__close:hover,
.class-modal__close:hover {
  background: #eef2f7;
}

.student-modal__close:hover img,
.student-modal__close:focus-visible img,
.class-modal__close:hover img,
.class-modal__close:focus-visible img {
  transform: rotate(90deg);
}

.student-modal__close:focus-visible,
.class-modal__close:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.2);
  outline-offset: 2px;
}

.class-modal__body {
  display: grid;
  gap: 14px;
  padding: 18px;
  overflow: auto;
}

.class-modal__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}

.class-modal__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.class-modal__field--full {
  grid-column: 1 / -1;
}

.class-modal__label {
  font-size: 13px;
  color: #334155;
  font-weight: 650;
}

.class-modal__input,
.class-modal__textarea,
.class-modal__select,
.class-modal .students-topbar-search__input {
  height: 40px;
  padding: 10px 12px;
  border: 1px solid #d6dbe3;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.35;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  background: #fff;
  color: #0f172a;
  box-shadow: none;
}

.class-modal__textarea-wrap {
  position: relative;
  display: flex;
}

.class-modal__textarea {
  min-height: 132px;
  resize: none;
  padding-bottom: 24px;
}

.class-modal__resize-handle {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  width: 40px;
  height: 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: ns-resize;
  padding: 0;
  touch-action: none;
  opacity: 0.72;
}

.class-modal__resize-handle::before,
.class-modal__resize-handle::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: rgba(15, 23, 42, 0.32);
  transform: translateX(-50%);
}

.class-modal__resize-handle::before {
  top: calc(50% - 3px);
}

.class-modal__resize-handle::after {
  top: calc(50% + 3px);
}

.class-modal__resize-handle:hover {
  opacity: 1;
}

.class-modal__resize-handle:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
  opacity: 1;
}

body.class-modal-resizing {
  user-select: none;
}

.class-modal__input:focus,
.class-modal__textarea:focus,
.class-modal__select:focus,
.class-modal .students-topbar-search__input:focus,
.class-modal .students-topbar-search__input:focus-visible {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.class-modal__section {
  border: 1px solid #dbe5f0;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.class-modal__section-head {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 0;
  background: #fff;
  text-align: left;
  cursor: pointer;
  position: sticky;
  top: 0;
  z-index: 1;
}

.class-modal__section-title {
  color: #0f172a;
  font-size: 15px;
  font-weight: 700;
}

.class-modal__section-summary {
  min-width: 0;
  max-width: 100%;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.class-modal__section-search {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.class-modal__section-chevron {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease;
}

.class-modal__section-chevron img {
  width: 20px;
  height: 20px;
  display: block;
}

.class-modal__section.is-open .class-modal__section-chevron {
  transform: rotate(180deg);
}

.class-modal__section-body {
  display: none;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  max-height: 340px;
  padding: 0 14px 14px;
  border-top: 1px solid #edf2f7;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.class-modal__section-body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.class-modal__section.is-open .class-modal__section-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.class-modal .students-topbar-search {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.class-modal .students-topbar-search__field {
  width: 0;
  max-width: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  overflow: hidden;
  transition: max-width 0.2s ease, opacity 0.18s ease, visibility 0.18s ease;
}

.class-modal .students-topbar-search__field.is-open {
  width: min(280px, 42vw);
  max-width: min(280px, 42vw);
  opacity: 1;
  border-radius: 10px;
  visibility: visible;
  pointer-events: auto;
}

.class-modal .students-topbar-search__toggle {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #dbe2ee;
  border-radius: 10px;
  background: #fff;
}

.class-modal .students-topbar-search__toggle.is-active,
.class-modal .students-topbar-search__toggle:hover,
.class-modal .students-topbar-search__toggle:focus-visible {
  background: #eff4ff;
  border-color: #b2ddff;
}

.class-modal .students-topbar-search__toggle img {
  width: 24px;
  height: 24px;
  display: block;
}

.class-modal__members-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-top: 12px;
  align-content: start;
}

.class-modal__member {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid #dbe2ee;
  border-radius: 12px;
  background: #fff;
  padding: 12px 14px;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.class-modal__member:hover {
  border-color: #b2ddff;
  background: #f8fbff;
}

.class-modal__member.is-active {
  border-color: #b2ddff;
  background: #eff4ff;
}

.class-modal__member input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  flex: 0 0 auto;
}

.class-modal__member-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.class-modal__member-name {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
}

.class-modal__member-meta {
  font-size: 12px;
  color: #64748b;
  word-break: break-word;
}

.class-modal__members-empty {
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 16px;
  background: #fff;
  color: #64748b;
  font-size: 13px;
  line-height: 1.45;
}

.class-modal__footer {
  padding: 12px 18px;
  border-top: 1px solid #dbe5f0;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.class-modal__footer-tools {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.class-modal__paint-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  box-shadow: 0 8px 18px rgba(100, 116, 139, 0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.class-modal__color-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 12px);
  padding: 12px;
  border: 1px solid #d6dbe3;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.16);
  z-index: 8;
}

.class-modal__color-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.class-modal__color-option {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.28);
  transition: border-color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

.class-modal__color-check {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  display: block;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.9));
  transition: opacity 0.12s ease;
}

.class-modal__color-option:hover {
  border-color: #94a3b8;
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.36);
}

.class-modal__color-option.is-selected {
  border-color: #111827;
  box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.14);
}

.class-modal__color-option.is-selected .class-modal__color-check {
  opacity: 1;
}

.class-modal__paint-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.class-modal__paint-btn img {
  width: 24px;
  height: 24px;
  display: block;
}

.class-modal__paint-btn.is-active {
  border-color: var(--class-modal-picked-color, #94a3b8);
  box-shadow: 0 10px 22px rgba(100, 116, 139, 0.18);
}

.class-modal__paint-swatch {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--class-modal-picked-color, transparent);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.45);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.class-modal__paint-btn.is-active .class-modal__paint-swatch {
  opacity: 1;
}

.class-modal__color-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.class-modal__error {
  color: #b91c1c;
  font-size: 13px;
  flex: 1 1 auto;
  min-width: 0;
}

.class-modal__actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.class-modal__actions .btn {
  min-width: 140px;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 800;
  font-family: inherit;
  border: 1px solid #cbd5e1;
  background: #e2e8f0;
  color: #1f2937;
  box-shadow: 0 8px 18px rgba(100, 116, 139, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
}

.class-modal__actions .btn:hover {
  background: #d7e0eb;
  border-color: #bfcada;
}

.class-modal__actions .btn.primary {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #fff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.25);
}

.class-modal__actions .btn.primary:hover {
  background: #1d4ed8;
}

.lesson-create-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.lesson-create-modal {
  width: min(560px, 94vw);
  max-height: 88vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: inherit;
}

.lesson-create-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #e6e9ef;
  background: #f8fafc;
}

.lesson-create-modal__title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #111;
  font-size: 18px;
  font-weight: 900;
}

.lesson-create-modal__title-icon {
  width: 32px;
  height: 32px;
  display: block;
}

.lesson-create-modal__close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  padding: 0;
  border: 1px solid #dbe5f0;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.lesson-create-modal__close img {
  width: 18px;
  height: 18px;
  display: block;
  transition: transform 0.18s ease;
}

.lesson-create-modal__close:hover,
.lesson-create-modal__close:focus-visible {
  border-color: #bfdbfe;
  background: #f8fbff;
  box-shadow: 0 10px 24px rgba(59, 130, 246, 0.16);
}

.lesson-create-modal__close:hover img,
.lesson-create-modal__close:focus-visible img {
  transform: rotate(90deg);
}

.lesson-create-modal__body {
  padding: 18px;
  overflow: auto;
}

.lesson-create-modal__form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.lesson-create-modal__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.lesson-create-modal__field--full {
  grid-column: 1 / -1;
}

.lesson-create-modal__label {
  font-size: 13px;
  color: #334155;
  font-weight: 650;
}

.lesson-create-modal__hint {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.4;
  color: #64748b;
}

.lesson-create-modal__visibility {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #dbe5f0;
  background: #f8fafc;
  cursor: pointer;
}

.lesson-create-modal__visibility-text {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.lesson-create-modal__switch {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 28px;
}

.lesson-create-modal__switch-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}

.lesson-create-modal__switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 0.18s ease;
}

.lesson-create-modal__switch-slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.16);
  transition: transform 0.18s ease;
}

.lesson-create-modal__switch-input:checked + .lesson-create-modal__switch-slider {
  background: #2563eb;
}

.lesson-create-modal__switch-input:checked + .lesson-create-modal__switch-slider::after {
  transform: translateX(20px);
}

.lesson-create-modal__switch-input:focus-visible + .lesson-create-modal__switch-slider {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.lesson-create-modal__input,
.lesson-create-modal__select {
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #d6dbe3;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.35;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  background: #fff;
  font-family: inherit;
  color: #0f172a;
}

.lesson-create-modal__input[readonly] {
  background: #f8fafc;
  color: #475467;
}

.lesson-create-modal__input:focus,
.lesson-create-modal__select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.lesson-create-modal__footer {
  padding: 12px 18px;
  border-top: 1px solid #e6e9ef;
  background: #f8fafc;
  display: flex;
  align-items: center;
  gap: 12px;
}

.lesson-create-modal__error {
  margin-top: 10px;
  color: #b91c1c;
  font-size: 13px;
}

.lesson-create-modal__status {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 28px;
  min-height: 28px;
}

.lesson-create-modal__status-icon {
  width: 24px;
  height: 24px;
  display: block;
}

.lesson-create-modal__actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.lesson-create-modal__actions .btn {
  min-width: 140px;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 800;
  font-family: inherit;
  border: 1px solid #cbd5e1;
  background: #e2e8f0;
  color: #1f2937;
  box-shadow: 0 8px 18px rgba(100, 116, 139, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
}

.lesson-create-modal__actions .btn:hover {
  background: #d7e0eb;
  border-color: #bfcada;
}

.lesson-create-modal__actions .btn.primary {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #fff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.25);
}

.lesson-create-modal__actions .btn.primary:hover {
  background: #1d4ed8;
}

.lesson-folder-modal__colors {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.lesson-folder-modal__color-btn {
  position: relative;
  min-height: 40px;
  border: 1px solid #dbe5f0;
  border-radius: 10px;
  background: var(--folder-color, #dbeafe);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.lesson-folder-modal__color-btn:hover,
.lesson-folder-modal__color-btn:focus-visible {
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.lesson-folder-modal__color-btn.is-selected {
  border-color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(29, 78, 216, 0.08);
}

.lesson-folder-modal__color-check {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  display: none;
}

.lesson-folder-modal__color-btn.is-selected .lesson-folder-modal__color-check {
  display: block;
}

.media-folder-delete-modal {
  width: min(560px, 94vw);
}

.media-folder-delete-modal__intro {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.media-folder-delete-modal__folder {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.media-folder-delete-modal__meta {
  font-size: 13px;
  color: #475569;
}

.media-folder-delete-modal__choices {
  display: grid;
  gap: 10px;
}

.media-folder-delete-modal__choice {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid #d6dbe3;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.media-folder-delete-modal__choice:has(input:checked) {
  border-color: #93c5fd;
  background: #eff6ff;
}

.media-folder-delete-modal__choice input[type="radio"] {
  margin: 1px 0 0;
}

.media-folder-delete-modal__choice-copy {
  min-width: 0;
}

.media-folder-delete-modal__choice-title {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.media-folder-delete-modal__description {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #d6dbe3;
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 720px) {
  .class-modal-overlay {
    padding-top: 24px;
  }

  .class-modal__grid {
    grid-template-columns: 1fr;
  }

  .class-modal__section-head {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .class-modal__members-list {
    grid-template-columns: 1fr;
  }

  .class-modal__footer {
    flex-direction: column;
    align-items: stretch;
  }

  .class-modal__footer-tools {
    justify-content: flex-start;
  }

  .class-modal__color-popover {
    left: 0;
    bottom: calc(100% + 10px);
    max-width: min(100vw - 48px, 264px);
  }

  .class-modal__actions {
    width: 100%;
    margin-left: 0;
  }

  .class-modal__actions .btn {
    flex: 1 1 0;
    min-width: 0;
  }

  .lesson-create-modal__form {
    grid-template-columns: 1fr;
  }

  .lesson-create-modal__actions .btn {
    min-width: 0;
    flex: 1 1 0;
  }

  .lesson-folder-modal__colors {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.working-hours-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 56px 16px 24px;
  background: rgba(15, 23, 42, 0.46);
  overflow-y: auto;
}

.working-hours-modal-shell {
  width: min(600px, 100%);
  border-radius: 12px;
  border: 1px solid #dbe5f0;
  background: #f8fafc;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  color: #0f172a;
}

.working-hours-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid #dbe5f0;
}

.working-hours-modal__title-wrap {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.working-hours-modal__title {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
}

.working-hours-modal__title-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: block;
}

.working-hours-modal__subtitle {
  color: #64748b;
}

.working-hours-modal__close {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 1px solid #dbe5f0;
  border-radius: 10px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.working-hours-modal__close img {
  width: 20px;
  height: 20px;
  display: block;
  transition: transform 0.18s ease;
}

.working-hours-modal__close:hover,
.working-hours-modal__close:focus-visible {
  background: #eef2f7;
  border-color: #cbd5e1;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

.working-hours-modal__close:hover img,
.working-hours-modal__close:focus-visible img {
  transform: rotate(90deg);
}

.working-hours-modal__body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.working-hours-modal__meta {
  display: flex;
  justify-content: flex-end;
  min-height: 18px;
}

.working-hours-modal__mode {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.working-hours-modal__mode-btn {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid #dbe5f0;
  border-radius: 10px;
  background: #fff;
  color: #334155;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.working-hours-modal__mode-btn.is-active {
  border-color: #93c5fd;
  background: #eaf3ff;
  color: #1d4ed8;
}

.working-hours-modal__panel-frame {
  height: 120px;
  overflow: hidden;
  align-content: space-evenly;
  transition: height 220ms ease;
}

.working-hours-modal__panel-frame.is-inactive {
  opacity: 0.52;
}

.working-hours-modal__panel-frame.is-inactive .working-hours-modal__panel:not([data-panel="none"]) {
  pointer-events: none;
}

.working-hours-modal__panel {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 0;
}

.working-hours-modal__panel[data-panel="weekly"] {
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr);
}

.working-hours-modal__panel[hidden],
.working-hours-modal__error[hidden] {
  display: none !important;
}

.working-hours-modal__simple-weekdays {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.working-hours-modal__simple-weekdays[hidden] {
  display: none !important;
}

.working-hours-modal__row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.working-hours-modal__label {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.working-hours-modal__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.working-hours-modal__panel--simple {
  align-content: center;
  justify-items: center;
}

.working-hours-modal__simple-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 100%;
}

.working-hours-modal__simple-divider {
  width: 56px;
  height: 1px;
  background: #dbe5f0;
  flex: 0 0 auto;
}

.working-hours-modal__input-wrap--simple {
  width: 120px;
  min-width: 120px;
}

.working-hours-modal__input-wrap--simple-start {
  justify-content: flex-start;
}

.working-hours-modal__input-wrap--simple-end {
  justify-content: flex-end;
}

.working-hours-modal__input {
  width: 100%;
  min-height: 40px;
  padding: 8px 42px 8px 12px;
  border: 1px solid #dbe5f0;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  text-align: center;
  font-family: inherit;
  font-size: 14px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: textfield;
}

.working-hours-modal__input::-webkit-calendar-picker-indicator {
  opacity: 0;
  width: 0;
  margin: 0;
  pointer-events: none;
}

.working-hours-modal__input:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.working-hours-modal__input-icon {
  position: absolute;
  right: 12px;
  width: 24px;
  height: 24px;
  color: #64748b;
  pointer-events: none;
}

.working-hours-modal__input-icon--left {
  left: 12px;
  right: auto;
}

.working-hours-modal__input-icon--right {
  left: auto;
  right: 12px;
}

.working-hours-modal__input--simple-start {
  padding-left: 44px;
  padding-right: 12px;
}

.working-hours-modal__input--simple-end {
  padding-left: 12px;
  padding-right: 44px;
}

.working-hours-modal__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.working-hours-modal__toggle input {
  width: 16px;
  height: 16px;
}

.working-hours-modal__toggle--weekday {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #dbe5f0;
  border-radius: 10px;
  background: #fff;
}

.working-hours-modal__toggle--weekday.is-active {
  border-color: #93c5fd;
  background: #eaf3ff;
  color: #1d4ed8;
}

.working-hours-modal__toggle--weekday.is-disabled {
  opacity: 0.55;
}

.working-hours-modal__panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.working-hours-modal__panel-actions .btn {
  min-height: 40px;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
}

.working-hours-modal__table {
  display: grid;
  align-content: start;
  gap: 8px;
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.working-hours-modal__week-row {
  display: grid;
  grid-template-columns: 84px 120px minmax(0, 1fr) minmax(0, 1fr) 72px;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #dbe5f0;
  border-radius: 10px;
  background: #fff;
}

.working-hours-modal__week-day {
  margin-left: 10px;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.working-hours-modal__clear-btn {
  min-height: 32px;
  border: none;
  background: transparent;
  color: #64748b;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.working-hours-modal__clear-btn:hover {
  color: #0f172a;
}

.working-hours-modal__error {
  color: #b91c1c;
  font-size: 13px;
  font-weight: 700;
}

.working-hours-modal__none-hint {
  color: #64748b;
  transition: color 180ms ease, opacity 180ms ease;
}

.working-hours-modal__none-hint.is-active {
  color: #334155;
}

.working-hours-modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px 18px;
}

.working-hours-modal__switch-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.working-hours-modal__switch-row.is-disabled {
  opacity: 0.55;
}

.working-hours-modal__switch-label {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.working-hours-modal__switch-label[hidden] {
  display: none !important;
}

.working-hours-modal__switch {
  position: relative;
  width: 50px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.working-hours-modal__switch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.working-hours-modal__switch-track {
  width: 50px;
  height: 28px;
  border-radius: 999px;
  background: #cbd5e1;
  border: 1px solid #94a3b8;
  position: relative;
  transition: background-color .2s ease, border-color .2s ease;
}

.working-hours-modal__switch-track::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  transition: transform .2s ease;
}

.working-hours-modal__switch input:checked + .working-hours-modal__switch-track {
  background: #2563eb;
  border-color: #1d4ed8;
}

.working-hours-modal__switch input:checked + .working-hours-modal__switch-track::after {
  transform: translateX(22px);
}

.working-hours-modal__actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.working-hours-modal__actions .btn {
  min-width: 148px;
  min-height: 40px;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
}

.working-hours-modal__actions .btn {
  border: 1px solid #cbd5e1;
  background: #e2e8f0;
}

.working-hours-modal__actions .btn:hover {
  background: #d7e0eb;
  border-color: #bfcada;
}

.working-hours-modal__actions .btn.primary {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #fff;
}

.working-hours-modal__actions .btn.primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

@media (max-width: 720px) {
  .working-hours-modal-overlay {
    padding-top: 24px;
  }

  .working-hours-modal__panel-frame {
    min-height: 0;
  }

  .working-hours-modal__row {
    grid-template-columns: 1fr;
  }

  .working-hours-modal__week-row {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .working-hours-modal__footer {
    align-items: stretch;
    flex-direction: column;
  }

  .working-hours-modal__footer-start {
    width: 100%;
  }

  .working-hours-modal__actions {
    width: 100%;
  }

  .working-hours-modal__actions .btn {
    flex: 1 1 0;
    min-width: 0;
  }
}

.fb-view-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.fb-view-line {
  font-size: 13px;
  color: #334155;
}

.fb-chip {
  display: inline-flex;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #0f172a;
}

.fb-chip.new { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.fb-chip.viewed { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.fb-chip.closed { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }

.fb-view-images {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.fb-view-images img {
  width: 120px;
  height: 90px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
}

.custom-modal.sticker-settings-modal {
    width: min(640px, 94vw);
    min-width: min(540px, 94vw);
    overflow: visible;
}
.custom-modal-overlay:has(.custom-modal.sticker-settings-modal) {
    align-items: flex-start;
    padding-top: 28px;
    padding-bottom: 20px;
}
.custom-modal.sticker-settings-modal .custom-modal-title {
    align-items: stretch;
    justify-content: center;
    width: 160px;
    padding: 24px 18px;
    border-top-left-radius: 22px;
    border-bottom-left-radius: 22px;
    overflow: hidden;
}
.custom-modal.sticker-settings-modal .sticker-settings__heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}
.custom-modal.sticker-settings-modal .sticker-settings__titleIcon {
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(191, 219, 254, 0.96);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.96), rgba(248, 250, 252, 0.96));
}
.custom-modal.sticker-settings-modal .sticker-settings__titleIcon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}
.custom-modal.sticker-settings-modal .custom-modal-content {
    padding: 20px 20px 18px;
    border-top-right-radius: 22px;
    border-bottom-right-radius: 22px;
    overflow: visible;
}
.custom-modal.sticker-settings-modal .custom-modal-body {
    gap: 14px;
    overflow: visible;
}
.custom-modal.sticker-settings-modal .sticker-settings__preview-stack {
    position: relative;
    width: 100%;
    min-height: 220px;
    height: 100%;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}
.custom-modal.sticker-settings-modal .sticker-settings__preview-stack.is-group {
    display: block;
}
.custom-modal.sticker-settings-modal .sticker-settings__preview-card {
    width: 120px;
    height: 120px;
    padding: 12px;
    box-sizing: border-box;
    appearance: none;
    border-radius: 18px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
    overflow: hidden;
    cursor: default;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.custom-modal.sticker-settings-modal .sticker-settings__preview-card.is-selectable {
    cursor: pointer;
}
.custom-modal.sticker-settings-modal .sticker-settings__preview-card.is-selectable:hover {
    border-color: rgba(59, 130, 246, 0.38);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.14);
}
.custom-modal.sticker-settings-modal .sticker-settings__preview-card.is-selected {
    border-color: rgba(37, 99, 235, 0.72);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16), 0 14px 30px rgba(15, 23, 42, 0.14);
    transform: translateX(-2px);
}
.custom-modal.sticker-settings-modal .sticker-settings__preview-stack.is-group .sticker-settings__preview-card.is-selected {
    transform: translateX(calc(-50% - 2px));
}
.custom-modal.sticker-settings-modal .sticker-settings__preview-stack.is-single .sticker-settings__preview-card {
    width: 136px;
    height: 136px;
}
.custom-modal.sticker-settings-modal .sticker-settings__preview-stack.is-group .sticker-settings__preview-card {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
}
.custom-modal.sticker-settings-modal .sticker-settings__preview-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #f8fafc;
}
.custom-modal.sticker-settings-modal .sticker-settings__field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.custom-modal.sticker-settings-modal .sticker-settings__label {
    margin: 0;
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}
.custom-modal.sticker-settings-modal .sticker-settings__textarea {
    min-height: 168px;
    resize: vertical;
}
.custom-modal.sticker-settings-modal .sticker-settings__font-picker {
    position: relative;
}
.custom-modal.sticker-settings-modal .sticker-settings__fontRow {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 132px;
    gap: 12px;
    align-items: end;
}
.custom-modal.sticker-settings-modal .sticker-settings__fontField {
    min-width: 0;
}
.custom-modal.sticker-settings-modal .sticker-settings__colorField {
    width: 72px;
}
.custom-modal.sticker-settings-modal .sticker-settings__sizeField--topRow {
    min-width: 0;
    width: 132px;
    justify-self: end;
}
.custom-modal.sticker-settings-modal .sticker-settings__font-trigger {
    width: 100%;
    min-height: 44px;
    padding: 10px 40px 10px 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: center;
    column-gap: 14px;
    text-align: left;
    cursor: pointer;
    position: relative;
}
.custom-modal.sticker-settings-modal .sticker-settings__font-trigger::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    width: 10px;
    height: 10px;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: translateY(-65%) rotate(45deg);
    transition: transform .18s ease;
}
.custom-modal.sticker-settings-modal .sticker-settings__font-picker.is-open .sticker-settings__font-trigger::after {
    transform: translateY(-35%) rotate(-135deg);
}
.custom-modal.sticker-settings-modal .sticker-settings__font-trigger-name {
    font-size: 14px;
    font-style: italic;
    font-weight: 500;
    line-height: 1.2;
    color: var(--text-secondary, #475569);
    white-space: nowrap;
}
.custom-modal.sticker-settings-modal .sticker-settings__font-trigger-preview {
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
    color: var(--text-primary, #0f172a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.custom-modal.sticker-settings-modal .sticker-settings__font-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    max-height: 280px;
    overflow: auto;
    padding: 8px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
    z-index: 12;
}
.custom-modal.sticker-settings-modal .sticker-settings__inlineRow {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}
.custom-modal.sticker-settings-modal .sticker-settings__field--compact {
    min-width: 0;
}
.custom-modal.sticker-settings-modal .sticker-settings__sizeField {
    position: relative;
}
.custom-modal.sticker-settings-modal .text-settings__colorRow {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
}
.custom-modal.sticker-settings-modal .text-settings__color-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: #111111;
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.72);
    cursor: pointer;
    padding: 0;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.custom-modal.sticker-settings-modal .text-settings__color-btn:hover {
    border-color: #cbd5e1;
    transform: translateY(-1px);
}
.custom-modal.sticker-settings-modal .text-settings__color-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
.custom-modal.sticker-settings-modal .text-settings__size-picker {
    position: relative;
    min-width: 0;
}
.custom-modal.sticker-settings-modal .text-settings__size-trigger {
    box-sizing: border-box;
    position: relative;
    width: 100%;
    min-height: 44px;
    padding: 0 38px 0 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}
.custom-modal.sticker-settings-modal .text-settings__size-trigger:hover {
    border-color: #cbd5e1;
}
.custom-modal.sticker-settings-modal .text-settings__size-trigger:focus {
    outline: none;
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}
.custom-modal.sticker-settings-modal .text-settings__size-trigger::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 14px;
    width: 8px;
    height: 8px;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: translateY(-60%) rotate(45deg);
    transition: transform 0.16s ease;
    pointer-events: none;
}
.custom-modal.sticker-settings-modal .text-settings__size-picker.is-open .text-settings__size-trigger::after {
    transform: translateY(-35%) rotate(-135deg);
}
.custom-modal.sticker-settings-modal .text-settings__size-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 12;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 8px;
    width: 100%;
    min-width: 100%;
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
}
.custom-modal.sticker-settings-modal .text-settings__size-menu[hidden] {
    display: none !important;
}
.custom-modal.sticker-settings-modal .text-settings__size-presets {
    display: grid;
    gap: 8px;
    padding-right: 8px;
    border-right: 1px solid rgba(226, 232, 240, 0.92);
}
.custom-modal.sticker-settings-modal .text-settings__size-preset {
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: var(--bg-app, #f8fafc);
    color: var(--text-primary, #0f172a);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}
.custom-modal.sticker-settings-modal .text-settings__size-preset:hover {
    border-color: #cbd5e1;
    background: #ffffff;
}
.custom-modal.sticker-settings-modal .text-settings__size-preset.is-active {
    border-color: rgba(37, 99, 235, 0.42);
    background: rgba(239, 246, 255, 0.88);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}
.custom-modal.sticker-settings-modal .text-settings__size-slider-col {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 332px;
    padding-left: 0;
    min-width: 0;
}
.custom-modal.sticker-settings-modal .text-settings__size-range {
    width: 18px;
    height: 220px;
    min-height: 220px;
    margin: 0;
    writing-mode: vertical-lr;
}
.custom-modal.sticker-settings-modal .text-settings__choiceGroup {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
    overflow: hidden;
}
.custom-modal.sticker-settings-modal .text-settings__choiceButton {
    min-height: 44px;
    border: 0;
    border-right: 1px solid var(--border-default, #dbe5f0);
    border-radius: 0;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}
.custom-modal.sticker-settings-modal .text-settings__choiceButton:last-child {
    border-right: 0;
}
.custom-modal.sticker-settings-modal .text-settings__choiceButton--text {
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.custom-modal.sticker-settings-modal .text-settings__choiceButton:hover {
    border-color: #cbd5e1;
    background: var(--bg-app, #f8fafc);
}
.custom-modal.sticker-settings-modal .text-settings__choiceButton.is-active {
    background: rgba(239, 246, 255, 0.88);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}
.custom-modal.sticker-settings-modal .text-settings__choiceButton:focus-visible {
    outline: none;
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}
.custom-modal.sticker-settings-modal .text-settings__choiceText {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}
.custom-modal.sticker-settings-modal .text-settings__switchRow {
    display: grid;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: #ffffff;
}
.custom-modal.sticker-settings-modal .text-settings__switchRow.sticker-settings__switchRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.custom-modal.sticker-settings-modal .text-settings__switchLabel {
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}
.custom-modal.sticker-settings-modal .text-settings__switch {
    position: relative;
    flex: 0 0 auto;
    width: 46px;
    height: 28px;
}
.custom-modal.sticker-settings-modal .text-settings__switchInput {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
.custom-modal.sticker-settings-modal .text-settings__switchTrack {
    position: absolute;
    inset: 0;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 999px;
    background: var(--bg-app, #f8fafc);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
    transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.custom-modal.sticker-settings-modal .text-settings__switchTrack::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.14);
    transition: transform 0.16s ease;
}
.custom-modal.sticker-settings-modal .text-settings__switchInput:hover + .text-settings__switchTrack {
    border-color: #cbd5e1;
}
.custom-modal.sticker-settings-modal .text-settings__switchInput:focus-visible + .text-settings__switchTrack {
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}
.custom-modal.sticker-settings-modal .text-settings__switchInput:checked + .text-settings__switchTrack {
    border-color: rgba(37, 99, 235, 0.42);
    background: rgba(239, 246, 255, 0.92);
}
.custom-modal.sticker-settings-modal .text-settings__switchInput:checked + .text-settings__switchTrack::after {
    transform: translateX(18px);
}
.custom-modal.sticker-settings-modal .text-settings__switchInput:disabled + .text-settings__switchTrack {
    opacity: 0.55;
}
.custom-modal.sticker-settings-modal .sticker-settings__font-option {
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: center;
    column-gap: 14px;
    text-align: left;
    cursor: pointer;
}
.custom-modal.sticker-settings-modal .sticker-settings__font-option:hover,
.custom-modal.sticker-settings-modal .sticker-settings__font-option.is-selected {
    background: #f8fafc;
}
.custom-modal.sticker-settings-modal .sticker-settings__font-option.is-selected {
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}
.custom-modal.sticker-settings-modal .sticker-settings__font-option-name {
    font-size: 14px;
    font-style: italic;
    font-weight: 500;
    color: var(--text-secondary, #475569);
    line-height: 1.2;
    white-space: nowrap;
}
.custom-modal.sticker-settings-modal .sticker-settings__font-option-preview {
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
    color: var(--text-primary, #0f172a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.custom-modal.sticker-settings-modal .sticker-settings__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: #ffffff;
}
.custom-modal.sticker-settings-modal .sticker-settings__checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
}
.custom-modal.sticker-settings-modal .sticker-settings__checkbox input[type="checkbox"] {
    margin: 0;
}
.custom-modal.sticker-settings-modal .sticker-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    border: 1px solid #dbe5f0;
    background: #f8fafc;
    color: #21324a;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 13px;
    line-height: 1.2;
}

@media (max-width: 720px) {
    .custom-modal.sticker-settings-modal {
        min-width: 0;
        width: min(96vw, 560px);
    }

    .custom-modal.sticker-settings-modal .custom-modal-title {
        width: 100%;
        min-height: 156px;
        border-right: none;
        border-bottom: 1px solid var(--border-default, #dbe5f0);
        border-top-right-radius: 22px;
        border-bottom-left-radius: 0;
    }

    .custom-modal.sticker-settings-modal .custom-modal-content {
        border-top-right-radius: 0;
        border-bottom-left-radius: 22px;
    }

    .custom-modal.sticker-settings-modal .sticker-settings__preview-stack {
        min-height: 108px;
    }

    .custom-modal.sticker-settings-modal .sticker-settings__fontRow {
        grid-template-columns: minmax(0, 1fr);
    }

    .custom-modal.sticker-settings-modal .sticker-settings__sizeField--topRow {
        width: 100%;
        justify-self: stretch;
    }

    .custom-modal.sticker-settings-modal .sticker-settings__colorField {
        width: 100%;
        justify-self: stretch;
    }

    .custom-modal.sticker-settings-modal .text-settings__colorRow {
        justify-content: flex-start;
    }

    .custom-modal.sticker-settings-modal .sticker-settings__inlineRow {
        grid-template-columns: minmax(0, 1fr);
    }

    .custom-modal.sticker-settings-modal .sticker-settings__preview-card {
        width: 96px;
        height: 96px;
    }

    .custom-modal.sticker-settings-modal .sticker-settings__preview-stack.is-single .sticker-settings__preview-card {
        width: 112px;
        height: 112px;
    }
}

.custom-modal.crossword-settings-modal {
    width: min(680px, 94vw);
    min-width: min(560px, 94vw);
    overflow: visible;
}

.custom-modal-overlay:has(.custom-modal.crossword-settings-modal) {
    align-items: flex-start;
    padding-top: 28px;
    padding-bottom: 20px;
}

.custom-modal.crossword-settings-modal .custom-modal-title {
    align-items: stretch;
    justify-content: center;
    width: 176px;
    padding: 24px 18px;
    border-top-left-radius: 22px;
    border-bottom-left-radius: 22px;
    overflow: hidden;
}

.custom-modal.crossword-settings-modal .custom-modal-content {
    padding: 20px 20px 18px;
    border-top-right-radius: 22px;
    border-bottom-right-radius: 22px;
    overflow: visible;
}

.custom-modal.crossword-settings-modal .custom-modal-body {
    gap: 16px;
    overflow: visible;
}

.custom-modal.crossword-settings-modal .crossword-settings__preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    min-height: 220px;
    text-align: center;
}

.custom-modal.crossword-settings-modal .crossword-settings__previewCard {
    width: 126px;
    height: 126px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    border-radius: 24px;
    border: 1px solid rgba(203, 213, 225, 0.92);
    background:
        radial-gradient(circle at 22% 20%, rgba(191, 219, 254, 0.95), rgba(191, 219, 254, 0) 42%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
}

.custom-modal.crossword-settings-modal .crossword-settings__previewCard img {
    width: 88px;
    height: 88px;
    object-fit: contain;
}

.custom-modal.crossword-settings-modal .crossword-settings__previewMeta {
    display: grid;
    gap: 6px;
    width: 100%;
}

.custom-modal.crossword-settings-modal .crossword-settings__previewEyebrow {
    color: var(--text-secondary, #475569);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.custom-modal.crossword-settings-modal .crossword-settings__previewHint {
    color: var(--text-primary, #0f172a);
    font-size: 22px;
    font-weight: 800;
    line-height: 1.08;
}

.custom-modal.crossword-settings-modal .crossword-settings__intro {
    display: grid;
    gap: 8px;
    padding-right: 52px;
}

.custom-modal.crossword-settings-modal .crossword-settings__heading {
    margin: 0;
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.crossword-settings-modal .crossword-settings__lead {
    margin: 0;
    color: var(--text-secondary, #475569);
    font-size: 14px;
    line-height: 1.55;
}

.custom-modal.crossword-settings-modal .crossword-settings__metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.custom-modal.crossword-settings-modal .crossword-settings__field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.custom-modal.crossword-settings-modal .crossword-settings__field--color {
    max-width: 120px;
}

.custom-modal.crossword-settings-modal .crossword-settings__label {
    margin: 0;
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

.custom-modal.crossword-settings-modal .text-settings__colorRow {
    display: flex;
    align-items: center;
    gap: 10px;
}

.custom-modal.crossword-settings-modal .text-settings__color-btn {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: #111111;
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.72);
    cursor: pointer;
    padding: 0;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.custom-modal.crossword-settings-modal .text-settings__color-btn:hover {
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.custom-modal.crossword-settings-modal .text-settings__size-picker {
    position: relative;
    min-width: 0;
}

.custom-modal.crossword-settings-modal .text-settings__size-trigger {
    position: relative;
    width: 100%;
    min-height: 46px;
    padding: 0 38px 0 14px;
    text-align: left;
    cursor: pointer;
}

.custom-modal.crossword-settings-modal .text-settings__size-trigger::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 14px;
    width: 8px;
    height: 8px;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: translateY(-60%) rotate(45deg);
    transition: transform 0.16s ease;
    pointer-events: none;
}

.custom-modal.crossword-settings-modal .text-settings__size-picker.is-open .text-settings__size-trigger::after {
    transform: translateY(-35%) rotate(-135deg);
}

.custom-modal.crossword-settings-modal .text-settings__size-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 12;
    display: grid;
    grid-template-columns: 64px 40px;
    gap: 12px;
    width: auto;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
}

.custom-modal.crossword-settings-modal .text-settings__size-menu[hidden] {
    display: none !important;
}

.custom-modal.crossword-settings-modal .text-settings__size-presets {
    display: grid;
    gap: 10px;
    padding-right: 12px;
    border-right: 1px solid rgba(226, 232, 240, 0.92);
}

.custom-modal.crossword-settings-modal .text-settings__size-preset {
    min-height: 42px;
    padding: 0 10px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: var(--bg-app, #f8fafc);
    color: var(--text-primary, #0f172a);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.crossword-settings-modal .text-settings__size-preset:hover {
    border-color: #cbd5e1;
    background: #ffffff;
}

.custom-modal.crossword-settings-modal .text-settings__size-preset.is-active {
    border-color: rgba(37, 99, 235, 0.42);
    background: rgba(239, 246, 255, 0.88);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}

.custom-modal.crossword-settings-modal .text-settings__size-slider-col {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 302px;
}

.custom-modal.crossword-settings-modal .text-settings__size-range {
    width: 18px;
    height: 156px;
    min-height: 156px;
    margin: 0;
    writing-mode: vertical-lr;
}

.custom-modal.crossword-settings-modal .crossword-settings__navGroup {
    display: flex;
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: #ffffff;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.custom-modal.crossword-settings-modal .crossword-settings__navButton {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 14px;
    border: 0;
    border-right: 1px solid rgba(226, 232, 240, 0.92);
    background: transparent;
    color: var(--text-secondary, #475569);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.crossword-settings-modal .crossword-settings__navButton:last-child {
    border-right: 0;
}

.custom-modal.crossword-settings-modal .crossword-settings__navButton:hover {
    background: rgba(248, 250, 252, 0.98);
}

.custom-modal.crossword-settings-modal .crossword-settings__navButton.is-active {
    background: rgba(239, 246, 255, 0.98);
    color: var(--accent-primary, #2563eb);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}

.custom-modal.crossword-settings-modal .crossword-settings__navButton:focus-visible {
    position: relative;
    z-index: 1;
    outline: 2px solid rgba(37, 99, 235, 0.2);
    outline-offset: -2px;
}

.custom-modal.wheel-settings-modal {
    width: min(860px, 94vw);
    min-width: min(720px, 94vw);
    max-height: 90vh;
    overflow: visible;
}

.custom-modal-overlay:has(.custom-modal.wheel-settings-modal) {
    align-items: flex-start;
    padding-top: 24px;
    padding-bottom: 20px;
}

.custom-modal.wheel-settings-modal,
.custom-modal.wheel-settings-modal * {
    box-sizing: border-box;
}

.custom-modal.wheel-settings-modal .custom-modal-title {
    align-items: stretch;
    justify-content: center;
    width: 164px;
    padding: 22px 16px;
    border-top-left-radius: 22px;
    border-bottom-left-radius: 22px;
    overflow: hidden;
}

.custom-modal.wheel-settings-modal .custom-modal-content {
    min-width: 0;
    max-height: 90vh;
    padding: 18px 18px 16px;
    border-top-right-radius: 22px;
    border-bottom-right-radius: 22px;
    overflow: visible;
}

.custom-modal.wheel-settings-modal .custom-modal-body {
    gap: 14px;
    min-height: 0;
    overflow: visible;
}

.custom-modal.wheel-settings-modal .wheel-settings__preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 210px;
    text-align: center;
}

.custom-modal.wheel-settings-modal .wheel-settings__previewCard {
    width: 116px;
    height: 116px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.12);
}

.custom-modal.wheel-settings-modal .wheel-settings__previewCard img {
    width: 84px;
    height: 84px;
    object-fit: contain;
}

.custom-modal.wheel-settings-modal .wheel-settings__previewMeta {
    display: grid;
    gap: 6px;
    width: 100%;
}

.custom-modal.wheel-settings-modal .wheel-settings__previewEyebrow {
    color: var(--text-secondary, #475569);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.custom-modal.wheel-settings-modal .wheel-settings__previewHint {
    color: var(--text-primary, #0f172a);
    font-size: 18px;
    font-weight: 800;
    line-height: 1.16;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-modal.wheel-settings-modal .wheel-settings__head {
    display: grid;
    gap: 12px;
    padding-right: 52px;
}

.custom-modal.wheel-settings-modal .wheel-settings__heading {
    margin: 0;
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.wheel-settings-modal .wheel-settings__tabs {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    padding: 4px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: var(--bg-app, #f8fafc);
    gap: 4px;
}

.custom-modal.wheel-settings-modal .wheel-settings__tab {
    min-height: 34px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.custom-modal.wheel-settings-modal .wheel-settings__tab:hover,
.custom-modal.wheel-settings-modal .wheel-settings__tab:focus-visible {
    background: rgba(255, 255, 255, 0.86);
}

.custom-modal.wheel-settings-modal .wheel-settings__tab.is-active {
    background: #ffffff;
    color: var(--accent-primary, #2563eb);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.custom-modal.wheel-settings-modal .wheel-settings__body {
    min-height: 0;
    max-height: min(560px, calc(90vh - 178px));
    overflow: auto;
    padding-right: 2px;
}

.custom-modal.wheel-settings-modal .wheel-settings__grid {
    display: grid;
    gap: 12px;
}

.custom-modal.wheel-settings-modal .wheel-settings__section {
    display: grid;
    gap: 12px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
}

.custom-modal.wheel-settings-modal .wheel-settings__sectionTitle {
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.wheel-settings-modal .wheel-settings__fieldPair,
.custom-modal.wheel-settings-modal .wheel-settings__tileGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.custom-modal.wheel-settings-modal .wheel-settings__field,
.custom-modal.wheel-settings-modal .wheel-settings__field--color {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.custom-modal.wheel-settings-modal .wheel-settings__label {
    color: var(--text-secondary, #475569);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}

.custom-modal.wheel-settings-modal .wheel-settings__bulk {
    min-height: 76px;
}

.custom-modal.wheel-settings-modal .wheel-settings__softAction {
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.custom-modal.wheel-settings-modal .wheel-settings__softAction:hover,
.custom-modal.wheel-settings-modal .wheel-settings__softAction:focus-visible {
    border-color: var(--border-strong, #cbd5e1);
    background: var(--accent-soft, #eff6ff);
}

.custom-modal.wheel-settings-modal .wheel-settings__itemsHead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.custom-modal.wheel-settings-modal .wheel-settings__addActions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.custom-modal.wheel-settings-modal .wheel-settings__tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px;
}

.custom-modal.wheel-settings-modal .wheel-settings__tile {
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: var(--bg-app, #f8fafc);
}

.custom-modal.wheel-settings-modal .wheel-settings__tileTop {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.custom-modal.wheel-settings-modal .wheel-settings__tileNumber {
    color: var(--text-secondary, #475569);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.custom-modal.wheel-settings-modal .wheel-settings__tileActions {
    display: inline-flex;
    gap: 6px;
}

.custom-modal.wheel-settings-modal .wheel-settings__iconAction {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
}

.custom-modal.wheel-settings-modal .wheel-settings__iconAction:hover,
.custom-modal.wheel-settings-modal .wheel-settings__iconAction:focus-visible {
    border-color: var(--border-strong, #cbd5e1);
    background: var(--accent-soft, #eff6ff);
}

.custom-modal.wheel-settings-modal .wheel-settings__iconAction--danger {
    border-color: rgba(239, 68, 68, 0.28);
    background: var(--danger-bg, #fff1f2);
}

.custom-modal.wheel-settings-modal .wheel-settings__iconAction img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.custom-modal.wheel-settings-modal [data-wheel-action="up"] img {
    transform: rotate(180deg);
}

.custom-modal.wheel-settings-modal .wheel-settings__tileGrid--single {
    grid-template-columns: 1fr;
}

.custom-modal.wheel-settings-modal .wheel-settings__colorRow {
    display: flex;
    align-items: center;
    min-height: 46px;
}

.custom-modal.wheel-settings-modal .wheel-settings__colorButton,
.custom-modal.wheel-settings-modal .wheel-settings__paletteColor {
    width: 46px;
    height: 46px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.72);
    cursor: pointer;
}

.custom-modal.wheel-settings-modal .wheel-settings__colorButton:hover,
.custom-modal.wheel-settings-modal .wheel-settings__paletteColor:hover {
    border-color: var(--border-strong, #cbd5e1);
    transform: translateY(-1px);
}

.custom-modal.wheel-settings-modal .wheel-settings__paletteGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
    gap: 8px;
}

.custom-modal.wheel-settings-modal .wheel-settings__paletteColor {
    position: relative;
}

.custom-modal.wheel-settings-modal .wheel-settings__paletteColor span {
    position: absolute;
    right: 6px;
    bottom: 5px;
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(15, 23, 42, 0.42);
}

.custom-modal.wheel-settings-modal .wheel-settings__toggleGrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}

.custom-modal.wheel-settings-modal .wheel-settings__toggle {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
    cursor: pointer;
}

.custom-modal.wheel-settings-modal .wheel-settings__toggle:hover {
    border-color: var(--border-strong, #cbd5e1);
    background: var(--accent-soft, #eff6ff);
}

.custom-modal.wheel-settings-modal .wheel-settings__toggleText {
    color: var(--text-primary, #0f172a);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}

.custom-modal.wheel-settings-modal .wheel-settings__toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.custom-modal.wheel-settings-modal .wheel-settings__toggleTrack {
    position: relative;
    width: 46px;
    height: 26px;
    flex: 0 0 46px;
    border: 1px solid var(--border-strong, #cbd5e1);
    border-radius: 999px;
    background: #e2e8f0;
    transition: background-color 0.18s ease, border-color 0.18s ease;
}

.custom-modal.wheel-settings-modal .wheel-settings__toggleTrack::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
    transform: translateY(-50%);
    transition: left 0.18s ease;
}

.custom-modal.wheel-settings-modal .wheel-settings__toggle input:checked + .wheel-settings__toggleTrack {
    border-color: var(--accent-primary, #2563eb);
    background: var(--accent-primary, #2563eb);
}

.custom-modal.wheel-settings-modal .wheel-settings__toggle input:checked + .wheel-settings__toggleTrack::after {
    left: 21px;
}

.custom-modal.wheel-settings-modal .wheel-settings__toggle input:focus-visible + .wheel-settings__toggleTrack {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 2px;
}

@media (max-width: 760px) {
    .custom-modal.wheel-settings-modal {
        width: min(94vw, 560px);
        min-width: min(94vw, 560px);
        flex-direction: column;
    }

    .custom-modal.wheel-settings-modal .custom-modal-title {
        width: 100%;
        padding: 18px 20px 12px;
        border-right: 0;
        border-bottom: 1px solid var(--border-default, #dbe5f0);
        border-top-right-radius: 22px;
        border-bottom-left-radius: 0;
    }

    .custom-modal.wheel-settings-modal .custom-modal-content {
        max-height: none;
        border-top-right-radius: 0;
        border-bottom-left-radius: 22px;
    }

    .custom-modal.wheel-settings-modal .wheel-settings__preview {
        min-height: 0;
    }

    .custom-modal.wheel-settings-modal .wheel-settings__previewCard {
        width: 96px;
        height: 96px;
    }

    .custom-modal.wheel-settings-modal .wheel-settings__head {
        padding-right: 44px;
    }

    .custom-modal.wheel-settings-modal .wheel-settings__body {
        max-height: none;
    }

    .custom-modal.wheel-settings-modal .wheel-settings__fieldPair,
    .custom-modal.wheel-settings-modal .wheel-settings__tileGrid {
        grid-template-columns: 1fr;
    }

    .custom-modal.wheel-settings-modal .wheel-settings__itemsHead {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 760px) {
    .custom-modal.crossword-settings-modal {
        width: min(94vw, 560px);
        min-width: min(94vw, 560px);
        flex-direction: column;
    }

    .custom-modal.crossword-settings-modal .custom-modal-title {
        width: 100%;
        padding: 20px 20px 14px;
        border-right: 0;
        border-bottom: 1px solid var(--border-default, #dbe5f0);
        border-top-right-radius: 22px;
        border-bottom-left-radius: 0;
    }

    .custom-modal.crossword-settings-modal .custom-modal-content {
        border-top-right-radius: 0;
        border-bottom-left-radius: 22px;
    }

    .custom-modal.crossword-settings-modal .crossword-settings__preview {
        min-height: 0;
        gap: 14px;
    }

    .custom-modal.crossword-settings-modal .crossword-settings__previewCard {
        width: 108px;
        height: 108px;
    }

    .custom-modal.crossword-settings-modal .crossword-settings__metrics {
        grid-template-columns: 1fr;
    }

    .custom-modal.crossword-settings-modal .crossword-settings__field--color {
        max-width: none;
    }

    .custom-modal.crossword-settings-modal .crossword-settings__navGroup {
        flex-direction: column;
    }

    .custom-modal.crossword-settings-modal .crossword-settings__navButton {
        min-height: 44px;
        border-right: 0;
        border-bottom: 1px solid rgba(226, 232, 240, 0.92);
    }

    .custom-modal.crossword-settings-modal .crossword-settings__navButton:last-child {
        border-bottom: 0;
    }
}

.custom-modal.puzzle-settings-modal {
    width: min(880px, 94vw);
    min-width: min(720px, 94vw);
    overflow: visible;
}

.custom-modal-overlay:has(.custom-modal.puzzle-settings-modal) {
    align-items: flex-start;
    padding-top: 24px;
    padding-bottom: 20px;
}

.custom-modal.puzzle-settings-modal .custom-modal-title {
    width: 120px;
    padding: 20px 18px;
    border-top-left-radius: 22px;
    border-bottom-left-radius: 22px;
    overflow: hidden;
}

.custom-modal.puzzle-settings-modal .custom-modal-content {
    padding: 0;
    overflow: visible;
    border-top-right-radius: 22px;
    border-bottom-right-radius: 22px;
}

.custom-modal.puzzle-settings-modal .custom-modal-body {
    padding: 20px 24px 18px;
    gap: 18px;
    overflow: visible;
}

.custom-modal.puzzle-settings-modal .custom-modal-buttons {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 24px 20px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.92));
    border-bottom-right-radius: 22px;
}

.custom-modal.puzzle-settings-modal .custom-modal-buttons button {
    min-width: 120px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
}

.custom-modal.puzzle-settings-modal .btn-cancel {
    border: 1px solid rgba(203, 213, 225, 0.96);
    background: #f3f4f6;
    color: var(--text-secondary, #475569);
}

.custom-modal.puzzle-settings-modal .btn-cancel:hover {
    background: #e9edf2;
}

.custom-modal.puzzle-settings-modal .btn-ok {
    background: #4caf50;
    color: #ffffff;
}

.custom-modal.puzzle-settings-modal .btn-ok:hover {
    background: #45a049;
}

.custom-modal.puzzle-settings-modal .btn-ok:disabled {
    background: #9bd09e;
    cursor: not-allowed;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__rail {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 220px;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__railCard {
    width: 84px;
    height: 84px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    border-radius: 24px;
    border: 1px solid rgba(203, 213, 225, 0.92);
    background:
        radial-gradient(circle at 22% 20%, rgba(191, 219, 254, 0.95), rgba(191, 219, 254, 0) 42%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__railCard img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-right: 52px;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__headerText {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__title {
    margin: 0;
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__subtitle {
    margin: 0;
    color: var(--text-secondary, #475569);
    font-size: 14px;
    line-height: 1.55;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__headerActions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__iconAction {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__iconAction img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__iconAction:hover {
    border-color: #cbd5e1;
    background: var(--bg-app, #f8fafc);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__iconAction:focus-visible {
    outline: none;
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewZone {
    position: relative;
    min-height: 280px;
    display: grid;
    place-items: center;
    border: 1px dashed rgba(148, 163, 184, 0.5);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(239, 246, 255, 0.88));
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewZone:hover,
.custom-modal.puzzle-settings-modal .puzzle-settings__previewZone.is-dragover {
    border-color: rgba(37, 99, 235, 0.42);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewZone:focus-visible {
    outline: none;
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewZone.is-filled {
    border-style: solid;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewEmpty {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewEmpty[hidden] {
    display: none !important;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewEmpty img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    opacity: 0.82;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewEmptyTitle {
    color: var(--text-primary, #0f172a);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewEmptyHint {
    color: var(--text-secondary, #64748b);
    font-size: 13px;
    line-height: 1.45;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewMedia {
    position: relative;
    display: inline-grid;
    place-items: stretch;
    align-self: center;
    justify-self: center;
    width: fit-content;
    max-width: calc(100% - 24px);
    max-height: calc(100% - 24px);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewMedia[hidden] {
    display: none !important;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewImage {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100vh - 360px);
    object-fit: contain;
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.10);
    background:
        linear-gradient(45deg, rgba(226, 232, 240, 0.8) 25%, transparent 25%) -12px 0/24px 24px,
        linear-gradient(45deg, transparent 75%, rgba(226, 232, 240, 0.8) 75%) -12px 0/24px 24px,
        linear-gradient(45deg, transparent 75%, rgba(226, 232, 240, 0.8) 75%) 0 0/24px 24px,
        linear-gradient(45deg, rgba(226, 232, 240, 0.8) 25%, transparent 25%) 0 0/24px 24px,
        #ffffff;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewGrid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.62) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.62) 1px, transparent 1px),
        linear-gradient(to right, rgba(15, 23, 42, 0.52) 3px, transparent 3px),
        linear-gradient(to bottom, rgba(15, 23, 42, 0.52) 3px, transparent 3px);
    background-size:
        calc(100% / var(--puzzle-grid-cols, 3)) 100%,
        100% calc(100% / var(--puzzle-grid-rows, 3)),
        calc(100% / var(--puzzle-grid-cols, 3)) 100%,
        100% calc(100% / var(--puzzle-grid-rows, 3));
    border-radius: 14px;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.45),
        inset 0 0 0 3px rgba(15, 23, 42, 0.20),
        inset 0 0 28px rgba(15, 23, 42, 0.12);
    pointer-events: none;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewGrid[hidden] {
    display: none !important;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewReplace {
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewReplace:hover {
    border-color: #cbd5e1;
    background: var(--bg-app, #f8fafc);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewEmpty .puzzle-settings__previewReplace {
    display: none !important;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewReplace--overlay {
    position: absolute;
    right: 14px;
    bottom: 14px;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__previewZone:not(.is-filled) .puzzle-settings__previewReplace--overlay {
    display: none !important;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__label {
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetControl {
    position: relative;
    min-width: 0;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetTrigger {
    box-sizing: border-box;
    position: relative;
    width: 100%;
    min-height: 46px;
    padding: 0 38px 0 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: #ffffff;
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetTrigger:hover {
    border-color: #cbd5e1;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetTrigger:focus {
    outline: none;
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetTrigger::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 14px;
    width: 8px;
    height: 8px;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: translateY(-60%) rotate(45deg);
    transition: transform 0.16s ease;
    pointer-events: none;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetControl.is-open .puzzle-settings__presetTrigger::after {
    transform: translateY(-35%) rotate(-135deg);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetMenu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 12;
    display: grid;
    grid-template-columns: 74px 40px;
    gap: 12px;
    width: auto;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetMenu[hidden] {
    display: none !important;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetList {
    display: grid;
    gap: 10px;
    padding-right: 12px;
    border-right: 1px solid rgba(226, 232, 240, 0.92);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetOption {
    min-height: 42px;
    padding: 0 10px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 12px;
    background: var(--bg-app, #f8fafc);
    color: var(--text-primary, #0f172a);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetOption:hover {
    border-color: #cbd5e1;
    background: #ffffff;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetOption.is-active {
    border-color: rgba(37, 99, 235, 0.42);
    background: rgba(239, 246, 255, 0.88);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetSliderCol {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 302px;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__presetSlider {
    width: 18px;
    height: 156px;
    min-height: 156px;
    writing-mode: vertical-lr;
    direction: rtl;
    transform: rotate(180deg);
    accent-color: var(--accent-primary, #2563eb);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggleRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: #ffffff;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggleLabel {
    color: var(--text-primary, #0f172a);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggle {
    position: relative;
    flex: 0 0 auto;
    width: 46px;
    height: 28px;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggleInput {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggleTrack {
    position: absolute;
    inset: 0;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 999px;
    background: var(--bg-app, #f8fafc);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
    transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggleTrack::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.14);
    transition: transform 0.16s ease;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggleInput:hover + .puzzle-settings__toggleTrack {
    border-color: #cbd5e1;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggleInput:focus-visible + .puzzle-settings__toggleTrack {
    border-color: var(--accent-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggleInput:checked + .puzzle-settings__toggleTrack {
    border-color: rgba(37, 99, 235, 0.42);
    background: rgba(239, 246, 255, 0.92);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__toggleInput:checked + .puzzle-settings__toggleTrack::after {
    transform: translateX(18px);
}

.custom-modal.puzzle-settings-modal .puzzle-settings__footerLeft,
.custom-modal.puzzle-settings-modal .puzzle-settings__footerRight {
    display: flex;
    align-items: center;
    gap: 12px;
}

.custom-modal.puzzle-settings-modal .puzzle-settings__footerRight {
    justify-content: flex-end;
    margin-left: auto;
}

@media (max-width: 860px) {
    .custom-modal.puzzle-settings-modal {
        min-width: 0;
        width: min(96vw, 720px);
    }

    .custom-modal.puzzle-settings-modal .puzzle-settings__metrics {
        grid-template-columns: 1fr;
    }

    .custom-modal.puzzle-settings-modal .puzzle-settings__toggles {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .custom-modal.puzzle-settings-modal {
        flex-direction: column;
    }

    .custom-modal.puzzle-settings-modal .custom-modal-title {
        width: 100%;
        padding: 18px 18px 0;
        border-right: none;
        border-bottom: 1px solid var(--border-default, #dbe5f0);
        border-top-right-radius: 22px;
        border-bottom-left-radius: 0;
    }

    .custom-modal.puzzle-settings-modal .puzzle-settings__rail {
        min-height: 0;
    }

    .custom-modal.puzzle-settings-modal .puzzle-settings__railCard {
        width: 72px;
        height: 72px;
        padding: 14px;
    }

    .custom-modal.puzzle-settings-modal .puzzle-settings__header {
        flex-direction: column;
        align-items: stretch;
    }

    .custom-modal.puzzle-settings-modal .puzzle-settings__headerActions {
        justify-content: flex-start;
    }

    .custom-modal.puzzle-settings-modal .custom-modal-body {
        padding: 16px 16px 14px;
    }

    .custom-modal.puzzle-settings-modal .puzzle-settings__previewZone {
        min-height: 220px;
    }

    .custom-modal.puzzle-settings-modal .puzzle-settings__presetMenu {
        left: 0;
        min-width: 0;
    }

    .custom-modal.puzzle-settings-modal .custom-modal-buttons {
        padding: 14px 16px 16px;
        flex-direction: column;
        align-items: stretch;
        border-bottom-left-radius: 22px;
    }

    .custom-modal.puzzle-settings-modal .puzzle-settings__footerLeft,
    .custom-modal.puzzle-settings-modal .puzzle-settings__footerRight {
        width: 100%;
        margin-left: 0;
    }

    .custom-modal.puzzle-settings-modal .puzzle-settings__footerLeft button,
    .custom-modal.puzzle-settings-modal .puzzle-settings__footerRight button {
        width: 100%;
    }
}

/* ===== Toast (non-blocking) ===== */
.toast-root {
    position: fixed;
    right: 14px;
    bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2147483647;
    pointer-events: none;
}
.toast {
    pointer-events: none;
    min-width: 220px;
    max-width: 360px;
    background: rgba(33, 50, 74, 0.92);
    color: #fff;
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.35);
    transform: translateY(0);
    opacity: 1;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.toast-hide {
    opacity: 0;
    transform: translateY(8px);
}
.toast-message {
    font-size: 13px;
    line-height: 1.35;
    word-wrap: break-word;
    white-space: pre-line;
}

/* ===== Local picker modal ===== */
.custom-modal.local-picker-modal {
    max-width: 720px;
    width: 92vw;
}

/* ===== Schedule: teacher prompt (T - 3 min) ===== */
.custom-modal-overlay:has(.custom-modal.schedule-3m-modal) {
    background: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.custom-modal.schedule-3m-modal {
    width: min(520px, 92vw);
    min-width: min(420px, 92vw);
    max-width: 92vw;
    border-radius: 14px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0;
    overflow: hidden;
    flex-direction: column;
    gap: 0;
}

.custom-modal.schedule-3m-modal.is-draggable .custom-modal-title {
    cursor: grab;
}

.custom-modal.schedule-3m-modal.is-draggable .custom-modal-content {
    cursor: default;
}

body.modal-dragging .custom-modal.schedule-3m-modal.is-draggable .custom-modal-title {
    cursor: grabbing;
}

.custom-modal.schedule-3m-modal .custom-modal-title {
    max-width: none;
    width: 100%;
    padding: 20px 20px 0;
    display: block;
}

.custom-modal.schedule-3m-modal .schedule-3m-modal__header {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.custom-modal.schedule-3m-modal .custom-modal-content {
    padding: 12px 20px 20px;
    gap: 18px;
}

.custom-modal.schedule-3m-modal .schedule-3m-modal__icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid rgba(191, 219, 254, 0.95);
    background: rgba(239, 246, 255, 0.96);
    color: #2563eb;
}

.custom-modal.schedule-3m-modal .schedule-3m-modal__icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.custom-modal.schedule-3m-modal .schedule-3m-modal__heading {
    min-width: 0;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.3;
    color: #0f172a;
}

.custom-modal.schedule-3m-modal .custom-modal-close {
    display: none;
}

.custom-modal.schedule-3m-modal .custom-modal-body {
    gap: 12px;
}

.custom-modal.schedule-3m-modal .custom-modal-body p {
    margin: 0;
    font-size: 15px;
    line-height: 1.55;
    color: #475569;
}

.custom-modal.schedule-3m-modal .custom-modal-buttons {
    margin-top: 0;
    gap: 10px;
    justify-content: flex-end;
}

.custom-modal.schedule-3m-modal .custom-modal-buttons button {
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid transparent;
    box-shadow: none;
}

.custom-modal.schedule-3m-modal .btn-cancel {
    background: #ffffff;
    color: #334155;
    border-color: #dbe4ee;
}

.custom-modal.schedule-3m-modal .btn-cancel:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.custom-modal.schedule-3m-modal .btn-ok {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.custom-modal.schedule-3m-modal .btn-ok:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

@media (max-width: 640px) {
    .custom-modal.schedule-3m-modal {
        width: min(96vw, 520px);
        min-width: 0;
    }

    .custom-modal.schedule-3m-modal .custom-modal-title {
        padding: 18px 18px 0;
    }

    .custom-modal.schedule-3m-modal .custom-modal-content {
        padding: 12px 18px 18px;
    }

    .custom-modal.schedule-3m-modal .custom-modal-buttons {
        flex-direction: column;
    }

    .custom-modal.schedule-3m-modal .custom-modal-buttons button {
        width: 100%;
    }
}

/* ===== Schedule: booking confirm ===== */
.custom-modal-overlay:has(.custom-modal.schedule-booking-modal) {
    background: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.custom-modal.schedule-booking-modal {
    width: min(520px, 92vw);
    min-width: min(420px, 92vw);
    max-width: 92vw;
    border-radius: 18px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0;
    overflow: hidden;
    flex-direction: column;
    gap: 0;
}

.custom-modal.schedule-booking-modal .custom-modal-title {
    max-width: none;
    width: 100%;
    padding: 20px 20px 0;
    display: block;
}

.custom-modal.schedule-booking-modal .custom-modal-content {
    padding: 12px 20px 20px;
    gap: 18px;
    position: static;
}

.custom-modal.schedule-booking-modal .custom-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    color: #475569;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    z-index: 2;
}

.custom-modal.schedule-booking-modal .custom-modal-close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.18s ease;
}

.custom-modal.schedule-booking-modal .custom-modal-close:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.custom-modal.schedule-booking-modal .custom-modal-close:hover img {
    transform: rotate(90deg);
}

.custom-modal.schedule-booking-modal .custom-modal-close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.custom-modal.schedule-booking-modal .schedule-booking-modal__header {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.custom-modal.schedule-booking-modal .schedule-booking-modal__icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid rgba(191, 219, 254, 0.95);
    background: rgba(239, 246, 255, 0.96);
}

.custom-modal.schedule-booking-modal .schedule-booking-modal__icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.custom-modal.schedule-booking-modal .schedule-booking-modal__title-copy {
    min-width: 0;
}

.custom-modal.schedule-booking-modal .schedule-booking-modal__title {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.3;
    color: #0f172a;
}

.custom-modal.schedule-booking-modal .custom-modal-body {
    gap: 0;
}

.custom-modal.schedule-booking-modal .custom-modal-body p {
    display: grid;
    gap: 12px;
    margin: 0;
}

.custom-modal.schedule-booking-modal .schedule-booking-modal__meta {
    display: grid;
    gap: 12px;
}

.custom-modal.schedule-booking-modal .schedule-booking-modal__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 14px;
    background: #fff;
}

.custom-modal.schedule-booking-modal .schedule-booking-modal__label {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    color: #64748b;
}

.custom-modal.schedule-booking-modal .schedule-booking-modal__value {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    color: #0f172a;
    text-align: right;
}

.custom-modal.schedule-booking-modal .custom-modal-buttons {
    margin-top: 0;
    gap: 10px;
    justify-content: flex-end;
}

.custom-modal.schedule-booking-modal .custom-modal-buttons button {
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid transparent;
    box-shadow: none;
}

.custom-modal.schedule-booking-modal .btn-cancel {
    background: #ffffff;
    color: #334155;
    border-color: #dbe4ee;
}

.custom-modal.schedule-booking-modal .btn-cancel:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.custom-modal.schedule-booking-modal .btn-ok {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.custom-modal.schedule-booking-modal .btn-ok:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.custom-modal.release-manual-modal {
    width: min(720px, 92vw);
    min-width: min(560px, 92vw);
    max-width: 92vw;
    border-radius: 12px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.16);
    padding: 0;
    overflow: hidden;
    flex-direction: column;
    gap: 0;
}

.custom-modal.release-manual-modal .custom-modal-title {
    max-width: none;
    width: 100%;
    padding: 20px 20px 0;
    display: block;
}

.custom-modal.release-manual-modal .custom-modal-content {
    padding: 12px 20px 20px;
    gap: 16px;
    position: static;
}

.custom-modal.release-manual-modal .custom-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: var(--bg-panel, #ffffff);
    color: var(--text-secondary, #667085);
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    z-index: 2;
}

.custom-modal.release-manual-modal .custom-modal-close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.custom-modal.release-manual-modal .custom-modal-close:hover {
    background: var(--accent-soft, #eff6ff);
    border-color: var(--border-strong, #cbd5e1);
    transform: translateY(-1px);
}

.custom-modal.release-manual-modal .custom-modal-close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.custom-modal.release-manual-modal .release-manual-modal__header {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.custom-modal.release-manual-modal .release-manual-modal__icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid rgba(191, 219, 254, 0.95);
    background: rgba(239, 246, 255, 0.96);
}

.custom-modal.release-manual-modal .release-manual-modal__icon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.custom-modal.release-manual-modal .release-manual-modal__title-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.custom-modal.release-manual-modal .release-manual-modal__eyebrow {
    font-size: 12px;
    line-height: 1.4;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary, #667085);
}

.custom-modal.release-manual-modal .release-manual-modal__headline {
    font-size: 20px;
    line-height: 1.25;
    font-weight: 800;
    color: var(--text-primary, #0f172a);
}

.custom-modal.release-manual-modal .custom-modal-body {
    gap: 14px;
}

.custom-modal.release-manual-modal .custom-modal-body p {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 14px 16px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.96));
}

.custom-modal.release-manual-modal .release-manual-modal__lead {
    font-size: 15px;
    line-height: 1.5;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
}

.custom-modal.release-manual-modal .release-manual-modal__note {
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary, #667085);
}

.custom-modal.release-manual-modal .custom-modal-body textarea.modalInput {
    min-height: 220px;
    padding: 14px 16px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 10px;
    background: var(--bg-panel, #ffffff);
    color: var(--text-primary, #0f172a);
    font-size: 15px;
    line-height: 1.55;
    resize: vertical;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

.custom-modal.release-manual-modal .custom-modal-body textarea.modalInput::placeholder {
    color: var(--text-muted, #98a2b3);
}

.custom-modal.release-manual-modal .custom-modal-body textarea.modalInput:hover {
    border-color: var(--border-strong, #cbd5e1);
}

.custom-modal.release-manual-modal .custom-modal-body textarea.modalInput:focus {
    outline: 2px solid rgba(37, 99, 235, 0.14);
    outline-offset: 1px;
    border-color: var(--accent-primary, #2563eb);
}

.custom-modal.release-manual-modal .custom-modal-buttons {
    margin-top: 0;
    gap: 10px;
    justify-content: flex-end;
}

.custom-modal.release-manual-modal .custom-modal-buttons button {
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid transparent;
    box-shadow: none;
}

.custom-modal.release-manual-modal .btn-cancel {
    background: var(--bg-panel, #ffffff);
    color: var(--text-primary, #334155);
    border-color: var(--border-default, #dbe5f0);
}

.custom-modal.release-manual-modal .btn-cancel:hover {
    background: #f8fafc;
    border-color: var(--border-strong, #cbd5e1);
}

.custom-modal.release-manual-modal .btn-ok {
    background: var(--accent-primary, #2563eb);
    color: #ffffff;
    border-color: var(--accent-primary, #2563eb);
}

.custom-modal.release-manual-modal .btn-ok:hover {
    background: var(--accent-primary-hover, #1d4ed8);
    border-color: var(--accent-primary-hover, #1d4ed8);
}

@media (max-width: 640px) {
    .custom-modal.release-manual-modal {
        min-width: 0;
        width: min(92vw, 560px);
    }

    .custom-modal.release-manual-modal .custom-modal-title {
        padding: 18px 18px 0;
    }

    .custom-modal.release-manual-modal .custom-modal-content {
        padding: 10px 18px 18px;
    }

    .custom-modal.release-manual-modal .release-manual-modal__header {
        align-items: flex-start;
    }

    .custom-modal.release-manual-modal .release-manual-modal__icon {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
    }

    .custom-modal.release-manual-modal .release-manual-modal__icon img {
        width: 28px;
        height: 28px;
    }

    .custom-modal.release-manual-modal .release-manual-modal__headline {
        font-size: 18px;
    }

    .custom-modal.release-manual-modal .custom-modal-buttons {
        flex-direction: column-reverse;
    }

    .custom-modal.release-manual-modal .custom-modal-buttons button {
        width: 100%;
    }
}

.custom-modal.schedule-no-lessons-modal .custom-modal-body {
    gap: 0;
}

.custom-modal.schedule-no-lessons-modal .custom-modal-body p {
    margin: 0;
}

.custom-modal.schedule-no-lessons-modal .schedule-no-lessons-modal__body {
    display: block;
}

.custom-modal.schedule-no-lessons-modal .schedule-no-lessons-modal__notice {
    display: block;
    padding: 16px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 14px;
    background: #fff;
}

.custom-modal.schedule-no-lessons-modal .schedule-no-lessons-modal__text {
    display: block;
    font-size: 15px;
    line-height: 1.5;
    font-weight: 500;
    color: #334155;
}

.custom-modal.quick-messages-modal {
    width: min(680px, 92vw);
    min-width: 0;
    max-width: 92vw;
    padding: 0;
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
    overflow: hidden;
    flex-direction: column;
    gap: 0;
}

.custom-modal.quick-messages-modal .custom-modal-content {
    position: relative;
    padding: 20px;
    gap: 16px;
}

.custom-modal.quick-messages-modal .custom-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    color: #475569;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.custom-modal.quick-messages-modal .custom-modal-close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.18s ease;
}

.custom-modal.quick-messages-modal .custom-modal-close:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.custom-modal.quick-messages-modal .custom-modal-close:hover img {
    transform: rotate(90deg);
}

.custom-modal.quick-messages-modal .custom-modal-close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.quick-messages__header {
    padding-right: 56px;
}

.quick-messages__title {
    font-size: 20px;
    line-height: 1.3;
    font-weight: 800;
    color: #0f172a;
}

.custom-modal.quick-messages-modal .custom-modal-body.quick-messages__body {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.quick-messages__avatar {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
    border: 1px solid rgba(226, 232, 240, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.quick-messages__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.quick-messages__avatar-fallback {
    font-size: 28px;
    line-height: 1;
    font-weight: 800;
    color: #334155;
}

.quick-messages__form {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.quick-messages__presence {
    min-height: 20px;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 600;
    color: #64748b;
}

.quick-messages__presence.is-online {
    color: #15803d;
}

.quick-messages__input {
    width: 100%;
    min-height: 168px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #dbe4ee;
    background: #ffffff;
    color: #0f172a;
    font: inherit;
    line-height: 1.5;
    resize: vertical;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.quick-messages__input::placeholder {
    color: #94a3b8;
}

.quick-messages__input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.custom-modal.quick-messages-modal .custom-modal-buttons.quick-messages__footer {
    justify-content: flex-end;
    gap: 10px;
    margin-top: 0;
}

.custom-modal.quick-messages-modal .custom-modal-buttons button {
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid transparent;
    box-shadow: none;
}

.custom-modal.quick-messages-modal .btn-cancel {
    background: #ffffff;
    color: #334155;
    border-color: #dbe4ee;
}

.custom-modal.quick-messages-modal .btn-cancel:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.custom-modal.quick-messages-modal .btn-ok {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.custom-modal.quick-messages-modal .btn-ok:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.custom-modal.quick-messages-modal .btn-ok:disabled {
    opacity: 0.55;
    cursor: default;
}

@media (max-width: 640px) {
    .custom-modal.quick-messages-modal .custom-modal-content {
        padding: 18px;
    }

    .custom-modal.quick-messages-modal .custom-modal-body.quick-messages__body {
        grid-template-columns: 1fr;
    }

    .quick-messages__avatar {
        width: 64px;
        height: 64px;
    }

    .custom-modal.quick-messages-modal .custom-modal-buttons.quick-messages__footer {
        flex-direction: column;
    }

    .custom-modal.quick-messages-modal .custom-modal-buttons button {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .custom-modal.schedule-booking-modal {
        width: min(96vw, 520px);
        min-width: 0;
    }

    .custom-modal.schedule-booking-modal .custom-modal-title {
        padding: 18px 18px 0;
    }

    .custom-modal.schedule-booking-modal .custom-modal-content {
        padding: 12px 18px 18px;
    }

    .custom-modal.schedule-booking-modal .schedule-booking-modal__row {
        grid-template-columns: 1fr;
        display: grid;
        gap: 6px;
    }

    .custom-modal.schedule-booking-modal .schedule-booking-modal__value {
        text-align: left;
    }

    .custom-modal.schedule-booking-modal .custom-modal-buttons {
        flex-direction: column;
    }

    .custom-modal.schedule-booking-modal .custom-modal-buttons button {
        width: 100%;
    }

    .custom-modal.schedule-no-lessons-modal .schedule-no-lessons-modal__notice {
        padding: 14px;
    }
}

.custom-modal-overlay:has(.custom-modal.lessons-guest-link-modal) {
    background: rgba(15, 23, 42, 0.42);
}

.custom-modal.lessons-guest-link-modal {
    width: min(660px, 92vw);
    min-width: min(420px, 92vw);
    max-width: 92vw;
    border-radius: 22px;
    border: 1px solid var(--border-default, #dbe5f0);
    background: var(--bg-panel, #ffffff);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.16);
    padding: 0;
    overflow: hidden;
    gap: 0;
}

.custom-modal.lessons-guest-link-modal .custom-modal-title {
    max-width: none;
    width: 96px;
    padding: 20px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.96), rgba(248, 250, 252, 0.96));
    border-right: 1px solid rgba(226, 232, 240, 0.96);
}

.custom-modal.lessons-guest-link-modal .custom-modal-title img {
    width: 48px;
    height: 48px;
    max-width: none;
    max-height: none;
    object-fit: contain;
}

.custom-modal.lessons-guest-link-modal .custom-modal-content {
    padding: 20px 20px 18px;
    gap: 18px;
    position: static;
}

.custom-modal.lessons-guest-link-modal .custom-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-secondary, #475569);
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    z-index: 2;
}

.custom-modal.lessons-guest-link-modal .custom-modal-close img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transition: transform 0.18s ease;
}

.custom-modal.lessons-guest-link-modal .custom-modal-close:hover {
    background: var(--bg-app, #f8fafc);
    border-color: #cbd5e1;
}

.custom-modal.lessons-guest-link-modal .custom-modal-close:hover img,
.custom-modal.lessons-guest-link-modal .custom-modal-close:focus-visible img {
    transform: rotate(90deg);
}

.custom-modal.lessons-guest-link-modal .custom-modal-close:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 1px;
}

.custom-modal.lessons-guest-link-modal .custom-modal-body {
    gap: 16px;
}

.custom-modal.lessons-guest-link-modal .custom-modal-body p {
    margin: 0;
}

.custom-modal.lessons-guest-link-modal .lessons-guest-link-modal__stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.custom-modal.lessons-guest-link-modal .lessons-guest-link-modal__headline {
    color: var(--text-primary, #0f172a);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
}

.custom-modal.lessons-guest-link-modal .lessons-guest-link-modal__meta {
    display: inline-flex;
    align-self: flex-start;
    padding: 8px 12px;
    border: 1px solid rgba(191, 219, 254, 0.96);
    border-radius: 999px;
    background: rgba(239, 246, 255, 0.9);
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}

.custom-modal.lessons-guest-link-modal .lessons-guest-link-modal__link-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    border: 1px solid var(--border-default, #dbe5f0);
    border-radius: 14px;
    background: var(--bg-app, #f8fafc);
}

.custom-modal.lessons-guest-link-modal .lessons-guest-link-modal__link-label {
    color: var(--text-secondary, #475569);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.custom-modal.lessons-guest-link-modal .lessons-guest-link-modal__link {
    color: var(--text-primary, #0f172a);
    font-size: 13px;
    line-height: 1.45;
    word-break: break-all;
    user-select: text;
}

.custom-modal.lessons-guest-link-modal .lessons-guest-link-modal__hint {
    color: var(--text-secondary, #475569);
    font-size: 13px;
    line-height: 1.45;
}

.custom-modal.lessons-guest-link-modal .custom-modal-buttons {
    margin-top: 0;
    justify-content: flex-end;
}

.custom-modal.lessons-guest-link-modal .custom-modal-buttons button {
    min-width: 112px;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
}

.custom-modal.lessons-guest-link-modal .btn-ok {
    background: var(--accent-primary, #2563eb);
    color: #ffffff;
}

.custom-modal.lessons-guest-link-modal .btn-ok:hover {
    background: var(--accent-primary-hover, #1d4ed8);
}

@media (max-width: 640px) {
    .custom-modal.lessons-guest-link-modal {
        min-width: 0;
        width: min(96vw, 420px);
        flex-direction: column;
    }

    .custom-modal.lessons-guest-link-modal .custom-modal-title {
        width: 100%;
        padding: 18px 18px 0;
        border-right: none;
        border-bottom: 1px solid rgba(226, 232, 240, 0.96);
        justify-content: flex-start;
        align-items: center;
    }

    .custom-modal.lessons-guest-link-modal .custom-modal-content {
        padding: 16px 16px 16px;
    }

    .custom-modal.lessons-guest-link-modal .custom-modal-buttons button {
        width: 100%;
    }
}

.custom-modal.local-picker-modal .custom-modal-title {
    max-width: 45%;
}
.local-picker__title {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
}
.local-picker__subtitle {
    font-size: 13px;
    color: #4b5563;
    margin-top: -4px;
}
.local-picker__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 56vh;
    overflow: auto;
    padding-right: 4px;
}
.local-picker__item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 12px;
    padding: 10px 12px;
    cursor: pointer;
}
.local-picker__item:hover {
    background: #f7faff;
    border-color: #cdd9ff;
}
.local-picker__item-title {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
}
.local-picker__item-tags {
    font-size: 12px;
    color: #6b7280;
}
.local-picker__empty {
    font-size: 13px;
    color: #6b7280;
    padding: 10px 4px;
}
.local-picker__loading {
    color: #475569;
    font-weight: 700;
}
.custom-modal.sticker-settings-modal .sticker-chip .x {
    opacity: 0.7;
    font-weight: 700;
}
.custom-modal.sticker-settings-modal .sticker-chip:hover {
    background: #e3ebff;
}

/* ===== Create card from sticker modal ===== */
.custom-modal.create-card-from-sticker-modal {
    max-width: 860px;
    width: 92vw;
}
.custom-modal.create-card-from-sticker-modal .ccfs-title {
    font-size: 16px;
    font-weight: 800;
    color: #1f2937;
    margin-bottom: 8px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 2px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-queuebar {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-remaining {
    font-size: 12px;
    color: #6b7280;
    font-weight: 700;
}
.custom-modal.create-card-from-sticker-modal .ccfs-same {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #0f172a;
    font-weight: 700;
    user-select: none;
}
.custom-modal.create-card-from-sticker-modal .ccfs-same input {
    width: 16px;
    height: 16px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    align-items: end;
}
.custom-modal.create-card-from-sticker-modal .ccfs-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-label {
    font-size: 13px;
    color: #475569;
    font-weight: 700;
}
.custom-modal.create-card-from-sticker-modal .ccfs-section-title {
    font-size: 13px;
    color: #475569;
    font-weight: 800;
    margin: 12px 0 8px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-rows,
.custom-modal.create-card-from-sticker-modal .ccfs-custom {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-row {
    display: grid;
    grid-template-columns: 18px 22px 44px 1fr;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
}
.custom-modal.create-card-from-sticker-modal .ccfs-row:hover {
    border-color: #cdd9ff;
    background: #f7faff;
}
.custom-modal.create-card-from-sticker-modal .ccfs-radio {
    width: 18px;
    height: 18px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-flag {
    width: 22px;
    height: 16px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid #e5e7eb;
}
.custom-modal.create-card-from-sticker-modal .ccfs-lang {
    font-size: 12px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: 0.3px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-row-custom {
    grid-template-columns: 18px 18px 140px 1fr 92px 120px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-custom-icon {
    font-size: 14px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-custom-label {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}
.custom-modal.create-card-from-sticker-modal .ccfs-custom-lang {
    min-width: 88px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-translate-btn {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px 10px;
    background: #f3f4f6;
    color: #111827;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.18s, border-color 0.18s;
}
.custom-modal.create-card-from-sticker-modal .ccfs-translate-btn:hover {
    background: #e9edf2;
    border-color: #cbd5e1;
}
.custom-modal.create-card-from-sticker-modal .ccfs-translate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.custom-modal.create-card-from-sticker-modal .custom-modal-buttons.ccfs-footer {
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.custom-modal.create-card-from-sticker-modal .ccfs-footer-left {
    flex: 1 1 320px;
    min-width: 240px;
}
.custom-modal.create-card-from-sticker-modal .ccfs-footer-right {
    display: flex;
    gap: 8px;
    margin-left: auto;
}
.custom-modal.create-card-from-sticker-modal .ccfs-audio-note {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid #eee;
    border-radius: 10px;
    background: #f7f7f7;
}
@media (max-width: 680px) {
    .custom-modal.create-card-from-sticker-modal .ccfs-grid {
        grid-template-columns: 1fr;
    }
    .custom-modal.create-card-from-sticker-modal .ccfs-row-custom {
        grid-template-columns: 18px 18px 1fr;
        grid-template-areas:
            "radio icon label"
            "radio . input"
            "radio . lang"
            "radio . btn";
    }
    .custom-modal.create-card-from-sticker-modal .ccfs-row-custom .ccfs-radio { grid-area: radio; }
    .custom-modal.create-card-from-sticker-modal .ccfs-row-custom .ccfs-custom-icon { grid-area: icon; }
    .custom-modal.create-card-from-sticker-modal .ccfs-row-custom .ccfs-custom-label { grid-area: label; }
    .custom-modal.create-card-from-sticker-modal .ccfs-row-custom .ccfs-custom-word { grid-area: input; }
    .custom-modal.create-card-from-sticker-modal .ccfs-row-custom .ccfs-custom-lang { grid-area: lang; }
    .custom-modal.create-card-from-sticker-modal .ccfs-row-custom .ccfs-translate-btn { grid-area: btn; }
}

/* --- Link preview modal --- */
.custom-modal.link-preview-modal .link-preview-block {
  margin-top: 2px;
  border-top: 1px solid var(--border-default, #dbe5f0);
  padding-top: 14px;
}

.custom-modal.link-preview-modal .link-preview-block__label {
  margin-bottom: 8px;
  color: var(--text-secondary, #475569);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.custom-modal.link-preview-modal .link-preview-block__hint,
.custom-modal.link-preview-modal .link-preview-block__loading,
.custom-modal.link-preview-modal .link-preview-block__error {
  padding: 12px 14px;
  border: 1px solid var(--border-default, #dbe5f0);
  border-radius: 10px;
  background: var(--bg-app, #f8fafc);
  color: var(--text-secondary, #475569);
  font-size: 13px;
  line-height: 1.45;
}

.custom-modal.link-preview-modal .link-preview-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border-default, #dbe5f0);
  border-radius: 12px;
  background: #ffffff;
}

.custom-modal.link-preview-modal .link-preview-card__image {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  background: var(--bg-app, #f8fafc);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-modal.link-preview-modal .link-preview-card__image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.custom-modal.link-preview-modal .link-preview-card__placeholder {
  color: var(--text-secondary, #475569);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.custom-modal.link-preview-modal .link-preview-card__title {
  color: var(--text-primary, #0f172a);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  max-height: 2.8em;
  overflow: hidden;
}

.custom-modal.link-preview-modal .link-preview-card__domain {
  margin-top: 2px;
  color: var(--text-secondary, #475569);
  font-size: 12px;
  line-height: 1.35;
}

.custom-modal.link-preview-modal .link-preview-card__desc {
  margin-top: 4px;
  color: var(--text-secondary, #475569);
  font-size: 12px;
  line-height: 1.45;
  max-height: 2.9em;
  overflow: hidden;
}

/* --- Card settings modal --- */
.custom-modal.card-settings-modal {
  width: min(620px, 94vw);
  min-width: min(540px, 94vw);
}

.custom-modal.card-settings-modal .custom-modal-title {
  align-items: stretch;
  justify-content: center;
  padding: 22px 14px;
}

.custom-modal.card-settings-modal .custom-modal-content {
  padding: 20px 20px 18px;
}

.custom-modal.card-settings-modal .custom-modal-body {
  gap: 14px;
}

.custom-modal.card-settings-modal .custom-modal-body > h3 {
  margin: 0;
}

.custom-modal.card-settings-modal .card-settings__preview-stack {
  position: relative;
  width: 100%;
  min-height: 170px;
  height: 100%;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-modal.card-settings-modal .card-settings__preview-stack.is-group {
  display: block;
}

.custom-modal.card-settings-modal .card-settings__preview-card {
  width: 60px;
  height: 90px;
  border-radius: 14px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
  overflow: hidden;
}

.custom-modal.card-settings-modal .card-settings__preview-stack.is-single .card-settings__preview-card {
  width: 72px;
  height: 108px;
}

.custom-modal.card-settings-modal .card-settings__preview-stack.is-group .card-settings__preview-card {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
}

.custom-modal.card-settings-modal .card-settings__preview-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f8fafc;
}

.custom-modal.card-settings-modal .card-settings__size-section {
  margin-top: 2px;
}

.custom-modal.card-settings-modal .card-settings__size-title,
.custom-modal.card-settings-modal .card-settings__section-title {
  margin: 0 0 8px;
  color: var(--text-secondary, #475569);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.custom-modal.card-settings-modal .card-settings__size-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.custom-modal.card-settings-modal .card-settings__section {
  margin-top: 0;
}

.custom-modal.card-settings-modal .card-settings__radio-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.custom-modal.card-settings-modal .card-radio {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background .18s, border-color .18s, box-shadow .18s;
}

.custom-modal.card-settings-modal .card-radio:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.custom-modal.card-settings-modal .card-radio input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.custom-modal.card-settings-modal .card-radio__label {
  font-size: 14px;
  color: #0f172a;
  font-weight: 600;
}

.custom-modal.card-settings-modal .card-settings__size-grid .card-radio input:checked + .card-radio__label {
  font-size: x-large;
}

.custom-modal.card-settings-modal .card-settings__sep {
  height: 1px;
  background: #edf2f7;
  margin: 2px 0;
}

.custom-modal.card-settings-modal .card-settings__select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  border-radius: 12px;
  padding: 10px 12px;
}

.custom-modal.card-settings-modal .card-settings__select-label {
  font-size: 13px;
  color: #475569;
  font-weight: 700;
}

.custom-modal.card-settings-modal .card-settings__select {
  width: 100%;
  max-width: 260px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-weight: 600;
}

.custom-modal.card-settings-modal .card-settings__checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.custom-modal.card-settings-modal .card-settings__checkbox input[type="checkbox"] {
  margin: 0;
}

.custom-modal.card-settings-modal .card-settings__checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.custom-modal.card-settings-modal .card-settings__checkbox-label img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

@media (max-width: 720px) {
  .custom-modal.card-settings-modal {
    min-width: 0;
    width: min(96vw, 560px);
  }

  .custom-modal.card-settings-modal .custom-modal-title {
    width: 100%;
    min-height: 108px;
    border-right: none;
    border-bottom: 1px solid var(--border-default, #dbe5f0);
  }

  .custom-modal.card-settings-modal .card-settings__preview-stack {
    min-height: 72px;
  }

  .custom-modal.card-settings-modal .card-settings__preview-card {
    width: 52px;
    height: 78px;
  }
}

.student-modal__input-wrap {
  position: relative;
  width: 100%;
}

.student-modal__input-wrap .student-modal__input {
  padding-right: 40px;
}

.student-modal__toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: none;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.student-modal__toggle img {
  width: 24px;
  height: 24px;
  display: block;
  margin-right: 10px;
  opacity: 0.8;
}

.student-modal__toggle:hover img {
  opacity: 1;
}

.student-modal__toggle:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}
