/* 访客模式：未登录也能浏览首页；所有创作/账户操作统一提示登录。 */
.navbar-guest {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.navbar-account.is-guest {
    background: transparent;
    border: 1px dashed var(--border, #e2e8f0);
    cursor: pointer;
}

.navbar-account.is-guest .navbar-account-avatar {
    background: var(--card-2, #f1f5f9);
    color: var(--text-sub, #475569);
    box-shadow: none;
}

.navbar-account.is-guest .navbar-account-copy strong {
    color: var(--text-sub, #475569);
    font-weight: 600;
}

.navbar-guest-login {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 15px;
    border-radius: 8px;
    background: var(--brand, #6366f1);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: filter .18s ease;
}

.navbar-guest-login:hover { filter: brightness(.93); color: #fff; }

.navbar-guest-register {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--border, #e2e8f0);
    background: var(--card, #fff);
    color: var(--text-sub, #475569);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.navbar-guest-register:hover { border-color: var(--brand, #6366f1); color: var(--brand, #6366f1); }

/* ---------- 首页访客提示条 ---------- */
.guest-welcome {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 0 0 22px;
    padding: 20px 24px;
    border: 1px solid color-mix(in srgb, var(--brand, #6366f1) 22%, var(--border, #e2e8f0));
    border-radius: 16px;
    background:
        radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--brand-soft, #e0e7ff) 78%, transparent) 0%, transparent 62%),
        var(--card, #fff);
    box-shadow: 0 10px 30px rgba(15, 23, 42, .05);
}

.guest-welcome[hidden] { display: none !important; }

.guest-welcome-copy { min-width: 240px; flex: 1 1 420px; }
.guest-welcome-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--card, #fff);
    border: 1px solid color-mix(in srgb, var(--brand, #6366f1) 30%, transparent);
    color: var(--brand-dark, #4f46e5);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
}

.guest-welcome-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--brand, #6366f1);
}

.guest-welcome h3 {
    margin: 0 0 6px;
    font-size: 20px;
    line-height: 1.45;
    color: var(--text, #1e293b);
}

.guest-welcome p {
    margin: 0;
    max-width: 60ch;
    font-size: 13px;
    line-height: 1.8;
    color: var(--text-sub, #475569);
}

.guest-welcome-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.guest-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 104px;
    height: 38px;
    padding: 0 18px;
    border-radius: 9px;
    border: 1px solid var(--border, #e2e8f0);
    background: var(--card, #fff);
    color: var(--text, #1e293b);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.guest-btn:hover { border-color: var(--brand, #6366f1); color: var(--brand, #6366f1); }
.guest-btn:focus-visible { outline: 2px solid var(--brand, #6366f1); outline-offset: 2px; }

.guest-btn.primary {
    background: var(--brand, #6366f1);
    border-color: transparent;
    color: #fff;
}

.guest-btn.primary:hover { filter: brightness(.93); color: #fff; }

/* ---------- 首页占位内容 ---------- */
.guest-panel {
    display: grid;
    gap: 8px;
    align-content: center;
    width: 100%;
    min-height: 120px;
    padding: 18px 4px;
}

.guest-panel .guest-welcome-badge { justify-self: start; }

.guest-panel strong { font-size: 15px; color: var(--text, #1e293b); }
.guest-panel p { margin: 0; font-size: 13px; line-height: 1.75; color: var(--text-sub, #475569); }

.guest-panel .guest-panel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

.guest-panel .guest-btn { height: 34px; min-width: 88px; font-size: 12px; }
.studio-resume > .guest-panel { flex: 1 1 auto; min-width: 0; }
/* 窄屏时 overview-layout 会把续写卡片改成 58px + 1fr 的网格，引导块必须跨满整行 */
#view-home .studio-resume > .guest-panel { grid-column: 1 / -1; width: 100%; }
@media (max-width: 900px) {
    .studio-resume > .guest-panel { flex: 1 1 100%; padding: 6px 0 10px; }
}
#studioRecentWorks > .guest-panel,
#studioAttention > .guest-panel,
#studioQueue > .guest-panel { padding: 16px 0; }
#homeWorksGrid > .guest-panel { align-content: start; padding: 30px 20px; }
#homeWorksGrid > .guest-panel p { max-width: 46ch; }

/* ---------- 登录提示弹窗 ---------- */
.guest-auth-mask {
    position: fixed;
    inset: 0;
    z-index: 40000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(15, 23, 42, .46);
    backdrop-filter: blur(3px);
    animation: guestFade .16s ease;
}

.guest-auth-mask[hidden] { display: none !important; }

.guest-auth-dialog {
    position: relative;
    width: min(420px, 100%);
    padding: 30px 28px 22px;
    border-radius: 18px;
    background: var(--card, #fff);
    color: var(--text, #1e293b);
    box-shadow: 0 26px 70px rgba(15, 23, 42, .26);
    text-align: center;
    animation: guestRise .2s ease;
}

.guest-auth-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted, #94a3b8);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.guest-auth-close:hover { background: var(--card-2, #f1f5f9); color: var(--text, #1e293b); }

.guest-auth-icon {
    width: 46px;
    height: 46px;
    margin: 0 auto 14px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--brand-soft, #e0e7ff);
    color: var(--brand-dark, #4f46e5);
}

.guest-auth-icon svg { width: 22px; height: 22px; }

.guest-auth-dialog h3 {
    margin: 0 0 8px;
    font-size: 19px;
    line-height: 1.45;
}

.guest-auth-dialog p {
    margin: 0 auto 20px;
    max-width: 32ch;
    font-size: 13px;
    line-height: 1.8;
    color: var(--text-sub, #475569);
}

.guest-auth-actions { display: grid; gap: 10px; }
.guest-auth-actions .guest-btn { width: 100%; height: 42px; }

.guest-auth-later {
    margin-top: 12px;
    border: 0;
    background: transparent;
    color: var(--muted, #94a3b8);
    font-size: 12px;
    cursor: pointer;
}

.guest-auth-later:hover { color: var(--text-sub, #475569); text-decoration: underline; }

@keyframes guestFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes guestRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
    .guest-auth-mask, .guest-auth-dialog { animation: none; }
}

@media (max-width: 640px) {
    .navbar-guest-register { display: none; }
    /* 窄屏只留「未登录」文字：单看一个「未」字会被误解成用户名 */
    .navbar-account.is-guest .navbar-account-avatar { display: none; }
    .navbar-account.is-guest { height: 34px; padding: 0 10px; }
    .navbar-account.is-guest .navbar-account-copy { display: inline-flex !important; }
    .guest-welcome { padding: 16px 18px; }
    .guest-welcome h3 { font-size: 17px; }
    .guest-welcome-actions .guest-btn { flex: 1 1 auto; }
}

[data-theme="dark"] .guest-welcome {
    border-color: color-mix(in srgb, var(--brand, #6366f1) 34%, #334155);
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(99, 102, 241, .18) 0%, transparent 62%),
        var(--card, #1e293b);
    box-shadow: none;
}

[data-theme="dark"] .guest-welcome-badge { background: rgba(99, 102, 241, .16); }
[data-theme="dark"] .guest-auth-mask { background: rgba(2, 6, 23, .68); }
[data-theme="dark"] .guest-auth-icon { background: rgba(99, 102, 241, .18); color: #c7d2fe; }

/* 访客态下这些入口只提示登录，视觉上不做禁用，避免误以为功能不存在。 */
html.is-guest .guest-blocked { cursor: pointer; }

/* 窄屏：访客首页按普通文档流滚动，避免固定高度把「我的作品」压成 0 高。 */
@media (max-width: 900px) {
    html.is-guest,
    html.is-guest body { overflow: auto !important; overscroll-behavior-y: auto; }
    html.is-guest .app-with-side-nav:has(#view-home.active),
    html.is-guest .app-with-side-nav-right:has(#view-home.active),
    html.is-guest #view-home.active,
    html.is-guest #view-home .workspace-main {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }
    /* flex-basis:0 在 auto 高度容器里会把右栏压成 0，这里改为按内容撑开 */
    html.is-guest .app-with-side-nav-right:has(#view-home.active) { flex: 1 1 auto !important; }
    html.is-guest #view-home.active { flex: none !important; }
    html.is-guest #view-home .studio-overview-grid { display: block; flex: none !important; height: auto !important; min-height: 0 !important; }
    html.is-guest #view-home .studio-overview-main { display: block; }
    html.is-guest #view-home .studio-recent { display: block; margin-top: 22px; }
    html.is-guest #view-home #studioRecentWorks { flex: none; height: auto; overflow: visible; max-height: none; }
    html.is-guest #view-home .studio-overview-rail { margin-top: 18px; }
}
