/* Tekflix media page styles (Glance /media). All classes prefixed tm- */
:root { --tm-card: var(--color-widget-background-highlight, rgba(255,255,255,.04)); --tm-shadow: 0 6px 18px rgba(0,0,0,.35); }
.tm-trunc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-ico { width: 12px; height: 12px; vertical-align: -1px; opacity: .75; }

/* ---------- Now playing ---------- */
.tm-np { position: relative; overflow: hidden; border-radius: 12px; min-height: 168px; display: flex; gap: 20px; padding: 18px; align-items: flex-end; background: var(--tm-card); }
.tm-np + .tm-np { margin-top: 12px; }
.tm-np-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.tm-np::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8,13,15,.94) 0%, rgba(8,13,15,.72) 45%, rgba(8,13,15,.2) 100%); }
.tm-np > :not(.tm-np-art) { position: relative; z-index: 1; }
.tm-np-poster { width: 100px; aspect-ratio: 2/3; object-fit: cover; border-radius: 8px; box-shadow: 0 10px 28px rgba(0,0,0,.6); flex-shrink: 0; }
.tm-np-body { flex: 1; min-width: 0; }
.tm-np-state { display: inline-flex; align-items: center; gap: 7px; font-size: 1.05rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--color-positive); }
.tm-np-state.paused { color: var(--color-text-subdue); }
.tm-np-state i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 currentColor; animation: tm-pulse 1.8s infinite; }
.tm-np-state.paused i { animation: none; }
@keyframes tm-pulse { 0% { box-shadow: 0 0 0 0 rgba(120,220,140,.55); } 70% { box-shadow: 0 0 0 8px rgba(120,220,140,0); } 100% { box-shadow: 0 0 0 0 rgba(120,220,140,0); } }
.tm-np-title { margin-top: 4px; font-size: 2.2rem; font-weight: 700; line-height: 1.15; color: #fff; }
.tm-np-sub { margin-top: 2px; font-size: 1.35rem; color: rgba(255,255,255,.78); }
.tm-np-meta { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.tm-tag { font-size: 1.05rem; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.1); color: rgba(255,255,255,.85); white-space: nowrap; }
.tm-bar { margin-top: 12px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.15); overflow: hidden; }
.tm-bar > span { display: block; height: 100%; border-radius: 3px; background: var(--color-primary); }
.tm-np-time { margin-top: 5px; display: flex; justify-content: space-between; font-size: 1.05rem; color: rgba(255,255,255,.6); }
.tm-empty { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 10px; background: var(--tm-card); color: var(--color-text-subdue); }

/* ---------- Poster shelf (recently added) ---------- */
.tm-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 18px 14px; }
.tm-card { min-width: 0; }
.tm-poster { position: relative; aspect-ratio: 2/3; border-radius: 8px; overflow: hidden; background: var(--tm-card); box-shadow: var(--tm-shadow); transition: transform .18s ease, box-shadow .18s ease; }
.tm-card:hover .tm-poster { transform: translateY(-4px); box-shadow: 0 14px 28px rgba(0,0,0,.5); }
.tm-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tm-chip { position: absolute; top: 6px; left: 6px; font-size: .9rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; background: rgba(0,0,0,.7); color: #fff; }
.tm-count { position: absolute; bottom: 6px; right: 6px; font-size: 1.05rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--color-primary); color: #10181a; }
.tm-card-title { margin-top: 8px; font-size: 1.3rem; font-weight: 600; color: var(--color-text-highlight); }
.tm-card-sub { font-size: 1.12rem; color: var(--color-text-subdue); }

/* ---------- Watch history cards ---------- */
.tm-hist { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; }
.tm-h { position: relative; display: flex; gap: 12px; align-items: center; padding: 9px; border-radius: 10px; overflow: hidden; background: var(--tm-card); }
.tm-h-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .22; filter: blur(6px) saturate(1.3); transform: scale(1.15); }
.tm-h::after { content: ""; position: absolute; inset: 0; z-index: 0; background: linear-gradient(90deg, rgba(10,16,18,.15) 0%, rgba(10,16,18,.55) 55%, rgba(10,16,18,.7) 100%); }
.tm-h > :not(.tm-h-bg) { position: relative; z-index: 1; }
.tm-h-poster { width: 48px; aspect-ratio: 2/3; border-radius: 5px; object-fit: cover; flex-shrink: 0; box-shadow: 0 4px 10px rgba(0,0,0,.4); background: rgba(0,0,0,.2); }
.tm-h-body { flex: 1; min-width: 0; }
.tm-h-title { font-weight: 600; color: var(--color-text-highlight); }
.tm-h-sub { font-size: 1.15rem; color: var(--color-text-subdue); }
.tm-h-foot { margin-top: 5px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 1.1rem; color: var(--color-text-subdue); }
.tm-user { display: inline-flex; align-items: center; gap: 6px; color: var(--color-text-base); min-width: 0; }
.tm-av { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 1rem; font-weight: 700; color: #10181a; flex-shrink: 0; }
.tm-av.c0 { background: #8fd3c7; } .tm-av.c1 { background: #f2b880; } .tm-av.c2 { background: #b8a6f0; } .tm-av.c3 { background: #f08fa8; }

/* ---------- Side lists (upcoming / downloads / missing) ---------- */
.tm-day { display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; font-size: 1.02rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--color-text-subdue); }
.tm-day:first-child { margin-top: 0; }
.tm-day::after { content: ""; flex: 1; height: 1px; background: var(--color-separator, rgba(255,255,255,.08)); }
.tm-day.today { color: var(--color-primary); }
.tm-row { display: flex; gap: 10px; align-items: center; padding: 5px; margin: 0 -5px; border-radius: 8px; color: inherit; text-decoration: none; }
.tm-row:hover { background: var(--tm-card); }
.tm-row img { width: 36px; aspect-ratio: 2/3; object-fit: cover; border-radius: 4px; flex-shrink: 0; background: var(--tm-card); }
.tm-row-body { flex: 1; min-width: 0; }
.tm-row-title { font-weight: 600; color: var(--color-text-highlight); }
.tm-row-sub { font-size: 1.12rem; color: var(--color-text-subdue); }
.tm-row-meta { flex-shrink: 0; text-align: right; font-size: 1.1rem; color: var(--color-text-base); white-space: nowrap; }
.tm-row-meta small { display: block; color: var(--color-text-subdue); font-size: 1rem; }
.tm-pill { display: inline-block; font-size: .95rem; font-weight: 600; padding: 0 6px; border-radius: 999px; border: 1px solid currentColor; }
.tm-pill.ok { color: var(--color-positive); }
.tm-pill.bad { color: var(--color-negative); }

/* ---------- Library stats ---------- */
.tm-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tm-stat { padding: 10px 12px; border-radius: 10px; background: var(--tm-card); min-width: 0; }
.tm-stat b { display: block; font-size: 2.3rem; font-weight: 700; line-height: 1.1; color: var(--color-text-highlight); }
.tm-stat span { font-size: 1.02rem; letter-spacing: .1em; text-transform: uppercase; color: var(--color-text-subdue); }
.tm-stat small { display: block; font-size: 1.1rem; color: var(--color-text-subdue); }
.tm-stat.warn b { color: var(--color-negative); }
.tm-stat.good b { color: var(--color-positive); }

/* ---------- Upcoming calendar (main widget, month grid) ---------- */
.tm-mc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.tm-mc-month { font-size: 1.9rem; font-weight: 700; color: var(--color-text-highlight); }
.tm-mc-month span { font-weight: 400; color: var(--color-text-subdue); }
.tm-mc-sum { font-size: 1.1rem; color: var(--color-text-subdue); }
.tm-mc-sum b { color: var(--color-text-highlight); }
.tm-mc { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; border-radius: 10px; overflow: hidden; background: var(--color-separator, rgba(255,255,255,.06)); border: 1px solid var(--color-separator, rgba(255,255,255,.06)); }
.tm-mc-wd { padding: 7px 8px; font-size: 1rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--color-text-subdue); background: var(--color-widget-background); }
.tm-mc-day { min-width: 0; min-height: 104px; padding: 6px; display: flex; flex-direction: column; gap: 4px; background: var(--color-widget-background); }
.tm-mc-day.wkend, .tm-mc-wd.wkend { background: color-mix(in srgb, var(--color-widget-background) 88%, #fff 3%); }
.tm-mc-day.past { opacity: .45; }
.tm-mc-num { display: flex; align-items: center; gap: 5px; padding: 0 2px 2px; font-size: 1.25rem; font-weight: 600; color: var(--color-text-base); }
.tm-mc-num span { margin-left: auto; }
.tm-mc-num small, .tm-mc-num em { font-size: .95rem; font-style: normal; letter-spacing: .1em; text-transform: uppercase; color: var(--color-text-subdue); }
.tm-mc-day.today { box-shadow: inset 0 0 0 2px hsl(172,42%,60%); }
.tm-mc-day.today .tm-mc-num em { color: hsl(172,42%,60%); font-weight: 700; }
.tm-mc-day.today .tm-mc-num span { display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 4px; border-radius: 999px; background: hsl(172,42%,60%); color: #10181a; }
.tm-ev { --c: 172,42%,60%; display: block; min-width: 0; padding: 3px 6px 4px; border-radius: 5px; border-left: 3px solid hsl(var(--c)); background: hsla(var(--c), .13); color: inherit; text-decoration: none; line-height: 1.25; transition: background .15s; }
.tm-ev:hover { background: hsla(var(--c), .26); }
.tm-ev.c1 { --c: 32,78%,66%; } .tm-ev.c2 { --c: 255,62%,76%; } .tm-ev.c3 { --c: 345,72%,74%; } .tm-ev.c4 { --c: 205,70%,68%; } .tm-ev.c5 { --c: 95,45%,62%; }
.tm-ev-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 1.12rem; font-weight: 600; color: var(--color-text-highlight); overflow-wrap: anywhere; }
.tm-ev-sub { display: flex; align-items: center; gap: 3px; font-size: .98rem; color: var(--color-text-subdue); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-ev-sub svg { width: 11px; height: 11px; flex-shrink: 0; color: var(--color-positive); }
@media (max-width: 900px) {
  .tm-mc { grid-template-columns: repeat(7, 120px); overflow-x: auto; }
}
