/* Shared Studio-style workspace navigation (welcome bar + pill nav) */

:root {
    --alysum-nav-sticky-offset: 45px;
}

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

.wd-welcome-bar {
    position: relative;
    flex-shrink: 0;
    padding: 12px clamp(20px, 3vw, 36px);
    min-height: 108px;
    z-index: 5;
    display: flex;
    align-items: center;
    overflow: visible;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: var(
        --theme-welcome-bar,
        var(
            --alysum-chrome-gradient,
            linear-gradient(
                135deg,
                rgba(76, 29, 149, 0.95) 0%,
                var(--theme-header-mid, #6d28d9) 38%,
                var(--theme-header-end, #db2777) 100%
            )
        )
    );
    background-size: cover;
    background-position: center;
    box-shadow:
        0 4px 32px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.wd-welcome-bar::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 12% 50%, rgba(255, 255, 255, 0.14) 0%, transparent 42%),
        radial-gradient(circle at 88% 20%, rgba(251, 191, 36, 0.12) 0%, transparent 40%);
    pointer-events: none;
}

.wd-welcome-bar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    pointer-events: none;
}

.wd-welcome-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: clamp(14px, 2.5vw, 20px);
}

.wd-pfp {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.28);
    border: 2px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.wd-pfp img:not(.pfp-frame-deco) {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wd-pfp-initial {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 900;
    color: #fff;
}

.wd-pfp-initial.is-hidden { display: none; }

.wd-welcome-copy { min-width: 0; }

.wd-overhaul-announce {
    margin-left: auto;
    flex: 0 1 auto;
    min-width: 0;
    max-width: min(520px, 46%);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.wd-overhaul-badge {
    flex-shrink: 0;
    margin-top: 1px;
    padding: 2px 8px;
    border-radius: 999px;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #1c1917;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1.6;
}

.wd-overhaul-text {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    color: rgba(255, 247, 237, 0.92);
}

.wd-overhaul-reset {
    color: #fde68a;
}

.wd-overhaul-link {
    color: #fff;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.wd-overhaul-link:hover {
    text-decoration: underline;
}

.wd-welcome-title {
    margin: 0;
    font-size: clamp(22px, 4vw, 28px);
    font-weight: 900;
    line-height: 1.15;
    color: #fff7ed;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.wd-welcome-title .wd-name {
    background: linear-gradient(90deg, #fff 0%, #fde68a 55%, #fbcfe8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.wd-welcome-sub {
    margin: 5px 0 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.wd-nav-wrap {
    position: sticky;
    top: 0;
    z-index: 40;
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--theme-header-mid, #7c3aed) 55%, transparent) transparent;
    background: rgba(11, 18, 32, 0.92);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
}

.wd-nav-wrap::-webkit-scrollbar {
    height: 4px;
}

.wd-nav-wrap::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--theme-header-mid, #7c3aed) 55%, transparent);
    border-radius: 999px;
}

.wd-nav {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 4px 6px;
    width: max-content;
    min-width: 100%;
    max-width: none;
    margin: 0;
    padding: 10px clamp(12px, 2vw, 24px);
    box-sizing: border-box;
}

.wd-nav a,
.wd-nav button {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px clamp(10px, 0.9vw, 14px);
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: #d1d5db;
    font-family: inherit;
    font-size: clamp(12px, 0.85vw, 13px);
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.wd-nav a:hover,
.wd-nav button:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.wd-nav a.is-active,
.wd-nav button.is-active {
    color: #fff;
    border-color: color-mix(in srgb, var(--theme-header-end, #db2777) 45%, transparent);
    background: var(
        --theme-welcome-bar,
        linear-gradient(
            135deg,
            var(--purple-dark, #5b21b6),
            var(--theme-header-mid, #6d28d9),
            var(--theme-header-end, #db2777)
        )
    );
    background-size: cover;
    background-position: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
    box-shadow: 0 2px 10px color-mix(in srgb, var(--theme-header-mid, #6d28d9) 35%, transparent);
}

.wd-nav a.is-hidden,
.wd-nav button.is-hidden { display: none; }

.wd-nav-logout { color: #fca5a5; }

.wd-nav-logout:hover {
    color: #fecaca;
    background: rgba(248, 113, 113, 0.12);
}

.wd-nav-discord {
    color: #fff;
    background: #5865f2;
    border-color: rgba(255, 255, 255, 0.18);
}

.wd-nav-discord:hover {
    color: #fff;
    background: #4752c4;
    border-color: rgba(255, 255, 255, 0.28);
}

@media (max-width: 1200px) {
    .wd-nav-divider { display: none; }
}

.wd-nav-divider {
    flex-shrink: 0;
    width: 1px;
    height: 22px;
    margin: 0 2px;
    background: rgba(255, 255, 255, 0.12);
}

.wd-nav-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    line-height: 18px;
    text-align: center;
}

.wd-nav-badge.is-hidden { display: none; }

/* "New!" feature badges — distinct from red notification counts */
.wd-nav-new,
.fh-target-new,
.fh-page-new {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    margin-left: 2px;
    border-radius: 999px;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #1c1917;
    font-size: 9px;
    font-weight: 950;
    letter-spacing: 0.04em;
    line-height: 1.35;
    text-transform: uppercase;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.wd-nav-new.is-hidden,
.fh-target-new.is-hidden,
.fh-page-new.is-hidden { display: none; }

#tab-profile.fh-has-new-badge,
.settings-nav button.fh-has-new-badge {
    position: relative;
}

.settings-nav button.fh-has-new-badge .fh-page-new {
    position: absolute;
    top: 4px;
    right: 6px;
    margin-left: 0;
    z-index: 1;
}

#author-bio.fh-section-spotlight,
#author-support.fh-section-spotlight,
.fh-section-spotlight {
    outline: 2px solid rgba(251, 191, 36, 0.85);
    outline-offset: 4px;
    border-radius: 16px;
    animation: fhSectionPulse 1.4s ease-in-out 2;
}

@keyframes fhSectionPulse {
    0%, 100% { outline-color: rgba(251, 191, 36, 0.85); }
    50% { outline-color: rgba(249, 115, 22, 0.95); }
}

.fh-spotlight-where {
    margin: 8px 0 0;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.22);
    color: #fde68a;
    font-size: 13px;
    line-height: 1.45;
}

.fh-spotlight-where-label {
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 10px;
    color: #fcd34d;
    margin-right: 6px;
}

.fh-has-new-badge { position: relative; }

button.fh-has-new-badge .fh-target-new,
.pill-btn.fh-has-new-badge .fh-target-new {
    position: absolute;
    top: -7px;
    right: -4px;
    margin-left: 0;
    z-index: 1;
}

.topbar-tip.fh-has-new-badge .fh-target-new {
    position: absolute;
    top: -4px;
    right: -6px;
    margin-left: 0;
    z-index: 2;
}

.topbar-tip.fh-has-new-badge { position: relative; }

/* Returning-user spotlight */
.fh-spotlight-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(6px);
}

.fh-spotlight-panel {
    position: relative;
    width: min(560px, 100%);
    max-height: min(86vh, 720px);
    overflow: auto;
    padding: 24px 24px 20px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background:
        radial-gradient(circle at top left, rgba(124, 58, 237, 0.28), transparent 42%),
        linear-gradient(160deg, rgba(15, 23, 42, 0.98), rgba(17, 24, 39, 0.98));
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
    color: #f9fafb;
}

.fh-spotlight-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #e5e7eb;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.fh-spotlight-close:hover { background: rgba(255, 255, 255, 0.14); }

.fh-spotlight-kicker {
    margin: 0;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fcd34d;
}

.fh-spotlight-panel h2 {
    margin: 6px 0 0;
    font-size: clamp(24px, 4vw, 30px);
    font-weight: 900;
    line-height: 1.15;
}

.fh-spotlight-lead {
    margin: 10px 0 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 14px;
    line-height: 1.55;
}

.fh-spotlight-list {
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 12px;
}

.fh-spotlight-item {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
}

.fh-spotlight-item-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.fh-spotlight-new {
    display: inline-flex;
    padding: 2px 7px;
    border-radius: 999px;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #1c1917;
    font-size: 10px;
    font-weight: 950;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.fh-spotlight-item p {
    margin: 8px 0 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: 14px;
    line-height: 1.55;
}

.fh-spotlight-cta {
    display: inline-flex;
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.22);
    border: 1px solid rgba(167, 139, 250, 0.35);
    color: #ede9fe;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.fh-spotlight-cta:hover {
    background: rgba(124, 58, 237, 0.34);
    color: #fff;
}

.fh-spotlight-actions {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
}

.fh-spotlight-dismiss {
    border: 0;
    border-radius: 999px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #6d28d9, #7c3aed);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.fh-spotlight-dismiss:hover { filter: brightness(1.06); }

@media (max-width: 560px) {
    .wd-overhaul-text {
        font-size: 11px;
        line-height: 1.45;
    }

    .wd-overhaul-badge {
        display: none;
    }
}

@media (max-width: 900px) {
    .wd-welcome-bar {
        min-height: auto;
        padding-top: 14px;
        padding-bottom: 14px;
    }
    .wd-pfp { width: 48px; height: 48px; }
    .wd-welcome-sub { display: none; }

    .wd-welcome-inner {
        flex-wrap: wrap;
    }

    .wd-overhaul-announce {
        margin-left: 0;
        max-width: none;
        width: 100%;
        order: 3;
        padding: 8px 10px;
    }

    .wd-nav {
        padding: 8px 12px;
        gap: 8px;
    }

    .wd-nav a,
    .wd-nav button {
        font-size: 12px;
        padding: 10px 14px;
        min-height: 40px;
    }
}

/* Full-viewport tools: workspace nav stacks above the tool UI */
body.alysum-with-workspace-nav {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

body.alysum-with-workspace-nav > .wd-welcome-bar,
body.alysum-with-workspace-nav > .wd-nav-wrap {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
}

body.alysum-with-workspace-nav > .alysum-tool-root,
body.alysum-with-workspace-nav > .pw-app,
body.alysum-with-workspace-nav > .ng-app,
body.alysum-with-workspace-nav > .shell,
body.alysum-with-workspace-nav > #root {
    flex: 1;
    min-height: 0;
    height: auto !important;
    overflow: hidden;
}

body.alysum-with-workspace-nav.alysum-tool-editor > .alysum-tool-root {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

@media (max-width: 760px) {
    body.alysum-with-workspace-nav.alysum-tool-editor > .alysum-tool-root {
        isolation: isolate;
    }

    body.alysum-with-workspace-nav.alysum-tool-editor .sidebar {
        height: 100% !important;
        max-height: none;
    }
}

body.alysum-with-workspace-nav.alysum-tool-editor .sidebar,
body.alysum-with-workspace-nav.alysum-tool-editor .main {
    height: 100% !important;
}

/* Scrollable tool pages (publish, exporter, story bible) */
body.alysum-with-workspace-nav.alysum-tool-scroll {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow: auto;
}

body.alysum-with-workspace-nav.alysum-tool-scroll > .wd-nav-wrap {
    position: sticky;
    top: 0;
}
