#home-screen {
    --hs-on-cover:   #ffffff;
    --hs-scrim:      color-mix(in srgb, var(--ui-bg-deep) 82%, transparent);
    --hs-scrim-hi:   color-mix(in srgb, var(--ui-bg-deep) 92%, transparent);
    --hs-veil:       color-mix(in srgb, var(--hs-on-cover) 16%, transparent);
    --hs-veil-hi:    color-mix(in srgb, var(--hs-on-cover) 26%, transparent);
    --hs-edge:       color-mix(in srgb, var(--hs-on-cover) 30%, transparent);

    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: hs-fade-in 0.22s ease-out;
}

@keyframes hs-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#home-screen.hs-fading {
    opacity: 0;
    transition: opacity 0.18s ease-out;
}

.hs-window {
    position: relative;
    width: min(1100px, 92vw);
    height: min(680px, 88vh);
    background: var(--ui-bg);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
    display: grid;
    grid-template-columns: 280px 1fr;
    overflow: hidden;
    color: var(--ui-text);
    font-family: var(--ui-font);
    animation: hs-pop-in 0.28s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

@keyframes hs-pop-in {
    from { transform: scale(0.96); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.hs-sidebar {
    background-color: var(--ui-bg-deep);
    background-image: url('../../assets/home-cover.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: 28px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-right: 1px solid var(--ui-border);
}

.hs-top, .hs-foot { display: contents; }
.hs-brand          { order: 0; }
.hs-action-primary { order: 1; }
.hs-action-draft   { order: 2; }
.hs-spacer         { order: 3; }
.hs-mode           { order: 4; }
.hs-lang           { order: 5; }
.hs-account        { order: 5; }
.hs-footer-note    { order: 6; }

.hs-brand {
    display: flex;
    justify-content: center;
    margin: 18px 0 34px;
}

.hs-brand-logo {
    display: block;
    width: 68px;
    height: 79px;
    color: var(--hs-on-cover);
    filter: drop-shadow(0 2px 10px color-mix(in srgb, var(--ui-bg-deep) 45%, transparent));
}

.hs-brand-logo svg { display: block; width: 100%; height: 100%; }

.hs-action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    background: var(--hs-scrim);
    border: 1px solid transparent;
    border-radius: var(--ui-radius);
    color: var(--hs-on-cover);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: background 0.14s, border-color 0.14s, transform 0.08s;
}

.hs-action:hover {
    background: var(--hs-scrim-hi);
    border-color: var(--hs-edge);
}

.hs-action:active { transform: scale(0.985); }

.hs-action-primary {
    background: var(--ui-accent);
    border-color: var(--ui-accent);
    border-radius: var(--ui-radius-sm);
    color: #fff;
    font-weight: 600;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.hs-action-primary:hover {
    background: var(--ui-accent-hover);
    border-color: var(--ui-accent-hover);
}

.hs-action-icon {
    width: 22px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    opacity: 0.9;
}

.hs-action-label { flex: 1; }

.hs-account {
    align-self: center;
    justify-content: center;
    gap: 8px;
    padding: 6.5px 14px;
    border: 1px solid var(--hs-edge);
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    line-height: 1.2;
    max-width: 100%;
}
.hs-account .hs-action-icon { width: 16px; }
.hs-account .hs-acc-ava { width: 18px; height: 18px; border-radius: 50%; opacity: 1; }
.hs-account .hs-action-label { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-account .hs-acc-alert {
    flex: 0 0 auto; min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box;
    border-radius: 4px; background: var(--ui-danger-text); color: var(--ui-bg-deep);
    font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; letter-spacing: 0;
}
.hs-mode, .hs-lang, .hs-account { width: var(--hs-pill-w, 136px); box-sizing: border-box; }

.hs-spacer { flex: 1; }

.hs-footer-note {
    font-size: 10px;
    color: var(--hs-on-cover);
    letter-spacing: 0.4px;
    line-height: 1.5;
    text-align: center;
    padding: 8px 4px;
    text-shadow: 0 1px 5px color-mix(in srgb, var(--ui-bg-deep) 85%, transparent),
                 0 0 14px color-mix(in srgb, var(--ui-bg-deep) 55%, transparent);
}

.hs-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 50%;
    background: transparent;
    color: var(--ui-text-dim);
    font-family: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.hs-close:hover {
    background: var(--ui-bg-hover);
    border-color: var(--ui-border);
    color: var(--ui-text);
}

.hs-close:focus-visible {
    outline: 1px solid var(--ui-border-focus);
    outline-offset: 2px;
}

.hs-main {
    display: flex;
    flex-direction: column;
    background: var(--ui-bg);
    overflow: hidden;
}

.hs-header {
    padding: 30px 36px 18px;
    border-bottom: 1px solid var(--ui-border);
}

.hs-header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.2px;
}

.hs-list {
    flex: 1;
    overflow-y: auto;
    padding: 14px 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.hs-list::-webkit-scrollbar { width: 8px; }
.hs-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
}

.hs-card {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    align-items: center;
    gap: 16px;
    padding: 12px;
    border-radius: var(--ui-radius);
    cursor: pointer;
    transition: background 0.12s;
    position: relative;
    border: 1px solid transparent;
}

.hs-card:hover  { 
    background: var(--ui-bg-hover);
}
.hs-card:active { 
    background: var(--ui-bg-input); 
}

.hs-card-thumb {
    width: 56px;
    height: 56px;
    border-radius: var(--ui-radius-sm);
    background: var(--ui-bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: var(--ui-text-dim);
    font-family: var(--ui-font); font-variant-numeric: tabular-nums;
    border: 1px solid var(--ui-border);
}

.hs-card-info { min-width: 0; }

.hs-card-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hs-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--ui-text-dim);
}

.hs-card-dot { color: var(--ui-text-muted); }

.hs-card-more {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--ui-text-muted);
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.14s, background 0.12s, color 0.12s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.hs-card:hover .hs-card-more { opacity: 1; }
.hs-card-more:hover { background: rgba(255,255,255,0.08); color: var(--ui-text); }
.hs-card-more svg { width: 14px; height: 14px; }
.hs-menu {
    position: fixed; z-index: 100000;
    min-width: 190px; max-width: 260px;
    display: flex; flex-direction: column; gap: 2px; padding: 6px;
    background: var(--ui-bg, #1c1c1c); border: 1px solid var(--ui-border, rgba(255,255,255,0.12));
    border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,0.45);
}
.hs-menu-item {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 10px; border: none; border-radius: 7px;
    background: transparent; color: var(--ui-text, #e8e8ea);
    font-family: var(--ui-font); font-size: 12.5px; text-align: left; cursor: pointer;
}
.hs-menu-item:hover { background: rgba(255,255,255,0.08); }
.hs-menu-item.is-danger { color: var(--ui-danger-text, #f28b82); }
.hs-menu-item.is-danger:hover { background: rgba(229, 62, 62, 0.16); }
.hs-menu-ic { width: 14px; height: 14px; display: inline-flex; opacity: 0.8; }
.hs-menu-ic svg { width: 14px; height: 14px; }
.hs-menu-sep { height: 1px; margin: 4px 6px; background: var(--ui-border, rgba(255,255,255,0.12)); }

#home-screen .hs-skel-wrap { display: flex; flex-direction: column; gap: 4px; }
#home-screen .hs-skel {
    display: grid;
    grid-template-columns: 56px 1fr;
    align-items: center;
    gap: 16px;
    padding: 12px;
    border: 1px solid transparent;
}
#home-screen .hs-skel-thumb {
    width: 56px; height: 56px;
    border-radius: var(--ui-radius-sm);
    background: rgba(255, 255, 255, 0.11);
}
#home-screen .hs-skel-lines { display: flex; flex-direction: column; gap: 8px; }
#home-screen .hs-skel-line { height: 10px; border-radius: 5px; background: rgba(255, 255, 255, 0.11); }
#home-screen .hs-skel-line.w1 { width: 42%; }
#home-screen .hs-skel-line.w2 { width: 26%; height: 8px; opacity: 0.7; }
#home-screen .hs-skel-thumb,
#home-screen .hs-skel-line { animation: hs-skel-pulse 1.4s ease-in-out infinite; }
#home-screen .hs-skel:nth-child(2) .hs-skel-thumb,
#home-screen .hs-skel:nth-child(2) .hs-skel-line { animation-delay: 0.12s; }
#home-screen .hs-skel:nth-child(3) .hs-skel-thumb,
#home-screen .hs-skel:nth-child(3) .hs-skel-line { animation-delay: 0.24s; }
@keyframes hs-skel-pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    #home-screen .hs-skel-thumb, #home-screen .hs-skel-line { animation: none; opacity: 0.85; }
}
.hs-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.hs-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--ui-accent-glow);
    color: var(--ui-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
}

.hs-empty-title {
    font-size: 16px;
    color: var(--ui-text);
    margin-bottom: 6px;
    font-weight: 500;
}

.hs-empty-sub {
    font-size: 12px;
    color: var(--ui-text-dim);
    max-width: 340px;
    line-height: 1.5;
}

@media (max-width: 720px) {
    .hs-window {
        width: 96vw;
        height: 92vh;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-rows: auto auto auto 1fr auto;
    }

    .hs-window::before {
        content: '';
        grid-column: 1 / -1;
        grid-row: 1 / 3;
        background-color: var(--ui-bg-deep);
        background-image: url('../../assets/home-cover.webp');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
    }

    .hs-sidebar, .hs-main { display: contents; }

    .hs-top {
        grid-column: 1 / -1;
        grid-row: 1;
        display: flex;
        align-items: center;
        gap: 10px;
        min-height: 56px;
        padding: 8px 12px;
    }
    .hs-top .hs-brand { order: 0; }
    .hs-top .hs-mode  { order: 1; }
    .hs-top .hs-close { order: 2; }
    .hs-brand { margin: 0; justify-content: flex-start; }
    .hs-brand-logo { width: 26px; height: 30px; }
    .hs-mode { margin: 0 0 0 auto; }
    .hs-close {
        position: static;
        flex: none;
        margin: 0;
        color: var(--hs-on-cover);
    }
    .hs-close:hover { background: var(--hs-veil); border-color: var(--hs-edge); }

    .hs-action-primary { grid-column: 1; grid-row: 2; }
    .hs-action-draft   { grid-column: 2; grid-row: 2; }
    .hs-window.hs-no-draft .hs-action-primary { grid-column: 1 / -1; }
    .hs-action {
        min-height: 48px;
        margin: 0 12px 10px;
        justify-content: center;
        padding-block: 0;
        min-width: 0;
    }
    .hs-action { padding-inline: 10px; gap: 8px; }
    .hs-action-icon { flex: none; width: 18px; }
    .hs-action-label {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 12px;
    }
    .hs-action-primary { margin-right: 6px; }
    .hs-action-draft   { margin-left: 6px; }
    .hs-window.hs-no-draft .hs-action-primary { margin-right: 12px; }
    .hs-spacer { display: none; }

    .hs-header { grid-column: 1 / -1; grid-row: 3; padding: 0; }

    .hs-list {
        grid-column: 1 / -1;
        grid-row: 4;
        min-height: 0;
        padding: 8px 12px 12px;
    }

    .hs-foot {
        grid-column: 1 / -1;
        grid-row: 5;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid var(--ui-border);
    }
    .hs-foot .hs-lang { display: inline-grid; margin: 0; }
    .hs-foot .hs-footer-note {
        display: block;
        margin: 0 0 0 auto;
        font-size: 10px;
        line-height: 1.3;
        text-align: right;
        opacity: 0.55;
    }

    .hs-card {
        grid-template-columns: 40px 1fr auto;
        gap: 12px;
        padding: 10px 8px;
    }
    .hs-card-thumb {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        font-size: 16px;
    }
    .hs-card-name { font-size: 13px; margin-bottom: 2px; }
    .hs-card-meta {
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 11px;
    }
    .hs-card-dot { margin: 0 4px; }

    #home-screen .hs-skel { grid-template-columns: 40px 1fr; gap: 12px; padding: 10px 8px; }
    #home-screen .hs-skel-thumb { width: 40px; height: 40px; border-radius: 10px; }
}

@media (max-width: 380px) {
    .hs-action { padding-inline: 8px; gap: 6px; }
    .hs-action-icon  { width: 16px; }
    .hs-action-label { font-size: 11px; }
}

@media (hover: none) {
    .hs-card-more { opacity: 1; color: var(--ui-text-dim); }
}
.hs-lang, .hs-mode {
    position: relative;
    display: inline-grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    align-self: center;
    padding: 3px;
    margin-bottom: 4px;
    border: 1px solid var(--hs-edge);
    border-radius: 99px;
    background: var(--hs-scrim);
    color: var(--hs-on-cover);
    font-family: var(--ui-font);
    cursor: pointer;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.hs-lang-toggle:hover, .hs-mode-toggle:hover { border-color: var(--hs-on-cover); }
.hs-lang-toggle:focus-visible, .hs-mode-toggle:focus-visible { outline: 1px solid var(--hs-on-cover); outline-offset: 2px; }
.hs-lang-opt, .hs-lang-btn, .hs-mode-opt {
    position: relative;
    z-index: 1;
    min-width: 44px;
    padding: 5px 12px;
    border: none;
    border-radius: 99px;
    background: transparent;
    color: color-mix(in srgb, var(--hs-on-cover) 70%, transparent);
    font-family: var(--ui-font);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-align: center;
    line-height: 1.2;
    transition: color 0.16s;
}
.hs-lang-opt.active, .hs-lang-btn.active, .hs-mode-opt.active { color: var(--hs-on-cover); }
.hs-lang-btn { cursor: pointer; }
.hs-lang-btn:hover { color: var(--hs-on-cover); background: var(--hs-veil); }
.hs-lang-knob, .hs-mode-knob {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc(50% - 3px);
    border-radius: 99px;
    background: var(--hs-veil-hi);
    box-shadow: inset 0 0 0 1px var(--hs-edge);
    transition: transform 0.18s cubic-bezier(0.32, 0.72, 0.35, 1);
}
.hs-lang-toggle.on .hs-lang-knob, .hs-mode-toggle.on .hs-mode-knob { transform: translateX(100%); }
.hs-mode { margin-bottom: 8px; }

.hs-card-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.hs-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 8px; border-radius: 999px;
    font-size: 10.5px; line-height: 16px; white-space: nowrap;
    color: var(--ui-text-dim); background: var(--ui-bg-input); border: 1px solid var(--ui-border);
}
.hs-chip svg { flex: none; opacity: .85; }
.hs-chip-shared { color: var(--ui-accent-text); border-color: color-mix(in srgb, var(--ui-accent) 55%, transparent); }
.hs-chip-lock { color: var(--ui-warn); border-color: color-mix(in srgb, var(--ui-warn) 45%, transparent); }
.hs-card-owner { display: inline-flex; align-items: center; gap: 4px; color: var(--ui-text-dim); }
.hs-card-owner svg { opacity: .8; }
.hs-section {
    display: flex; align-items: center; gap: 8px;
    margin: 18px 12px 6px; padding-top: 14px;
    border-top: 1px solid var(--ui-border);
    font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--ui-text-dim);
}
.hs-section-ic { display: inline-flex; color: var(--ui-accent-text); }
.hs-section-count { color: var(--ui-text-muted); font-weight: 500; }

.pb-modal.ds-share-modal { width: min(520px, 96vw); height: min(560px, 86vh); }
.ds-share-body { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px; overflow: hidden; flex: 1 1 auto; min-height: 0; }
.ds-share-search { width: 100%; box-sizing: border-box; flex: 0 0 auto; }
.ds-share-list {
    display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow-y: auto;
    border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm);
}
.ds-share-row {
    display: flex; align-items: center; gap: 10px; padding: 7px 12px; font-size: 13px; flex: 0 0 auto;
    border-top: 1px solid var(--ui-border); cursor: pointer; color: var(--ui-text);
}
.ds-share-list .ds-share-row:first-child { border-top: none; }
.ds-share-row:hover { background: var(--ui-bg-hover); }
.ds-share-row.is-locked { cursor: default; }
.ds-share-row.is-locked:hover { background: transparent; }
.ds-share-all { border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-bg-deep); }
.ds-share-who { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-share-role { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ui-text-muted); font-size: 12px; }
.ds-share-row .aig-switch { margin-left: auto; }
.ds-share-none { padding: 10px 12px; }
.ds-share-status { min-height: 16px; flex: 0 0 auto; }
.ds-share-foot { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--ui-border); flex: 0 0 auto; }
.ds-share-gap { flex: 1; }
.ds-share-off { color: var(--ui-danger-text); border-color: color-mix(in srgb, var(--ui-danger) 70%, transparent); }
.ds-share-off:hover { background: color-mix(in srgb, var(--ui-danger) 25%, transparent); }
.ds-share-dlg .tbtn:disabled { opacity: .5; cursor: default; }
