/* Party and node sections */
.party-section,
.node-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.content-card__body.party-section {
    flex: 1;
    width: 100%;
    justify-content: center;
    align-items: center;
    min-height: 520px;
}

/* Circle Grid Styling for Party Section */
.party-grid {
    display: grid;
    grid-template-columns: repeat(2, 80px); /* 2 columns, each 80px wide */
    grid-template-rows: repeat(3, 80px); /* 3 rows, each 80px high */
    gap: 20px; /* Space between the circles */
    justify-content: center; /* Center the grid horizontally */
    align-content: center; /* Center the grid vertically */
    min-height: 280px;
}

/* Circle Grid Styling for Node Section */
.node-grid {
    display: grid;
    grid-template-columns: repeat(5, 80px); /* 5 columns, each 80px wide */
    grid-template-rows: repeat(5, 80px); /* 5 rows, each 80px high */
    gap: 20px; /* Space between the circles */
    justify-content: center; /* Center the grid horizontally */
}

/* Circle Styling */
.circle {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: radial-gradient(circle, #d3d3d3, #a9a9a9); /* Light grey to darker grey gradient */
    border: 2px solid #555; /* Dark border */
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2); /* Subtle shadow for depth */
    display: flex;
    align-items: center;
    justify-content: center;
}

.circle.is-keyboard-selected {
    outline: 3px solid rgba(245, 205, 110, 0.95);
    outline-offset: 4px;
    box-shadow:
        0 0 0 2px rgba(40, 28, 8, 0.75),
        0 0 18px rgba(245, 205, 110, 0.45),
        2px 2px 5px rgba(0, 0, 0, 0.2);
}

.circle.is-keyboard-drag-source {
    outline-color: rgba(120, 220, 255, 0.95);
    box-shadow:
        0 0 0 2px rgba(8, 28, 40, 0.75),
        0 0 20px rgba(120, 220, 255, 0.42),
        2px 2px 5px rgba(0, 0, 0, 0.2);
}

.circle.is-keyboard-drag-source .animal-icon-composite {
    opacity: 0.35;
}

.keyboard-drag-ghost {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 2200;
    pointer-events: none;
    transform: translate(-50%, -50%);
    transition: left 150ms ease, top 150ms ease, transform 150ms ease, opacity 150ms ease;
    filter: drop-shadow(0 16px 10px rgba(0, 0, 0, 0.38));
}

.keyboard-drag-ghost.is-lifted {
    transform: translate(-50%, -50%) translate(10px, -12px);
}

.keyboard-drag-ghost.is-releasing {
    transform: translate(-50%, -50%) scale(0.96);
    opacity: 0;
}

.animal-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.node-section {
    width: 100%;
    align-items: center;
}

.nodes-layout--embedded {
    min-height: calc(100vh - 32px);
    align-items: stretch;
    grid-auto-rows: minmax(0, 1fr) auto;
}

.nodes-layout--embedded .content-card--third,
.nodes-layout--embedded .content-card--two-thirds {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.nodes-layout--embedded .party-section,
.nodes-layout--embedded .node-section {
    display: grid;
    place-items: center;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}

.nodes-layout--embedded .party-grid {
    width: max-content;
    height: max-content;
    margin: auto;
}

.nodes-layout--embedded .node-grid {
    width: max-content;
    height: max-content;
    margin: auto;
}

.nodes-pagination {
    display: grid;
    grid-template-columns: repeat(var(--nodes-pagination-columns), minmax(36px, max-content));
    justify-content: center;
    width: 100%;
}

.nodes-pagination .content-page-btn.is-keyboard-selected {
    border-color: rgba(245, 205, 110, 0.95);
    box-shadow:
        0 0 0 1px rgba(245, 205, 110, 0.28),
        0 0 16px rgba(245, 205, 110, 0.24);
}

/* Context Menu Styles */
.custom-context-menu {
    position: absolute;
    display: none;
    z-index: 1000;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    min-width: 250px;
    font-family: Arial, sans-serif;
    /* Remove overflow properties that might hide the submenu */
    overflow: visible;
}

.custom-context-menu .menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.custom-context-menu .menu-item {
    padding: 10px 15px;
    cursor: pointer;
    white-space: nowrap;
    position: relative; /* Needed for submenu positioning */
}

.custom-context-menu .menu-item:hover,
.custom-context-menu .menu-item.is-menu-selected {
    background: linear-gradient(90deg, #f0f0f0, #e0e0e0);
}

.custom-context-menu .menu-item.has-submenu::after {
    content: '▶';
    position: absolute;
    right: 15px;
    font-size: 12px;
}

.custom-context-menu .submenu {
    position: absolute;
    top: 0;
    left: 100%;
    margin-left: 0;
    display: none;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
    min-width: 250px;
    padding: 10px;
    z-index: 1001;
}

.custom-context-menu .menu-item.has-submenu:hover .submenu,
.custom-context-menu .menu-item.has-submenu.is-menu-selected .submenu {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
}

.custom-context-menu .submenu-item {
    padding: 5px;
    cursor: pointer;
    border-radius: 5px;
}

.custom-context-menu .submenu-item:hover,
.custom-context-menu .submenu-item.is-menu-selected {
    background-color: #f0f0f0;
}

.custom-context-menu .submenu-item span {
    display: inline-block;
    margin-left: 5px;
}

.custom-context-menu .submenu-item .node-number {
    font-weight: bold;
}

.node-creature-header {
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.8);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.node-creature-image {
    margin-right: 20px; /* Space between image and name */
}

.drag-ghost {
    position: fixed;
    left: 0;
    top: 0;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0.9;
    z-index: 2000;
}

@media (max-width: 768px) {
    .party-grid {
        grid-template-columns: repeat(6, 44px);
        grid-template-rows: 44px;
        gap: 8px;
    }

    .node-grid {
        grid-template-columns: repeat(5, 48px);
        grid-template-rows: repeat(5, 48px);
        gap: 8px;
    }

    .circle {
        width: 40px;
        height: 40px;
        border-width: 1px;
        box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
    }

    .animal-icon-composite.node-slot-icon {
        --animal-icon-size: 40px;
        --animal-icon-bg-scale: 0.15625;
    }

    .animal-icon {
        touch-action: none;
        -webkit-user-drag: none;
    }

    .node-section {
        width: 100%;
    }
}
