/**
 * popup-modals.css — стили всплывающих окон и уведомлений (модалки, collect, статусы, загрузка, пароль, мелкие попапы).
 */

:root {
    --popup-overlay-bg: rgba(0, 0, 0, 0.25);
    --popup-modal-bg: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --popup-modal-bg-alt: linear-gradient(135deg, rgba(86, 78, 132, 0.95) 0%, rgba(65, 90, 119, 0.95) 100%);
    --popup-border: 2px solid rgba(106, 90, 205, 0.5);
    --popup-border-radius: 20px;
    --popup-shadow: 0 25px 80px rgba(0, 0, 0, 0.7);
    --popup-text-color: #fff;
    --popup-text-secondary: #e0e0e0;
    --popup-hint-color: #a0a0a0;  /* Контраст 4.6:1 (WCAG AA) */
    --popup-hint-font-size: 14px;
    --popup-heading-font-size: 18px;
    --popup-subheading-font-size: 14px;

    /* Рамка и фон в стиле snippet (матрица, сканлайн, L-уголки TL/BR) → variables.css */
    --popup-frame-sq-color: var(--frame-color);
    --popup-frame-line-color: var(--frame-rgb);
    --popup-frame-line-alpha: 0.2;
    --popup-matrix-primary: var(--frame-rgb);
    --popup-matrix-primary-alpha: 0.01;
    --popup-matrix-secondary: 0, 0, 0;
    --popup-matrix-secondary-alpha: 0.02;
    --popup-scanline-color: var(--frame-rgb);
    --popup-scanline-alpha: 0.05;
    --popup-bg-outer: #060508;  /* Почти чёрный */
    --popup-bg-inner-start: #060508;  /* Почти чёрный */
    --popup-bg-inner-end: #0a0a10;  /* Почти чёрный */

    /* Глитч на тексте: полоски по всей высоте, настраиваемые параметры */
    --glitch-duration: 5s;
    --glitch-active-percent: 20%;
    --glitch-strip-height: 4%;
    --glitch-color-1: #f03;
    --glitch-color-2: #0af;
    --glitch-offset-x: 2px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.7); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

@keyframes searchMove {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(-5px) rotate(-5deg); }
    75% { transform: translateX(5px) rotate(5deg); }
}

@keyframes progressShine {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes shakeModal {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes lockPop {
    0% { transform: scale(0.3); opacity: 0; }
    70% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes matrixFlow {
    0% { background-position: 0 0; }
    100% { background-position: 100px 100px; }
}

/* --- Глитч на текст: цикл 5s, глитч только в начале, не чаще раза в 5 сек --- */
.glitch {
    position: relative;
    display: inline-block;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    white-space: pre-wrap;
    word-wrap: break-word;
    pointer-events: none;
}

.glitch::before {
    left: calc(var(--glitch-offset-x) * -1);
    text-shadow: var(--glitch-offset-x) 0 var(--glitch-color-1);
    clip-path: inset(0 0 100% 0);
    animation: glitch-anim-1 var(--glitch-duration) infinite linear;
}

.glitch::after {
    left: var(--glitch-offset-x);
    text-shadow: calc(var(--glitch-offset-x) * -1) 0 var(--glitch-color-2);
    clip-path: inset(0 0 100% 0);
    animation: glitch-anim-2 var(--glitch-duration) infinite linear;
}

/* Полоски в % высоты — покрывают весь текст (верх, середина, низ). 0–20%: глитч, 20–100%: скрыто. */
@keyframes glitch-anim-1 {
    0% { clip-path: inset(0 0 calc(100% - var(--glitch-strip-height)) 0); }
    2.5% { clip-path: inset(15% 0 calc(85% - var(--glitch-strip-height)) 0); }
    5% { clip-path: inset(35% 0 calc(65% - var(--glitch-strip-height)) 0); }
    7.5% { clip-path: inset(55% 0 calc(45% - var(--glitch-strip-height)) 0); }
    10% { clip-path: inset(75% 0 calc(25% - var(--glitch-strip-height)) 0); }
    12.5% { clip-path: inset(90% 0 calc(10% - var(--glitch-strip-height)) 0); }
    15% { clip-path: inset(5% 0 calc(95% - var(--glitch-strip-height)) 0); }
    17.5% { clip-path: inset(50% 0 calc(50% - var(--glitch-strip-height)) 0); }
    20% { clip-path: inset(82% 0 calc(18% - var(--glitch-strip-height)) 0); }
    20.01%, 100% { clip-path: inset(100% 0 0 0); }
}

@keyframes glitch-anim-2 {
    0% { clip-path: inset(15% 0 calc(85% - var(--glitch-strip-height)) 0); }
    2.5% { clip-path: inset(0 0 calc(100% - var(--glitch-strip-height)) 0); }
    5% { clip-path: inset(75% 0 calc(25% - var(--glitch-strip-height)) 0); }
    7.5% { clip-path: inset(35% 0 calc(65% - var(--glitch-strip-height)) 0); }
    10% { clip-path: inset(90% 0 calc(10% - var(--glitch-strip-height)) 0); }
    12.5% { clip-path: inset(55% 0 calc(45% - var(--glitch-strip-height)) 0); }
    15% { clip-path: inset(50% 0 calc(50% - var(--glitch-strip-height)) 0); }
    17.5% { clip-path: inset(5% 0 calc(95% - var(--glitch-strip-height)) 0); }
    20% { clip-path: inset(82% 0 calc(18% - var(--glitch-strip-height)) 0); }
    20.01%, 100% { clip-path: inset(100% 0 0 0); }
}

/* --- Рамка и фон (матрица, сканлайн, L-уголки TL/BR) для модалок --- */
.popup-frame-style,
#collect-message,
.rpg-confirm-box,
.rpg-shop-detail-modal,
#map-wrong-world-popup,
.status-expire-content,
#status-details-modal,
#item-details-modal,
#loading-content {
    position: relative !important;
    overflow: hidden !important;
    border-radius: 0 !important;
    border: 1px solid rgba(var(--popup-frame-line-color), var(--popup-frame-line-alpha)) !important;
    box-shadow: var(--popup-shadow) !important;
    background:
        linear-gradient(
            rgba(0, 0, 0, 0) 50%,
            rgba(var(--popup-scanline-color), var(--popup-scanline-alpha)) 50%
        ),
        repeating-linear-gradient(
            45deg,
            rgba(var(--popup-matrix-primary), var(--popup-matrix-primary-alpha)),
            rgba(var(--popup-matrix-primary), var(--popup-matrix-primary-alpha)) 50px,
            rgba(var(--popup-matrix-secondary), var(--popup-matrix-secondary-alpha)) 50px,
            rgba(var(--popup-matrix-secondary), var(--popup-matrix-secondary-alpha)) 70px
        ) !important;
    background-size: 100% 4px, auto !important;
}

/* L-уголок TL (7 квадратов 2×2) */
.popup-frame-style::before,
#collect-message::before,
.rpg-confirm-box::before,
.rpg-shop-detail-modal::before,
#map-wrong-world-popup::before,
.status-expire-content::before,
#status-details-modal::before,
#item-details-modal::before,
#loading-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 2px;
    background: var(--popup-frame-sq-color);
    box-shadow:
        2px 0 0 0 var(--popup-frame-sq-color),
        4px 0 0 0 var(--popup-frame-sq-color),
        6px 0 0 0 var(--popup-frame-sq-color),
        0 2px 0 0 var(--popup-frame-sq-color),
        0 4px 0 0 var(--popup-frame-sq-color),
        0 6px 0 0 var(--popup-frame-sq-color);
    z-index: 1;
    pointer-events: none;
}

/* L-уголок BR (7 квадратов 2×2) */
.popup-frame-style::after,
#collect-message::after,
.rpg-confirm-box::after,
.rpg-shop-detail-modal::after,
#map-wrong-world-popup::after,
.status-expire-content::after,
#status-details-modal::after,
#item-details-modal::after,
#loading-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 2px;
    height: 2px;
    background: var(--popup-frame-sq-color);
    box-shadow:
        -2px 0 0 0 var(--popup-frame-sq-color),
        -4px 0 0 0 var(--popup-frame-sq-color),
        -6px 0 0 0 var(--popup-frame-sq-color),
        0 -2px 0 0 var(--popup-frame-sq-color),
        0 -4px 0 0 var(--popup-frame-sq-color),
        0 -6px 0 0 var(--popup-frame-sq-color);
    z-index: 1;
    pointer-events: none;
}

/* Контент модалки поверх углов */
#collect-message .collect-icon,
#collect-message .collect-label,
#collect-message .collect-text,
#collect-message .collect-hint,
#collect-message #collect-buttons,
.rpg-confirm-box .collect-icon,
.rpg-confirm-box .collect-label,
.rpg-confirm-box .collect-text,
.rpg-confirm-box .rpg-confirm-subtitle,
.rpg-confirm-box .rpg-confirm-btns,
.rpg-shop-detail-modal .collect-icon,
.rpg-shop-detail-modal .collect-label,
.rpg-shop-detail-modal .rpg-shop-detail-history,
.rpg-shop-detail-modal .rpg-shop-detail-stats,
.rpg-shop-detail-modal .rpg-shop-detail-price,
.rpg-shop-detail-modal .rpg-shop-detail-btns,
#map-wrong-world-popup .map-wrong-world-emoji,
#map-wrong-world-popup .map-wrong-world-msg,
.status-expire-content > *,
#status-details-modal > *,
#item-details-modal > *,
#loading-content > * {
    position: relative;
    z-index: 2;
}

/* --- Общий подсказка «Нажмите в любое место» --- */
.popup-hint,
.collect-hint {
    color: var(--popup-hint-color) !important;
    font-size: var(--popup-hint-font-size) !important;
    font-style: italic !important;
}

/* === Модальное окно для сообщений (collect) === */
#collect-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: var(--popup-overlay-bg) !important;
    display: none !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 10000 !important;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
    cursor: pointer;
}

#collect-overlay.active {
    display: flex !important;
}

#collect-message {
    padding: 50px 40px !important;
    text-align: center !important;
    max-width: 500px !important;
    min-height: 250px !important;
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 20px;
    cursor: default;
}

#collect-message .collect-icon {
    font-size: 80px !important;
    margin-bottom: 25px !important;
    animation: pulse 1.5s ease infinite;
    line-height: 1;
}

#collect-message .collect-icon.search-icon {
    animation: searchMove 2s ease-in-out infinite;
}

#collect-message .collect-label {
    color: var(--popup-text-color) !important;
    font-size: var(--popup-heading-font-size) !important;
    margin-bottom: 15px !important;
    line-height: 1.4 !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5) !important;
    white-space: pre-line !important;
    max-width: 100% !important;
}

#collect-message .collect-text {
    color: var(--popup-text-secondary) !important;
    font-size: var(--popup-subheading-font-size) !important;
    margin-bottom: 30px !important;
    line-height: 1.6 !important;
    font-weight: 400 !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5) !important;
    white-space: pre-line !important;
    max-width: 100% !important;
}

#collect-message .collect-hint {
    margin-top: 10px !important;
    opacity: 0.7 !important;
}

#collect-buttons {
    display: none;
}

#collect-buttons.show {
    display: flex !important;
    margin-top: 20px;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

#collect-button-yes,
.rpg-confirm-box button.rpg-confirm-yes-btn {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 12px 30px !important;
    font-size: var(--popup-subheading-font-size) !important;
    font-weight: bold !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4) !important;
    transition: all 0.3s !important;
}

#collect-button-yes:hover,
.rpg-confirm-box button.rpg-confirm-yes-btn:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.6) !important;
}

#collect-button-no,
.rpg-confirm-box button.rpg-confirm-no-btn {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 12px 30px !important;
    font-size: var(--popup-subheading-font-size) !important;
    font-weight: bold !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4) !important;
    transition: all 0.3s !important;
}

#collect-button-no:hover,
.rpg-confirm-box button.rpg-confirm-no-btn:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 6px 16px rgba(244, 67, 54, 0.6) !important;
}

/* === Shop Detail Modal (модалка подтверждения покупки = карточка сразу) === */
#rpg-shop-detail-overlay,
.rpg-shop-detail-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: var(--popup-overlay-bg) !important;
    display: none !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 11000 !important;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

#rpg-shop-detail-overlay.active,
.rpg-shop-detail-overlay.active {
    display: flex !important;
}

.rpg-shop-detail-modal {
    padding: 40px 36px !important;
    text-align: left !important;
    max-width: 480px !important;
    width: 100%;
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    margin: 20px;
}

.rpg-shop-detail-modal .collect-icon {
    font-size: 48px !important;
    margin-bottom: 12px !important;
    line-height: 1;
    text-align: center !important;
}

.rpg-shop-detail-modal .collect-label {
    color: var(--frame-color) !important;
    font-size: var(--popup-heading-font-size) !important;
    margin-bottom: 12px !important;
    line-height: 1.4 !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    text-align: center !important;
    letter-spacing: 0.06em !important;
}

.rpg-shop-detail-modal .rpg-shop-detail-history {
    color: rgba(255, 255, 255, 0.85) !important;
    font-size: 14px !important;
    text-align: center !important;
    margin-bottom: 24px !important;
    line-height: 1.5 !important;
}

.rpg-shop-detail-modal .rpg-shop-detail-stats {
    color: rgba(255, 255, 255, 0.85) !important;
    font-size: 14px !important;
    margin-bottom: 24px !important;
    text-align: center !important;
}

.rpg-shop-detail-modal .rpg-shop-detail-stats .stat-higher { color: #4ade80 !important; }
.rpg-shop-detail-modal .rpg-shop-detail-stats .stat-lower { color: #f87171 !important; }
.rpg-shop-detail-modal .rpg-shop-detail-stats .stat-same { color: rgba(255, 255, 255, 0.85) !important; }

.rpg-shop-detail-modal .rpg-shop-detail-price {
    color: #4ade80 !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    margin-bottom: 24px !important;
    text-align: center !important;
}

.rpg-shop-detail-modal .rpg-shop-detail-price .glitch {
    color: #4ade80 !important;
}

.rpg-shop-detail-modal .rpg-shop-detail-btns {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.rpg-shop-detail-modal .rpg-shop-detail-btn {
    display: block !important;
    width: 100% !important;
    padding: 14px 20px !important;
    background: rgba(var(--frame-rgb), 0.06) !important;
    border: none !important;
    border-top: 1px solid rgba(var(--frame-rgb), 0.5) !important;
    border-bottom: 1px solid rgba(var(--frame-rgb), 0.5) !important;
    color: rgba(185, 207, 211, 0.95) !important;
    font-size: 15px !important;
    font-family: "Noto Sans", sans-serif !important;
    cursor: pointer !important;
    text-align: center !important;
    transition: background 0.2s !important;
}

.rpg-shop-detail-modal .rpg-shop-detail-btn:hover {
    background: rgba(var(--accent-rgb), 0.35) !important;
}

.rpg-shop-detail-modal .rpg-shop-detail-btn:first-child {
    border-radius: 0 !important;
}


/* === RPG Confirm (стиль как collect/hospital) === */
#rpg-confirm-overlay,
.rpg-confirm-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: var(--popup-overlay-bg) !important;
    display: none !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 11000 !important;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

#rpg-confirm-overlay.active,
.rpg-confirm-overlay.active {
    display: flex !important;
}

#rpg-confirm-overlay,
.rpg-confirm-overlay {
    cursor: default;
}

.rpg-confirm-box {
    padding: 50px 40px !important;
    text-align: center !important;
    max-width: 500px !important;
    min-height: 200px !important;
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 20px;
}

.rpg-confirm-box .collect-icon {
    font-size: 60px !important;
    margin-bottom: 20px !important;
    line-height: 1;
}

.rpg-confirm-box .collect-label {
    color: var(--popup-text-color) !important;
    font-size: var(--popup-heading-font-size) !important;
    margin-bottom: 12px !important;
    line-height: 1.4 !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5) !important;
}

.rpg-confirm-box .rpg-confirm-subtitle {
    color: #4ade80 !important;
    font-size: var(--popup-subheading-font-size) !important;
    margin-bottom: 25px !important;
    line-height: 1.5 !important;
    font-weight: 600 !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5) !important;
}

.rpg-confirm-box .collect-text {
    color: var(--popup-text-secondary) !important;
    font-size: var(--popup-subheading-font-size) !important;
    margin-bottom: 25px !important;
    line-height: 1.6 !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5) !important;
}

.rpg-confirm-box .rpg-confirm-btns {
    display: flex !important;
    gap: 15px !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
}

.rpg-combat-outro--lose .rpg-confirm-subtitle,
.rpg-pirate-intercept .rpg-confirm-subtitle {
    color: #f87171 !important;
}

.rpg-pirate-intercept button.rpg-confirm-yes-btn {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%) !important;
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4) !important;
}

.rpg-pirate-intercept button.rpg-confirm-yes-btn:hover {
    box-shadow: 0 6px 16px rgba(244, 67, 54, 0.6) !important;
}

.rpg-combat-outro--lose button.rpg-confirm-yes-btn {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%) !important;
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4) !important;
}

.rpg-combat-outro--lose button.rpg-confirm-yes-btn:hover {
    box-shadow: 0 6px 16px rgba(244, 67, 54, 0.6) !important;
}

@media (max-width: 600px) {
    #collect-message {
        max-width: 90% !important;
        padding: 40px 30px !important;
    }
    #collect-message .collect-icon {
        font-size: 60px !important;
    }
    #collect-message .collect-text {
        font-size: var(--popup-heading-font-size) !important;
    }
    .rpg-confirm-box {
        max-width: 90% !important;
        padding: 40px 30px !important;
    }
}

/* === Экран загрузки === */
#loading-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    display: none !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 9999 !important;
    animation: fadeIn 0.3s ease;
}

#loading-overlay.active {
    display: flex !important;
}

#loading-content {
    padding: 40px 50px !important;
    text-align: center !important;
    max-width: 500px !important;
    width: 90% !important;
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#loading-text {
    font-size: var(--popup-heading-font-size) !important;
    color: #e8e6f6 !important;
    margin-bottom: 30px !important;
    min-height: 60px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1.5 !important;
}

#loading-progress-container {
    width: 100% !important;
    height: 12px !important;
    background: rgba(0, 0, 0, 0.3) !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    margin-top: 20px !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

#loading-progress-bar {
    height: 100% !important;
    background: linear-gradient(90deg, #ffffff 0%, #e0e0e0 50%, #ffffff 100%) !important;
    background-size: 200% 100% !important;
    border-radius: 10px !important;
    width: 100% !important;
    transform: scaleX(0);
    transform-origin: left center !important;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5), inset 0 0 10px rgba(255, 255, 255, 0.3) !important;
    animation: progressShine 2s linear infinite !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    will-change: transform !important;
}

/* === Модальное окно завершения статуса === */
#status-expire-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.9) !important;
    display: none !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 20000 !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

#status-expire-modal.active {
    display: flex !important;
}

.status-expire-content {
    border-color: rgba(255, 212, 59, 0.5);
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 30px rgba(255, 212, 59, 0.3);
    animation: scaleIn 0.3s ease;
}

.status-expire-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.status-expire-title {
    font-size: var(--popup-heading-font-size);
    font-weight: bold;
    color: #ffd43b;
    margin-bottom: 15px;
}

.status-expire-description {
    font-size: var(--popup-subheading-font-size);
    color: var(--popup-text-secondary);
    margin-bottom: 25px;
    line-height: 1.5;
}

.status-expire-btn {
    background: linear-gradient(135deg, #ffd43b 0%, #f59e0b 100%);
    color: #1a1a2e;
    border: none;
    padding: 14px 30px;
    font-size: var(--popup-subheading-font-size);
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.status-expire-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(255, 212, 59, 0.5);
}

.status-expire-btn:active {
    transform: scale(0.98);
}

/* === Детали статуса / описание предмета (overlay + modal) === */
#status-details-overlay,
#item-details-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

#status-details-overlay.active,
#item-details-overlay.active {
    display: flex;
}

#status-details-modal,
#item-details-modal {
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

#item-details-modal {
    padding: 15px 20px;
    max-height: 65vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#status-details-icon,
#item-details-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

#item-details-icon {
    margin-bottom: 8px;
    flex-shrink: 0;
}

#status-details-countdown {
    color: #4cc9f0;
    font-size: var(--popup-heading-font-size);
    font-weight: bold;
    margin-bottom: 15px;
}

#status-details-label,
#item-details-label {
    font-size: var(--popup-heading-font-size);
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--popup-text-color);
}

#item-details-label {
    margin-bottom: 12px;
    flex-shrink: 0;
}

#status-details-description {
    color: #a0aec0;
    font-size: var(--popup-subheading-font-size);
    line-height: 1.5;
    margin-bottom: 20px;
}

#status-boost-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 25px;
    font-size: var(--popup-subheading-font-size);
    font-weight: bold;
    cursor: pointer;
    margin: 0 auto 15px auto;
    display: block;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
    transition: all 0.2s ease;
}

#item-details-history {
    color: #a0aec0;
    font-size: var(--popup-subheading-font-size);
    line-height: 1.6;
    margin-bottom: 15px;
    text-align: left;
    white-space: pre-wrap;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    max-height: calc(65vh - 150px);
    padding-right: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

#status-details-modal .collect-hint,
#item-details-modal .collect-hint {
    margin-top: 15px;
    font-size: 12px;
}

#item-details-modal .collect-hint {
    margin-top: 10px;
    flex-shrink: 0;
}

#item-details-history::-webkit-scrollbar {
    width: 8px;
}

#item-details-history::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

#item-details-history::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

#item-details-history::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.84);
}

/* === Мелкие попапы (карта: блокировка, не тот мир) === */
#right-menu-map-lock-popup {
    display: none;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 9530;
    padding: 24px 36px;
    border-radius: 16px;
    max-width: 340px;
    text-align: center;
    font-size: var(--popup-heading-font-size);
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(40, 35, 70, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(106, 90, 205, 0.4);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#right-menu-map-lock-popup .right-menu-map-lock-emoji {
    font-size: 36px;
    display: block;
    margin-bottom: 12px;
    animation: lockPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

#right-menu-map-lock-popup .right-menu-map-lock-title {
    font-weight: 600;
    font-size: var(--popup-heading-font-size);
    margin-bottom: 4px;
}

#right-menu-map-lock-popup .right-menu-map-lock-description {
    font-size: var(--popup-subheading-font-size);
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.82);
    display: none;
}

#right-menu-map-lock-popup .right-menu-map-lock-description:not(:empty) {
    display: block;
    margin-top: 4px;
}

/* === Окно «Надо перейти в систему X» (карта мира) — как collect === */
#map-wrong-world-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: var(--popup-overlay-bg) !important;
    display: none !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 10050 !important;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
    cursor: pointer;
}

#map-wrong-world-overlay.active {
    display: flex !important;
}

#map-wrong-world-popup {
    padding: 50px 40px !important;
    text-align: center !important;
    max-width: 420px !important;
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 20px;
    cursor: pointer;
}

#map-wrong-world-popup .map-wrong-world-emoji {
    font-size: 56px !important;
    display: block !important;
    margin-bottom: 20px !important;
    line-height: 1;
    animation: lockPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

#map-wrong-world-popup .map-wrong-world-msg {
    color: var(--popup-text-color) !important;
    font-size: var(--popup-heading-font-size) !important;
    line-height: 1.5 !important;
    font-weight: 500 !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5) !important;
    white-space: pre-line !important;
}

/* ═══════════════════════════════════════════════
   ПРИНУДИТЕЛЬНЫЕ ШРИФТЫ ДЛЯ ВСЕХ МОДАЛЬНЫХ ОКОН
   Для мобильных устройств: явное указание шрифтов с fallback
   ═══════════════════════════════════════════════ */

/* Базовые стили шрифтов для всех модальных окон */
#collect-overlay,
#collect-message,
#item-details-overlay,
#item-details-modal,
#status-details-overlay,
#status-details-modal,
#loading-overlay,
#loading-content,
#status-expire-modal,
.status-expire-content,
#boost-selection-overlay,
#boost-selection-modal,
#saves-overlay,
#saves-modal,
#password-overlay,
#password-modal,
#map-wrong-world-overlay,
#map-wrong-world-popup,
#rpg-shop-detail-overlay,
.rpg-shop-detail-modal,
#rpg-confirm-overlay,
.rpg-confirm-box {
    font-family: var(--font-primary) !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    text-rendering: optimizeLegibility !important;
}

/* Заголовки в модальных окнах */
#collect-message .collect-label,
#item-details-modal #item-details-label,
#status-details-modal #status-details-label,
#loading-content #loading-text,
.status-expire-content .status-expire-title,
#boost-selection-modal > div:first-child,
#saves-modal > div:first-child,
#password-modal #password-title,
#map-wrong-world-popup .map-wrong-world-msg,
.rpg-shop-detail-modal .collect-label,
.rpg-confirm-box .collect-label {
    font-family: var(--font-heading) !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em !important;
}

/* Текст в модальных окнах */
#collect-message .collect-text,
#item-details-modal #item-details-history,
#status-details-modal #status-details-description,
.status-expire-content .status-expire-description,
#password-modal #password-description,
.rpg-shop-detail-modal .rpg-shop-detail-history,
.rpg-confirm-box .collect-text {
    font-family: var(--font-primary) !important;
    font-weight: 400 !important;
    line-height: 1.6 !important;
}

/* Кнопки в модальных окнах */
#collect-message button,
#status-details-modal button,
#status-expire-modal button,
#boost-selection-modal button,
#saves-modal button,
#password-modal button,
#map-wrong-world-popup button,
.rpg-shop-detail-modal button,
.rpg-confirm-box button {
    font-family: var(--font-primary) !important;
    font-weight: 600 !important;
    letter-spacing: 0.02em !important;
}

/* Hint text */
.collect-hint,
.popup-hint {
    font-family: var(--font-primary) !important;
    font-weight: 400 !important;
}
