/* Ensure the native HTML hidden attribute always wins over component display rules.
   Without this, author-level display:flex/grid rules can make hidden account/guest
   controls and empty/history sections visible at the same time. */
[hidden] {
    display: none !important;
}

.nm-history-body {
    background: #090b0f;
    color: #f4f6f8;
}

.nm-history-main {
    min-height: 70vh;
    padding: 122px 0 72px;
}

.nm-history-shell {
    display: grid;
    gap: 28px;
}

.nm-history-hero,
.nm-history-section {
    border: 1px solid rgba(255,255,255,.08);
    background:
        radial-gradient(circle at 88% 0%, rgba(255,70,84,.10), transparent 34%),
        linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.018));
    border-radius: 22px;
    box-shadow: 0 18px 50px rgba(0,0,0,.20);
}

.nm-history-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 26px;
    padding: 34px;
}

.nm-history-hero-copy {
    max-width: 760px;
}

.nm-history-hero h1,
.nm-history-section h2,
.nm-history-empty h3 {
    margin: 0;
    color: #fff;
    letter-spacing: -.03em;
}

.nm-history-hero h1 {
    margin-top: 8px;
    font-size: clamp(34px, 5vw, 56px);
    line-height: 1.02;
}

.nm-history-hero p {
    max-width: 680px;
    margin: 14px 0 0;
    color: #aeb4be;
    font-size: 16px;
    line-height: 1.65;
}

.nm-history-sync-note {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    padding: 8px 11px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 999px;
    color: #b5bbc5;
    background: rgba(255,255,255,.035);
    font-size: 12px;
    font-weight: 700;
}

.nm-history-sync-note::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #737b87;
    box-shadow: 0 0 0 4px rgba(115,123,135,.10);
}

.nm-history-sync-note.is-synced {
    color: #d7f6df;
    border-color: rgba(74,207,111,.22);
    background: rgba(74,207,111,.08);
}

.nm-history-sync-note.is-synced::before {
    background: #4acf6f;
    box-shadow: 0 0 0 4px rgba(74,207,111,.11);
}

.nm-history-hero-actions,
#nm-history-account-actions,
#nm-history-guest-actions,
.nm-history-toolbar-actions,
.nm-history-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nm-history-primary,
.nm-history-secondary,
.nm-history-clear,
.nm-history-filter {
    appearance: none;
    border: 0;
    text-decoration: none;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease;
}

.nm-history-primary,
.nm-history-secondary,
.nm-history-clear {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    border-radius: 12px;
}

.nm-history-primary {
    color: #fff;
    background: #e93444;
    box-shadow: 0 10px 28px rgba(233,52,68,.20);
}

.nm-history-primary:hover,
.nm-history-secondary:hover,
.nm-history-clear:hover,
.nm-history-filter:hover {
    transform: translateY(-1px);
}

.nm-history-secondary,
.nm-history-clear {
    color: #f4f6f8;
    border: 1px solid rgba(255,255,255,.11);
    background: rgba(255,255,255,.045);
}

.nm-history-clear {
    color: #ffb5bc;
    border-color: rgba(233,52,68,.22);
    background: rgba(233,52,68,.07);
}

.nm-history-section {
    padding: 28px;
}

.nm-history-section-head,
.nm-history-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.nm-history-section-head {
    margin-bottom: 20px;
}

.nm-history-eyebrow {
    display: block;
    margin-bottom: 5px;
    color: #e93444;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.nm-history-section h2 {
    font-size: clamp(24px, 3vw, 32px);
}

.nm-history-count {
    color: #858d98;
    font-size: 13px;
    white-space: nowrap;
}

.nm-history-toolbar {
    padding: 14px;
    margin-bottom: 22px;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 15px;
    background: rgba(0,0,0,.18);
}

.nm-history-filter {
    min-height: 36px;
    padding: 0 13px;
    border-radius: 10px;
    color: #aab0b9;
    background: transparent;
}

.nm-history-filter.is-active {
    color: #fff;
    background: rgba(255,255,255,.09);
}

.nm-history-search {
    width: min(320px, 44vw);
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 11px;
    background: #0d1015;
    color: #777f8a;
}

.nm-history-search input {
    width: 100%;
    border: 0;
    outline: 0;
    color: #fff;
    background: transparent;
    font: inherit;
}

.nm-history-search input::placeholder {
    color: #69717d;
}

.nm-history-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 18px;
}

.nm-history-card {
    position: relative;
    min-width: 0;
}

.nm-history-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.nm-history-card-poster {
    position: relative;
    overflow: hidden;
    aspect-ratio: 2 / 3;
    border-radius: 14px;
    background: #12161d;
    box-shadow: 0 14px 30px rgba(0,0,0,.22);
}

.nm-history-card-poster::after {
    content: '';
    position: absolute;
    inset: 55% 0 0;
    background: linear-gradient(transparent, rgba(0,0,0,.72));
    pointer-events: none;
}

.nm-history-card-poster img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform .25s ease, filter .25s ease;
}

.nm-history-card:hover .nm-history-card-poster img {
    transform: scale(1.035);
    filter: brightness(1.05);
}

.nm-history-type-badge {
    position: absolute;
    z-index: 2;
    left: 9px;
    bottom: 9px;
    padding: 4px 7px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 7px;
    color: #fff;
    background: rgba(8,10,14,.78);
    backdrop-filter: blur(8px);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.nm-history-card-body {
    padding: 11px 2px 0;
}

.nm-history-card-title {
    overflow: hidden;
    margin: 0;
    color: #f6f7f9;
    font-size: 14px;
    line-height: 1.35;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nm-history-card-meta,
.nm-history-card-time,
.nm-history-card-resume {
    margin-top: 5px;
    color: #7f8793;
    font-size: 11px;
    line-height: 1.35;
}

.nm-history-card-resume {
    color: #c8cdd5;
    font-weight: 700;
}

.nm-history-card-progress {
    height: 3px;
    overflow: hidden;
    margin-top: 8px;
    border-radius: 999px;
    background: rgba(255,255,255,.09);
}

.nm-history-card-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #e93444;
}

.nm-history-card-remove {
    position: absolute;
    z-index: 3;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 50%;
    color: #fff;
    background: rgba(4,6,9,.80);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    opacity: 0;
    transform: translateY(-3px);
    transition: opacity .18s ease, transform .18s ease, background .18s ease;
}

.nm-history-card:hover .nm-history-card-remove,
.nm-history-card-remove:focus-visible {
    opacity: 1;
    transform: translateY(0);
}

.nm-history-card-remove:hover {
    background: #e93444;
}

.nm-history-empty {
    padding: 58px 20px;
    text-align: center;
    border: 1px dashed rgba(255,255,255,.10);
    border-radius: 16px;
    background: rgba(0,0,0,.14);
}

.nm-history-empty-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    margin: 0 auto 14px;
    border-radius: 50%;
    color: #fff;
    background: rgba(233,52,68,.12);
}

.nm-history-empty p {
    margin: 8px auto 18px;
    color: #8e96a2;
}

.nm-history-load-wrap {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

/* Cards rendered by SiteWatchHistory on the homepage Continue Watching shelf. */
.watch-history-card {
    position: relative;
    min-width: 0;
}

.watch-history-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.watch-history-poster {
    position: relative;
    overflow: hidden;
    aspect-ratio: 2 / 3;
    border-radius: 12px;
    background: #12161d;
}

.watch-history-poster img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.watch-history-badge {
    position: absolute;
    left: 8px;
    bottom: 8px;
    padding: 3px 6px;
    border-radius: 6px;
    color: #fff;
    background: rgba(0,0,0,.72);
    font-size: 10px;
    font-weight: 800;
}

.watch-history-card-body {
    padding-top: 9px;
}

.watch-history-title {
    overflow: hidden;
    margin: 0;
    color: #fff;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.watch-history-meta,
.watch-history-resume {
    margin-top: 4px;
    color: #818a96;
    font-size: 11px;
}

.watch-history-resume {
    color: #bec5ce;
}

.watch-history-progress {
    height: 3px;
    overflow: hidden;
    margin-top: 7px;
    border-radius: 999px;
    background: rgba(255,255,255,.10);
}

.watch-history-progress-bar {
    display: block;
    height: 100%;
    background: #e93444;
}

.watch-history-remove {
    position: absolute;
    top: 7px;
    right: 7px;
    z-index: 3;
    width: 29px;
    height: 29px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 50%;
    color: #fff;
    background: rgba(0,0,0,.78);
    cursor: pointer;
}

@media (max-width: 1180px) {
    .nm-history-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 920px) {
    .nm-history-main { padding-top: 102px; }
    .nm-history-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .nm-history-hero { align-items: flex-start; flex-direction: column; }
    .nm-history-toolbar { align-items: stretch; flex-direction: column; }
    .nm-history-toolbar-actions { width: 100%; }
    .nm-history-search { flex: 1 1 240px; width: auto; }
}

@media (max-width: 680px) {
    .nm-history-main { padding: 88px 0 46px; }
    .nm-history-shell { gap: 18px; }
    .nm-history-hero,
    .nm-history-section { border-radius: 17px; }
    .nm-history-hero { padding: 24px 20px; }
    .nm-history-section { padding: 21px 16px; }
    .nm-history-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; }
    .nm-history-section-head { align-items: flex-end; }
    .nm-history-toolbar-actions { align-items: stretch; flex-direction: column; }
    .nm-history-search { width: 100%; flex-basis: auto; }
    .nm-history-clear { width: 100%; }
    .nm-history-card-remove { opacity: 1; transform: none; }
}

@media (max-width: 430px) {
    .nm-history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .nm-history-hero h1 { font-size: 38px; }
    .nm-history-primary,
    .nm-history-secondary { width: 100%; }
    #nm-history-account-actions,
    #nm-history-guest-actions { width: 100%; }
}
