.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: 2147483647;
}
.custom-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,1.6);
    padding: 20px;
    width: fit-content;
    max-width: fit-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: 48px;
    object-fit: contain;
}
.custom-modal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    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%;
    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 (resize should affect modal width too) */
.custom-modal.add-text-modal {
    max-width: 92vw;
}
.custom-modal.add-text-modal textarea.modalInput {
    resize: both;
}
.custom-modal.dice-faces-modal {
    width: min(1120px, 96vw);
    max-width: 96vw;
    padding: 0;
    border-radius: 16px;
    overflow: hidden;
    gap: 0;
}

.custom-modal.dice-faces-modal .custom-modal-title {
    max-width: none;
    width: 88px;
    padding: 14px 10px;
    background: #f8fafc;
    border-right: 1px solid rgba(15, 23, 42, 0.10);
}

.custom-modal.dice-faces-modal .custom-modal-title img {
    max-height: 56px;
}

.custom-modal.dice-faces-modal .custom-modal-content {
    padding: 14px 14px 12px;
}

.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__hint{
    font-size: 12px;
    color: #6b7280;
    line-height: 1.35;
    margin-top: 8px;
}

.custom-modal.memory-settings-modal .custom-modal-buttons{
    margin-top: 14px;
}

@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;
    }
}

.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: 20px;
    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: 16px;
    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__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 {
    max-width: 90vw;
}
.custom-modal.text-settings-modal .text-settings__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.custom-modal.text-settings-modal .text-settings__preview-list {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}
.custom-modal.text-settings-modal .text-settings__preview img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid #eee;
    background: #fafafa;
}
.custom-modal.text-settings-modal .text-settings__textarea {
    resize: both;
    min-height: 140px;
    width: 420px;
    max-width: 86vw;
}

.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(460px, 92vw);
  background: #fff;
  border-radius: 18px;
  border: 1px solid #e1e6ef;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.donation-header {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fff;
  border-bottom: 1px solid #e6eaf2;
  cursor: grab;
  user-select: none;
}

.donation-title {
  font-weight: 600;
  font-size: 18px;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 8px;
}

.donation-heart {
  color: #ff7a5a;
}

.donation-close {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid #e6e9ef;
  background: #fff;
  cursor: pointer;
  font-size: 22px;
  line-height: 26px;
  color: #111;
}

.donation-close:hover {
  background: #f1f5f9;
}

.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 #e1e6ef;
  background: #f9fafc;
  cursor: pointer;
  font-weight: 600;
  color: #0f172a;
}

.donation-amount:hover {
  background: #f1f5f9;
}

.donation-amount.active {
  border-color: #6c8cff;
  background: #eef2ff;
  color: #3b5bdb;
  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 #e1e6ef;
  padding: 0 12px;
  font-size: larger;
  font-weight: 600;
  text-align: center;
  background: #fff;
}

.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: flex-end;
  border-top: 1px solid #e6eaf2;
  background: #fff;
}

.donation-action-btn {
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  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);
}

.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: 2147483647;
}

.feedback-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(760px, 92vw);
  max-height: min(84vh, 780px);
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.feedback-header {
  padding: 12px 14px;
  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 {
  font-weight: 800;
  font-size: 16px;
  color: #0f172a;
}

.feedback-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #111827;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.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;
  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-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 14px;
  border-top: 1px solid #e6e9ef;
  background: #fff;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.feedback-modal .btn.small {
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 10px;
  border: 1px solid #d7e3ff;
  cursor: pointer;
}

.feedback-modal .btn.small.primary {
  background: #2563eb;
  color: #fff;
  border-color: #1d4ed8;
}

.feedback-modal .btn.small.ghost {
  background: #fff;
  color: #0f172a;
  border-color: #e2e8f0;
}

.feedback-modal .btn.small.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;
}

.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 {
    max-width: 92vw;
}
.custom-modal.sticker-settings-modal .sticker-settings__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.custom-modal.sticker-settings-modal .sticker-settings__title {
    font-size: 16px;
    font-weight: 700;
}
.custom-modal.sticker-settings-modal .sticker-settings__preview img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid #eee;
    background: #fafafa;
}
.custom-modal.sticker-settings-modal .sticker-settings__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.custom-modal.sticker-settings-modal .sticker-settings__label {
    font-size: 13px;
    color: #444;
}
.custom-modal.sticker-settings-modal .sticker-settings__textarea {
    resize: both;
    min-height: 120px;
    width: 460px;
    max-width: 86vw;
}
.custom-modal.sticker-settings-modal .sticker-settings__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: -4px;
}
.custom-modal.sticker-settings-modal .sticker-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #d8def0;
    background: #eef3ff;
    color: #21324a;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 13px;
}

/* ===== 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;
}

/* ===== Local picker modal ===== */
.custom-modal.local-picker-modal {
    max-width: 720px;
    width: 92vw;
}

/* ===== Schedule: teacher prompt (T - 3 min) ===== */
.custom-modal.schedule-3m-modal {
    max-width: 560px;
    width: 92vw;
}

.custom-modal.schedule-3m-modal .custom-modal-title {
    max-width: 0;
    padding: 0;
}

.custom-modal.schedule-3m-modal .custom-modal-content {
    padding-left: 6px;
}
.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; }
}
