/* My Media home ("Up next").
   The signed-in My Media page opens on what you are in the middle of: Keep
   going, Paused, Up next, Recently finished. Filters and sorting live one
   step away, under "Everything" (the older library view).
   Rule for this page: an action is an outlined button with a verb; a state is
   a dot with a word. Nothing that can be pressed is tinted like a status. */

body[data-page="app"] {
  --smh-line: color-mix(in srgb, var(--hs4-text) 12%, transparent);
  --smh-line-strong: color-mix(in srgb, var(--hs4-text) 26%, transparent);
  --smh-muted: var(--sh-on-muted, var(--hs4-muted-text));
  --smh-subtle: var(--sh-on-subtle, var(--hs4-muted-text));
  --smh-soft: color-mix(in srgb, var(--hs4-text) 5%, transparent);
  --smh-hover: color-mix(in srgb, var(--hs4-text) 9%, transparent);
  --smh-star: var(--hs4-orange);
  --smh-star-off: color-mix(in srgb, var(--hs4-text) 20%, transparent);
  --smh-pop-bg: var(--hs4-surface);
  --smh-radius: 14px;
  --smh-s-active: var(--hs4-green-strong);
  --smh-s-want: var(--hs4-blue-strong);
  --smh-s-done: var(--hs4-text);
  --smh-s-paused: #b07a00;
  --smh-s-dropped: #8a8a8a;
  --smh-s-revisit: var(--hs4-berry);
}
html[data-theme="dark"] body[data-page="app"] {
  --smh-pop-bg: #262626;
  --smh-s-active: #6cc777;
  --smh-s-want: #6fb4ff;
  --smh-s-paused: #ffcb00;
  --smh-s-dropped: #9a9a9a;
  --smh-s-revisit: #ff9cc6;
}

.stella-app-main.smh { --app-main-max: 1080px; }

/* ---- small parts ---- */
.smh-ic { display: inline-block; flex: 0 0 auto; width: 16px; height: 16px; vertical-align: -3px; }
.smh-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 15px;
  border: 1.5px solid var(--hs4-field-edge);
  border-radius: 999px;
  background: transparent;
  color: var(--hs4-text);
  font: 600 13.5px / 1 var(--hs4-font-inter);
  white-space: nowrap;
  cursor: pointer;
}
.smh-btn:hover { background: var(--smh-hover); }
.smh-btn--sm { min-height: 32px; padding: 0 12px; font-size: 12.5px; }
.smh-btn:disabled { opacity: 0.55; cursor: wait; }
.smh-icon-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--hs4-text);
  cursor: pointer;
}
.smh-icon-btn:hover { background: var(--smh-hover); }
.smh-link {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  color: var(--hs4-text);
  font: 600 13px / 1.3 var(--hs4-font-inter);
  text-decoration: underline;
  text-decoration-color: var(--smh-line-strong);
  text-underline-offset: 3px;
  cursor: pointer;
}
.smh-link:hover { text-decoration-color: currentColor; }
.smh-btn:focus-visible,
.smh-icon-btn:focus-visible,
.smh-link:focus-visible,
.smh-stat:focus-visible,
.smh-kind:focus-visible,
.smh-finish:focus-visible,
.smh-open:focus-visible,
.smh-rail-nav:focus-visible {
  outline: 2px solid var(--hs4-focus);
  outline-offset: 2px;
}

/* "Mark finished": an action, so it must not look like a state. Outlined, a
   verb, and an empty tick box that only fills in on hover. */
.smh-finish {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 13px 0 8px;
  border: 1.5px solid var(--hs4-field-edge);
  border-radius: 999px;
  background: transparent;
  color: var(--hs4-text);
  font: 600 12.5px / 1 var(--hs4-font-inter);
  white-space: nowrap;
  cursor: pointer;
}
.smh-finish:disabled { opacity: 0.55; cursor: wait; }
.smh-finish-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  box-sizing: border-box;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}
.smh-finish-box .smh-ic { width: 11px; height: 11px; stroke-width: 3; opacity: 0; vertical-align: 0; }
.smh-finish:hover,
.smh-finish:focus-visible {
  border-color: var(--hs4-selected);
  background: var(--hs4-selected-soft);
  color: var(--hs4-on-selected-soft);
}
.smh-finish:hover .smh-ic,
.smh-finish:focus-visible .smh-ic { opacity: 1; }

.smh-private {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--smh-muted);
  font: 500 12.5px / 1.3 var(--hs4-font-inter);
  white-space: nowrap;
}
.smh-private .smh-ic { width: 13px; height: 13px; vertical-align: 0; }

/* Stars: the user's own rating (0-100 inside, five stars outside) */
.smh-stars {
  position: relative;
  display: inline-block;
  font: 400 13px / 1 var(--hs4-font-inter);
  letter-spacing: 1px;
  white-space: nowrap;
  vertical-align: middle;
}
.smh-stars-bg { color: var(--smh-star-off); }
.smh-stars-fg { position: absolute; inset: 0 auto 0 0; overflow: hidden; color: var(--smh-star); }
.smh-rate { display: inline-flex; gap: 2px; }
.smh-rate button {
  appearance: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--smh-star-off);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.smh-rate button:hover,
.smh-rate button:has(~ button:hover),
.smh-rate button:focus-visible,
.smh-rate button:has(~ button:focus-visible) { color: var(--smh-star); }
.smh-rate button:focus-visible { outline: 2px solid var(--hs4-focus); outline-offset: -2px; }
/* The rating that is set (STE-49). While the pointer is on the stars, the
   hover preview wins: lit stars past the one under the pointer dim. */
.smh-rate button.is-on { color: var(--smh-star); }
.smh-rate button.is-half {
  background: linear-gradient(90deg, var(--smh-star) 50%, var(--smh-star-off) 50%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.smh-rate:hover button:hover ~ button.is-on,
.smh-rate:hover button:hover ~ button.is-half {
  background: none;
  color: var(--smh-star-off);
}
.smh-rate:hover button.is-half:hover,
.smh-rate:hover button.is-half:has(~ button:hover) {
  background: none;
  color: var(--smh-star);
}
.smh-rate--sm { margin-left: -3px; }
.smh-rate--sm button { width: 21px; height: 22px; font-size: 16px; }

/* Status: a dot and a word */
.smh-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--hs4-text);
  font: 600 12px / 1.2 var(--hs4-font-inter);
  white-space: nowrap;
}
.smh-status i { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--smh-s-done); }
.smh-status[data-s="active"] i { background: var(--smh-s-active); }
.smh-status[data-s="want"] i { background: transparent; box-shadow: inset 0 0 0 2px var(--smh-s-want); }
.smh-status[data-s="paused"] i { background: var(--smh-s-paused); border-radius: 2px; }
.smh-status[data-s="dropped"] i { background: var(--smh-s-dropped); border-radius: 2px; height: 3px; }
.smh-status[data-s="revisit"] i { background: var(--smh-s-revisit); }

/* Posters inside cards (rails use the app's own .stella-tile) */
.smh-open {
  appearance: none;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.smh-open .stella-poster { width: 100%; height: auto; aspect-ratio: 2 / 3; border-radius: 6px; }
.smh-open .stella-poster--missing { font-size: 10px; }

/* ---- head: title, four numbers, search, import ---- */
.smh-titlerow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin: 4px 0 14px; }
/* STE-50: the numbers are one panel with a line between each, so they read
   apart from the privacy note and the buttons. */
.smh-stats {
  display: flex;
  padding: 4px;
  border: 1px solid var(--smh-line);
  border-radius: 14px;
}
.smh-stat + .smh-stat { position: relative; }
.smh-stat + .smh-stat::before {
  content: "";
  position: absolute;
  left: -0.5px;
  top: 10px;
  bottom: 10px;
  width: 1px;
  background: var(--smh-line);
}
.smh-stat {
  appearance: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--hs4-text);
  text-align: left;
  cursor: pointer;
}
.smh-stat b { font: 400 27px / 1 var(--hs4-font-serif); }
.smh-stat span { color: var(--smh-muted); font: 500 12px / 1.2 var(--hs4-font-inter); white-space: nowrap; }
button.smh-stat:hover { background: var(--smh-hover); }
div.smh-stat { cursor: default; }
.smh-stat .smh-star-glyph { color: var(--smh-star); font: 400 17px / 1 var(--hs4-font-inter); vertical-align: 3px; }
.smh-head-actions { position: relative; display: flex; align-items: center; gap: 8px; margin-left: auto; }
.smh-head-actions .smh-private { margin-right: 6px; }
.smh-import-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 230px;
  padding: 10px;
  border-radius: 14px;
  background: var(--smh-pop-bg);
  box-shadow: 0 14px 36px color-mix(in srgb, var(--hs4-ink) 22%, transparent), 0 0 0 1px var(--smh-line);
}
.smh-import-menu[hidden] { display: none; }
.smh-import-menu .stella-my-actions { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.smh-import-menu .stella-import-secondary { width: 100%; min-height: 38px; text-align: left; }
.smh-import-note { margin: 2px 2px 0; color: var(--smh-muted); font: 400 12px / 1.4 var(--hs4-font-inter); }
.smh-head .sbf-row--types { margin-bottom: 0; }

/* ---- sections ---- */
.smh-sec { margin-top: 30px; }
.smh-sec-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; }
.smh-sec-head h2 { margin: 0; font: 400 26px / 1.15 var(--hs4-font-serif); color: var(--hs4-text); white-space: nowrap; }
.smh-sec-count { color: var(--smh-muted); font: 500 13px / 1 var(--hs4-font-inter); }
.smh-sec-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.smh-empty {
  padding: 28px 16px;
  border: 1px dashed var(--smh-line-strong);
  border-radius: var(--smh-radius);
  color: var(--smh-muted);
  font: 400 14px / 1.5 var(--hs4-font-inter);
  text-align: center;
}

/* Keep going */
.smh-going { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.smh-go {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--smh-line);
  border-radius: var(--smh-radius);
  background: var(--hs4-surface);
}
.smh-go:nth-child(n + 7) { display: none; }
.smh-go-body { min-width: 0; }
.smh-go-type { display: block; color: var(--smh-muted); font: 500 12px / 1.2 var(--hs4-font-inter); }
.smh-go-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 3px;
  font: 600 16px / 1.25 var(--hs4-font-inter);
}
.smh-go-since { display: flex; flex-wrap: wrap; gap: 0 5px; margin-top: 5px; color: var(--smh-muted); font: 400 12.5px / 1.3 var(--hs4-font-inter); }
.smh-go-actions { display: flex; align-items: center; gap: 4px; margin-top: 9px; }
.smh-go.is-rating { border-color: var(--hs4-selected-edge); background: var(--hs4-selected-soft); }
.smh-go-ask { display: block; margin-top: 4px; font: 600 13px / 1.3 var(--hs4-font-inter); }
.smh-go.is-rating .smh-rate { margin: 4px 0 0 -5px; }
.smh-go.is-rating .smh-rate button { color: color-mix(in srgb, var(--hs4-text) 30%, transparent); }
.smh-go.is-rating .smh-rate button:hover,
.smh-go.is-rating .smh-rate button:has(~ button:hover) { color: var(--smh-star); }

/* Paused: small cards under Keep going */
.smh-paused { margin-top: 18px; }
.smh-paused-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  color: var(--smh-muted);
  font: 600 11.5px / 1.2 var(--hs4-font-inter);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.smh-paused-head .smh-status { color: inherit; font: inherit; }
.smh-paused-list { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.smh-hold {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  width: 322px;
  box-sizing: border-box;
  padding: 6px 4px 6px 6px;
  border: 1px solid var(--smh-line);
  border-radius: 12px;
}
.smh-hold .stella-poster { border-radius: 4px; }
.smh-hold .smh-icon-btn { width: 30px; margin-left: -4px; }
.smh-hold > span { min-width: 0; margin-left: 2px; }
.smh-hold b { display: block; font: 600 13.5px / 1.25 var(--hs4-font-inter); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smh-hold small { display: block; margin-top: 2px; color: var(--smh-muted); font: 400 12px / 1.3 var(--hs4-font-inter); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smh-hold-more { display: flex; align-items: center; padding: 0 6px; }

/* Up next and Recently finished: rows that page sideways */
.smh-kinds { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: 4px; }
.smh-kind {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 11px;
  border: 1.5px solid var(--smh-line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--hs4-text);
  font: 600 12.5px / 1 var(--hs4-font-inter);
  cursor: pointer;
}
.smh-kind span { color: var(--smh-muted); font-weight: 500; }
.smh-kind:hover { border-color: var(--hs4-text); }
.smh-kind[aria-pressed="true"] { border-color: var(--hs4-text); background: var(--hs4-text); color: var(--hs4-bg); }
.smh-kind[aria-pressed="true"] span { color: inherit; opacity: 0.75; }
.smh-railwrap { position: relative; }
.smh-rail {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  margin: 0 -2px;
  padding: 2px 2px 10px;
  list-style: none;
  scrollbar-width: thin;
}
.smh-rail > li { flex: 0 0 132px; min-width: 0; scroll-snap-align: start; }
.smh-rail .smh-start { width: 100%; min-height: 30px; margin-top: auto; padding: 0 6px; font-size: 12px; }
.smh-rail .stella-tile-meta:has(+ .smh-start) { margin-bottom: 3px; }
.smh-rail .stella-tile.is-picked .stella-poster { outline: 3px solid var(--hs4-action); outline-offset: 3px; }
.smh-tile-my { display: flex; align-items: center; gap: 6px; min-height: 16px; color: var(--smh-muted); font: 500 12px / 1.2 var(--hs4-font-inter); }
.smh-rail-nav {
  appearance: none;
  position: absolute;
  top: 78px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--smh-line-strong);
  border-radius: 50%;
  background: var(--smh-pop-bg);
  color: var(--hs4-text);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--hs4-ink) 22%, transparent);
  cursor: pointer;
}
.smh-rail-nav:hover { background: var(--hs4-text); color: var(--hs4-bg); }
.smh-rail-nav--prev { left: -16px; }
.smh-rail-nav--next { right: -16px; }
.smh-rail-nav[hidden] { display: none; }

/* Everything band, and the head of the Everything view */
.smh-all {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  margin-top: 38px;
  padding: 18px 20px;
  border-radius: var(--smh-radius);
  background: var(--smh-soft);
}
.smh-all h2 { margin: 0; font: 400 26px / 1.15 var(--hs4-font-serif); }
.smh-all p { margin: 4px 0 0; color: var(--smh-muted); font: 400 13px / 1.4 var(--hs4-font-inter); }
.smh-all .smh-btn { margin-left: auto; }
.smh-back { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 12px; }

@media (max-width: 1040px) {
  .smh-stat { padding: 6px 9px; }
}
@media (max-width: 960px) {
  .smh-going { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px), (hover: none) {
  .smh-rail-nav { display: none; }
}
@media (max-width: 720px) {
  .smh-hide-sm { display: none !important; }
  .smh-sec { margin-top: 26px; }
  .smh-sec-head h2 { font-size: 23px; }
  .smh-titlerow { align-items: center; }
  /* Phone: the buttons and the note on top, the numbers panel full width under them. */
  .smh-head-actions { order: 1; flex: 1 0 100%; }
  .smh-head-actions .smh-private { margin-right: auto; }
  .smh-stats { order: 2; flex: 1 0 100%; justify-content: space-between; }
  .smh-stat { flex: 1 1 0; min-width: 0; padding: 4px 8px; }
  .smh-stat b { font-size: 23px; }
  .smh-stat span { font-size: 11px; white-space: normal; }
  .smh-going {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    margin: 0 -16px;
    padding: 0 16px 8px;
    scrollbar-width: none;
  }
  .smh-go { flex: 0 0 min(80vw, 300px); scroll-snap-align: start; }
  .smh-go:nth-child(n + 7) { display: grid; }
  .smh-paused-list { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 6px; scrollbar-width: none; }
  .smh-hold { flex: 0 0 322px; width: auto; }
  .smh-hold-more { flex: 0 0 auto; white-space: nowrap; }
  .smh-sec-head:has(.smh-kinds) { flex-wrap: wrap; row-gap: 8px; }
  .smh-kinds { order: 5; flex: 1 0 100%; margin-left: 0; }
  .smh-rail > li { flex-basis: 112px; }
  .smh-all .smh-btn { margin-left: 0; }
}

/* STE-55: with a public profile the note is a link to it. */
a.smh-private--public { color: var(--hs4-text); text-decoration: none; }
a.smh-private--public:hover,
a.smh-private--public:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
