/* ==========================================================================
   Site messages (2026-11-29)
   1. SweetAlert skin "diamond crest" (canvas page "alerts", AlCrest): every swal() on the site — AnimeTVToast,
      AnimeTVConfirm (animetv-core.js) and the older inline calls. The icon becomes a rotated colour badge on the
      card's top edge; colour by type: success green, error rose, warning amber, info / question violet.
      The swal overlay lives on <body>, outside #animetvApp, so day mode is read with html:has(#animetvApp.day).
   2. Home announcement card (canvas page "announce", AnCard): partials/home/main.php #animetvAdTextModal /
      #animetvAdImgModal (open: initHomeAnnouncements in animetv-home.js, close: .js-close-parent-modal).
   ========================================================================== */

:root {
    --sm-card: #1a1c24;
    --sm-line: rgba(255, 255, 255, 0.1);
    --sm-tx: #f2f3f7;
    --sm-tx2: #c9cdd6;
    --sm-mut: #9aa1ae;
    --sm-chip: rgba(255, 255, 255, 0.06);
    --sm-chip-2: rgba(255, 255, 255, 0.1);
}
html:has(#animetvApp.day) {
    --sm-card: #ffffff;
    --sm-line: rgba(15, 23, 42, 0.1);
    --sm-tx: #141722;
    --sm-tx2: #374151;
    --sm-mut: #6b7280;
    --sm-chip: #f1f3f8;
    --sm-chip-2: #e8ebf2;
}

/* ---------- 1. SweetAlert ---------- */
body .swal-overlay {
    background-color: rgba(6, 7, 10, 0.66);
}
html:has(#animetvApp.day) body .swal-overlay {
    background-color: rgba(15, 23, 42, 0.45);
}
body .swal-overlay .swal-modal {
    --c: #f5b942;
    --c2: #ffe1a1;
    --crgb: 245, 185, 66;
    --ink: #1c1503;
    --g: none;
    position: relative;
    width: 340px;
    max-width: calc(100% - 32px);
    margin: 40px auto 0;
    padding: 54px 24px 22px;
    border: 0;
    border-radius: 26px;
    overflow: visible;
    direction: rtl;
    text-align: center;
    background: radial-gradient(260px 120px at 50% 0%, rgba(var(--crgb), 0.12), transparent 70%), var(--sm-card);
    box-shadow: 0 30px 60px -28px rgba(0, 0, 0, 0.95), inset 0 0 0 1px var(--sm-line);
}
html:has(#animetvApp.day) body .swal-overlay .swal-modal {
    box-shadow: 0 30px 60px -28px rgba(15, 23, 42, 0.5), inset 0 0 0 1px var(--sm-line);
}
body .swal-overlay .swal-modal:has(.swal-icon--success) {
    --c: #3ddc97;
    --c2: #b6f7d8;
    --crgb: 61, 220, 151;
    --ink: #06281a;
}
body .swal-overlay .swal-modal:has(.swal-icon--error) {
    --c: #ff5d73;
    --c2: #ffc2cb;
    --crgb: 255, 93, 115;
    --ink: #2d0710;
}
body .swal-overlay .swal-modal:has(.swal-icon--info),
body .swal-overlay .swal-modal.atv-swal-ask {
    --c: #9d86ff;
    --c2: #d9d0ff;
    --crgb: 157, 134, 255;
    --ink: #150d33;
}
/* short glowing line on the top edge, under the badge */
body .swal-overlay .swal-modal::before {
    content: "";
    position: absolute;
    top: 0;
    left: 22%;
    right: 22%;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: var(--c);
    box-shadow: 0 0 14px rgba(var(--crgb), 0.9);
}
body .swal-overlay .swal-modal:not(:has(.swal-icon)) {
    padding-top: 28px;
}

/* the badge (swal's own icon drawing is hidden; the glyph is a mask on ::before) */
body .swal-overlay .swal-modal .swal-icon {
    position: absolute;
    top: -36px;
    left: 50%;
    width: 72px;
    height: 72px;
    margin: 0 0 0 -36px;
    padding: 0;
    border: 0;
    border-radius: 24px;
    background: linear-gradient(140deg, var(--c2), var(--c));
    box-shadow: 0 0 0 6px var(--sm-card), 0 16px 30px -10px rgba(var(--crgb), 0.85);
    transform: rotate(45deg);
    animation: atvSmPop 0.5s cubic-bezier(0.2, 0.9, 0.25, 1.35) both;
}
body .swal-overlay .swal-modal .swal-icon > * {
    display: none !important;
}
body .swal-overlay .swal-modal .swal-icon::before {
    content: "";
    position: absolute;
    top: 19px;
    left: 19px;
    right: auto;
    bottom: auto;
    width: 34px;
    height: 34px;
    margin: 0;
    border-radius: 0;
    background: var(--ink);
    transform: rotate(-45deg);
    transform-origin: 50% 50%;
    animation: none;
    -webkit-mask: var(--g) center / contain no-repeat;
    mask: var(--g) center / contain no-repeat;
}
body .swal-overlay .swal-modal .swal-icon::after {
    display: none;
}
body .swal-overlay .swal-modal .swal-icon--success {
    --g: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
body .swal-overlay .swal-modal .swal-icon--error {
    --g: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6.5 6.5l11 11M17.5 6.5l-11 11'/%3E%3C/svg%3E");
}
body .swal-overlay .swal-modal .swal-icon--warning {
    --g: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.2' stroke-linecap='round'%3E%3Cpath d='M12 5.5v8M12 18.5h.01'/%3E%3C/svg%3E");
}
body .swal-overlay .swal-modal .swal-icon--info {
    --g: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.2' stroke-linecap='round'%3E%3Cpath d='M12 10.5v8M12 5.5h.01'/%3E%3C/svg%3E");
}
body .swal-overlay .swal-modal.atv-swal-ask .swal-icon {
    --g: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8.6 8.6a3.5 3.5 0 1 1 4.9 3.2c-1 .5-1.5 1.2-1.5 2.2v.6M12 18.6h.01'/%3E%3C/svg%3E");
}
@keyframes atvSmPop {
    from {
        opacity: 0;
        transform: rotate(45deg) scale(0.5);
    }
}

body .swal-overlay .swal-modal .swal-title {
    margin: 0;
    padding: 0;
    font-family: "IRANYekanX", "Vazirmatn", sans-serif;
    font-size: 18px;
    font-weight: 900;
    line-height: 1.5;
    color: var(--sm-tx);
    text-transform: none;
    text-align: center;
}
body .swal-overlay .swal-modal .swal-text {
    display: block;
    float: none;
    max-width: none;
    margin: 6px 0 0;
    padding: 0;
    font-size: 13.5px;
    font-weight: 400;
    line-height: 2;
    color: var(--sm-tx2);
    text-align: center;
    background: none;
}
body .swal-overlay .swal-modal .swal-content {
    margin: 12px 0 0;
    padding: 0;
    color: var(--sm-tx2);
}
body .swal-overlay .swal-modal .swal-footer {
    display: flex;
    gap: 10px;
    margin: 18px 0 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    text-align: center;
}
body .swal-overlay .swal-modal .swal-button-container {
    flex: 1 1 0;
    margin: 0;
}
body .swal-overlay .swal-modal .swal-button {
    width: 100%;
    height: 46px;
    margin: 0;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 800;
    color: #1c1503;
    background: linear-gradient(180deg, #ffc964, #f0ab22);
    box-shadow: 0 10px 22px -12px rgba(245, 185, 66, 0.95);
    transition: filter 0.2s, transform 0.2s;
}
body .swal-overlay .swal-modal .swal-button:not([disabled]):hover {
    background: linear-gradient(180deg, #ffd27a, #f5b942);
    filter: brightness(1.04);
    transform: translateY(-1px);
}
body .swal-overlay .swal-modal .swal-button--cancel,
body .swal-overlay .swal-modal .swal-button--cancel:not([disabled]):hover {
    color: var(--sm-tx);
    background: var(--sm-chip);
    box-shadow: inset 0 0 0 1px var(--sm-line);
}
body .swal-overlay .swal-modal .swal-button--cancel:not([disabled]):hover {
    background: var(--sm-chip-2);
}
body .swal-overlay .swal-modal .swal-button--danger,
body .swal-overlay .swal-modal .swal-button--danger:not([disabled]):hover {
    color: #ffffff;
    background: linear-gradient(180deg, #ff7a8c, #e5485f);
    box-shadow: 0 10px 22px -12px rgba(255, 93, 115, 0.95);
}
body .swal-overlay .swal-modal .swal-button:focus,
body .swal-overlay .swal-modal .swal-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--sm-card), 0 0 0 4px rgba(var(--crgb), 0.75);
}
body .swal-overlay .swal-modal .swal-button__loader div {
    background-color: currentColor;
}

/* ---------- 2. Home announcement card ---------- */
.atv-an-ov.animetv-modal-overlay {
    background: rgba(6, 7, 10, 0.62);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}
#animetvApp.day .atv-an-ov.animetv-modal-overlay {
    background: rgba(15, 23, 42, 0.45);
}
.atv-an {
    --an-card: #1a1c24;
    --an-line: rgba(255, 255, 255, 0.1);
    --an-chip: rgba(255, 255, 255, 0.06);
    --an-tx: #f2f3f7;
    --an-tx2: #c9cdd6;
    --an-mut: #9aa1ae;
    position: relative;
    width: 100%;
    max-width: 460px;
    padding: 22px 24px 24px;
    border-radius: 26px;
    direction: rtl;
    text-align: right;
    color: var(--an-tx);
    background: radial-gradient(360px 160px at 100% 0%, rgba(245, 185, 66, 0.12), transparent 70%), var(--an-card);
    box-shadow: 0 34px 70px -30px rgba(0, 0, 0, 0.95), inset 0 0 0 1px var(--an-line);
    animation: atvAnIn 0.4s cubic-bezier(0.2, 0.9, 0.25, 1.1) both;
}
#animetvApp.day .atv-an {
    --an-card: #ffffff;
    --an-line: rgba(15, 23, 42, 0.1);
    --an-chip: #f3f5f9;
    --an-tx: #141722;
    --an-tx2: #374151;
    --an-mut: #6b7280;
    box-shadow: 0 34px 70px -30px rgba(15, 23, 42, 0.55), inset 0 0 0 1px var(--an-line);
}
@keyframes atvAnIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.98);
    }
}
.atv-an__top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.atv-an__ic {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 15px;
    font-size: 19px;
    color: #1c1503;
    background: linear-gradient(140deg, #ffd98a, #f0ab22);
    box-shadow: 0 10px 22px -8px rgba(245, 185, 66, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.atv-an__tt {
    display: flex;
    flex-direction: column;
    line-height: 1.45;
}
.atv-an__tt small {
    font-size: 11.5px;
    font-weight: 800;
    color: #f0ab22;
}
#animetvApp.day .atv-an__tt small {
    color: #b87500;
}
.atv-an__tt b {
    font-size: 15.5px;
    font-weight: 800;
}
.atv-an .atv-an__x {
    position: static;
    margin: 0 auto 0 0;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    font-size: 14px;
    color: var(--an-mut);
    background: var(--an-chip);
    box-shadow: inset 0 0 0 1px var(--an-line);
    cursor: pointer;
    transition: color 0.2s;
}
.atv-an .atv-an__x:hover {
    color: var(--an-tx);
}
.atv-an__tx {
    margin: 0;
    padding: 14px 16px;
    border-radius: 16px;
    font-size: 13.8px;
    line-height: 2.1;
    color: var(--an-tx2);
    background: var(--an-chip);
    box-shadow: inset 0 0 0 1px var(--an-line);
    overflow-wrap: anywhere;
}
.atv-an__img {
    display: block;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px var(--an-line);
}
.atv-an__img img {
    display: block;
    width: 100%;
    height: auto;
}
.atv-an__act {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}
.atv-an__act .atv-an__btn {
    flex: 1;
    height: 46px;
    display: grid;
    place-items: center;
    margin: 0;
    padding: 0 16px;
    border: 0;
    border-radius: 14px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition: filter 0.2s, transform 0.2s;
}
.atv-an__btn.is-pri {
    color: #1c1503;
    background: linear-gradient(180deg, #ffc964, #f0ab22);
    box-shadow: 0 10px 22px -12px rgba(245, 185, 66, 0.95);
}
.atv-an__btn.is-pri:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}
.atv-an__btn.is-sec {
    color: var(--an-tx);
    background: var(--an-chip);
    box-shadow: inset 0 0 0 1px var(--an-line);
}
.atv-an a:focus-visible,
.atv-an button:focus-visible {
    outline: 2px solid #f5b942;
    outline-offset: 2px;
}

/* phones: the card rises from the bottom like a sheet (above the tab bar) */
@media (max-width: 640px) {
    .atv-an-ov.animetv-modal-overlay {
        align-items: flex-end;
        padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    }
    .atv-an {
        max-width: none;
        padding: 12px 18px 18px;
        animation-name: atvAnUp;
    }
    .atv-an::before {
        content: "";
        display: block;
        width: 42px;
        height: 5px;
        margin: 0 auto 12px;
        border-radius: 5px;
        background: var(--an-line);
    }
}
@keyframes atvAnUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
}
@media (prefers-reduced-motion: reduce) {
    .atv-an,
    body .swal-overlay .swal-modal .swal-icon {
        animation: none;
    }
}
