/* =========================================
   POPULAR TALES MINI-PANEL - PREMIUM STYLE
   ========================================= */

:root {
    --pt-bg-dark: #0a050a;
    --pt-border: rgba(255, 46, 99, 0.2);
    --pt-border-hover: rgba(255, 46, 99, 0.6);
    --pt-glow: rgba(255, 46, 99, 0.15);
    --pt-text-main: #fff;
    --pt-text-sub: #aaa;
    --pt-accent: #ff2e63;
    --pt-glass: rgba(10, 5, 10, 0.85);
}

/* Card Container - Credit Card Format (narrow, tall, auto-growing) */
.popular-tales-card {
    position: relative;
    width: 100%;
    min-height: 640px;
    height: auto;
    max-height: none;
    background: linear-gradient(145deg, #120815 0%, #050205 100%);
    border: 1px solid var(--pt-border);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s ease;
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 46, 99, 0.1);
    display: flex;
    flex-direction: column;
    padding: 22px 22px;
    box-sizing: border-box;
}

.popular-tales-card:hover {
    border-color: var(--pt-border-hover);
    box-shadow:
        0 20px 60px rgba(255, 46, 99, 0.2),
        0 0 0 1px rgba(255, 46, 99, 0.3);
    transform: translateY(-3px);
}

/* Header - Premium spacing */
.pt-header {
    padding: 6px 0 18px;
    background: linear-gradient(to bottom, rgba(255, 46, 99, 0.05), transparent);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.pt-title {
    font-family: 'Cinzel', serif;
    font-size: 1.4rem;
    color: var(--pt-text-main);
    margin: 0 0 5px 0;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(255, 46, 99, 0.3);
}

.pt-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: var(--pt-text-sub);
    font-weight: 300;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pt-subtitle::before {
    content: '🔒';
    font-size: 0.9em;
    opacity: 0.7;
}

/* Tales List - No internal scroll, card grows in height */
.pt-list {
    flex: 1;
    padding: 4px 0 12px;
    overflow-x: hidden;
    overflow-y: visible;
}

.pt-item {
    position: relative;
    padding: 16px 0;
    /* User fix: Overflow visible to prevent clipping */
    overflow: visible;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* Changed from Flex to Block with padding reservation */
    display: block;
    padding-right: 96px;
    /* Space for the avatar */
}

.pt-item:last-child {
    border-bottom: none;
}

.pt-text-col {
    /* Removed flex: 1 since parent is block */
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    z-index: 2;
}

/* Thumbnail Styles */
.tale-thumb {
    width: 56px;
    height: 56px;
    /* User fix: Absolute positioning */
    position: absolute;
    right: 14px;
    /* Positive value, inside item */
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;

    border-radius: 50%;
    /* Ensure internal overflow is visible too if needed, but circle clip is fine */
    overflow: visible;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tale-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    position: relative;
    z-index: 10;
    border: 2px solid rgba(0, 0, 0, 0.5);
    /* Inner contrast border */
}

/* Gradient Ring */
.tale-thumb::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff2e63, #ff0055, #9b59b6);
    z-index: 1;
    opacity: 0.8;
    transition: opacity 0.3s;
}

/* Glow Effect */
.tale-thumb::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: var(--pt-accent);
    filter: blur(8px);
    opacity: 0;
    z-index: 0;
    transition: opacity 0.3s;
}

/* Hover Effects */
.pt-item:hover {
    background: rgba(255, 255, 255, 0.02);
    /* Keep existing translate for item */
    transform: translateY(-2px);
    padding-left: 8px;
    border-left: 3px solid var(--pt-accent);
}

.pt-item:hover .tale-thumb {
    /* Updated transform: Maintain vertical center + scale */
    transform: translateY(-50%) scale(1.15);
}

.pt-item:hover .tale-thumb::after {
    opacity: 0.6;
}

.pt-item:hover .tale-thumb::before {
    opacity: 1;
}

/* Item Content */
.pt-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pt-item-title {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: color 0.3s;
}

.pt-item:hover .pt-item-title {
    color: var(--pt-accent);
    text-shadow: 0 0 8px rgba(255, 46, 99, 0.4);
}

.pt-arrow {
    font-size: 1.2rem;
    color: var(--pt-accent);
    opacity: 0;
    /* Hidden by default, appears on hover */
    transform: translateX(-10px);
    transition: all 0.3s ease;
    margin-left: auto;
    /* Push to right of text col if needed */
    display: none;
    /* Hide arrow in favor of thumb visual? Or keep next to title? */
}

/* Re-enable arrow next to title */
.pt-item:hover .pt-arrow {
    display: inline-block;
    opacity: 1;
    transform: translateX(0);
}

.pt-item-desc {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: #888;
    line-height: 1.4;
    max-width: 90%;
    transition: color 0.3s;
}

.pt-item:hover .pt-item-desc {
    color: #ccc;
}

.pt-status-badge {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #aaa;
    align-self: flex-start;
    margin-top: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.pt-status-badge.open {
    border-color: #00ff88;
    color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
}

.pt-status-badge.locked {
    border-color: var(--pt-accent);
    color: var(--pt-accent);
    background: rgba(255, 46, 99, 0.1);
}

/* Mobile Polish */
@media (max-width: 768px) {
    .popular-tales-card {
        min-height: 600px;
    }

    .pt-item:active {
        background: rgba(255, 46, 99, 0.05);
    }
}

/* =========================================
   SEALED PORTAL MODAL
   ========================================= */

.sealed-portal-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 2, 5, 0.95);
    /* Webkit support */
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.sealed-portal-modal.active {
    display: flex;
    opacity: 1;
}

.sp-content {
    background: linear-gradient(135deg, rgba(20, 10, 20, 0.95), rgba(5, 2, 5, 0.98));
    border: 1px solid rgba(255, 46, 99, 0.3);
    padding: 50px 30px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 50px rgba(255, 46, 99, 0.15);
    position: relative;
    transform: scale(0.95);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sealed-portal-modal.active .sp-content {
    transform: scale(1);
}

/* Lock Icon Animation */
.sp-icon-lock {
    font-size: 3rem;
    margin-bottom: 20px;
    display: inline-block;
    animation: lockShake 0.5s ease-in-out;
    filter: drop-shadow(0 0 15px rgba(255, 46, 99, 0.5));
}

@keyframes lockShake {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-10deg);
    }

    75% {
        transform: rotate(10deg);
    }
}

.sp-title {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    color: var(--pt-accent);
    margin-bottom: 10px;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.sp-message {
    font-family: 'Inter', sans-serif;
    color: #ccc;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 35px;
    font-weight: 300;
}

.sp-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sp-btn {
    padding: 14px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s;
    cursor: pointer;
    border: none;
    outline: none;
}

.sp-btn.primary {
    background: var(--pt-accent);
    color: #fff;
    box-shadow: 0 0 20px rgba(255, 46, 99, 0.3);
}

.sp-btn.primary:hover {
    background: #ff4d7a;
    box-shadow: 0 0 30px rgba(255, 46, 99, 0.5);
    transform: translateY(-2px);
}

.sp-btn.secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #aaa;
}

.sp-btn.secondary:hover {
    border-color: #fff;
    color: #fff;
}

.sp-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    transition: color 0.3s;
    background: none;
    border: none;
}

.sp-close:hover {
    color: #fff;
}