:root {
    color-scheme: light;
    --primary: #6c4ad1;
    --primary-soft: rgba(108, 74, 209, 0.16);
    --primary-deep: #4830a8;
    --accent: #ff835c;
    --bg: #f8f6ff;
    --bg-soft: #efe9ff;
    --surface-1: rgba(255, 255, 255, 0.94);
    --surface-2: rgba(255, 255, 255, 0.85);
    --panel: rgba(255, 255, 255, 0.97);
    --panel-border: rgba(78, 56, 158, 0.18);
    --panel-text: #302247;
    --text-strong: #1f1436;
    --muted: rgba(47, 32, 80, 0.55);
    --muted-strong: rgba(47, 32, 80, 0.78);
    --shadow-soft: rgba(108, 74, 209, 0.15);
    --shadow-strong: rgba(59, 37, 122, 0.25);
    --link-stroke: rgba(108, 74, 209, 0.38);
    --node-fill: rgba(255, 255, 255, 0.96);
    --node-stroke: rgba(108, 74, 209, 0.28);
    --node-selected-fill: rgba(108, 74, 209, 0.18);
    --generation-line: rgba(104, 85, 180, 0.22);
    --generation-text: rgba(50, 34, 71, 0.65);
    --control-button-bg: rgba(76, 56, 158, 0.08);
    --control-button-hover-bg: rgba(76, 56, 158, 0.18);
    --stage-background: radial-gradient(circle at 22% 14%, rgba(255, 131, 92, 0.15), transparent 48%),
        radial-gradient(circle at 78% 82%, rgba(108, 74, 209, 0.2), transparent 55%),
        linear-gradient(135deg, rgba(253, 250, 255, 0.98), rgba(235, 229, 255, 0.92));
    font-family: 'Yatra One', cursive;
    --nav-height: 4.5rem;
    --outline-line: rgba(108, 74, 209, 0.26);
}

:root[data-theme='dark'] {
    color-scheme: dark;
    --primary: #a68eff;
    --primary-soft: rgba(166, 142, 255, 0.2);
    --primary-deep: #7057d9;
    --accent: #ff9675;
    --bg: #0f1221;
    --bg-soft: #171a2c;
    --surface-1: rgba(28, 32, 54, 0.92);
    --surface-2: rgba(28, 32, 54, 0.82);
    --panel: rgba(32, 36, 60, 0.88);
    --panel-border: rgba(166, 142, 255, 0.24);
    --panel-text: rgba(232, 228, 255, 0.95);
    --text-strong: rgba(244, 241, 255, 0.98);
    --muted: rgba(184, 176, 230, 0.7);
    --muted-strong: rgba(214, 206, 247, 0.85);
    --shadow-soft: rgba(8, 10, 25, 0.55);
    --shadow-strong: rgba(4, 6, 18, 0.7);
    --link-stroke: rgba(166, 142, 255, 0.55);
    --node-fill: rgba(35, 39, 66, 0.92);
    --node-stroke: rgba(166, 142, 255, 0.36);
    --node-selected-fill: rgba(166, 142, 255, 0.25);
    --generation-line: rgba(166, 142, 255, 0.28);
    --generation-text: rgba(214, 206, 247, 0.78);
    --control-button-bg: rgba(166, 142, 255, 0.14);
    --control-button-hover-bg: rgba(166, 142, 255, 0.24);
    --stage-background: radial-gradient(circle at 20% 16%, rgba(255, 150, 117, 0.17), transparent 54%),
        radial-gradient(circle at 82% 88%, rgba(108, 74, 209, 0.28), transparent 60%),
        linear-gradient(135deg, rgba(14, 18, 34, 0.96), rgba(8, 11, 24, 0.98));
    --outline-line: rgba(166, 142, 255, 0.34);
}

* {
    box-sizing: border-box;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.material-symbols-rounded {
    font-variation-settings:
        'FILL' 0,
        'wght' 500,
        'GRAD' 0,
        'opsz' 24;
    font-size: 1.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

::selection {
    background: var(--primary);
    color: #fff;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    color: var(--text-strong);
    touch-action: manipulation;
    transition: background 0.6s ease, color 0.4s ease;
}

body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: var(--panel-text);
}

.viewport {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: radial-gradient(circle at top left, var(--primary-soft), transparent 55%),
        radial-gradient(circle at bottom right, var(--primary-soft), transparent 60%);
}

.tree-stage {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--stage-background);
    backdrop-filter: blur(28px);
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: 0 50px 110px var(--shadow-strong);
    overflow: hidden;
    transition: background 0.6s ease, border 0.4s ease;
    padding-top: calc(var(--nav-height) + 1rem);
}


.site-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    padding: 0 1.8rem;
    background: var(--surface-1);
    border-bottom: 1px solid var(--panel-border);
    box-shadow: 0 20px 44px var(--shadow-soft);
    backdrop-filter: blur(18px);
    z-index: 10;
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 1.5rem;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.header-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 16rem;
    max-width: clamp(18rem, 26vw, 22.5rem);
    background: var(--surface-2);
    border-radius: 999px;
    border: 1px solid var(--panel-border);
    padding: 0 1rem 0 0.75rem;
    box-shadow: 0 14px 32px var(--shadow-soft);
}

.header-search__icon {
    font-size: 1.25rem;
    color: var(--muted);
    margin-right: 0.4rem;
}

.header-search__input {
    flex: 1 1 auto;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--panel-text);
    padding: 0.6rem 0;
    min-width: 0;
}

.header-search__input::placeholder {
    color: var(--muted);
}

.header-search__input:focus {
    outline: none;
}

.header-search__suggestions {
    position: absolute;
    top: calc(100% + 0.55rem);
    left: 0;
    right: 0;
    background: var(--panel);
    border-radius: 1.2rem;
    border: 1px solid var(--panel-border);
    box-shadow: 0 28px 60px var(--shadow-soft);
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    z-index: 20;
}

.header-search__message {
    margin: 0;
    padding: 0.75rem 0.6rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.header-search__option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: 0.65rem 0.75rem;
    border-radius: 0.9rem;
    border: none;
    background: transparent;
    color: var(--panel-text);
    cursor: pointer;
    text-align: left;
    transition: background 0.18s ease, transform 0.18s ease;
}

.header-search__option:hover,
.header-search__option:focus-visible,
.header-search__option.is-active {
    background: var(--primary-soft);
    transform: translateY(-1px);
    outline: none;
}

.header-search__primary {
    font-size: 0.98rem;
    font-weight: 600;
}

.header-search__meta {
    margin-top: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    font-size: 0.78rem;
    color: var(--muted);
}

.header-search__meta span {
    background: rgba(108, 74, 209, 0.12);
    color: var(--primary);
    border-radius: 999px;
    padding: 0.25rem 0.55rem;
}

.header-search__note {
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: var(--muted-strong);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

:root[data-theme='dark'] .header-search {
    background: rgba(46, 51, 78, 0.85);
    border-color: rgba(166, 142, 255, 0.28);
}

:root[data-theme='dark'] .header-search__suggestions {
    background: rgba(32, 36, 60, 0.96);
    border-color: rgba(166, 142, 255, 0.28);
    box-shadow: 0 28px 60px rgba(4, 6, 18, 0.68);
}

:root[data-theme='dark'] .header-search__meta span {
    background: rgba(166, 142, 255, 0.18);
    color: var(--primary);
}

.admin-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.6rem 1.1rem;
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.012em;
    min-width: 0;
    white-space: nowrap;
}

.admin-toggle__icon {
    font-size: 1.1rem;
}

.admin-toggle__label {
    font-size: 0.95rem;
}

body.is-admin-mode .admin-toggle {
    background: linear-gradient(135deg, var(--primary), var(--primary-deep));
    box-shadow: 0 24px 52px rgba(55, 45, 140, 0.32);
}

.admin-toggle--busy {
    pointer-events: none;
    opacity: 0.7;
}

.header-button__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    line-height: 1;
}

.filter-button__icon {
    font-size: 1.15rem;
}

.view-switch {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid var(--panel-border);
    background: var(--surface-2);
    box-shadow: 0 16px 38px var(--shadow-soft);
    overflow: hidden;
}

.view-switch__button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.9rem;
    border: none;
    background: transparent;
    font: inherit;
    font-weight: 600;
    color: var(--muted-strong);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.view-switch__button .material-symbols-rounded {
    font-size: 1.2rem;
}

.view-switch__button.is-active {
    background: linear-gradient(135deg, var(--primary), var(--primary-deep));
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.view-switch__button:not(.is-active):hover {
    background: rgba(10, 159, 191, 0.12);
    color: var(--panel-text);
}

.view-switch__button:hover,
.view-switch__button:active {
    transform: none;
    box-shadow: inherit;
}

.header-button__label {
    font-size: 0.92rem;
}

.mobile-menu-toggle {
    display: none !important;
    font-size: 1.5rem;
    width: 2.8rem;
    height: 2.8rem;
    color: var(--panel-text);
}

.header-tools {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

@media (max-width: 720px) {
    .site-header {
        height: auto;
        padding: 0.7rem 1rem;
    }

    .site-header__inner {
        flex-direction: row;
        /* Keep row layout */
        align-items: center;
        flex-wrap: wrap;
        gap: 0.8rem;
    }

    .brand {
        flex: 1 1 auto;
        /* Allow brand to take space */
        align-items: flex-start;
        text-align: left;
    }

    .brand p {
        display: none;
        /* Hide subtitle on mobile for space */
    }

    .mobile-menu-toggle {
        display: inline-flex !important;
        order: 2;
        /* Put toggle on the right */
        z-index: 25;
    }

    .header-actions {
        width: 100%;
        order: 3;
        display: contents;
        /* Allow children to interact with the grid/flex if needed, or just standard flow */
    }

    /* Header Tools (Buttons) - Hidden by default on mobile */
    .header-tools {
        display: none;
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.8rem;
        padding-top: 1rem;
        border-top: 1px solid var(--panel-border);
        margin-top: 0.8rem;
        animation: slideDown 0.3s ease forwards;
    }

    /* Show tools when menu is open */
    .mobile-menu-open .header-tools {
        display: flex;
        justify-content: flex-end;
    }

    /* Search Bar always visible, but adapts */
    .header-search {
        order: 3;
        /* Below brand/toggle */
        width: 100%;
        max-width: none;
        margin-top: 0;
    }

    /* Animation for menu */
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }

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

    .view-switch {
        width: 100%;
        max-width: none;
        justify-content: center;
    }

    .view-switch__button {
        flex: 1;
        justify-content: center;
        bottom: 1rem;
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .tree-stage {
        padding-top: 14rem;
    }

    .tree-hint {
        top: 14.5rem;
    }

    .filter-panel {
        top: 14.5rem;
    }

    .outline-stage,
    .sunburst-stage {
        top: 14.5rem;
    }
}

.brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand h1 {
    margin: 0 0 0.03rem;
    font-size: clamp(1.2rem, 2.6vw, 1.9rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-strong);
    transition: color 0.4s ease;
}

.brand p {
    margin: 0;
    max-width: clamp(280px, 42vw, 520px);
    line-height: 1.45;
    color: var(--muted);
    font-size: clamp(0.78rem, 1.5vw, 0.95rem);
    transition: color 0.4s ease;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: var(--primary-soft);
    color: var(--panel-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 18px 36px var(--shadow-soft);
    transition: transform 0.2s ease, box-shadow 0.3s ease, background 0.25s ease, border 0.25s ease;
}

.theme-toggle:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 26px 60px var(--shadow-soft);
}

.theme-toggle:active {
    transform: translateY(0);
}

.theme-toggle__icon {
    font-size: 1.4rem;
}

#filter-toggle.is-active {
    background: var(--primary);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 18px 36px rgba(10, 159, 191, 0.32);
}

.filter-panel {
    position: absolute;
    top: calc(var(--nav-height) + 1.2rem);
    right: clamp(1.2rem, 6vw, 3rem);
    width: clamp(280px, 28vw, 340px);
    border-radius: 1.5rem;
    background: var(--surface-1);
    border: 1px solid var(--panel-border);
    box-shadow: 0 26px 70px var(--shadow-soft);
    backdrop-filter: blur(22px);
    z-index: 20;
}

.filter-panel.hidden {
    display: none;
}

.filter-panel__content {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    padding: 1.2rem 1.4rem 1.3rem;
}

.filter-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.filter-panel__header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.filter-close {
    width: 2.4rem;
    height: 2.4rem;
}

.filter-status {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.filter-section {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.filter-section h3 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--muted-strong);
}

.filter-section__hint {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--muted);
}

.filter-option-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.filter-option {
    padding: 0.55rem 0.9rem;
    border-radius: 0.95rem;
    border: 1px solid rgba(9, 121, 154, 0.2);
    background: var(--surface-2);
    color: var(--panel-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.2s ease, border 0.2s ease, box-shadow 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.filter-option:hover {
    transform: translateY(-1px);
    background: rgba(10, 159, 191, 0.12);
    border-color: rgba(10, 159, 191, 0.35);
}

.filter-option.is-active {
    background: linear-gradient(135deg, var(--primary), var(--primary-deep));
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 20px 45px rgba(10, 159, 191, 0.35);
}

.filter-option.is-pending {
    background: rgba(10, 159, 191, 0.18);
    border-color: rgba(10, 159, 191, 0.4);
}

.filter-option .material-symbols-rounded,
.filter-footer .material-symbols-rounded {
    font-size: 1.35rem;
}

.filter-footer {
    display: flex;
    justify-content: flex-end;
}

.filter-footer .secondary {
    padding: 0.55rem 1.2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.outline-stage {
    position: absolute;
    top: calc(var(--nav-height) + 1.8rem);
    left: clamp(1.2rem, 6vw, 3.2rem);
    right: clamp(1.2rem, 6vw, 3.2rem);
    bottom: clamp(4.5rem, 8vh, 5.6rem);
    overflow-y: auto;
    padding: clamp(1.2rem, 4vw, 2rem);
    border-radius: 1.5rem;
    background: var(--surface-1);
    border: 1px solid var(--panel-border);
    box-shadow: 0 28px 70px var(--shadow-soft);
}

.sunburst-stage {
    position: absolute;
    top: calc(var(--nav-height) + 1.8rem);
    left: clamp(1.2rem, 6vw, 3.2rem);
    right: clamp(1.2rem, 6vw, 3.2rem);
    bottom: clamp(4.5rem, 8vh, 5.6rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 3vw, 1.4rem);
    border-radius: 1.5rem;
    background: var(--surface-1);
    border: 1px solid var(--panel-border);
    box-shadow: 0 28px 70px var(--shadow-soft);
    overflow: hidden;
}

.sunburst-stage.hidden {
    display: none;
}

#sunburst {
    width: 100%;
    height: 100%;
}

.sunburst-layer {
    font-family: inherit;
}

.sunburst-arc {
    stroke: var(--surface-1);
    stroke-width: 1px;
    cursor: pointer;
    transition: stroke 0.2s ease, fill-opacity 0.2s ease, transform 0.25s ease;
}

.sunburst-arc:hover {
    stroke-width: 2px;
}

.sunburst-arc.is-selected {
    stroke: var(--primary);
    stroke-width: 2.4px;
}

.sunburst-label {
    font-size: 0.76rem;
    font-weight: 600;
    fill: var(--panel-text);
    pointer-events: none;
    text-shadow: 0 0 14px rgba(0, 0, 0, 0.18);
}

.sunburst-center {
    fill: var(--surface-2);
    cursor: pointer;
    stroke: var(--panel-border);
    stroke-width: 1.2px;
    transition: fill 0.2s ease;
}

.sunburst-center.is-selected {
    stroke: var(--primary);
    stroke-width: 2px;
}

.sunburst-center:not(.has-parent) {
    cursor: default;
}

.sunburst-center:hover {
    fill: var(--surface-hover, rgba(255, 255, 255, 0.08));
}

.sunburst-center-label {
    font-size: 0.85rem;
    font-weight: 600;
    fill: var(--panel-text);
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}

.outline-stage.hidden {
    display: none;
}

.outline-content {
    font-size: 0.95rem;
    line-height: 1.58;
    color: var(--panel-text);
}

.outline-empty {
    margin: 0;
    font-size: 0.92rem;
    color: var(--muted);
}

.outline-root,
.outline-list {
    list-style: none;
    margin: 0;
    padding-left: 1.7rem;
    position: relative;
}

.outline-root {
    padding-left: 0;
}

.outline-list--root {
    padding-left: 1.4rem;
}

.outline-list::before {
    content: '';
    position: absolute;
    top: 0.8rem;
    bottom: 0.4rem;
    left: 0.45rem;
    border-left: 2px solid var(--outline-line, rgba(10, 159, 191, 0.25));
}

.outline-root::before,
.outline-list--root::before {
    top: 1rem;
}

.outline-node {
    position: relative;
    padding-bottom: 0.3rem;
}

.outline-list>.outline-node {
    padding-left: 1.2rem;
}

.outline-list>.outline-node::before {
    content: '';
    position: absolute;
    top: 1.35rem;
    left: -0.75rem;
    width: 1.15rem;
    border-top: 2px solid var(--outline-line, rgba(10, 159, 191, 0.25));
}

.outline-list>.outline-node:last-child::after {
    content: '';
    position: absolute;
    left: -0.75rem;
    bottom: 0;
    width: 1.15rem;
    height: calc(100% - 1.35rem);
    background: var(--surface-1);
    pointer-events: none;
}

.outline-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.35rem 0.5rem 0.35rem 0.65rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: background 0.18s ease, box-shadow 0.18s ease;
}

.outline-item:hover,
.outline-item:focus-visible {
    outline: none;
    background: rgba(10, 159, 191, 0.12);
    box-shadow: inset 0 0 0 1px rgba(10, 159, 191, 0.18);
}

.outline-item.is-selected {
    background: rgba(10, 159, 191, 0.18);
    box-shadow: inset 3px 0 0 rgba(10, 159, 191, 0.6);
}

.outline-item__name {
    font-weight: 600;
    color: var(--panel-text);
}

.outline-item__note {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.82rem;
    color: var(--muted-strong);
    line-height: 1.45;
    white-space: pre-wrap;
}

.tree-hint {
    position: absolute;
    top: calc(var(--nav-height) + 0.85rem);
    right: clamp(2.2rem, 6vw, 3.8rem);
    padding: 0.55rem 1rem;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted-strong);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: 0 16px 40px var(--shadow-soft);
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.tree-hint.hidden {
    opacity: 0;
}

.control-bar {
    position: absolute;
    left: 50%;
    bottom: clamp(1.2rem, 5vw, 2.6rem);
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    background: var(--surface-1);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 22px 52px var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.control-btn {
    border: none;
    width: 2.55rem;
    height: 2.55rem;
    border-radius: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--control-button-bg);
    color: var(--panel-text);
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.2s ease;
}

.control-btn .material-symbols-rounded {
    font-size: 1.45rem;
}

.control-btn:hover {
    transform: translateY(-1px);
    background: var(--control-button-hover-bg);
    box-shadow: 0 12px 26px var(--shadow-soft);
}

.control-btn:active {
    transform: translateY(0);
}

.control-bar.is-outline {
    gap: 0.35rem;
}

.control-btn:focus-visible {
    outline: 3px solid rgba(10, 159, 191, 0.6);
    outline-offset: 2px;
}

.control-btn--reset {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 0.95rem;
    width: auto;
    min-width: 0;
    height: 2.55rem;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
}

.control-reset__icon {
    font-size: 1.35rem;
    line-height: 1;
}

.control-reset__label {
    letter-spacing: 0.01em;
}

#tree {
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: grab;
}

#tree.is-grabbing,
.is-grabbing {
    cursor: grabbing !important;
}

text {
    text-anchor: middle;
    dominant-baseline: middle;
}

.node {
    cursor: pointer;
    transition: transform 0.18s ease, filter 0.25s ease;
}

.node:hover .name-plate {
    stroke: var(--primary);
    stroke-width: 2.6px;
    fill: var(--node-selected-fill);
    filter: drop-shadow(0 22px 40px rgba(10, 159, 191, 0.3));
}

.name-plate {
    fill: var(--node-fill);
    stroke: var(--node-stroke);
    stroke-width: 1.8px;
    filter: drop-shadow(0 18px 32px rgba(10, 159, 191, 0.18));
    transition: stroke 0.2s ease, fill 0.2s ease, filter 0.2s ease;
}

.node.is-selected .name-plate {
    stroke: var(--primary);
    stroke-width: 2.6px;
    fill: var(--node-selected-fill);
    filter: drop-shadow(0 24px 45px rgba(10, 159, 191, 0.32));
}

.node-label-fo {
    overflow: visible;
    pointer-events: none;
}

.node-label-html {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--muted-strong);
    pointer-events: none;
    line-height: 1.35;
    white-space: nowrap;
}

.node-label-html .node-name {
    display: block;
}

.node-label-html .node-note {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.02em;
    margin-top: 2px;
}


.link {
    fill: none;
    stroke: var(--link-stroke);
    stroke-width: 2.4px;
}

.adoption-connection {
    pointer-events: none;
}

.adoption-layer {
    pointer-events: none;
}

.adoption-connection .adoption-link {
    fill: none;
    stroke-width: 2.2px;
    opacity: 0.75;
    stroke-linecap: round;
}

.adoption-connection .adoption-arrow {
    stroke: none;
    opacity: 0.85;
}

.adoption-connection.adoption-in .adoption-link,
.adoption-connection.adoption-in .adoption-arrow {
    stroke: #ff8a65;
    fill: #ff8a65;
}

.adoption-connection.adoption-out .adoption-link,
.adoption-connection.adoption-out .adoption-arrow {
    stroke: #ff8a65;
    fill: #ff8a65;
}

.generation-layer {
    pointer-events: none;
}

.generation-line {
    stroke: var(--generation-line);
    stroke-width: 1;
    stroke-dasharray: 6 10;
    stroke-linecap: round;
}

.generation-label {
    fill: var(--generation-text);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: fill 0.4s ease;
}

.generation-label-left {
    text-anchor: end;
}

.generation-label-right {
    text-anchor: start;
}

.node-dialog {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.node-dialog.hidden {
    display: none;
}

.node-dialog__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 11, 18, 0.56);
    backdrop-filter: blur(8px);
}

.node-dialog__content {
    position: relative;
    width: min(540px, 92vw);
    max-height: min(82vh, 640px);
    padding: clamp(1.6rem, 4vw, 2.3rem);
    border-radius: 1.6rem;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    box-shadow: 0 40px 110px var(--shadow-strong);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    color: var(--panel-text);
}

.close-dialog {
    position: absolute;
    display: grid;
    place-items: center;
    background: transparent;
    padding: 0;
    top: 1rem;
    right: 1rem;
    border: none;
    color: var(--panel-text);
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 50%;
    font-size: 1.35rem;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease;
}

.close-dialog:hover {
    transform: translateY(-2px);
}

.dialog-header {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.admin-login {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.admin-login.hidden {
    display: none;
}

.admin-login__backdrop {
    position: absolute;
    inset: 0;
    background: var(--bg);
    backdrop-filter: blur(25px);
    z-index: -1;
}

.admin-login__panel {
    position: relative;
    width: min(420px, 90vw);
    border-radius: 1.4rem;
    padding: clamp(1.6rem, 4vw, 2.1rem);
    background: var(--panel);
    border: 1px solid var(--panel-border);
    box-shadow: 0 32px 90px var(--shadow-strong);
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    color: var(--panel-text);
}

.admin-login__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.admin-login__hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.admin-login__form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.admin-login__field {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.admin-pin-input-single {
    width: 100%;
    padding: 0.9rem 3.2rem 0.9rem 1.2rem;
    border-radius: 1.2rem;
    font-family: inherit;
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-strong);
    background: var(--surface-1);
    border: 2px solid var(--panel-border);
    box-shadow: inset 0 2px 5px var(--shadow-soft);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}

.admin-pin-input-single:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft), inset 0 2px 5px var(--shadow-soft);
}

.password-toggle {
    position: absolute;
    right: 0.8rem;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, transform 0.2s ease;
    z-index: 2;
}

.password-toggle:hover {
    color: var(--primary);
    transform: scale(1.1);
}

.password-toggle:active {
    transform: scale(0.95);
}

:root[data-theme='dark'] .admin-login__panel {
    box-shadow: 0 36px 120px rgba(5, 7, 16, 0.75);
}

.admin-login__error {
    min-height: 1.2rem;
    margin: 0;
    color: #d64545;
    font-weight: 600;
}

.session-timer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem;
    background: var(--primary-soft);
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    color: var(--primary);
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px var(--shadow-soft);
}

.session-timer.warning {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    animation: timerPulse 1s infinite;
}

@keyframes timerPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

body.is-admin-login-open {
    overflow: hidden;
}

.admin-list-locked {
    opacity: 0.65;
}

.admin-hidden {
    display: none !important;
}

.dialog-label {
    margin: 0;
    letter-spacing: 0.18em;
    font-size: 0.68rem;
    text-transform: uppercase;
    color: var(--muted);
}

.dialog-title {
    margin: 0;
    font-size: clamp(1.3rem, 3.4vw, 1.8rem);
    font-weight: 700;
}

.dialog-note {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
    white-space: pre-wrap;
}

.dialog-note:not(:empty) {
    margin-top: 0.85rem;
    padding: 0.95rem 1.15rem;
    border-radius: 1rem;
    background: var(--surface-2);
    border: 1px solid var(--panel-border);
    color: var(--muted-strong);
    box-shadow: 0 18px 36px var(--shadow-soft);
}

:root[data-theme='dark'] .dialog-note:not(:empty) {
    background: rgba(46, 51, 78, 0.85);
    border-color: rgba(166, 142, 255, 0.28);
}

.dialog-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.button-label {
    display: inline-block;
    line-height: 1;
}

.dialog-action-button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border: none;
    box-shadow: 0 10px 24px rgba(30, 37, 94, 0.12);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.dialog-action-button .material-symbols-rounded {
    font-size: 1.15rem;
    line-height: 1;
}

.dialog-action-button .button-label {
    white-space: nowrap;
}

.dialog-action-button.ghost {
    background: linear-gradient(135deg, rgba(206, 217, 255, 0.95), rgba(167, 182, 255, 0.85));
    color: #2d1f55;
    border: 1px solid rgba(120, 129, 220, 0.32);
}

:root[data-theme='dark'] .dialog-action-button.ghost {
    background: linear-gradient(135deg, rgba(74, 84, 158, 0.65), rgba(108, 120, 208, 0.56));
    color: #f2f1ff;
    border-color: rgba(133, 144, 226, 0.46);
}

.dialog-action-button.secondary {
    background: linear-gradient(135deg, #0a78a8, #0fc2ae);
    color: #ffffff;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1;
}

.status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-badge--alive {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.status-badge--alive .status-dot {
    background-color: #16a34a;
}

:root[data-theme='dark'] .status-badge--alive {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.3);
}

.status-badge--dead {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

:root[data-theme='dark'] .status-badge--dead {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

.dialog-action-button.danger {
    background: linear-gradient(135deg, #ff6a88, #c73a8d);
    color: #ffffff;
}

.dialog-action-button.danger-soft {
    background: linear-gradient(135deg, #ffa07a, #e06050);
    color: #ffffff;
}

:root[data-theme='dark'] .dialog-action-button.danger-soft {
    background: linear-gradient(135deg, #c75a3a, #a03828);
}

.dialog-delete-actions {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin: 1rem 0;
    padding: 0.85rem;
    border-radius: 1.1rem;
    background: rgba(255, 106, 136, 0.06);
    border: 1px solid rgba(255, 106, 136, 0.18);
}

.dialog-delete-actions h3 {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #c73a5e;
    text-transform: uppercase;
}

:root[data-theme='dark'] .dialog-delete-actions {
    background: rgba(255, 106, 136, 0.08);
    border-color: rgba(255, 106, 136, 0.22);
}

:root[data-theme='dark'] .dialog-delete-actions h3 {
    color: #ff8fa8;
}

.dialog-action-button:hover,
.dialog-action-button:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 22px 44px rgba(30, 37, 94, 0.28);
    filter: brightness(1.02);
    outline: 3px solid rgba(32, 38, 102, 0.22);
    outline-offset: 2px;
}

.dialog-action-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.dialog-section {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.relation-section {
    gap: 0.6rem;
}

.relation-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.relation-lineage {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.relation-lineage .relation-group {
    flex: 1 1 0;
    min-width: 0;
}

.relation-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid rgba(76, 56, 158, 0.18);
    border-radius: 0.85rem;
    background: var(--surface-2);
}

.relation-group__title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted-strong);
}

.relation-group__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.relation-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.85rem 0.25rem 0.35rem;
    min-height: 2.2rem;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--panel-border);
    font-weight: 600;
    color: var(--text-strong);
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.relation-button--alive {
    background: rgba(34, 197, 94, 0.08); /* Very subtle green */
    border-color: rgba(34, 197, 94, 0.15);
}

.relation-button--deceased {
    background: rgba(239, 68, 68, 0.08); /* Very subtle red */
    border-color: rgba(239, 68, 68, 0.15);
}

.relation-button--alive:hover {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.3);
}

.relation-button--deceased:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
}

.relation-button__image {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    background: var(--surface-1);
}

.relation-button__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 0.4rem;
    flex-shrink: 0;
}

.relation-button__name {
    font-size: 0.9rem;
    white-space: nowrap;
}

.relation-button--adopted {
    color: #ffffff;
}

.relation-button--adopted-in {
    background: #ff8a65;
    border-color: #ff8a65;
}

.relation-button--adopted-out {
    background: #f6b48f;
    border-color: #f6b48f;
}

.relation-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px var(--shadow-soft);
}

.relation-button--adopted-in:hover {
    box-shadow: 0 12px 26px rgba(255, 138, 101, 0.35);
}

.relation-button--adopted-out:hover {
    box-shadow: 0 12px 26px rgba(246, 180, 143, 0.35);
}

.dialog-section h3 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--muted-strong);
}


.adoption-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: stretch;
}

.adoption-action-button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.6rem 1rem;
    border-radius: 1.2rem;
    flex: 1 0 auto;
    justify-content: center;
    border: 1px solid transparent;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(208, 213, 255, 0.65), rgba(198, 205, 255, 0.45));
    color: #2a2361;
    box-shadow: 0 14px 28px rgba(30, 37, 94, 0.12);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.adoption-action-button .material-symbols-rounded {
    font-size: 1.2rem;
    line-height: 1;
}

.adoption-action-button.adoption-action-button--in {
    background: linear-gradient(135deg, rgba(255, 207, 186, 0.95), rgba(255, 172, 132, 0.92));
    border-color: rgba(255, 158, 116, 0.6);
    color: #5f1d00;
}

.adoption-action-button.adoption-action-button--out {
    background: linear-gradient(135deg, rgba(255, 224, 201, 0.95), rgba(246, 189, 150, 0.92));
    border-color: rgba(246, 180, 143, 0.55);
    color: #5b2f0f;
}

.adoption-action-button.adoption-action-button--cancel {
    background: linear-gradient(135deg, rgba(221, 230, 255, 0.9), rgba(200, 208, 255, 0.75));
    border-color: rgba(153, 162, 238, 0.45);
    color: #1f2468;
}

:root[data-theme='dark'] .adoption-action-button {
    color: #f4f3ff;
    box-shadow: none;
}

.adoption-action-button:hover,
.adoption-action-button:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 18px 36px rgba(30, 37, 94, 0.2);
    filter: brightness(1.05);
}

.adoption-action-button:focus-visible {
    outline: 3px solid rgba(255, 172, 132, 0.35);
    outline-offset: 2px;
}

.adoption-action-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

:root[data-theme='dark'] .adoption-action-button:focus-visible {
    outline-color: rgba(255, 206, 150, 0.4);
}

.adoption-hint {
    font-size: 0.85rem;
    color: var(--muted);
}

.adoption-list {
    margin: 0;
    padding-left: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.88rem;
    color: var(--muted);
}

.adoption-list .empty {
    list-style: none;
    padding-left: 0;
    color: var(--muted);
    font-style: italic;
}

.adoption-list button {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
}

.adoption-list .adoption-remove-button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 106, 136, 0.15);
    border: 1px solid rgba(255, 106, 136, 0.28);
    color: #a30f3c;
    margin-left: 0.45rem;
}

.adoption-list .adoption-remove-button .material-symbols-rounded {
    font-size: 1.05rem;
}

.adoption-list .adoption-remove-button .button-label {
    font-size: 0.78rem;
    font-weight: 600;
}

.adoption-list .adoption-remove-button:hover,
.adoption-list .adoption-remove-button:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(200, 29, 119, 0.2);
}

.adoption-list .adoption-remove-button:focus-visible {
    outline: 3px solid rgba(200, 29, 119, 0.32);
    outline-offset: 2px;
}

:root[data-theme='dark'] .adoption-list .adoption-remove-button {
    background: rgba(255, 106, 136, 0.18);
    border-color: rgba(255, 106, 136, 0.32);
    color: #ffb4c4;
}

.adoption-item__title {
    display: inline-block;
    font-weight: 600;
    color: var(--text-strong);
}

.adoption-detail {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.8rem;
    color: var(--muted-strong);
}

:root[data-theme='dark'] .adoption-hint {
    color: var(--muted);
}

button {
    border: none;
    border-radius: 0.95rem;
    padding: 0.7rem 1.15rem;
    font: inherit;
    font-weight: 600;
    letter-spacing: 0.015em;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px var(--shadow-soft);
}

button:active {
    transform: translateY(0);
}

button:disabled,
button:disabled:hover,
button:disabled:active {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
    box-shadow: none;
}

.icon-button {
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-deep));
    color: #ffffff;
    box-shadow: 0 24px 52px rgba(10, 159, 191, 0.35);
}

.secondary {
    background: linear-gradient(135deg, rgba(6, 59, 92, 0.95), rgba(10, 159, 191, 0.65));
    color: #ffffff;
    box-shadow: 0 20px 40px rgba(6, 59, 92, 0.28);
}

.ghost {
    background: var(--primary-soft);
    color: var(--text-strong);
    border: 1px solid rgba(9, 121, 154, 0.22);
}

:root[data-theme='dark'] .ghost {
    background: rgba(76, 213, 255, 0.14);
    color: var(--panel-text);
    border-color: rgba(76, 213, 255, 0.28);
}

.danger {
    background: linear-gradient(135deg, #ff5f6d, #c81d77);
    color: #ffffff;
    box-shadow: 0 22px 48px rgba(200, 29, 119, 0.32);
}

/* Family data toggle */
.family-data-toggle {
    background: var(--primary-soft);
    color: var(--text-strong);
    border: 1px solid rgba(9, 121, 154, 0.22);
    transition: transform 0.18s ease, background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.family-data-toggle.is-active {
    background: linear-gradient(135deg, #0a9fbf, #0fc2ae);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 14px 32px rgba(10, 159, 191, 0.35);
}

:root[data-theme='dark'] .family-data-toggle {
    background: rgba(76, 213, 255, 0.14);
    color: var(--panel-text);
    border-color: rgba(76, 213, 255, 0.28);
}

:root[data-theme='dark'] .family-data-toggle.is-active {
    background: linear-gradient(135deg, #0a9fbf, #0fc2ae);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 14px 32px rgba(10, 159, 191, 0.25);
}

.dialog-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1.05rem;
    border-radius: 1.25rem;
    background: var(--surface-2);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.dialog-form.hidden {
    display: none;
}

.dialog-form h3 {
    margin: 0;
    font-size: 1.05rem;
}

.dialog-form label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted);
}

.dialog-form input,
.dialog-form textarea,
.dialog-form select {
    border-radius: 0.85rem;
    border: 1px solid rgba(9, 121, 154, 0.22);
    padding: 0.72rem 0.9rem;
    font: inherit;
    background: rgba(255, 255, 255, 0.92);
    color: var(--panel-text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.dialog-form input:focus,
.dialog-form textarea:focus,
.dialog-form select:focus {
    outline: none;
    border-color: rgba(10, 159, 191, 0.55);
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 4px rgba(10, 159, 191, 0.2);
}

.dialog-form textarea {
    resize: vertical;
}

.dialog-form,
.dialog-form input,
.dialog-form textarea,
.dialog-form select {
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

:root[data-theme='dark'] .dialog-form {
    background: rgba(18, 36, 50, 0.78);
    border: 1px solid rgba(76, 213, 255, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

:root[data-theme='dark'] .dialog-form label {
    color: var(--muted);
}

:root[data-theme='dark'] .dialog-form input,
:root[data-theme='dark'] .dialog-form textarea,
:root[data-theme='dark'] .dialog-form select {
    background: rgba(5, 21, 35, 0.62);
    border: 1px solid rgba(76, 213, 255, 0.24);
    color: var(--panel-text);
}

:root[data-theme='dark'] .dialog-form input:focus,
:root[data-theme='dark'] .dialog-form textarea:focus,
:root[data-theme='dark'] .dialog-form select:focus {
    border-color: rgba(76, 213, 255, 0.65);
    background: rgba(5, 21, 35, 0.78);
    box-shadow: 0 0 0 4px rgba(76, 213, 255, 0.28);
}

.dialog-status {
    min-height: 1.4rem;
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.dialog-status[data-state='success'] {
    color: var(--accent);
}

.dialog-status[data-state='error'] {
    color: #ff8a80;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

@media (max-width: 960px) {
    .site-header {
        height: auto;
        padding: 0.85rem 1.4rem;
    }

    .site-header__inner {
        gap: 0.8rem;
    }

    .tree-stage {
        padding-top: calc(var(--nav-height) + 2.2rem);
    }
}

/* Dialog Tabs */
.dialog-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--panel-border);
    margin: 0.8rem 0 0;
}

.dialog-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.65rem 1rem;
    background: none;
    border: none;
    border-bottom: 2.5px solid transparent;
    margin-bottom: -2px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    border-radius: 8px 8px 0 0;
}

.dialog-tab:hover {
    color: var(--text-primary);
    background: var(--surface-2);
}

.dialog-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

.dialog-tab-panel {
    padding-top: 0.8rem;
}

.dialog-tab-panel.hidden {
    display: none;
}
/* Full-screen Menu */
.fullscreen-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s;
}

.fullscreen-menu:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.fullscreen-menu__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 18, 33, 0.85);
    backdrop-filter: blur(20px);
}

.fullscreen-menu__content {
    position: relative;
    width: 90%;
    max-width: 800px;
    z-index: 2;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.fullscreen-menu:not(.hidden) .fullscreen-menu__content {
    transform: translateY(0);
}

.fullscreen-menu__close {
    position: absolute;
    top: -4rem;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.fullscreen-menu__close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.fullscreen-menu__title {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 2.5rem;
    text-align: center;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.fullscreen-menu__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
}

.menu-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    padding: 2rem 1rem;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(108, 74, 209, 0.3);
}

.menu-item .material-symbols-rounded {
    font-size: 2.5rem;
    color: var(--primary);
}

.menu-item span:not(.material-symbols-rounded) {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Logs Modal */
.logs-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logs-modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
}

.logs-modal__panel {
    position: relative;
    width: 95%;
    max-width: 900px;
    max-height: 85vh;
    background: var(--surface-1);
    border: 1px solid var(--panel-border);
    border-radius: 2rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 40px 100px rgba(0,0,0,0.4);
}

.logs-modal__header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logs-modal__header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.logs-modal__content {
    padding: 1.5rem 2rem;
    overflow-y: auto;
    flex: 1;
}

.logs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.logs-table th {
    text-align: left;
    padding: 1rem;
    background: var(--surface-2);
    color: var(--muted-strong);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.logs-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--panel-border);
}

.logs-table tr:hover {
    background: var(--primary-soft);
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge--success { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.status-badge--warning { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }

/* Security Logs UI */
.log-tab {
    padding: 0.6rem 1.2rem;
    border: none;
    background: transparent;
    color: var(--muted-strong);
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.log-tab.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.log-panel tr:hover {
    background: var(--primary-soft);
}

.log-panel td, .log-panel th {
    border-bottom: 1px solid var(--panel-border);
}

.log-status-blocked {
    color: #ef4444;
    font-weight: 700;
}

.log-status-active {
    color: #22c55e;
}

/* Date Input Clear Button */
.input-with-action {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.input-with-action input {
    flex: 1;
}
.clear-date-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 0.6rem;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.4rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.clear-date-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    transform: scale(1.05);
}
:root[data-theme='dark'] .clear-date-btn {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Fullscreen Admin Menu */
.fullscreen-menu {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s;
    overflow-y: auto;
}

.fullscreen-menu:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.fullscreen-menu__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 12, 24, 0.45);
    backdrop-filter: blur(40px) saturate(180%);
    z-index: -1;
}

.fullscreen-menu__content {
    width: 100%;
    max-width: 1100px;
    margin: auto;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 2.5rem;
    padding: 3rem;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.3);
    position: relative;
    transform: translateY(30px) scale(0.95);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fullscreen-menu:not(.hidden) .fullscreen-menu__content {
    transform: translateY(0) scale(1);
}

.fullscreen-menu__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--panel-border);
}

.menu-brand {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.menu-brand .material-symbols-rounded {
    font-size: 2.8rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-deep));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.menu-brand h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.close-menu-btn {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    border: 1px solid var(--panel-border);
    background: var(--surface-2);
    color: var(--panel-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-menu-btn:hover {
    transform: rotate(90deg);
    background: var(--primary-soft);
    color: var(--primary);
}

.menu-grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
}

.menu-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--muted-strong);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
}

/* Stats Section */
.menu-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.menu-stat-card {
    background: var(--surface-2);
    border: 1px solid var(--panel-border);
    padding: 1.2rem;
    border-radius: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    transition: transform 0.3s ease;
}

.menu-stat-card:hover { rotate: -1deg; transform: translateY(-4px); }

.menu-stat-card .material-symbols-rounded {
    font-size: 1.8rem;
}

.menu-stat-card.total { color: var(--primary); }
.menu-stat-card.alive { color: #22c55e; }
.menu-stat-card.deceased { color: #ef4444; }

.stat-value {
    display: block;
    font-size: 1.6rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0.8;
}

/* Action Cards */
.menu-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
}

.menu-action-card {
    height: 120px;
    background: var(--surface-2);
    border: 1px solid var(--panel-border);
    border-radius: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font: inherit;
    color: var(--panel-text);
}

.menu-action-card .material-symbols-rounded {
    font-size: 2.2rem;
    transition: transform 0.3s ease;
}

.menu-action-card:hover {
    background: var(--primary);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 15px 35px var(--primary-soft);
}

.menu-action-card:hover .material-symbols-rounded {
    transform: scale(1.1) translateY(-2px);
}

.menu-action-card.secondary-toggle:hover {
    background: var(--accent);
    box-shadow: 0 15px 35px rgba(255, 131, 92, 0.3);
}

/* Advanced Items */
.menu-advanced-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.menu-advanced-item {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 1.2rem;
    background: var(--surface-2);
    border: 1px solid var(--panel-border);
    border-radius: 1.5rem;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: left;
    width: 100%;
}

.menu-advanced-item:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    transform: translateX(8px);
}

.menu-advanced-item .material-symbols-rounded {
    font-size: 2rem;
    color: var(--primary);
}

.item-title {
    display: block;
    font-size: 1rem;
    font-weight: 700;
}

.item-desc {
    font-size: 0.8rem;
    color: var(--muted);
}

/* Session Section */
.session-info-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--surface-2);
    border-radius: 1.8rem;
    margin-bottom: 2rem;
}

.timer-circle {
    position: relative;
    width: 4rem;
    height: 4rem;
}

.timer-circle svg {
    transform: rotate(-90deg);
}

.circle-bg {
    fill: none;
    stroke: var(--panel-border);
    stroke-width: 3;
}

.circle {
    fill: none;
    stroke: var(--primary);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray 1s linear;
}

#menu-timer-display {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.session-text {
    display: flex;
    flex-direction: column;
}

.session-label {
    font-size: 0.95rem;
    font-weight: 700;
}

.session-hint {
    font-size: 0.75rem;
    color: var(--muted);
}

.menu-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    width: 100%;
    padding: 1.2rem;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 1.5rem;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
}

.menu-logout-btn:hover {
    background: #ef4444;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.3);
}

/* Staggered Animation */
.fullscreen-menu:not(.hidden) .menu-section {
    animation: slideUpFade 0.6s cubic-bezier(0.23, 1, 0.32, 1) both;
}

.stats-section { animation-delay: 0.1s !important; }
.tools-section { animation-delay: 0.2s !important; }
.advanced-section { animation-delay: 0.3s !important; }
.session-section { animation-delay: 0.4s !important; }

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 900px) {
    .menu-grid-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .fullscreen-menu__content {
        padding: 2rem;
        margin-top: 2rem;
    }
}

@media (max-width: 600px) {
    .menu-stats-grid {
        grid-template-columns: 1fr;
    }
    .menu-actions-grid {
        grid-template-columns: 1fr;
    }
}

