/* Global Variables and Design Tokens */
:root {
    --bg-main: #0a0a12;
    --bg-glass: rgba(255, 255, 255, 0.03);
    --border-glass: rgba(255, 255, 255, 0.08);
    --accent-primary: #8a4fff;
    --accent-secondary: #00d2ff;
    --accent-glow: rgba(138, 79, 255, 0.3);
    --text-primary: #ffffff;
    --text-secondary: #a0a0c0;
    --text-muted: #6b7280;
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

/* Click Feedback Effect */
.click-feedback {
    position: fixed;
    width: 20px;
    height: 20px;
    background: var(--accent-primary);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0.5;
    z-index: 9999;
    animation: rippleEffect 0.6s ease-out forwards;
}

@keyframes rippleEffect {
    to {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
    }
}

/* Premium nav items are visible; lock state is handled by body.is-pro */
.premium-tool {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Localhost Safety Guard: Prevent huge unstyled images */
.dashboard-page img {
    max-width: 100%;
    height: auto;
}

.app-header-nav img {
    max-width: 32px !important;
    max-height: 32px !important;
}

.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--border-glass);
}

/* Landing Page Styles */
.landing-page {
    scroll-behavior: smooth;
}

.logo {
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: 4px;
    color: #fff;
}

.feature-detailed {
    display: flex;
    align-items: center;
    gap: 80px;
    padding: 120px 8%;
    max-width: 1400px;
    margin: 0 auto;
}

.feature-info {
    flex: 1;
}

.feature-info h2 {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 2rem;
    font-weight: 800;
}

.feature-image {
    flex: 1;
    position: relative;
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.feature-image img {
    width: 100%;
    display: block;
    transition: var(--transition);
}

.tool-tag {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(138, 79, 255, 0.1);
    color: var(--accent-primary);
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.coming-soon-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 210, 255, 0.1);
    color: var(--accent-secondary);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid rgba(0, 210, 255, 0.2);
}

/* Instagram Banner Card */
#ig-banner-card:hover > div {
    transform: translateY(-3px);
    box-shadow: 0 20px 50px rgba(225, 48, 108, 0.2), 0 0 0 1px rgba(225, 48, 108, 0.45);
    border-color: rgba(225, 48, 108, 0.6) !important;
}

/* TikTok Banner Card */
#tiktok-banner-card:hover > div {
    transform: translateY(-3px);
    box-shadow: 0 20px 50px rgba(0, 242, 234, 0.16), 0 0 0 1px rgba(255, 0, 80, 0.45);
    border-color: rgba(0, 242, 234, 0.55) !important;
}

/* Tools Gallery */
.tools-gallery {
    padding: 120px 5%;
    background: radial-gradient(circle at 10% 20%, rgba(138, 79, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(0, 210, 255, 0.05) 0%, transparent 50%);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    max-width: 1400px;
    margin: 50px auto 0;
}

.narrative-card {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 2.5rem;
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.narrative-card:hover {
    transform: translateY(-10px);
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4), 0 0 20px var(--accent-glow);
}

.unit-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    border-radius: 28px;
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    /* Card depth effect */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.unit-card:hover {
    transform: translateY(-8px) scale(1.02);
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-primary);
    box-shadow: 0 20px 40px rgba(138, 79, 255, 0.15);
}

.card-avatar {
    width: 140px;
    height: 140px;
    border-radius: 20px;
    /* Square with rounded corners looks more like a card */
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

.unit-card:hover .card-avatar {
    border-color: var(--accent-secondary);
}

.narrative-card .card-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 10px var(--accent-glow));
    display: flex;
    align-items: center;
}

.narrative-card .card-icon img {
    height: 50px;
    width: auto;
    object-fit: contain;
}

.narrative-card h3 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: #fff;
}

.narrative-card p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
}

.narrative-card .card-img-preview {
    margin-top: auto;
    width: 100%;
    height: 150px;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    border: 1px solid var(--border-glass);
    opacity: 0.7;
    transition: var(--transition);
}

.narrative-card:hover .card-img-preview {
    opacity: 1;
    transform: scale(1.02);
}

/* ---------------------------------------------------------
   DASHBOARD / WORKSPACE (Scoped to .dashboard-page) 
--------------------------------------------------------- */
.dashboard-page {
    background: radial-gradient(circle at 50% 50%, #1e1b4b 0%, #0a0a12 100%);
    position: relative;
    height: 100vh;
    min-height: 100dvh;
}

/* Background animated glow */
.dashboard-page::after {
    content: "";
    position: absolute;
    width: 400px;
    height: 400px;
    background: var(--accent-primary);
    filter: blur(180px);
    opacity: 0.15;
    top: 5%;
    right: 5%;
    z-index: 0;
    pointer-events: none;
    animation: pulseGlow 15s infinite alternate;
}

@keyframes pulseGlow {
    from {
        transform: translate(0, 0) scale(1.2);
    }

    to {
        transform: translate(-200px, 200px) scale(2);
    }
}

/* --- New 3-Column Layout --- */
.dashboard-page .app-layout {
    display: flex;
    height: 100vh;
    min-height: 100dvh;
}

.left-sidebar {
    width: 320px;
    background: rgba(10, 10, 20, 0.45);
    backdrop-filter: blur(50px);
    border-right: 1px solid var(--border-glass);
    z-index: 100;
    flex-shrink: 0;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.main-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    position: relative;
}

.right-sidebar {
    width: 250px;
    background: rgba(10, 10, 20, 0.45);
    backdrop-filter: blur(50px);
    border-left: 1px solid var(--border-glass);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    z-index: 100;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

/* Keep ads pinned on the right side in desktop layout */
.dashboard-page .left-sidebar {
    order: 1;
}

.dashboard-page .main-content-wrapper {
    order: 2;
}

.dashboard-page .right-sidebar,
.dashboard-page .ads-sidebar {
    order: 3;
    margin-left: auto;
}

/* --- Header Header Nav (Sketch) --- */
.app-header-nav {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    background: rgba(10, 10, 20, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    z-index: 1000;
}

.global-search {
    flex: 1;
    max-width: 360px;
    margin-left: auto;
    margin-right: 0;
}

.global-search .f-input {
    padding: 10px 16px !important;
    font-size: 0.8rem;
}

@media (max-width: 1100px) {
    .global-search {
        display: none;
    }
}

.nav-group {
    display: flex;
    gap: 10px;
    height: 100%;
    align-items: center;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 5px 12px;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 10px;
    min-width: 70px;
}

.nav-item img {
    width: 32px;
    height: 32px;
    max-width: 100%;
    object-fit: contain;
    margin-bottom: 5px;
    opacity: 0.7;
}

.nav-item span {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item:hover img,
.nav-item.active img {
    opacity: 1;
    transform: translateY(-2px);
}

.nav-item.active {
    background: rgba(138, 79, 255, 0.1);
    border-bottom: 2px solid var(--accent-primary);
    border-radius: 12px 12px 0 0;
}

/* --- Ads Sidebar --- */
.ads-label {
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--accent-primary);
    margin-bottom: 1rem;
    text-align: center;
}

.ad-slot {
    width: 100%;
    border-radius: 15px;
    margin-bottom: 1.5rem;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.05);
    /* Fallback background */
}

.ad-slot img {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0.8;
}

.ad-slot:hover {
    transform: scale(1.02);
}

/* --- Floating IA Button --- */
.ia-floating-trigger {
    position: absolute;
    bottom: 30px;
    right: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 1000;
}

.ia-inner {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px var(--accent-glow);
    transition: var(--transition);
}

.ia-inner img {
    width: 35px;
    height: 35px;
}

.ia-label {
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: #fff;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition);
}

.ia-floating-trigger:hover .ia-inner {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 0 50px var(--accent-glow);
}

.ia-floating-trigger:hover .ia-label {
    opacity: 1;
    transform: translateY(0);
}

.ai-chat-window {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(3, 6, 18, 0.6);
    backdrop-filter: blur(10px);
    z-index: 1600;
}

.ai-chat-window.is-open {
    display: flex;
}

.ai-chat-panel {
    width: min(720px, 100%);
    height: min(78vh, 760px);
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(21, 24, 48, 0.98), rgba(8, 10, 22, 0.99));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.48);
}

.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.24), rgba(59, 130, 246, 0.16));
}

.ai-chat-header h3 {
    margin: 0;
    font-size: 0.95rem;
    letter-spacing: 0.08em;
}

.ai-chat-header p {
    margin: 4px 0 0;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.72);
}

.ai-chat-close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    cursor: pointer;
    font-size: 1rem;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ai-message {
    max-width: 88%;
    padding: 13px 15px;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 0.94rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    border-bottom-right-radius: 6px;
}

.ai-message.system {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-bottom-left-radius: 6px;
}

.ai-message.typing {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.75);
    animation: aiTypingPulse 1s infinite ease-in-out;
}

@keyframes aiTypingPulse {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

.ai-chat-input-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 16px 18px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.04));
}

.ai-chat-input {
    resize: none;
    min-height: 60px;
    max-height: 180px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    outline: none;
    font: inherit;
}

.ai-chat-send {
    align-self: end;
    min-width: 108px;
    height: 60px;
}

/* --- Workspace Adjustments --- */
.workspace {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding: 0 3rem 5rem 3rem;
}

.workspace-header {
    padding: 3rem 5% 1rem 5%;
    border-bottom: none;
    backdrop-filter: none;
    text-align: center;
}

/* --- Inputs and Buttons --- */
.dashboard-page .f-input {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--border-glass) !important;
    border-radius: 12px !important;
    color: white !important;
    padding: 15px 25px !important;
    backdrop-filter: blur(10px);
    transition: var(--transition);
    width: 100%;
    outline: none;
}

/* Selects and options styling for folder filter */
.dashboard-page select.f-input {
    background: rgba(15, 15, 25, 0.95) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-glass) !important;
}

.dashboard-page select.f-input option {
    background: #0f0f19;
    color: #ffffff;
}

.dashboard-page .f-input:focus {
    border-color: var(--accent-primary) !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

.dashboard-page .f-button {
    padding: 15px 30px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 0.8rem;
    transition: var(--transition);
    box-shadow: 0 10px 35px var(--accent-glow);
}

.dashboard-page .f-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 45px var(--accent-glow);
    filter: brightness(1.2);
}

.dashboard-page .f-card {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-glass);
    padding: 2.5rem;
    border-radius: 20px;
    margin-bottom: 1.5rem;
    transition: var(--transition);
    position: relative;
    /* Fixed for actions */
}

.dashboard-page .f-card:hover {
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.04);
}

/* --- 3D Character Cards (THE WOW FACTOR) --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 40px;
    perspective: 2500px;
}

.card-grid.card-grid-5x5 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
    align-items: stretch;
}

.card-grid.card-grid-5x5 .unit-card {
    width: 100%;
    min-width: 0;
}

@media (max-width: 1400px) {
    .card-grid.card-grid-5x5 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        grid-template-rows: none;
    }
}

@media (max-width: 1100px) {
    .card-grid.card-grid-5x5 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 800px) {
    .card-grid.card-grid-5x5 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .card-grid.card-grid-5x5 {
        grid-template-columns: 1fr;
    }
}

.unit-card {
    position: relative;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(35px);
    -webkit-backdrop-filter: blur(35px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 40px;
    height: 480px;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform-style: preserve-3d;
    transition: transform 0.1s ease-out, box-shadow 0.5s ease, border-color 0.5s ease;
    cursor: pointer;
    animation: cardEntry 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.unit-card:hover {
    border-color: rgba(138, 79, 255, 0.6);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5), 0 0 40px var(--accent-glow);
}

.unit-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.15) 0%, transparent 80%);
    pointer-events: none;
    z-index: 2;
    border-radius: 40px;
}

.unit-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 40px;
    padding: 1.5px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), transparent, rgba(138, 79, 255, 0.5));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.card-avatar {
    width: 180px;
    height: 180px;
    border-radius: 35px;
    background: linear-gradient(135deg, #1e293b, #0a0a12);
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    font-weight: 900;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transform: translateZ(60px);
}

.card-info {
    text-align: center;
    transform: translateZ(40px);
}

.card-info h3 {
    font-size: 1.8rem;
    font-weight: 900;
    margin: 15px 0 5px 0;
    background: linear-gradient(to bottom, #fff, #a0a0c0);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.card-actions {
    margin-top: auto;
    width: 100%;
    display: flex;
    justify-content: space-around;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    transform: translateZ(20px);
}

@keyframes cardEntry {
    from {
        opacity: 0;
        transform: translateY(60px) rotateX(-15deg);
    }

    to {
        opacity: 1;
        transform: translateY(0) rotateX(0);
    }
}

/* Modal Ultra Premium */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 8, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 20px;
}

.modal-content {
    background: rgba(15, 15, 25, 0.8);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 50px 100px rgba(0, 0, 0, 0.8), 0 0 30px var(--accent-glow);
    border-radius: 30px;
    padding: 3.5rem;
    width: 100%;
    max-width: 550px;
    position: relative;
    animation: modalScale 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScale {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-content h3 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, #fff 0%, var(--accent-primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.modal-actions button {
    flex: 1;
}

/* Plan/Prompt dialog polish */
#dialog-modal.modal-overlay {
    background:
        radial-gradient(circle at 20% 15%, rgba(138, 79, 255, 0.2), transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(0, 210, 255, 0.12), transparent 45%),
        rgba(4, 4, 10, 0.9);
}

#dialog-modal .modal-content {
    max-width: 520px !important;
    border-radius: 28px;
    border: 1px solid rgba(138, 79, 255, 0.45);
    background: linear-gradient(160deg, rgba(12, 12, 26, 0.92), rgba(20, 16, 45, 0.82));
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.62),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 0 40px rgba(138, 79, 255, 0.35);
    padding: 2.4rem;
}

#dialog-modal .modal-content::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.14), transparent 45%);
    opacity: 0.55;
}

#dialog-title {
    font-size: clamp(2rem, 3.8vw, 2.7rem);
    margin-bottom: 1rem;
    letter-spacing: -0.4px;
}

#dialog-message {
    font-size: 1.04rem !important;
    line-height: 1.6;
    color: rgba(233, 234, 255, 0.88);
    margin-bottom: 1.2rem !important;
}

#dialog-input,
#dialog-select,
#dialog-file {
    min-height: 54px;
    border-radius: 14px !important;
    border: 1px solid rgba(138, 79, 255, 0.65) !important;
    background: linear-gradient(180deg, rgba(35, 35, 48, 0.88), rgba(26, 26, 40, 0.88)) !important;
    color: #f7f6ff !important;
    font-size: 1rem;
    box-shadow: 0 0 0 1px rgba(138, 79, 255, 0.12) inset;
}

#dialog-select {
    cursor: pointer;
    font-weight: 700;
}

#dialog-input:focus,
#dialog-select:focus,
#dialog-file:focus {
    border-color: rgba(167, 117, 255, 0.95) !important;
    box-shadow: 0 0 0 3px rgba(138, 79, 255, 0.24);
}

#dialog-modal .modal-actions {
    margin-top: 1.35rem;
    gap: 12px;
}

#btn-dialog-cancel,
#btn-dialog-confirm {
    min-height: 50px;
    border-radius: 14px;
    font-size: 0.93rem;
    letter-spacing: 1.1px;
}

#btn-dialog-cancel {
    background: linear-gradient(135deg, rgba(56, 56, 66, 0.95), rgba(45, 45, 56, 0.95)) !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

#btn-dialog-confirm {
    background: linear-gradient(135deg, #6b2cff, #8855ff) !important;
    box-shadow: 0 14px 30px rgba(107, 44, 255, 0.4);
}

#btn-dialog-confirm:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
}

@media (max-width: 560px) {
    #dialog-modal .modal-content {
        padding: 1.5rem;
        border-radius: 22px;
    }

    #dialog-title {
        font-size: 1.8rem;
    }
}

/* Plan modal redesign */
.plan-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 12% 16%, rgba(106, 96, 255, 0.18), transparent 38%),
        radial-gradient(circle at 86% 82%, rgba(47, 188, 255, 0.14), transparent 42%),
        rgba(2, 4, 12, 0.88);
    backdrop-filter: blur(12px);
}

.plan-modal-shell {
    width: min(1100px, 100%);
    border-radius: 30px;
    border: 1px solid rgba(94, 96, 255, 0.72);
    background: linear-gradient(160deg, rgba(8, 10, 24, 0.96), rgba(13, 13, 20, 0.92));
    box-shadow:
        0 30px 90px rgba(0, 0, 0, 0.6),
        0 0 38px rgba(66, 116, 255, 0.22),
        inset 0 0 0 1px rgba(255, 255, 255, 0.03);
    padding: 1.6rem 1.5rem 1.2rem 1.5rem;
    position: relative;
}

.plan-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(170, 196, 255, 0.26);
    color: #fff;
    background: rgba(46, 56, 86, 0.45);
    cursor: pointer;
    font-weight: 800;
}

.plan-billing-toggle {
    width: 100%;
    max-width: 430px;
    margin: 0 auto 1.35rem auto;
    border: 1px solid rgba(94, 96, 255, 0.72);
    border-radius: 999px;
    padding: 6px;
    display: flex;
    gap: 8px;
    background: rgba(7, 10, 21, 0.84);
}

.plan-billing-toggle button {
    flex: 1;
    border: none;
    border-radius: 999px;
    color: #fff;
    background: transparent;
    padding: 0.8rem 1rem;
    cursor: pointer;
    font-weight: 800;
    letter-spacing: 0.4px;
}

.plan-billing-toggle button.is-active {
    color: #020202;
    background: linear-gradient(135deg, #6f5bff, #1dbbff);
}

.plan-billing-save {
    display: block;
    font-size: 0.65rem;
    opacity: 0.9;
    margin-top: 2px;
}

.plan-cards-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.plan-card {
    flex: 1 1 280px;
    min-height: 510px;
    border-radius: 24px;
    border: 1px solid rgba(94, 96, 255, 0.64);
    background: linear-gradient(165deg, rgba(8, 8, 14, 0.96), rgba(6, 8, 16, 0.94));
    padding: 1.2rem 1.1rem 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.plan-card-popular {
    transform: translateY(-3px);
    box-shadow:
        0 10px 30px rgba(71, 123, 255, 0.24),
        0 20px 40px rgba(31, 72, 190, 0.22),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.plan-badge {
    width: fit-content;
    font-size: 0.66rem;
    letter-spacing: 1.2px;
    font-weight: 900;
    border-radius: 999px;
    border: 1px solid rgba(94, 96, 255, 0.64);
    padding: 4px 10px;
    margin-bottom: 0.8rem;
    color: #62d4ff;
}

.plan-card h3 {
    font-size: clamp(2rem, 2.8vw, 2.75rem);
    margin: 0 0 4px 0;
    line-height: 1.05;
}

.plan-price {
    font-size: 2.1rem;
    font-weight: 800;
    margin: 0 0 0.65rem 0;
    color: #ffffff;
}

.plan-price-note {
    font-size: 0.72rem;
    opacity: 0.68;
    margin-top: -6px;
    margin-bottom: 0.7rem;
}

.plan-price-yearly {
    display: none;
}

.plan-modal-overlay[data-billing="yearly"] .plan-price-monthly {
    display: none;
}

.plan-modal-overlay[data-billing="yearly"] .plan-price-yearly {
    display: block;
}

.plan-cta-solid,
.plan-cta-outline {
    border-radius: 999px;
    min-height: 46px;
    font-weight: 900;
    letter-spacing: 0.45px;
    cursor: pointer;
    border: 1px solid #5e6fff;
    margin-bottom: 0.85rem;
}

.plan-cta-solid {
    color: #050505;
    background: linear-gradient(135deg, #6f5bff, #1dbbff);
}

.plan-cta-outline {
    color: #99c8ff;
    background: transparent;
}

.plan-feature-list {
    margin: 0;
    padding-left: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    opacity: 0.92;
    font-size: 1rem;
}

.plan-feature-list li::marker {
    color: #44b8ff;
}

.plan-paypal-wrap {
    margin-bottom: 0.9rem;
    padding: 0.45rem;
    border: 1px solid rgba(94, 96, 255, 0.6);
    border-radius: 14px;
    background: rgba(8, 12, 26, 0.8);
}

@media (max-width: 900px) {
    .plan-modal-shell {
        padding: 1rem;
    }

    .plan-card-popular {
        transform: none;
    }
}

/* Sidebar trigger button for plan modal */
.plan-trigger-btn {
    background: linear-gradient(90deg, #6f5bff 0%, #1dbbff 100%) !important;
    color: #ffffff !important;
    border: none;
    box-shadow: 0 10px 24px rgba(29, 187, 255, 0.24);
}

.plan-trigger-btn:hover {
    filter: brightness(1.07);
    transform: translateY(-2px);
}

/* Landing plans section */
.plans-landing {
    padding: 100px 5%;
}

.landing-plan-toggle {
    width: min(420px, 100%);
    margin: 0 auto 28px auto;
    border: 1px solid rgba(94, 96, 255, 0.75);
    border-radius: 999px;
    padding: 6px;
    display: flex;
    gap: 8px;
    background: rgba(8, 10, 22, 0.85);
}

.landing-plan-toggle button {
    flex: 1;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #fff;
    padding: 0.8rem 1rem;
    font-weight: 800;
    cursor: pointer;
}

.landing-plan-toggle button span {
    display: block;
    font-size: 0.7rem;
    opacity: 0.85;
}

.landing-plan-toggle button.is-active {
    background: linear-gradient(135deg, #6f5bff, #1dbbff);
    color: #050505;
}

.landing-plan-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.landing-plan-card {
    flex: 1 1 300px;
    min-height: 520px;
    border-radius: 24px;
    border: 1px solid rgba(94, 96, 255, 0.65);
    padding: 1.25rem;
    background: linear-gradient(165deg, rgba(8, 8, 14, 0.96), rgba(6, 8, 16, 0.94));
}

.landing-plan-card.popular {
    box-shadow: 0 16px 40px rgba(71, 123, 255, 0.22);
}

.landing-plan-tag {
    width: fit-content;
    border: 1px solid rgba(94, 96, 255, 0.65);
    border-radius: 999px;
    padding: 4px 12px;
    color: #62d4ff;
    font-weight: 900;
    font-size: 0.72rem;
    letter-spacing: 0.8px;
    margin-bottom: 0.9rem;
}

.landing-plan-card h3 {
    font-size: 3rem;
    line-height: 1;
    margin-bottom: 0.7rem;
}

.landing-plan-price {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.landing-price-yearly {
    display: none;
}

.plans-landing[data-billing="yearly"] .landing-price-monthly {
    display: none;
}

.plans-landing[data-billing="yearly"] .landing-price-yearly {
    display: inline;
}

.landing-plan-btn {
    width: 100%;
    min-height: 46px;
    border-radius: 999px;
    font-weight: 900;
    letter-spacing: 0.4px;
    cursor: pointer;
    margin-bottom: 0.9rem;
}

.landing-plan-btn.solid {
    border: 1px solid #5e6fff;
    background: linear-gradient(135deg, #6f5bff, #1dbbff);
    color: #050505;
}

.landing-plan-btn.outline {
    border: 1px solid #5e6fff;
    background: transparent;
    color: #99c8ff;
}

.landing-plan-list {
    margin: 0;
    padding-left: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.52rem;
    font-size: 1rem;
    opacity: 0.95;
}

.landing-plan-list li::marker {
    color: #44b8ff;
}

@media (max-width: 900px) {
    .landing-plan-card h3 {
        font-size: 2.4rem;
    }

    .landing-plan-price {
        font-size: 1.6rem;
    }
}

.dev-msg {
    padding: 4rem;
    border: 2px dashed rgba(255, 255, 255, 0.05);
    text-align: center;
    color: var(--text-muted);
    border-radius: 20px;
    font-weight: 600;
}

/* --- Pricing and Plans Section --- */
.section-title {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title h2 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.donation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.price-card {
    padding: 3rem 2rem;
    border-radius: 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
    transition: var(--transition);
}

.price-card:hover {
    transform: translateY(-10px);
    border-color: var(--accent-primary);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 20px var(--accent-glow);
}

.price-card.featured {
    background: rgba(138, 79, 255, 0.05);
    border: 1px solid var(--accent-primary);
    transform: scale(1.05);
    z-index: 2;
}

.price-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.price-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: #fff;
}

.price-features {
    list-style: none;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0;
}

.price-features li {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.price-features li::before {
    content: "✓";
    color: var(--accent-primary);
    font-weight: 900;
}

.price-card button {
    margin-top: auto;
    border-radius: 12px;
    font-weight: 700;
    transition: var(--transition);
}

.price-card button:hover {
    background: var(--accent-primary);
    color: white;
}

/* --- Footer --- */
footer {
    background: #050508;
    padding: 80px 8% 40px;
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: 60px;
    border-top: 1px solid var(--border-glass);
}

@media (max-width: 900px) {
    footer {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    footer {
        grid-template-columns: 1fr;
    }
}

/* NARRATIVA 2.0 PREMIUM STYLES */

/* Zelda Style Inventory */
.inventory-slot.empty-slot:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-primary);
    transform: scale(1.05);
    box-shadow: 0 0 15px var(--accent-glow);
}

.inventory-slot.empty-slot:hover::after {
    content: '+';
    position: absolute;
    font-size: 2rem;
    color: var(--accent-primary);
    opacity: 0.5;
}

.zelda-inventory-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 20px;
    background: rgba(0, 0, 0, 0.3);
    padding: 2rem;
    border-radius: 20px;
    border: 1px solid var(--border-glass);
    width: 100%;
    margin: 0;
}

.inventory-slot {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
}

.inventory-slot:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.slot-glow {
    position: absolute;
    inset: 0;
    border-radius: 12px;
    box-shadow: inset 0 0 15px rgba(138, 79, 255, 0);
    transition: var(--transition);
    pointer-events: none;
}

.inventory-slot.occupied .slot-glow {
    box-shadow: inset 0 0 15px var(--accent-glow);
}

.item-icon {
    width: 70%;
    height: 70%;
    filter: drop-shadow(0 0 5px var(--accent-primary));
}

/* Horizontal Timeline */
.horizontal-timeline-container {
    width: 100%;
    overflow-x: auto;
    padding: 4rem 2rem;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) transparent;
}

.timeline-track {
    display: flex;
    gap: 50px;
    min-width: max-content;
    position: relative;
    padding-bottom: 2rem;
}

.timeline-track::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--border-glass), transparent);
}

.timeline-event {
    width: 250px;
    padding: 1.5rem;
    border-radius: 20px;
    position: relative;
    transition: var(--transition);
}

.timeline-event:hover {
    transform: translateY(-10px);
}

.event-dot {
    position: absolute;
    top: 50%;
    left: -25px;
    width: 10px;
    height: 10px;
    background: var(--accent-secondary);
    border-radius: 50%;
    transform: translateY(-50%);
    box-shadow: 0 0 10px var(--accent-secondary);
}

/* Maps and Cartography */
.map-pin {
    position: absolute;
    font-size: 24px;
    cursor: pointer;
    transform: translate(-50%, -100%);
    filter: drop-shadow(0 2px 4px black);
    transition: var(--transition);
}

.map-pin:hover {
    transform: translate(-50%, -100%) scale(1.3);
}

.map-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
    justify-content: center;
}

#map-tool-size {
    width: 100%;
    padding: 6px 10px !important;
}

#map-tool-label {
    flex: 1 1 auto;
    width: 180px !important;
    max-width: 180px;
}

#map-tool-icon {
    flex: 0 0 90px;
    width: 90px !important;
    max-width: 90px;
    text-align: center;
}

.map-tool-icon-preview {
    flex: 0 0 90px;
    width: 90px !important;
    max-width: 90px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    user-select: none;
}

.map-tool-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 0 0 300px;
    max-width: 300px;
}

.map-tool-meta-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.map-tool-size-label {
    font-size: 0.68rem;
    color: var(--text-secondary);
    letter-spacing: 0.6px;
    margin-top: -2px;
}

.map-tool-types {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 10px;
    max-width: 270px;
    padding: 6px;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
}

.map-type-btn {
    width: 100%;
    min-width: 120px;
    padding: 10px 12px;
    font-size: 0.72rem;
    letter-spacing: 0.8px;
}

.map-cursor-standalone {
    flex: 0 0 120px;
    width: 120px;
    height: 120px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
}

.map-cursor-svg {
    width: 54px;
    height: 54px;
    fill: #f3f4f6;
    stroke: #111827;
    stroke-width: 1.4;
    stroke-linejoin: round;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

.map-cursor-btn {
    min-width: 120px;
    padding: 10px 12px;
    font-size: 0.72rem;
    letter-spacing: 0.8px;
}

.map-marker {
    position: absolute;
    transform: translate(-50%, -100%);
    color: var(--marker-color, #00d2ff);
    font-size: var(--marker-size, 26px);
    display: flex;
    align-items: center;
    gap: 8px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
    cursor: move;
}

.map-marker-remove {
    margin-left: 6px;
    width: 18px;
    height: 18px;
    border: 1px solid rgba(239, 68, 68, 0.7);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.map-marker-remove:hover {
    background: rgba(239, 68, 68, 0.85);
}

.map-marker.map-circle {
    width: var(--marker-size, 26px);
    height: var(--marker-size, 26px);
    border-radius: 50%;
    border: 2px solid var(--marker-color, #00d2ff);
    background: rgba(0, 210, 255, 0.15);
}

.map-marker.map-arrow {
    font-size: calc(var(--marker-size, 26px) * 0.9);
}

.map-marker.map-arrow-line,
.map-arrow-preview {
    transform: translate(0, -50%);
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}

.map-arrow-preview {
    position: absolute;
    z-index: 15;
    pointer-events: none;
}

.map-size-preview {
    position: absolute;
    transform: translate(-50%, -100%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 16;
}

.map-size-preview-circle {
    border: 2px dashed var(--marker-color, #00d2ff);
    background: rgba(0, 210, 255, 0.12);
    box-shadow: 0 0 0 1px rgba(0, 210, 255, 0.35), inset 0 0 18px rgba(0, 210, 255, 0.12);
}

.map-size-preview-image {
    border-radius: 8px;
    border: 1px dashed rgba(255, 255, 255, 0.6);
    background-size: cover;
    background-position: center;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.map-arrow-visual {
    display: inline-flex;
    align-items: center;
    transform-origin: left center;
}

.map-arrow-line-seg {
    display: inline-block;
    height: 2px;
    width: 100%;
    min-width: 12px;
    background: var(--marker-color, #00d2ff);
}

.map-arrow-head-glyph {
    color: var(--marker-color, #00d2ff);
    font-weight: 900;
    margin-left: -1px;
}

.map-marker.map-image img {
    width: var(--marker-size, 26px);
    height: var(--marker-size, 26px);
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.map-label {
    font-size: 0.7rem;
    background: rgba(10, 10, 20, 0.8);
    border: 1px solid var(--border-glass);
    padding: 4px 8px;
    border-radius: 10px;
}

/* Unit Cards 2.0 */
.view-header-actions {
    display: flex;
    justify-content: center;
    margin-bottom: 3rem;
}

.card-actions-mini {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 8px;
    z-index: 9999;
    opacity: 0.3;
    /* Subtle by default */
    transition: var(--transition);
    pointer-events: auto;
}

.f-card:hover .card-actions-mini,
.unit-card:hover .card-actions-mini,
.timeline-event:hover .card-actions-mini,
.inventory-slot:hover .card-actions-mini {
    opacity: 1;
}

/* Network Node Polish */
.network-node {
    background: rgba(138, 79, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent-primary) !important;
    border-radius: 15px;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

/* Split Viewer Storyboard */
#script-viewer {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) rgba(0, 0, 0, 0.2);
}

#script-viewer::-webkit-scrollbar {
    width: 6px;
}

#script-viewer::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 10px;
}

.btn-edit-universal,
.btn-delete-universal,
.btn-folder-universal {
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: var(--transition);
}

.action-btn-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    pointer-events: none;
}

.btn-edit-universal:hover {
    background: var(--accent-primary);
}

.btn-delete-universal:hover {
    background: #ff3e3e;
}

.btn-folder-universal:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* Network Interactivity */
.network-node {
    z-index: 10;
    transition: transform 0.2s, box-shadow 0.2s;
    user-select: none;
    border: 1px solid var(--accent-secondary) !important;
}

.network-node:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px var(--accent-glow);
    z-index: 20;
}

/* Map Pin Styling */
[id^="map-world-"] {
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5);
}

.map-canvas {
    width: 100%;
    height: 100%;
    will-change: transform;
}

.map-zoom-controls {
    position: absolute;
    right: 14px;
    bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 30;
}

.map-zoom-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    background: rgba(10, 10, 18, 0.72);
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.map-zoom-btn:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 0 14px var(--accent-glow);
}

.map-pin {
    animation: pinDrop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pinDrop {
    from {
        transform: translate(-50%, -200%);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -100%);
        opacity: 1;
    }
}

/* Profiles Custom Fields */
#custom-fields-container .f-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 10px;
    padding: 1rem 1.5rem;
}

.card-summary {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 8px;
    line-height: 1.4;
}

.field-block {
    margin-bottom: 20px;
}

.field-rows {
    display: grid;
    gap: 10px;
    margin-bottom: 10px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    align-items: center;
}

.iceberg-card {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.4), rgba(5, 10, 20, 0.7)), url('../images/ICEBERGS.png') center/cover;
}

.iceberg-list {
    margin-top: 1rem;
    display: grid;
    gap: 6px;
    list-style: none;
    padding-left: 0;
}

.iceberg-list li {
    font-size: 0.8rem;
    opacity: 0.85;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.timeline-meta {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-top: 6px;
}

.timeline-tag {
    font-size: 0.7rem;
    color: var(--accent-secondary);
    margin-top: 6px;
}

.timeline-desc {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 8px;
    line-height: 1.4;
}

/* Timeline Showcase */
.timeline-showcase-wrap {
    background: linear-gradient(135deg, rgba(18, 22, 54, 0.55), rgba(20, 25, 70, 0.42));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 24px;
    padding: 2rem 1.2rem 2.4rem 1.2rem;
    color: #f5f7ff;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

.timeline-showcase-title {
    text-align: center;
    font-size: clamp(1.6rem, 2.5vw, 2.8rem);
    letter-spacing: 8px;
    font-weight: 900;
    margin-bottom: 1.8rem;
    color: #f5f7ff;
    text-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.timeline-showcase-scroll {
    overflow-x: auto;
    padding-bottom: 8px;
}

.timeline-showcase-track {
    position: relative;
    min-width: max-content;
    display: flex;
    gap: 34px;
    padding: 0 16px 10px 16px;
}

.timeline-showcase-axis {
    position: absolute;
    left: 0;
    right: 0;
    top: 230px;
    height: 5px;
    background: rgba(255, 255, 255, 0.78);
}

.timeline-showcase-stage {
    position: relative;
    width: 230px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
}

.timeline-showcase-card {
    width: 200px;
    min-height: 165px;
    border-radius: 12px;
    padding: 14px 14px 12px 14px;
    color: #f5f7ff;
    position: relative;
    box-shadow: 0 12px 25px rgba(16, 16, 16, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.timeline-showcase-card h3 {
    margin: 2px 0 4px 0;
    font-size: 1.2rem;
    line-height: 1.15;
}

.timeline-showcase-card p {
    margin: 6px 0 0 0;
    font-size: 0.9rem;
    line-height: 1.2;
}

.timeline-showcase-phase {
    font-size: 0.85rem;
    font-weight: 800;
}

.timeline-showcase-date {
    font-size: 0.92rem;
    font-weight: 900;
    margin-top: 2px;
}

.timeline-showcase-tag {
    margin-top: 6px;
    display: inline-flex;
    font-size: 0.72rem;
    border-radius: 999px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.16);
}

.timeline-showcase-pointer {
    width: 0;
    height: 0;
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    margin-top: -1px;
}

.timeline-showcase-node {
    margin-top: 18px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.88);
}

.timeline-showcase-stem {
    width: 2px;
    height: 95px;
    background: rgba(255, 255, 255, 0.65);
}

.timeline-showcase-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 3px solid rgba(255, 255, 255, 0.78);
}

.timeline-showcase-media {
    width: 220px;
    height: 140px;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    border: 3px solid rgba(255, 255, 255, 0.78);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

.timeline-showcase-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #d9d9d9;
    font-size: 2rem;
    font-weight: 900;
}

.tl-tone-1 { background: linear-gradient(135deg, rgba(243, 215, 79, 0.38), rgba(243, 215, 79, 0.2)); }
.tl-tone-2 { background: linear-gradient(135deg, rgba(247, 166, 74, 0.38), rgba(247, 166, 74, 0.2)); }
.tl-tone-3 { background: linear-gradient(135deg, rgba(75, 160, 223, 0.38), rgba(75, 160, 223, 0.2)); color: #f5f7ff; }
.tl-tone-4 { background: linear-gradient(135deg, rgba(71, 103, 223, 0.38), rgba(71, 103, 223, 0.2)); color: #f5f7ff; }
.tl-tone-5 { background: linear-gradient(135deg, rgba(242, 76, 159, 0.38), rgba(242, 76, 159, 0.2)); }
.tl-tone-6 { background: linear-gradient(135deg, rgba(213, 74, 242, 0.38), rgba(213, 74, 242, 0.2)); }

.timeline-showcase-pointer.tl-tone-1 { border-top: 20px solid #f3d74f; }
.timeline-showcase-pointer.tl-tone-2 { border-top: 20px solid #f7a64a; }
.timeline-showcase-pointer.tl-tone-3 { border-top: 20px solid #4ba0df; }
.timeline-showcase-pointer.tl-tone-4 { border-top: 20px solid #4767df; }
.timeline-showcase-pointer.tl-tone-5 { border-top: 20px solid #f24c9f; }
.timeline-showcase-pointer.tl-tone-6 { border-top: 20px solid #d54af2; }

@media (max-width: 900px) {
    .timeline-showcase-title {
        letter-spacing: 4px;
    }

    .timeline-showcase-stage {
        width: 200px;
    }

    .timeline-showcase-card {
        width: 176px;
        min-height: 154px;
    }

    .timeline-showcase-axis {
        top: 216px;
    }

    .timeline-showcase-stem {
        height: 78px;
    }

    .timeline-showcase-avatar {
        width: 86px;
        height: 86px;
    }

    .timeline-showcase-media {
        width: 176px;
        height: 112px;
    }
}

.network-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.network-panel {
    padding: 1.5rem;
    border-radius: 20px;
}

/* Collection Grid View Styles */
.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 2rem;
}

.collection-item-card {
    position: relative;
    aspect-ratio: 2/3;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 2px solid transparent;
}

.collection-item-card:hover {
    transform: scale(1.05);
    border-color: rgba(138, 79, 255, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.collection-item-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: all 0.3s ease;
}

.collection-item-card:hover .collection-item-image {
    transform: scale(1.1);
}

.collection-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.7) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.collection-item-card:hover .collection-item-overlay {
    opacity: 1;
}

/* Always show overlay when checked */
.collection-item-card.checked .collection-item-overlay {
    opacity: 1;
    background: rgba(0, 0, 0, 0.4);
}

.collection-checkmark {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: 4px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.collection-item-card.checked .collection-checkmark {
    background: #10b981;
    border-color: #10b981;
    transform: scale(1);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.6), 0 0 60px rgba(16, 185, 129, 0.3);
    animation: checkPulse 2s ease-in-out infinite;
}

@keyframes checkPulse {

    0%,
    100% {
        box-shadow: 0 0 30px rgba(16, 185, 129, 0.6), 0 0 60px rgba(16, 185, 129, 0.3);
    }

    50% {
        box-shadow: 0 0 40px rgba(16, 185, 129, 0.8), 0 0 80px rgba(16, 185, 129, 0.4);
    }
}

.collection-checkmark svg {
    width: 45px;
    height: 45px;
    color: white;
    stroke-width: 4;
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    transition: stroke-dashoffset 0.3s ease 0.1s;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.collection-item-card.checked .collection-checkmark svg {
    stroke-dashoffset: 0;
}

.collection-item-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.collection-item-info h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
    flex: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.collection-edit-btn {
    background: rgba(138, 79, 255, 0.8);
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(10px);
}

.collection-item-card:hover .collection-edit-btn {
    opacity: 1;
    transform: translateY(0);
}

.collection-edit-btn:hover {
    background: var(--accent-primary);
    transform: scale(1.1) translateY(0);
}

.collection-edit-btn .action-btn-icon {
    width: 16px;
    height: 16px;
}

/* Checked state styling */
.collection-item-card.checked {
    border-color: #10b981;
}

.collection-item-card.checked .collection-item-image {
    filter: brightness(0.7);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .collection-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
}

/* Publications Library View */
.pub-library-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 22px;
    align-items: start;
    margin-bottom: 2rem;
}

.pub-library-left {
    min-width: 0;
}

.pub-library-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.pub-library-head h2 {
    margin: 0;
    font-size: 1.9rem;
    letter-spacing: 0.4px;
}

.pub-library-head p {
    margin: 2px 0 0 0;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.pub-chip-btn {
    background: rgba(138, 79, 255, 0.24);
    color: #fff;
    border: 1px solid rgba(138, 79, 255, 0.45);
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.pub-loading {
    padding: 1rem 0;
    font-size: 0.9rem;
    opacity: 0.72;
}

.pub-books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 16px;
}

.pub-book-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    padding: 10px;
}

.pub-book-card:hover {
    border-color: rgba(138, 79, 255, 0.65);
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-3px);
}

.pub-book-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 8px;
    background-size: cover !important;
    background-position: center !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.pub-owner-actions {
    position: absolute;
    top: 7px;
    right: 7px;
    display: flex;
    gap: 5px;
}

.pub-owner-actions button {
    width: 23px;
    height: 23px;
    border: none;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    font-size: 0.65rem;
    font-weight: 800;
}

.pub-owner-actions button:first-child {
    background: rgba(14, 165, 233, 0.9);
}

.pub-owner-actions button:last-child {
    background: rgba(239, 68, 68, 0.9);
}

.pub-progress-wrap {
    margin: 8px 0 4px 0;
}

.pub-progress-bar {
    width: 100%;
    height: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
}

.pub-progress-bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}

.pub-progress-wrap small {
    display: block;
    margin-top: 3px;
    font-size: 0.67rem;
    color: var(--text-secondary);
}

.pub-book-card h4 {
    margin: 3px 0 0 0;
    font-size: 0.8rem;
    line-height: 1.25;
}

.pub-book-card p {
    margin: 2px 0 0 0;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.pub-inline-section {
    margin-top: 20px;
}

.pub-inline-section h3 {
    font-size: 1rem;
    margin-bottom: 10px;
}

.pub-continue-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.pub-continue-item {
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    border-radius: 12px;
    padding: 8px;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 9px;
    align-items: center;
    text-align: left;
    cursor: pointer;
}

.pub-continue-item .thumb {
    width: 46px;
    height: 58px;
    border-radius: 7px;
    background-size: cover !important;
    background-position: center !important;
}

.pub-continue-item .meta {
    min-width: 0;
}

.pub-continue-item .meta strong {
    display: block;
    font-size: 0.78rem;
    line-height: 1.2;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.pub-continue-item .meta span {
    display: block;
    font-size: 0.68rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.pub-empty-inline {
    grid-column: 1 / -1;
    border: 1px dashed rgba(255, 255, 255, 0.22);
    border-radius: 12px;
    padding: 14px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.pub-library-right {
    border-radius: 16px;
    padding: 14px;
    display: grid;
    gap: 12px;
    position: sticky;
    top: 12px;
}

.pub-right-block h3,
.pub-right-block h4 {
    margin: 0 0 8px 0;
}

.pub-right-eyebrow {
    margin: 0 0 4px 0;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-secondary);
}

.pub-side-card {
    width: 100%;
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    border-radius: 12px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    margin-bottom: 8px;
}

.pub-side-card .meta {
    text-align: left;
}

.pub-side-card .meta strong {
    display: block;
    font-size: 0.78rem;
}

.pub-side-card .meta span {
    display: block;
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.pub-side-card .arrow {
    opacity: 0.72;
}

.pub-side-empty {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.pub-right-block label {
    display: block;
    font-size: 0.68rem;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.pub-right-block .f-input {
    margin-bottom: 9px;
    padding: 10px 12px !important;
    font-size: 0.78rem;
}

.pub-upload-btn {
    width: 100%;
    margin-top: 6px;
}

/* Mobile dashboard layout */
.mobile-menu-btn,
.mobile-sidebar-close,
.mobile-sidebar-backdrop {
    display: none;
}

@media (max-width: 980px) {
    .dashboard-page {
        height: 100dvh;
    }

    .dashboard-page .app-layout {
        height: 100dvh;
        position: relative;
    }

    .mobile-menu-btn {
        display: flex;
        position: fixed;
        top: 14px;
        left: 14px;
        z-index: 1601;
        width: 44px;
        height: 44px;
        border-radius: 12px;
        border: 1px solid rgba(255, 255, 255, 0.16);
        background: rgba(8, 11, 30, 0.86);
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 5px;
        cursor: pointer;
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
    }

    .mobile-menu-btn span {
        display: block;
        width: 20px;
        height: 2px;
        background: #fff;
        border-radius: 99px;
    }

    .mobile-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1499;
        background: rgba(2, 4, 12, 0.65);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    body.sidebar-open .mobile-sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .left-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(86vw, 340px);
        z-index: 1500;
        transform: translateX(-104%);
        transition: transform 0.28s ease;
        box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
    }

    body.sidebar-open .left-sidebar {
        transform: translateX(0);
    }

    .mobile-sidebar-close {
        display: inline-flex;
        position: absolute;
        top: 12px;
        right: 12px;
        width: 34px;
        height: 34px;
        align-items: center;
        justify-content: center;
        border-radius: 9px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        background: rgba(255, 255, 255, 0.04);
        color: #fff;
        font-weight: 800;
        cursor: pointer;
    }

    .main-content-wrapper {
        width: 100%;
    }

    .app-header-nav {
        height: auto;
        min-height: 70px;
        padding: 10px 12px 10px 64px;
        gap: 10px;
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .nav-group {
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 4px;
        gap: 6px;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .nav-item {
        min-width: 64px;
        padding: 6px 10px;
        flex: 0 0 auto;
    }

    .nav-item img {
        width: 26px;
        height: 26px;
    }

    .nav-item span {
        font-size: 0.58rem;
    }

    .global-search {
        order: 3;
        display: block !important;
        width: 100%;
        max-width: none;
        margin: 0;
    }

    .global-search .f-input {
        font-size: 0.9rem;
        padding: 10px 12px !important;
        height: 40px !important;
    }

    .workspace {
        padding: 0 12px 90px 12px;
    }

    .workspace-header {
        padding: 1rem 0.5rem 0.6rem 0.5rem;
    }

    .workspace-header h1 {
        font-size: 1.15rem;
        line-height: 1.2;
    }

    .dashboard-page .f-button {
        min-height: 42px;
        padding: 10px 14px;
        font-size: 0.72rem;
        letter-spacing: 1px;
    }

    .dashboard-page .f-input {
        padding: 12px 14px !important;
    }

    .dashboard-page .f-card {
        padding: 1rem;
        border-radius: 14px;
    }

    .card-grid {
        grid-template-columns: 1fr;
        gap: 14px;
        perspective: none;
    }

    .unit-card {
        height: auto;
        min-height: 240px;
        padding: 1rem;
        border-radius: 18px;
        transform: none !important;
    }

    .unit-card::before,
    .unit-card::after {
        border-radius: 18px;
    }

    .card-avatar {
        width: 92px;
        height: 92px;
        border-radius: 14px;
        font-size: 2rem;
        margin-bottom: 0.8rem;
        transform: none;
    }

    .card-info {
        transform: none;
    }

    .ia-floating-trigger {
        right: 12px;
        bottom: 14px;
        z-index: 1300;
    }

    .ia-inner {
        width: 56px;
        height: 56px;
    }

    .ia-inner img {
        width: 30px;
        height: 30px;
    }

    .ia-label {
        opacity: 1;
        transform: none;
        font-size: 0.55rem;
        letter-spacing: 1px;
    }

    .ai-chat-window {
        padding: 12px;
    }

    .ai-chat-panel {
        width: 100%;
        height: min(82vh, 680px);
        border-radius: 18px;
    }

    .ai-chat-input-row {
        grid-template-columns: 1fr;
    }

    .ai-chat-send {
        width: 100%;
    }

    .modal-content {
        width: min(94vw, 520px);
        padding: 1rem;
        border-radius: 14px;
        max-height: 88vh;
        overflow: auto;
    }

    .modal-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-actions button {
        flex: 1;
        min-width: 120px;
    }

    .plan-modal-shell {
        width: min(96vw, 1080px);
        max-height: 92vh;
        overflow: auto;
        padding: 1rem;
    }

    .plan-cards-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .network-layout {
        grid-template-columns: 1fr;
        height: auto;
        gap: 12px;
    }

    .pub-library-shell {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .pub-library-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .pub-books-grid {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
        gap: 10px;
    }

    .pub-continue-row {
        grid-template-columns: 1fr;
    }

    .pub-library-right {
        position: static;
        top: auto;
    }
}

@media (max-width: 560px) {
    .user-meta {
        margin-left: 0 !important;
        margin-top: 2px;
        width: 100%;
        justify-content: flex-end;
    }

    .workspace {
        padding-bottom: 100px;
    }
}

/* DRAG AND DROP FEEDBACK */
.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.drag-ghost {
    background: var(--accent-primary) !important;
    border-color: var(--accent-secondary) !important;
}

.drag-over {
    border: 2px dashed var(--accent-primary) !important;
    background: rgba(138, 79, 255, 0.15) !important;
    transform: scale(1.02);
    box-shadow: 0 0 20px var(--accent-glow) !important;
}

/* --- NETWORK REDESIGN (HEXAGONAL TECH) --- */
.network-hexagon-container {
    filter: drop-shadow(0 0 15px rgba(138, 79, 255, 0.45));
    transition: transform 0.2s ease, filter 0.3s ease;
    cursor: grab;
}

.network-hexagon-container:active {
    cursor: grabbing;
}

.network-hexagon {
    width: 120px;
    height: 130px;
    background: rgba(15, 15, 25, 0.95);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px solid rgba(138, 79, 255, 0.5);
}

.network-hexagon::before {
    content: '';
    position: absolute;
    inset: 2px;
    background: inherit;
    clip-path: inherit;
    z-index: 1;
}

.network-hexagon-glow {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(138, 79, 255, 0.2) 0%, rgba(0, 210, 255, 0.2) 100%);
    z-index: 0;
    opacity: 0.5;
    animation: hexGlowPulse 4s infinite alternate;
}

@keyframes hexGlowPulse {
    from { opacity: 0.3; transform: scale(1); }
    to { opacity: 0.7; transform: scale(1.05); }
}

.network-hexagon-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    z-index: 2;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.network-hexagon-label-box {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 5px;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 100%);
    z-index: 5;
    text-align: center;
}

.network-hexagon-label-box span {
    font-size: 0.75rem;
    font-weight: 800;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.node-hover .network-hexagon {
    border-color: var(--accent-secondary) !important;
    box-shadow: 0 0 30px rgba(0, 210, 255, 0.6);
}

/* Connection Glows */
.connection-line {
    filter: drop-shadow(0 0 8px rgba(0, 210, 255, 0.8));
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawLine 1.5s ease forwards;
}

@keyframes drawLine {
    to { stroke-dashoffset: 0; }
}

.network-canvas-grid {
    background-image: 
        radial-gradient(circle at 2px 2px, rgba(138, 79, 255, 0.1) 1px, transparent 0);
    background-size: 40px 40px;
}
