/* Drawer scrollbar styling to match the app palette */
.mud-drawer-content {
    scrollbar-color: var(--mud-palette-primary) var(--mud-palette-drawer-background);
}

.mud-drawer-content::-webkit-scrollbar {
    width: 10px;
}

.mud-drawer-content::-webkit-scrollbar-track {
    background: var(--mud-palette-drawer-background);
}

.mud-drawer-content::-webkit-scrollbar-thumb {
    background-color: var(--mud-palette-primary);
    border-radius: 999px;
    border: 2px solid var(--mud-palette-drawer-background);
}

/* Keep the desktop app bar visible while scrolling */
.appbar-sticky {
    position: sticky;
    top: 0;
    z-index: 1300;
    background: var(--mud-palette-surface);
    border-bottom: 1px solid var(--mud-palette-lines-default);
    -webkit-backdrop-filter: blur(10px) saturate(1.08);
    backdrop-filter: blur(10px) saturate(1.08);
}

/* Desktop-only drawer offset so the notice bar stays visible */
@media (min-width: 960px) {
    .mud-drawer.desktop-drawer-offset {
        top: 70px !important;
        height: calc(100% - 70px) !important;
    }
}

/* Dialog styling for blurred backdrop and clear edges */
.dialog-backdrop,
.dialog-backdrop.mud-overlay,
.dialog-backdrop .mud-overlay {
    background-color: rgba(8, 12, 10, 0.5) !important;
    -webkit-backdrop-filter: blur(12px) saturate(1.1);
    backdrop-filter: blur(12px) saturate(1.1);
}

.mud-dialog {
    border: 2px solid var(--mud-palette-lines-default);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 22px 60px rgba(0, 0, 0, 0.55);
}

.cursor-pointer {
    cursor: pointer;
}

.related-link-card {
    min-width: 170px;
    max-width: 240px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.related-link-card:hover {
    border-color: var(--mud-palette-primary);
    box-shadow: 0 0 0 1px rgba(44, 196, 111, 0.3);
}

.family-tree {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 6px 0;
}

.family-tree-row {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.family-tree-row.has-top::before,
.family-tree-row.has-bottom::after {
    content: "";
    position: absolute;
    left: 8%;
    right: 8%;
    height: 1px;
    background: var(--mud-palette-lines-default);
}

.family-tree-row.has-top::before {
    top: -10px;
}

.family-tree-row.has-bottom::after {
    bottom: -10px;
}

.family-tree-node {
    position: relative;
    min-width: 150px;
    max-width: 220px;
    padding: 10px 12px;
    border-radius: 12px;
    background: linear-gradient(150deg, rgba(26, 38, 32, 0.9), rgba(18, 26, 22, 0.95));
    color: var(--mud-palette-text-primary);
    border: 1px solid var(--mud-palette-lines-default);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.family-tree-node.has-top::before,
.family-tree-node.has-bottom::after {
    content: "";
    position: absolute;
    left: 50%;
    width: 1px;
    background: var(--mud-palette-lines-default);
}

.family-tree-node.has-top::before {
    top: -10px;
    height: 10px;
}

.family-tree-node.has-bottom::after {
    bottom: -10px;
    height: 10px;
}

.family-tree-node.is-root {
    border-color: var(--mud-palette-primary);
    background: linear-gradient(140deg, rgba(44, 196, 111, 0.15), rgba(18, 28, 24, 0.2));
    box-shadow: 0 0 0 1px rgba(44, 196, 111, 0.35);
}

.family-tree-node:hover {
    border-color: var(--mud-palette-primary);
    box-shadow: 0 0 0 1px rgba(44, 196, 111, 0.3);
}

.avatar-frame {
    position: relative;
    display: inline-flex;
}

.avatar-edit-button {
    position: absolute;
    right: 6px;
    bottom: 6px;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
}

.avatar-crop-frame {
    width: 220px;
    height: 220px;
    position: relative;
    overflow: hidden;
    border-radius: var(--mud-default-borderradius);
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
    touch-action: none;
}

.avatar-crop-frame-inner {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.avatar-crop-image {
    position: absolute;
    top: 50%;
    left: 50%;
    height: 100%;
    width: auto;
    min-width: 100%;
    min-height: 100%;
    transform: translate(-50%, -50%) translate(var(--avatar-offset-x, 0px), var(--avatar-offset-y, 0px)) scale(var(--avatar-scale, 1));
    cursor: grab;
    user-select: none;
}

.avatar-crop-image:active {
    cursor: grabbing;
}
