/* ==========================================================================
   FASOOLLKA — «Воплощения демона» / «Воплощения ангела»: косплеи (cosplay.php, с 23.10.2026)
   1. Шапка и фильтр  2. Колода карт  3. Просмотр образа  4. Телефон
   Карта: в аду — тёмная, алая кайма, пентаграммы в углах; в раю — слоновая кость, золото, звёзды.
   Движется только transform / opacity (свечение карты — отдельный слой, у него меняется прозрачность).
   ========================================================================== */
.cosp {
    position: relative;
    z-index: 10;
    width: min(1320px, 100%);
    margin: 0 auto;
    padding: clamp(10px, 2vh, 20px) clamp(16px, 3vw, 40px) 60px;
}

/* ---------- 1. Шапка и фильтр ---------- */
.cosp__hero { text-align: center; margin-bottom: clamp(16px, 2.6vh, 26px); }
.cosp__kicker { font-size: 13px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--accent-hot); }
:root[data-theme="heaven"] .cosp__kicker { color: #8a5f12; text-shadow: 0 0 8px #fff, 0 0 18px #fff; }
:root[data-theme="hell"] .cosp__kicker { text-shadow: 0 1px 2px #000, 0 0 12px #000; }
.cosp__title {
    margin: 4px 0 10px;
    font-family: var(--serif);
    font-weight: 700;
    font-style: italic;
    font-size: clamp(42px, 6.6vw, 88px);
    line-height: .95;
}
:root[data-theme="hell"] .cosp__title { color: #ffe6da; text-shadow: 0 0 6px #ff3a1a, 0 0 22px rgba(255, 30, 0, .9), 0 3px 0 #3a0006; }
:root[data-theme="heaven"] .cosp__title { color: #6a4a0a; text-shadow: 0 0 10px #fff, 0 0 24px #fff6d0, 0 1px 0 #fff; }
.cosp__lead { max-width: 64ch; margin: 0 auto; font-size: clamp(15px, 1.4vw, 17px); color: var(--text-soft); }
.cosp__lead b { color: var(--text); }
:root[data-theme="hell"] .cosp__lead { text-shadow: 0 1px 2px #000, 0 0 14px #000; }
:root[data-theme="heaven"] .cosp__lead { text-shadow: 0 0 10px #fff; }

.cosp__bar { display: flex; justify-content: center; margin-bottom: clamp(18px, 3vh, 30px); }
.cosp__bar .chip small { margin-left: 4px; opacity: .7; font-weight: 600; }

/* ---------- 2. Колода карт ---------- */
.deck {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(214px, 42vw), 1fr));
    gap: clamp(16px, 2.2vw, 28px) clamp(14px, 2vw, 26px);
    margin: 0;
    padding: 0;
    list-style: none;
}
.deck__item { animation: cardDeal .8s var(--ease-out) calc(min(var(--i), 14) * 55ms + .1s) both; }
.deck__item[hidden] { display: none; }
@keyframes cardDeal { from { opacity: 0; transform: translateY(34px) rotate(-4deg) scale(.94); } }

.tcard {
    --fr: linear-gradient(160deg, #3d0812, #12020a 52%, #2c050d);
    --edge: rgba(255, 96, 76, .55);
    --edge-in: rgba(255, 140, 110, .38);
    --glow: 0 18px 46px -14px rgba(255, 30, 20, .75), 0 0 26px rgba(255, 60, 40, .45);
    --pip: #ff6b55;
    --pip-bg: rgba(14, 1, 5, .78);
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 5 / 7.2;
    padding: 7px;
    border: 1px solid var(--edge);
    border-radius: 15px;
    background: var(--fr);
    box-shadow: 0 14px 32px -16px rgba(0, 0, 0, .9);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform .45s var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}
:root[data-theme="heaven"] .tcard {
    --fr: linear-gradient(160deg, #fffef8, #f6ebcf 55%, #fff9e8);
    --edge: rgba(190, 140, 40, .75);
    --edge-in: rgba(201, 154, 46, .55);
    --glow: 0 18px 46px -14px rgba(180, 130, 30, .55), 0 0 30px rgba(255, 230, 160, .9);
    --pip: #a8740f;
    --pip-bg: rgba(255, 252, 240, .88);
    box-shadow: 0 14px 30px -18px rgba(60, 50, 110, .55);
}
/* свечение — свой слой: при наведении меняется только его прозрачность */
.tcard::after {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    box-shadow: var(--glow);
    opacity: 0;
    transition: opacity .35s ease;
    pointer-events: none;
}
.tcard:hover, .tcard:focus-visible { transform: translateY(-8px) rotate(-1.2deg); }
.deck__item:nth-child(even) .tcard:hover, .deck__item:nth-child(even) .tcard:focus-visible { transform: translateY(-8px) rotate(1.2deg); }
.tcard:hover::after, .tcard:focus-visible::after { opacity: 1; }
.tcard:active { transform: translateY(-3px) scale(.985); }
.tcard__face {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 10px;
    outline: 1px solid var(--edge-in);
    outline-offset: -5px;
    background: #0b0105;
}
:root[data-theme="heaven"] .tcard__face { background: #efe6cf; }
.tcard__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 22%;
    transition: transform .8s var(--ease-out);
}
.tcard:hover .tcard__img { transform: scale(1.05); }
/* масть в углах */
.tcard__pip {
    position: absolute;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: var(--pip);
    background: var(--pip-bg);
    box-shadow: 0 0 0 1px var(--edge-in);
}
.tcard__pip .ico { width: 17px; height: 17px; }
.tcard__pip--tl { left: 9px; top: 9px; }
.tcard__pip--br { right: 9px; bottom: 9px; transform: rotate(180deg); }
.tcard__tag {
    position: absolute;
    z-index: 2;
    right: 9px;
    top: 11px;
    padding: 3px 9px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
    color: var(--pip);
    background: var(--pip-bg);
    box-shadow: 0 0 0 1px var(--edge-in);
}
.tcard__cap {
    position: absolute;
    z-index: 1;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 46px 44px 13px 14px;
    background: linear-gradient(rgba(10, 0, 4, 0), rgba(10, 0, 4, .78) 45%, rgba(10, 0, 4, .94));
}
/* в раю подложки нет (просьба владельца 24.10.2026): подпись светлая с узкой тенью у букв — тёмный текст
   с белым свечением на тёмных фото без подложки не читался */
:root[data-theme="heaven"] .tcard__cap { background: none; }
.tcard__name {
    font-family: var(--serif);
    font-weight: 700;
    font-style: italic;
    font-size: clamp(20px, 1.8vw, 25px);
    line-height: 1.02;
    color: #ffe9e0;
    text-shadow: 0 0 12px rgba(255, 40, 20, .6);
}
:root[data-theme="heaven"] .tcard__name { color: #fffaf0; text-shadow: 0 1px 2px rgba(0, 0, 0, .9), 0 0 8px rgba(0, 0, 0, .45); }
:root[data-theme="heaven"] .tcard__from { color: #ffe6a0; text-shadow: 0 1px 2px rgba(0, 0, 0, .95), 0 0 6px rgba(0, 0, 0, .5); }
.tcard__from { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--pip); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 3. Просмотр образа ---------- */
.modal--cos .modal__dialog {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    width: min(1220px, 100%);
    padding: 0;
    overflow: hidden;
}
.modal--cos .modal__close { z-index: 6; }
.cosv { display: contents; }
.cosv__stage {
    position: relative;
    display: grid;
    place-items: center;
    height: min(84vh, 880px);
    background: radial-gradient(90% 80% at 50% 40%, #240509, #050102);
    overflow: hidden;
    touch-action: pan-y;
}
:root[data-theme="heaven"] .cosv__stage { background: radial-gradient(90% 80% at 50% 40%, #fffaf0, #e4dcc6); }
/* фото — во всю рамку и целиком внутри неё (раньше max-height: 100% в ячейке сетки не работал, и большое фото
   вылезало за край — «Уэнсдэй») */
.cosv__img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity .3s ease;
}
.cosv__img.is-on { opacity: 1; }
.cosv__nav {
    position: absolute;
    top: 50%;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    margin-top: -23px;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 50%;
    color: #fff;
    background: rgba(0, 0, 0, .5);
    cursor: pointer;
    transition: transform .25s var(--ease-out), background .2s ease;
}
.cosv__nav:hover { background: rgba(0, 0, 0, .75); transform: scale(1.08); }
.cosv__nav .ico { width: 22px; height: 22px; }
.cosv__nav--prev { left: 14px; }
.cosv__nav--next { right: 14px; }
.cosv__nav--next .ico, .cosv__fwd .ico { transform: rotate(180deg); }
.cosv__nav[hidden] { display: none; }
.cosv__count {
    position: absolute;
    left: 50%;
    bottom: 12px;
    padding: 3px 11px;
    border-radius: 99px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, .55);
    transform: translateX(-50%);
}
.cosv__side {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    max-height: min(84vh, 880px);
    overflow: auto;
    padding: 50px 24px 22px;
    scrollbar-width: thin;
}
.cosv__from { font-size: 12.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-hot); }
:root[data-theme="heaven"] .cosv__from { color: #8a5f12; }
.cosv__name { font-family: var(--serif); font-weight: 700; font-style: italic; font-size: clamp(30px, 3vw, 40px); line-height: 1; }
.cosv__date { font-size: 14px; color: var(--text-faint); }
.cosv__note { color: var(--text-soft); line-height: 1.5; }
.cosv__note:empty { display: none; }
.cosv__thumbs { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; }
.cosv__thumb {
    width: 58px;
    height: 76px;
    padding: 0;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    overflow: hidden;
    background: none;
    cursor: pointer;
    opacity: .65;
    transition: opacity .2s ease, transform .25s var(--ease-out);
}
.cosv__thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; }
.cosv__thumb:hover { opacity: 1; transform: translateY(-2px); }
.cosv__thumb.is-on { opacity: 1; border-color: var(--accent-hot); box-shadow: 0 0 0 1px var(--accent-hot); }
.cosv__acts { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.cosv__acts .btn { justify-content: center; }
.cosv__lock { font-size: 13px; color: var(--text-faint); }
.cosv__walk { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; padding-top: 10px; }
.cosv__walk .btn { height: 40px; padding: 0 10px; font-size: 13px; justify-content: center; }
.cosv__walk .ico { width: 15px; height: 15px; }

.cosp__foot { margin-top: clamp(26px, 4vh, 40px); text-align: center; font-size: 13.5px; color: var(--text-faint); }
:root[data-theme="hell"] .cosp__foot { text-shadow: 0 1px 2px #000, 0 0 10px #000; }
:root[data-theme="heaven"] .cosp__foot { text-shadow: 0 0 8px #fff; }
.cosp__foot a { color: var(--accent-hot); }

/* без анимаций по желанию системы */
@media (prefers-reduced-motion: reduce) {
    .deck__item { animation: none; }
    .tcard, .tcard__img { transition: none; }
}

/* ---------- 4. Телефон и планшет ---------- */
@media (max-width: 900px) {
    .modal--cos { padding: 0; align-items: start; }
    .modal--cos .modal__dialog { grid-template-columns: 1fr; max-height: 100%; border-radius: 0; overflow: auto; }
    .cosv__stage { height: 64svh; }
    .cosv__side { max-height: none; overflow: visible; padding: 16px 16px 24px; }
    .modal--cos .modal__close { background: rgba(0, 0, 0, .55); color: #fff; border-color: rgba(255, 255, 255, .3); }
}
@media (max-width: 600px) {
    .deck { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
    .tcard { padding: 5px; border-radius: 12px; }
    .tcard__face { border-radius: 8px; outline-offset: -4px; }
    .tcard__cap { padding: 34px 34px 9px 10px; }
    .tcard__name { font-size: 18px; }
    .tcard__from { font-size: 10.5px; letter-spacing: .06em; }
    .tcard__pip { width: 24px; height: 24px; }
    .tcard__pip .ico { width: 14px; height: 14px; }
    .tcard__pip--tl { left: 7px; top: 7px; }
    .tcard__pip--br { right: 7px; bottom: 7px; }
    .tcard__tag { right: 7px; top: 8px; font-size: 11px; padding: 2px 7px; }
    .cosp__bar .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
    .cosp__bar .chip { flex: none; }
    .cosv__nav { width: 40px; height: 40px; margin-top: -20px; }
}

/* Тема «Сакура» (с 30.10.2026): карты — без багровой / золотой рамки, как обложки кинотеатра: скруглённая фотография,
   внизу тёмная подложка и имя (Unbounded), «масть» в углах — маленький розовый значок */
.tcard, :root[data-theme="heaven"] .tcard {
    --edge: transparent;
    --edge-in: rgba(255, 255, 255, .25);
    --pip: #ff8fab;
    --pip-bg: rgba(20, 14, 34, .72);
    --glow: 0 18px 40px -14px rgba(255, 90, 140, .6), 0 0 0 1.5px rgba(255, 111, 145, .75);
    padding: 0;
    border: 0;
    border-radius: 18px;
    background: none;
    box-shadow: 0 16px 32px -18px rgba(0, 0, 0, .8);
}
:root[data-theme="heaven"] .tcard { --glow: 0 18px 40px -14px rgba(236, 63, 104, .5), 0 0 0 1.5px rgba(236, 63, 104, .6); box-shadow: 0 16px 32px -18px rgba(130, 45, 80, .6); }
.tcard:hover, .tcard:focus-visible, .deck__item:nth-child(even) .tcard:hover, .deck__item:nth-child(even) .tcard:focus-visible { transform: translateY(-6px); }
.tcard__face { border-radius: 18px; outline: 0; }
.tcard__cap, :root[data-theme="heaven"] .tcard__cap { padding: 50px 44px 14px 14px; background: linear-gradient(rgba(14, 8, 24, 0), rgba(14, 8, 24, .72) 50%, rgba(14, 8, 24, .9)); }
.tcard__name, :root[data-theme="heaven"] .tcard__name { font: 800 clamp(16px, 1.3vw, 19px)/1.15 var(--display); font-style: normal; color: #fff; text-shadow: none; letter-spacing: -.01em; }
.tcard__from, :root[data-theme="heaven"] .tcard__from { color: #ffb3c6; text-shadow: none; letter-spacing: .08em; }
.tcard__pip { box-shadow: none; width: 26px; height: 26px; }
.tcard__tag { box-shadow: none; color: #fff; }