/**
 * 000 - 工具平台首页（公共壳层 + 首页）
 */

html,
body {
    min-height: 100%;
}

body {
    background: var(--color-bg);
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 120vh;
    min-height: 760px;
    background:
        radial-gradient(circle at 18% 8%, var(--color-aurora-accent), transparent 28rem),
        radial-gradient(circle at 86% 12%, var(--color-aurora-success), transparent 26rem);
    pointer-events: none;
    z-index: 0;
}

.welcome-screen {
    position: fixed;
    inset: 0;
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    gap: var(--space-4);
}

.welcome-screen.hidden {
    display: none;
}

.welcome-logo {
    font-size: 3rem;
}

.welcome-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.welcome-sub {
    color: var(--color-muted);
    font-size: .95rem;
    margin: 0;
    text-align: center;
    max-width: 420px;
}

.welcome-btn {
    padding: .875rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    margin-top: var(--space-3);
}

.workspace-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

.topbar {
    width: min(1180px, calc(100% - 48px));
    height: 66px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-button {
    border: 0;
    background: transparent;
    color: var(--color-text);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    cursor: pointer;
    transition: opacity .16s ease;
}

.brand-button:hover {
    opacity: .82;
}

.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--color-accent) 13%, white);
    color: var(--color-accent);
    font-weight: 800;
    box-shadow: 0 1px 0 rgba(46, 37, 32, .04);
}

.brand-text {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-link {
    border: 0;
    background: transparent;
    color: var(--color-muted);
    cursor: pointer;
    border-radius: 999px;
    transition: background .16s ease, color .16s ease;
    padding: 8px 13px;
    font-size: 14px;
}

.topbar-link:hover {
    background: color-mix(in srgb, var(--color-accent) 8%, transparent);
    color: var(--color-accent);
}

.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .52);
    border: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
    color: var(--color-text);
    max-width: 180px;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease;
}

.user-pill:hover {
    background: rgba(255, 255, 255, .68);
    border-color: color-mix(in srgb, var(--color-accent) 40%, var(--color-border));
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-text);
    color: var(--color-surface);
    font-size: 12px;
    font-weight: 700;
    flex: 0 0 auto;
}

.user-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
}

.workspace-main {
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto;
    padding: 18px 0 44px;
}

.view {
    display: none;
}

.view.is-active {
    display: block;
}

.hero {
    padding: 26px 0 34px;
}

.hero-title {
    margin: 0;
    color: var(--color-text);
    font-size: clamp(1.75rem, 3.5vw, 2.25rem);
    line-height: 1.2;
    letter-spacing: -.035em;
    font-weight: 760;
}

.hero-subtitle {
    margin: 8px 0 0;
    color: var(--color-muted);
    font-size: 15px;
}

.section-block {
    margin-top: 8px;
    margin-bottom: 28px;
}

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

.section-title {
    margin: 0;
    font-size: 15px;
    font-weight: 760;
    color: var(--color-text);
    letter-spacing: -.01em;
}

.section-meta {
    color: var(--color-muted);
    font-size: 12px;
    white-space: nowrap;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.module-card {
    position: relative;
    min-height: 180px;
    border: 1px solid var(--color-border-soft);
    background: var(--color-surface-glass);
    border-radius: 22px;
    color: var(--color-text);
    text-align: left;
    cursor: pointer;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(8px);
    transition: background .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.module-card:hover {
    background: var(--color-surface-glass-strong);
    border-color: color-mix(in srgb, var(--color-accent) 18%, white);
    box-shadow: var(--shadow-float);
    transform: translateY(-1px);
}

.favorite-toggle {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .88);
    color: var(--color-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(46, 37, 32, .08);
    transition: transform .16s ease, color .16s ease, background .16s ease;
}

.favorite-toggle:hover {
    transform: scale(1.04);
    color: var(--color-accent);
}

.favorite-toggle.is-active {
    color: #d89a1d;
}

.card-icon {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--color-accent) 9%, white);
    font-size: 24px;
    flex: 0 0 auto;
}

.card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 760;
    color: var(--color-text);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding-right: 34px;
}

.card-desc {
    margin: 0;
    color: var(--color-muted);
    font-size: 13px;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1 1 auto;
}

.card-category {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    color: var(--color-muted);
    font-size: 12px;
    line-height: 1.3;
    margin-top: auto;
}

.empty-card {
    border-radius: 22px;
    background: var(--color-surface-soft);
    border: 1px dashed color-mix(in srgb, var(--color-border) 75%, transparent);
    padding: 28px;
    color: var(--color-muted);
}

.empty-title {
    color: var(--color-text);
    font-weight: 700;
    margin-bottom: 4px;
}

.empty-desc {
    font-size: 13px;
    line-height: 1.6;
}

.identity-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease;
}

.identity-panel-overlay.hidden {
    display: none;
}

.identity-panel-overlay.is-visible {
    background: rgba(0, 0, 0, .4);
}

.identity-panel {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: min(440px, 90%);
    max-height: 90vh;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity .2s ease, transform .2s ease;
}

.identity-panel.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.identity-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5);
    border-bottom: 1px solid var(--color-border);
}

.identity-panel-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.identity-panel-close {
    border: 0;
    background: transparent;
    color: var(--color-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background .15s ease;
}

.identity-panel-close:hover {
    background: color-mix(in srgb, var(--color-border) 40%, transparent);
}

.identity-panel-body {
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.identity-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.identity-label {
    font-size: .875rem;
    font-weight: 600;
    color: var(--color-text);
}

.identity-value {
    font-size: .875rem;
    color: var(--color-muted);
}

.identity-id {
    font-family: var(--font-mono);
    font-size: .8rem;
}

.identity-code-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.identity-code-box {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.identity-code-val {
    flex: 1;
    font-family: var(--font-mono);
    font-size: .85rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    word-break: break-all;
    line-height: 1.4;
}

.identity-tip {
    font-size: .8rem;
    color: var(--color-muted);
    margin: 0;
    line-height: 1.6;
}

.identity-switch-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.identity-switch-row {
    display: flex;
    gap: var(--space-2);
}

.identity-switch-input {
    flex: 1;
    font-size: .875rem;
    font-family: var(--font-mono);
}

.disclaimer-dialog {
    text-align: left;
}

.disclaimer-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 10px;
}

.announcement-time {
    color: var(--color-muted);
    font-size: 12px;
    margin-bottom: 10px;
}

.disclaimer-list {
    margin: 0;
    padding-left: 20px;
    color: var(--color-muted);
    line-height: 1.7;
}

.disclaimer-list li + li {
    margin-top: 6px;
}

@media (max-width: 760px) {
    body::before {
        height: 96vh;
        min-height: 640px;
    }

    .topbar,
    .workspace-main {
        width: min(100% - 28px, 1180px);
    }

    .topbar {
        height: 60px;
    }

    .brand-text {
        max-width: 128px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .user-name {
        display: none;
    }

    .topbar-actions {
        gap: 6px;
    }

    .topbar-link {
        padding: 7px 10px;
        font-size: 13px;
    }

    .workspace-main {
        padding-bottom: 34px;
    }

    .hero {
        padding: 20px 0 26px;
    }

    .hero-title {
        font-size: 1.65rem;
    }

    .hero-subtitle {
        font-size: 14px;
    }

    .welcome-logo {
        font-size: 2.5rem;
    }

    .welcome-title {
        font-size: 1.3rem;
    }

    .welcome-sub {
        font-size: .875rem;
        max-width: 340px;
    }

    .welcome-btn {
        padding: .75rem 2rem;
        font-size: .95rem;
    }

    .section-head {
        align-items: flex-start;
    }

    .modules-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .module-card {
        min-height: 160px;
        border-radius: 20px;
        padding: 16px;
    }

    .card-icon {
        width: 40px;
        height: 40px;
        border-radius: 14px;
        font-size: 22px;
    }

    .identity-panel-overlay {
        align-items: flex-end;
    }

    .identity-panel {
        width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 85vh;
    }

    .identity-code-box,
    .identity-switch-row {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 430px) {
    .topbar-link {
        font-size: 12px;
    }

    .brand-mark {
        width: 28px;
        height: 28px;
    }

    .module-card {
        min-height: 150px;
        padding: 14px;
    }

    .favorite-toggle {
        top: 12px;
        right: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition-duration: .01ms !important;
    }
}