/* 登录状态、示例模式提示、加锁标注、登录与退出页 */
.header-actions:has(.access-user) {
    display: flex;
    align-items: center;
    gap: 8px;
}

.access-user {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    white-space: nowrap;
}

/* 账号按钮只占头像宽度，全名在下拉菜单中显示，不挤占导航 */
.access-menu {
    position: relative;
}

.access-chip {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px 4px 2px 2px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-color);
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.access-chip::-webkit-details-marker {
    display: none;
}

.access-chip:hover,
.access-menu[open] .access-chip {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.access-chip:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.access-caret {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.access-menu[open] .access-caret {
    transform: rotate(180deg);
}

.access-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: hsl(var(--avatar-hue, 225) 55% 52%);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    object-fit: cover;
}

img.access-avatar {
    background: var(--bg-card);
}

.access-avatar.is-large {
    width: 44px;
    height: 44px;
    font-size: 18px;
}

.access-pop {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1001;
    width: max-content;
    min-width: 200px;
    max-width: min(300px, calc(100vw - 24px));
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 12px);
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    white-space: normal;
}

.access-pop-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 10px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.access-pop-who {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.access-pop-who strong {
    color: var(--text-primary);
    font-size: 14px;
    overflow-wrap: anywhere;
}

.access-pop-who span {
    color: var(--text-muted);
    font-size: 12px;
}

.access-pop-link {
    display: block;
    padding: 8px 10px;
    border-radius: var(--radius-md, 8px);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.access-pop-link:hover {
    background: var(--bg-hover, #f3f4f6);
    color: var(--primary-color);
}

.access-link {
    padding: 5px 12px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--bg-color);
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.access-link:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.access-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 16px;
    padding: 10px 14px;
    border: 1px solid #fde68a;
    border-radius: 10px;
    background: #fffbeb;
    color: #92400e;
    font-size: 13px;
    line-height: 1.5;
}

.access-banner-btn {
    flex-shrink: 0;
    padding: 4px 14px;
    border-radius: 14px;
    background: #f59e0b;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}

.access-banner-btn:hover {
    background: #d97706;
}

/* 加锁标注：导航下拉项、首页卡片角标、三维标题 */
.dropdown-badge.access-badge {
    background: #fef3c7;
    color: #92400e;
}

.dropdown-badge.access-badge-paused {
    background: var(--bg-muted, #f3f4f6);
    color: var(--text-muted);
}

.available-badge.access-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.35);
}

.available-badge.access-badge-paused {
    background: linear-gradient(135deg, #9ca3af, #6b7280);
    box-shadow: none;
}

.viz3d-flag.access-badge {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

.viz3d-flag.access-badge-paused {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #6b7280;
}

/* 登录、退出、拦截页 */
.doc-page:has(.access-card) {
    max-width: 460px;
    margin-top: 24px;
}

.access-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 20px;
}

.access-form .form-input {
    margin-bottom: 8px;
}

.access-check {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 2px 0 6px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.access-error {
    margin: 0 0 4px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-size: 13px;
}

.access-submit {
    margin-top: 6px;
    width: 100%;
}

.access-note {
    margin: 16px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #eef2f7;
    font-size: 13px;
    color: var(--text-secondary);
}

.access-foot {
    margin: 18px 0 0;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-muted);
}

.access-foot a {
    margin-left: 6px;
    color: var(--primary-color);
}

.access-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.access-actions form {
    margin: 0;
}

.access-actions a {
    display: inline-block;
    text-decoration: none;
}

.access-apply {
    margin: 18px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f5f8ff;
    border: 1px solid #dbe4ff;
    font-size: 13px;
    line-height: 1.65;
    color: var(--text-secondary);
}

.access-apply a {
    color: var(--primary-color);
}

/* 桌面版授权页 */
.doc-page:has(.license-card) {
    max-width: 560px;
}

.license-card [hidden] {
    display: none !important;
}

.license-state.is-ok {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
    font-weight: 600;
}

.license-state.is-off {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.license-info {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 16px;
    margin: 16px 0 0;
    font-size: 14px;
}

.license-info dt {
    color: var(--text-muted);
}

.license-info dd {
    margin: 0;
    color: var(--text-primary);
    word-break: break-word;
}

.license-title {
    margin: 24px 0 4px;
    font-size: 15px;
}

.license-hint {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.license-machine {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.license-machine code {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: 15px;
    letter-spacing: 0.04em;
    user-select: all;
}

.license-ok {
    margin: 16px 0 0;
    padding: 8px 12px;
    border-radius: 8px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    font-size: 13px;
}

.license-card .access-error {
    margin-top: 16px;
}

/* 账号申请页 */
.doc-page:has(.access-request) {
    max-width: 520px;
}

.access-req {
    margin-left: 3px;
    color: #dc2626;
}

.access-opt {
    margin-left: 8px;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
}

.access-contact {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 4px 0 10px;
    padding: 10px 14px 4px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.access-contact legend {
    padding: 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
}

.access-modules {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px 12px;
    margin-bottom: 8px;
}

.access-modules .access-check {
    margin: 2px 0;
}

.access-purpose {
    min-height: 72px;
    resize: vertical;
    font-family: inherit;
}

.access-trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.access-done {
    margin: 20px 0 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    font-size: 14px;
    line-height: 1.6;
}

.access-request .doc-heading a,
.access-foot a {
    color: var(--primary-color);
}

/* 首页「可用功能」标题右侧的需登录说明 */
.section-header:has(.access-notice) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 24px;
}

.access-notice {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    color: #475569;
    font-size: 13px;
    line-height: 1.5;
}

.access-notice-icon {
    flex: none;
    width: 15px;
    height: 15px;
    color: #4f6bed;
}

.access-notice-text {
    min-width: 0;
}

.access-notice-more {
    flex: none;
    margin-left: 4px;
    padding: 3px 10px;
    border: 1px solid #c7d7fe;
    border-radius: 999px;
    background: #f5f8ff;
    color: #3b5bdb;
    font: inherit;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.access-notice-more:hover,
.access-notice-more[aria-expanded="true"] {
    background: #e8eefc;
    border-color: #a5b8fb;
}

.access-notice-more::after {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    margin: 0 0 2px 6px;
    border-right: 1.6px solid currentColor;
    border-bottom: 1.6px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.15s;
}

a.access-notice-more {
    text-decoration: none;
}

a.access-notice-more::after {
    display: none;
}

.access-notice-more[aria-expanded="true"]::after {
    margin-bottom: -1px;
    transform: rotate(-135deg);
}

.access-notice-detail {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 30;
    width: min(560px, calc(100vw - 32px));
    padding: 14px 18px;
    border: 1px solid #dbe4ff;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
    color: #334155;
    font-size: 13.5px;
    line-height: 1.65;
}

.access-notice-detail ul {
    margin: 0;
    padding-left: 18px;
}

.access-notice-detail li + li {
    margin-top: 6px;
}

.access-notice-detail a {
    color: #3b5bdb;
}

.access-need > span + span::before {
    content: '、';
}

html[lang="en"] .access-need > span + span::before {
    content: ', ';
}

.access-load > span + span::before {
    content: '、';
}

.access-load > span + span:last-child::before {
    content: '和';
}

.access-load > span + span.latin:last-child::before {
    content: '和 ';
}

html[lang="en"] .access-load > span + span::before {
    content: ', ';
}

html[lang="en"] .access-load > span + span:last-child::before {
    content: ' and ';
}

@media (max-width: 640px) {
    .access-modules {
        grid-template-columns: 1fr;
    }

    .access-notice {
        display: block;
    }

    .access-notice-icon {
        display: inline-block;
        margin-right: 4px;
        vertical-align: -3px;
    }

    .access-notice-detail {
        left: 0;
        right: auto;
        width: calc(100vw - 32px);
    }

    .access-link {
        padding: 4px 8px;
        font-size: 11px;
    }

    .access-banner {
        flex-direction: column;
        align-items: flex-start;
    }
}
