.notification-center {
    position: relative;
    flex: 0 0 auto;
}

.notification-center__toggle {
    position: relative;
    display: grid;
    width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--app-topbar-shell-border);
    border-radius: 13px;
    background: var(--app-topbar-shell-control);
    color: var(--app-topbar-shell-muted);
    font:inherit;
    font-size: var(--font-size-400);
    cursor: pointer;
    box-shadow: inset 0 1px 0 var(--app-topbar-shell-control-inset);
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, color .18s ease;
}

.notification-center__toggle:hover {
    border-color: var(--app-topbar-shell-active-border);
    background: var(--app-topbar-shell-control-hover);
    color: var(--app-topbar-shell-ink);
    box-shadow: inset 0 1px 0 var(--app-topbar-shell-control-inset);
}

.notification-center__toggle[aria-expanded="true"] {
    border-color: var(--app-topbar-shell-gold);
    background: var(--app-topbar-shell-control-hover);
    color: var(--app-topbar-shell-gold);
    box-shadow: inset 0 1px 0 var(--app-topbar-shell-control-inset);
}

.notification-center__toggle:focus-visible {
    border-color: var(--app-topbar-shell-active-border);
    background: var(--app-topbar-shell-control-hover);
    color: var(--app-topbar-shell-ink);
    outline: none;
    box-shadow: 0 0 0 3px var(--app-topbar-shell-focus), inset 0 1px 0 var(--app-topbar-shell-control-inset);
}

.notification-center__toggle[aria-expanded="true"]:focus-visible {
    background: var(--app-topbar-shell-control-hover);
    color: var(--app-topbar-shell-gold);
}

.notification-center__count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 2px solid var(--app-topbar-shell-surface);
    border-radius: 999px;
    background: var(--app-topbar-coral);
    color: var(--app-topbar-on-accent);
    font-size: var(--font-size-100);
    font-weight: var(--site-weight-bold, 800);
    line-height: 16px;
    text-align: center;
}

.notification-center__panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 1400;
    width: min(410px, calc(100vw - 24px));
    max-height: calc(100vh - var(--app-topbar-height, 60px) - 18px);
    max-height: calc(100dvh - var(--app-topbar-height, 60px) - 18px);
    overflow: hidden;
    border: 1px solid var(--app-topbar-border);
    border-radius: 20px;
    background: var(--app-topbar-paper);
    color: var(--app-topbar-ink);
    box-shadow: var(--app-topbar-popover-shadow);
}

.notification-center__panel > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 19px 20px 16px;
    border-bottom: 1px solid var(--app-topbar-border);
}

.notification-center__panel > header strong,
.notification-center__panel > header span {
    display: block;
}

.notification-center__panel > header strong {
    color: var(--app-topbar-ink);
    font-size: var(--font-size-300);
    font-weight: var(--site-weight-bold, 800);
}

.notification-center__panel > header span {
    margin-top: 2px;
    color: var(--app-topbar-muted);
    font-size: var(--font-size-100);
}

.notification-center__panel > header button {
    padding: 5px 0;
    border: 0;
    background: transparent;
    color: var(--app-topbar-blue);
    font:inherit;
    font-size: var(--font-size-100);
    font-weight: var(--site-weight-bold, 800);
    white-space: nowrap;
    cursor: pointer;
}

.notification-center__panel > header button:hover {
    color: var(--app-topbar-ink);
}

.notification-center__panel > header button:focus-visible {
    outline: 3px solid var(--app-topbar-focus);
    outline-offset: 3px;
}

.notification-center__state {
    padding: 38px 20px;
    color: var(--app-topbar-muted);
    font-size: var(--font-size-100);
    text-align: center;
}

.notification-center__list {
    max-height: min(450px, calc(100vh - var(--app-topbar-height, 60px) - 144px));
    max-height: min(450px, calc(100dvh - var(--app-topbar-height, 60px) - 144px));
    overflow-y: auto;
    overscroll-behavior: contain;
}

.notification-item {
    position: relative;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 12px;
    width: 100%;
    padding: 15px 32px 15px 20px;
    border: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--app-topbar-border) 42%, var(--app-topbar-paper));
    background: transparent;
    color: inherit;
    font:inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background .16s ease, color .16s ease;
}

.notification-item:hover,
.notification-item:focus-visible {
    background: var(--app-topbar-sand);
    color: inherit;
}

.notification-item:focus-visible {
    outline: 3px solid var(--app-topbar-focus);
    outline-offset: -3px;
}

.notification-item.is-unread {
    background: color-mix(in srgb, var(--app-topbar-sand) 58%, var(--app-topbar-paper));
    box-shadow: inset 3px 0 0 var(--app-topbar-gold);
}

.notification-item.is-unread:hover,
.notification-item.is-unread:focus-visible {
    background: var(--app-topbar-sand);
}

.notification-item.is-unread::after {
    position: absolute;
    top: 19px;
    right: 16px;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--app-topbar-blue);
    content: '';
}

.notification-item__icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 13px;
    background: var(--app-topbar-notification-blue-soft);
    color: var(--app-topbar-blue);
    font-size: var(--font-size-300);
}

.notification-item[data-notification-type="achievement"] .notification-item__icon {
    background: var(--app-topbar-notification-gold-soft);
    color: var(--app-topbar-gold);
}

.notification-item strong {
    display: block;
    color: var(--app-topbar-ink);
    font-size: var(--font-size-100);
    font-weight: var(--site-weight-bold, 800);
    line-height: 1.25;
}

.notification-item p {
    margin: 4px 0 8px;
    color: var(--app-topbar-muted);
    font-size: var(--font-size-100);
    line-height: 1.4;
}

.notification-item time {
    color: var(--app-topbar-muted);
    font-size: var(--font-size-100);
}

.notification-center__achievements {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 48px;
    padding: 10px 20px;
    background: var(--app-topbar-paper);
    color: var(--app-topbar-blue);
    font-size: var(--font-size-100);
    font-weight: var(--site-weight-bold, 800);
    text-align: center;
    text-decoration: none;
}

.notification-center__achievements:hover,
.notification-center__achievements:focus-visible {
    background: var(--app-topbar-sand);
    color: var(--app-topbar-ink);
}

.notification-center__achievements:focus-visible {
    outline: 3px solid var(--app-topbar-focus);
    outline-offset: -3px;
}

@media (max-width: 1180px) {
    .notification-center__toggle {
        width: 44px;
        height: 44px;
    }
}

@media (max-width: 650px) {
    .notification-center__panel {
        position: fixed;
        top: calc(var(--app-topbar-height, 54px) + 8px);
        right: 10px;
        left: 10px;
        width: auto;
    }

    .notification-center__panel > header {
        gap: 10px;
        padding: 14px 14px 12px;
    }

    .notification-center__panel > header span {
        font-size: var(--font-size-100);
    }

    .notification-center__panel > header button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
        padding: 0 4px;
        font-size: var(--font-size-100);
    }

    .notification-center__state {
        font-size: var(--font-size-100);
    }

    .notification-item {
        padding: 14px 28px 14px 14px;
    }

    .notification-item strong {
        font-size: var(--font-size-200);
    }

    .notification-item p {
        font-size: var(--font-size-100);
    }

    .notification-item time {
        font-size: var(--font-size-100);
    }
}

@media (prefers-reduced-motion: reduce) {
    .notification-center__toggle,
    .notification-item {
        transition: none;
    }
}
