* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: #111;
  color: #eee;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Full-width sticky bar; its content (.bar) centers to a max width on desktop. */
#topbar {
  position: sticky;
  top: 0;
  /* Above card content (the .qcorner "Top k%" badge is z-index 1, and the grid
     comes later in the DOM, so an equal z-index let it paint over the bar on
     scroll). Stays below the overlays (detail 70, selection 75, sheet 80). */
  z-index: 50;
  padding-top: env(safe-area-inset-top);
  background: #1a1a1aee;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #2a2a2a;
}
#topbar .bar {
  display: flex;
  gap: .5rem;
  align-items: center;
  padding: .6rem .9rem;
}
#topbar .back {
  text-decoration: none; color: #7aa9d6; font-size: 1.35rem; line-height: 1;
  padding: 0 .25rem 0 0;
}
.count { color: #888; font-size: .82rem; margin-left: auto; white-space: nowrap; }
#topbar .gear { color: #9a9a9a; display: flex; padding: .15rem; margin-left: .1rem; }
#topbar .gear:hover { color: #ccc; }
/* iOS-style search field: rounded grey fill, inset magnifier glyph, custom ✕
   (iOS Safari doesn't render a clear button for type=search). 16px font avoids
   iOS focus-zoom. */
.searchwrap { flex: 1; min-width: 0; position: relative; display: flex; }
#topbar #searchq {
  flex: 1; min-width: 0;
  color: #eee; border: 0; border-radius: 10px; font-size: 16px;
  padding: .5rem 2rem .5rem 2rem;
  background: #2a2a2a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%238e8e93' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='6.7' cy='6.7' r='4.3'/%3E%3Cline x1='10' y1='10' x2='14' y2='14'/%3E%3C/svg%3E") no-repeat .6rem center;
  background-size: .95rem;
}
#topbar #searchq::placeholder { color: #8e8e93; }
/* Suppress any native (desktop) search clear so we don't get two ✕. */
#topbar #searchq::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
/* Our clear button: a tappable ✕ inset at the field's right edge, shown only when
   the field is visible and non-empty. */
#clearq {
  display: none; position: absolute; right: .35rem; top: 50%; transform: translateY(-50%);
  width: 1.5rem; height: 1.5rem; padding: 0; border: 0; border-radius: 999px;
  background: #555; color: #eee; font-size: .8rem; line-height: 1; cursor: pointer;
  align-items: center; justify-content: center;
}
.searchwrap:has(#searchq:not([hidden]):not(:placeholder-shown)) #clearq { display: flex; }
/* Graphical ✕ to leave search (the field's own ✕ just clears the text). */
#cancel {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  background: none; border: 0; color: #8e8e93; padding: .2rem .25rem; cursor: pointer;
}
#cancel svg { width: 1.3rem; height: 1.3rem; display: block; }
#cancel:active { color: #ccc; }

/* Grid — #grid is a plain container; .secgrid lays out the poster columns
   (a view can have several: a foldable In Progress section + the pool). */
#grid { padding: .9rem; }
.secgrid {
  display: grid;
  gap: .85rem;
  grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
}
#grid.empty-state::after { content: "No matches."; color: #888; padding: 0 .15rem 1rem; display: block; }

/* View controls — JustWatch-style flat rounded bar: segmented type toggle +
   In Progress pill + sort/filter icon buttons. */
#controls {
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem .9rem .2rem;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
#controls::-webkit-scrollbar { display: none; }
.ctl-icons { margin-left: auto; display: flex; gap: .4rem; flex: 0 0 auto; }
.seg { display: inline-flex; flex: 0 0 auto; background: #1e1e1e; border: 1px solid #333; border-radius: 999px; padding: 2px; }
.seg-btn {
  background: none; border: 0; color: #aaa; cursor: pointer;
  padding: .3rem .7rem; font-size: .82rem; border-radius: 999px; line-height: 1;
}
.seg-btn.on { background: #3a3a3a; color: #fff; }
.ctlbtn {
  display: inline-flex; align-items: center; justify-content: center;
  background: #1e1e1e; color: #ccc; border: 1px solid #333; border-radius: 999px;
  cursor: pointer; font-size: .82rem;
}
.ctlbtn.pill { padding: .35rem .8rem; flex: 0 0 auto; }
.ctlbtn.icon { width: 2.1rem; height: 2.1rem; padding: 0; flex: 0 0 auto; }
.ctlbtn.icon svg { width: 1.15rem; height: 1.15rem; }
.ctlbtn.on { background: #2e6da4; border-color: #3a82c4; color: #fff; }
.ctlbtn.dim { opacity: .4; cursor: default; }

/* Sort / filter modal — drops down from the control bar that invoked it (its
   --top is the bar's bottom edge). On the phone it's a full-width sheet just
   under the bar; on the web it tucks to the bar's right edge (--right) so it
   reads as a menu popping down from the icon buttons. */
#sheet { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.5); display: flex; align-items: flex-start; justify-content: center; padding: 0 1rem 1rem; }
.sheet-panel {
  position: relative; top: var(--top, 0);
  width: 100%; max-width: 420px; max-height: 80vh; overflow-y: auto; background: #1c1c1c;
  border: 1px solid #333; border-radius: 14px;
  padding: 1rem 1rem 1.1rem;
}
@media (min-width: 768px) {
  #sheet { justify-content: flex-end; padding-left: 0; padding-right: var(--right, 1rem); }
  .sheet-panel { max-width: 340px; }
}
.sheet-h { display: flex; align-items: center; justify-content: space-between; font-size: 1.05rem; font-weight: 600; margin-bottom: .8rem; }
.sheet-h-actions { display: flex; align-items: center; gap: .8rem; }
.sheet-clear { background: none; border: 0; color: #7aa9d6; font-size: .9rem; cursor: pointer; }
.sheet-x { background: none; border: 0; color: #999; font-size: 1.05rem; line-height: 1; cursor: pointer; padding: 0 .1rem; }
.sheet-x:active { color: #ccc; }
.sheet-opt { display: block; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid #262626; color: #eee; font-size: 1rem; padding: .8rem .2rem; cursor: pointer; }
.sheet-opt.on { color: #6fb1ec; font-weight: 600; }
.fgroup { margin-bottom: 1rem; }
.fglabel { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: #888; margin-bottom: .5rem; }
.fchips { display: flex; flex-wrap: wrap; gap: .4rem; }
.fchip { background: #222; color: #ccc; border: 1px solid #333; border-radius: 999px; padding: .35rem .75rem; font-size: .85rem; cursor: pointer; }
.fchip.on { background: #2e6da4; border-color: #3a82c4; color: #fff; }
.sheet-done {
  width: 100%; margin-top: .4rem; background: #2e6da4; color: #fff; border: 0;
  border-radius: 10px; padding: .7rem; font-size: 1rem; font-weight: 600; cursor: pointer;
}

/* Who-list pills carry a joined ⤒ "watch next" segment, shown only while the pill
   is active. The toggle squares its right edge when the segment is visible so the
   two read as one control. */
.pillwrap { display: inline-flex; align-items: stretch; }
.pillwrap .toggle.on { border-top-right-radius: 0; border-bottom-right-radius: 0; padding-right: .55rem; }
.pbump {
  display: none; align-items: center; justify-content: center;
  background: #2e6da4; color: #fff; border: 1px solid #3a82c4; border-left-color: #6aa6da;
  border-radius: 0 999px 999px 0; padding: .3rem .6rem; font-size: .9rem; line-height: 1; cursor: pointer;
}
.toggle.on + .pbump { display: inline-flex; }   /* only when its pill is active */
.pbump:disabled { opacity: .55; cursor: default; }
.pbump.top { background: #2f7d33; border-color: #3f9f43; border-left-color: #5fbf63; }  /* first in this list's Next order */
/* "+ Add to <list>" quick button in the Search/Add detail (jumped from a list). */
.daddto {
  display: inline-flex; align-items: center; gap: .3rem; margin: .1rem 0 .3rem;
  background: #2e6da4; color: #fff; border: 0; border-radius: 999px;
  padding: .35rem .9rem; font-size: .9rem; font-weight: 600; cursor: pointer;
}
.daddto.on { background: #28361f; color: #9fcf7f; }
.daddto:disabled { cursor: default; }
/* "Search all of WatchBase for …" CTA shown under a list's search-within results. */
.global-cta { padding: 1rem .9rem 1.5rem; text-align: center; }
.global-cta button {
  background: #2e6da4; color: #fff; border: 0; border-radius: 999px;
  padding: .55rem 1.1rem; font-size: .95rem; font-weight: 600; cursor: pointer;
  max-width: 100%;
}
/* Item-page Select checkbox: above the poster (next to Back) on the phone,
   inline with the title on the web. */
.detail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.detail-head .dback { margin-bottom: 0; }
.meta-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.meta-head h2 { margin: 0 0 .3rem; }
.dselbox {
  display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; flex: 0 0 auto;
  background: none; border: 0; color: #aaa; font-size: .95rem;
  padding: .5rem .6rem; margin: -.3rem -.3rem -.3rem 0; /* bigger tap target without shifting layout */
}
.dsel-title { display: none; }                 /* phone: header checkbox; hide the title one */
@media (min-width: 640px) {
  .dsel-head { display: none; }                /* web: inline-with-title checkbox; hide the header one */
  .dsel-title { display: inline-flex; }
  .dsel-title .box { margin-top: .2rem; }       /* nudge toward the larger title's baseline */
}
.dselbox .box {
  width: 1.3rem; height: 1.3rem; border-radius: 5px; border: 1.5px solid #888;
  display: inline-block; position: relative; flex: 0 0 auto;
}
.dselbox.on { color: #6fb1ec; }
.dselbox.on .box { background: #2e6da4; border-color: #2e6da4; }
.dselbox.on .box::after {
  content: "✓"; color: #fff; font-size: .9rem; position: absolute; inset: 0;
  text-align: center; line-height: 1.2rem;
}

/* Cards: suppress the touch callout / text-selection so long-press can select. */
.card {
  text-decoration: none; color: inherit; display: block; position: relative;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
}
/* Corner select checkbox — hidden until a selection is active (start one from an
   item page); then it appears top-right on every card. The hit area is a large
   transparent box; the visible circle is drawn (smaller) inside it via ::before,
   so it's easy to tap without a big circle covering the poster. */
.selbox {
  display: none;
  position: absolute; top: 0; right: 0; z-index: 2;
  width: 2.4rem; height: 2.4rem; cursor: pointer; place-items: center;
}
body.sel-active .selbox { display: grid; }
.selbox::before {
  content: ""; grid-area: 1 / 1; width: 1.45rem; height: 1.45rem; border-radius: 999px;
  background: rgba(0,0,0,.5); border: 1.5px solid rgba(255,255,255,.8);
}
.selbox.on::before { background: #2e6da4; border-color: #fff; }
.selbox.on::after { content: "✓"; grid-area: 1 / 1; place-self: center; color: #fff; font-size: .95rem; font-weight: 700; }
.card.sel img { outline: 2px solid #3a82c4; outline-offset: 1px; }
.card img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 8px;
  background: #222;
  display: block;
  /* Kill the iOS touch-and-hold image preview so it doesn't fight long-press
     selection (callout doesn't inherit, so it must be set on the img itself). */
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}
.card .cap { padding: .35rem .15rem 0; }
.card .t { font-size: .85rem; line-height: 1.2; }
.card .y {
  font-size: .75rem; color: #999; margin-top: .1rem;
  display: flex; align-items: center; flex-wrap: wrap; gap: .25rem .3rem;
}
.card .y .yr { flex: 0 0 auto; }
/* Other-list membership pills on a card (which lists a title is also on),
   flowing inline after the year. */
.lmark {
  font-size: .66rem; line-height: 1.5; padding: 0 .4rem; white-space: nowrap;
  border-radius: 999px; background: #262626; border: 1px solid #333; color: #aaa;
}
.lmark.lm-in-progress { color: #e0a72e; }
.lmark.lm-watched { color: #5fb56b; }
.lmark.lm-who { color: #9ab8d6; border-color: #34465a; }
.mark { font-size: .72rem; }
.mark.in {
  margin-left: auto; color: #7aa9d6; background: #1e2a36;
  border: 1px solid #2c4055; border-radius: 999px; padding: .02rem .4rem;
  white-space: nowrap;
}

/* Detail — a full-screen overlay above the grid. The grid stays mounted and
   frozen at its scroll offset (body.detail-open), so closing the detail lands
   you exactly where you were. The overlay is its own scroll container. */
body.detail-open { position: fixed; left: 0; right: 0; width: 100%; }
#detail {
  position: fixed;
  inset: 0;
  z-index: 70;     /* above the add overlay (60), so a previewed title opens on top */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: #111;
}
.detail-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: .9rem;
  /* Room to scroll the last element (the trailer) up off the bottom edge. */
  padding-bottom: 45vh;
}
.dback { display: inline-block; margin-bottom: 1rem; color: #7aa9d6; text-decoration: none; font-size: .9rem; }
.dback:hover { text-decoration: underline; }
/* Mobile: poster spans the full page width, metadata stacks below. */
.detail-top { display: flex; flex-direction: column; gap: 1.1rem; }
.detail-top .poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 10px;
  background: #222;
}
.detail-meta { min-width: 0; }

/* Desktop: fixed-width poster beside the metadata. */
@media (min-width: 640px) {
  .detail-top { flex-direction: row; gap: 1.4rem; }
  .detail-top .poster { width: 260px; flex: 0 0 auto; align-self: flex-start; }
  .detail-meta { flex: 1; }
}
.detail-meta h2 { margin: 0 0 .3rem; font-size: 1.5rem; line-height: 1.2; }
.detail-meta .year { color: #999; font-weight: 400; }
.detail-meta .tagline { color: #aaa; font-style: italic; font-size: .98rem; margin: .15rem 0 .5rem; }
.badges { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
.badges span {
  background: #262626; border: 1px solid #333; border-radius: 999px;
  padding: .15rem .6rem; font-size: .78rem; color: #ccc;
}
.detail-meta .sub { color: #bbb; font-size: .92rem; margin: .3rem 0; }
.ratings { display: flex; flex-wrap: wrap; gap: .5rem; margin: .55rem 0; }
.rating {
  display: inline-flex; align-items: baseline; gap: .35rem;
  background: #1e1e1e; border: 1px solid #333; border-radius: 6px;
  padding: .2rem .55rem;
  text-decoration: none; color: inherit;
}
a.rating:hover { border-color: #555; background: #262626; }
.rating .rsrc { color: #888; text-transform: uppercase; font-size: .68rem; letter-spacing: .04em; }
.rating .rval { color: #eee; font-weight: 600; font-size: .9rem; }
/* The composite quality percentile — leads the ratings row; color via .q-*. */
.rating.qmark { font-weight: 600; font-size: .9rem; }
/* Same score as a small badge in the bottom-right of the poster. The poster is
   wrapped (.pwrap) so the badge anchors to the image, not the card+caption. */
.card .pwrap { position: relative; display: block; }
.qcorner {
  position: absolute; right: .3rem; bottom: .3rem; z-index: 1;
  font-size: .66rem; font-weight: 600; line-height: 1;
  padding: .2rem .34rem; border-radius: 5px; pointer-events: none;
}
/* Quartile colors (Rotten-Tomatoes-style): top 25% green, 25–50 yellow,
   50–75 orange, bottom 25% red. Shared by the card and detail badges. */
.qcorner.q-green,  .rating.qmark.q-green  { background: #1f9d57; border-color: #1f9d57; color: #fff; }
.qcorner.q-yellow, .rating.qmark.q-yellow { background: #e6c200; border-color: #e6c200; color: #1a1a1a; }
.qcorner.q-orange, .rating.qmark.q-orange { background: #e67e22; border-color: #e67e22; color: #1a1a1a; }
.qcorner.q-red,    .rating.qmark.q-red    { background: #d8412f; border-color: #d8412f; color: #fff; }
.credits { margin: .7rem 0 .3rem; display: flex; flex-direction: column; gap: .25rem; }
.credits div { display: flex; gap: .55rem; align-items: baseline; }
.credits dt { color: #888; font-size: .82rem; flex: 0 0 4.7rem; text-transform: uppercase; letter-spacing: .03em; }
.credits dd { margin: 0; color: #ddd; font-size: .92rem; }
.desc { line-height: 1.55; color: #ddd; margin: .9rem 0; }
.awards { color: #c9a23a; font-size: .85rem; margin: .6rem 0; line-height: 1.4; }

/* List-membership toggles — one chip per list; .on when this title is a member. */
.toggles { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 .3rem; }
.toggle {
  background: #1e1e1e; color: #bbb; border: 1px solid #333; border-radius: 999px;
  padding: .3rem .8rem; font-size: .85rem; cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.toggle:hover { border-color: #555; }
.toggle.on { background: #2e6da4; border-color: #3a82c4; color: #fff; }
.toggle:disabled { opacity: .55; cursor: default; }

.links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .9rem; margin-top: 1rem; }
.links a { color: #7aa9d6; text-decoration: none; font-size: .92rem; }
.links a:hover { text-decoration: underline; }

.trailer { margin-top: 1.3rem; }
.trailer iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 10px;
  background: #000;
  display: block;
}

.msg { padding: 2rem .9rem; color: #888; }
.desc.dim { color: #888; font-style: italic; }

/* ---------- home menu ---------- */
#home { padding: .9rem; }
.sec { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: #888; margin: 1.3rem 0 .5rem; font-weight: 600; }
.sec:first-child { margin-top: .2rem; }
/* Combined who-list cards: a strip of sample posters + name + count. */
.cards { display: grid; grid-template-columns: 1fr; gap: .7rem; }
.lcard {
  display: block; background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 12px;
  overflow: hidden; color: #eee; text-decoration: none;
}
.lcard:active { background: #222; }
.lcard-posters { display: flex; gap: 2px; height: 96px; background: #141414; }
.lcard-posters img { flex: 1; min-width: 0; height: 100%; object-fit: cover; }
.lcard-meta { display: flex; align-items: baseline; justify-content: space-between; padding: .55rem .8rem; }
.lcard-name { font-size: 1.05rem; font-weight: 600; }
.lcard-n { color: #888; font-size: .82rem; }
/* Lists are rarely browsed raw — compact pills, not full-width rows. */
.listrows { display: flex; flex-wrap: wrap; gap: .4rem; }
.listrow {
  display: inline-flex; align-items: baseline; gap: .35rem;
  padding: .3rem .7rem; background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 999px;
  color: #ccc; text-decoration: none; font-size: .85rem;
}
.listrow .n { color: #777; font-size: .78rem; }
.listrow:active { background: #222; }
/* Ad-hoc ("Your lists") pill: label link + a delete ✕. */
.listrow.adhoc { padding-right: .35rem; }
.listrow.adhoc a { display: inline-flex; align-items: baseline; gap: .35rem; color: inherit; text-decoration: none; }
.ldel {
  background: none; border: 0; color: #666; cursor: pointer; font-size: .8rem;
  padding: 0 .15rem; line-height: 1; align-self: center;
}
.ldel:hover { color: #c66; }

/* Selection action bar — bottom-sticky, appears when ≥1 title is selected. */
#selbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 75;
  display: flex; align-items: center; gap: .8rem;
  padding: .7rem 1rem max(.7rem, env(safe-area-inset-bottom));
  background: #1c1c1ef2; backdrop-filter: blur(8px); border-top: 1px solid #333;
}
body.sel-active main { padding-bottom: 4.5rem; } /* room so the bar never covers the last row */
.selx {
  flex: 0 0 auto; background: none; border: 0; color: #aaa; cursor: pointer;
  font-size: 1.05rem; line-height: 1; padding: .35rem .5rem; margin-left: -.3rem;
}
.selx:active { color: #fff; }
.selcount { color: #ccc; font-size: .9rem; white-space: nowrap; }
.selacts { display: flex; gap: .6rem; margin-left: auto; }
/* Round +/- buttons: + adds to a list, − removes from one. */
.selop {
  width: 2.4rem; height: 2.4rem; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.5rem; line-height: 1; font-weight: 500;
  background: #2a2a2a; border: 1px solid #3a3a3a;
}
.selop.add { color: #7fcf8f; }
.selop.remove { color: #d68a8a; }
.selop:active { background: #383838; }
.selshare {
  height: 2.4rem; padding: 0 1.05rem; border-radius: 999px; cursor: pointer;
  background: #2e6da4; color: #fff; border: 1px solid #3a82c4; font-size: .9rem; white-space: nowrap;
}
.selshare:active { background: #3a82c4; }
/* Share-link dialog. */
.share-note { color: #aaa; font-size: .85rem; margin: 0 0 .8rem; line-height: 1.45; }
.share-url { display: flex; gap: .5rem; margin-bottom: .3rem; }
.share-url input {
  flex: 1; min-width: 0; background: #2a2a2a; color: #eee; border: 1px solid #3a3a3a;
  border-radius: 8px; padding: .5rem .6rem; font-size: .85rem;
}
.share-copy { background: #2e6da4; color: #fff; border: 0; border-radius: 8px; padding: .5rem .95rem; cursor: pointer; font-size: .85rem; white-space: nowrap; }
.sheet-opt.new { color: #6fb1ec; }
@media (min-width: 768px) { #selbar { max-width: 1040px; margin: 0 auto; border-radius: 14px 14px 0 0; } }

/* ---------- desktop: a centered web layout, not a stretched phone ---------- */
@media (min-width: 768px) {
  #topbar .bar, #home, #controls, #grid, #ask { max-width: 1040px; margin-left: auto; margin-right: auto; }
  #home { padding: 1.3rem .9rem; }
  .cards { grid-template-columns: repeat(3, 1fr); } /* the 3 combined lists in a row */
  .secgrid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1.1rem; }
}

/* ---- Ask: natural-language recommendations over a pool of titles ---- */
/* The home menu leaves room at the bottom for the pinned Ask composer. */
#home { padding-bottom: 8.5rem; }
/* Ask is a chat: the transcript scrolls in normal document flow (newest at the
   bottom) and the composer is pinned to the bottom of the viewport — the same
   fixed bottom-bar pattern as #selbar. No chat framework needed. */
#ask { padding: .9rem .9rem 0; }
.ask-transcript { display: flex; flex-direction: column; gap: 1.4rem; padding: .4rem 0 9rem; }
.ask-turn { display: flex; flex-direction: column; scroll-margin-top: calc(env(safe-area-inset-top) + 3.8rem); }
/* Room to pin the newest question at the top (viewport minus top bar + composer). */
.ask-turn.latest { min-height: calc(100dvh - env(safe-area-inset-top) - 12rem); }
.ask-q { /* the user's message — a bubble on the right */
  align-self: flex-end; max-width: 85%; line-height: 1.35;
  background: #2e6da4; color: #fff; padding: .5rem .8rem;
  border-radius: 16px 16px 4px 16px; margin-bottom: .9rem;
}

/* composer pinned to the bottom of the screen */
.askbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 75;
  background: #1a1a1aee; backdrop-filter: blur(8px); border-top: 1px solid #2a2a2a;
  /* Bar fills to the physical screen bottom (needs viewport-fit=cover, which an
     installed iOS PWA only picks up when re-added to the home screen). The
     home-indicator inset lifts the input clear of the pill. */
  padding: .55rem 1rem max(.5rem, env(safe-area-inset-bottom));
}
.askbar-inner { max-width: 1040px; margin: 0 auto; }
.ask-row { display: flex; gap: .5rem; align-items: flex-end; }
#askin {
  flex: 1; min-width: 0; resize: none; border: 0; border-radius: 12px;
  background: #2a2a2a; color: #eee; font-size: 16px; padding: .6rem .8rem;
  font-family: inherit; line-height: 1.35; max-height: 40vh;
}
.ask-send { flex: 0 0 auto; border: 0; border-radius: 12px; background: #2e6da4; color: #fff; font-size: 1.15rem; padding: .55rem 1.1rem; cursor: pointer; }
.ask-new { display: block; margin: 0 0 .5rem auto; background: #1e1e1e; color: #bbb; border: 1px solid #333; border-radius: 999px; padding: .25rem .75rem; font-size: .8rem; cursor: pointer; }
.ask-new[hidden] { display: none; }
.ask-answer { color: #cdcdcd; margin: .2rem 0 .8rem; line-height: 1.45; }
.ask-answer p { margin: 0 0 .6rem; }
.ask-answer ul, .ask-answer ol { margin: 0 0 .6rem; padding-left: 1.3rem; }
.ask-answer li { margin: .2rem 0; }
.ask-answer strong { color: #e6e6e6; }
.ask-answer code { background: #1e1e1e; padding: 0 .25rem; border-radius: 4px; font-size: .9em; }
.ask-cite { color: #8cc4ff; text-decoration: none; font-weight: 600; }
.ask-status { color: #8aa0b4; margin: .2rem 0 .8rem; font-style: italic; }
.ask-status::before { content: "✶ "; font-style: normal; opacity: .7; }
.ask-status.ask-err { color: #e0a98a; font-style: normal; }
.ask-status.ask-err::before { content: ""; }
.ask-hint { color: #888; line-height: 1.5; }
.ask-picks { margin-bottom: .7rem; }
.ask-save { background: #16321c; color: #9fcf7f; border: 1px solid #3a6b43; border-radius: 999px; padding: .45rem 1rem; font-size: .85rem; cursor: pointer; }
.ask-save:disabled { opacity: .7; }

/* Where to watch (detail) + Inbox reason (card) + services tally */
.detail-meta .sub.watch.dim { color: #888; font-size: .85rem; }
.card .why { color: #e0b45c; font-size: .74rem; line-height: 1.25; margin-top: .15rem;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.svc-tag { font-size: .7rem; color: #9ad19a; border: 1px solid #3d5a3d; border-radius: 999px;
  padding: 0 .4rem; margin-left: .35rem; vertical-align: middle; }
/* Services tally: a ranked list, one service per row. */
.svcrows { display: flex; flex-direction: column; }
.svcrow { display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .7rem .2rem; border-bottom: 1px solid #262626; color: inherit; text-decoration: none; }
.svcrow:active { background: #1c1c1c; }
.svcrow .svcname { display: flex; align-items: center; min-width: 0; }
.svcrow .n { color: #999; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
/* Where-to-watch on a grid card: one line, ellipsized. */
.card .wsvc { font-size: .72rem; color: #8a8a8a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.card .wsvc.mine { color: #9ad19a; }
.card .wsvc.some { color: #c9b36a; }
/* Year after the title on a card: smaller, the caption gray. */
.card .t .tyr { font-size: .75rem; color: #999; white-space: nowrap; }
.card .y:empty { display: none; }

/* ---------- login (login.html) ---------- */
.login {
  max-width: 340px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 18vh) 16px 32px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
}
.login img { border-radius: 16px; }
.login h1 { margin: 4px 0 0; font-size: 26px; }
.login p { margin: 0; color: #aaa; }
.login button {
  margin-top: 14px; width: 100%; padding: 13px 16px; font: inherit; font-weight: 600;
  color: #fff; background: #2f6fde; border: 0; border-radius: 12px; cursor: pointer;
}
.login button:disabled { opacity: .55; }
.loginmsg { min-height: 1.4em; font-size: 14px; }
.loginmsg.bad { color: #f08080; }

/* A who-list the title's genres suggest (shown while it's on none of them). */
.toggle.suggested:not(.on) { border-style: dashed; border-color: #5b7fa8; }

/* ---------- Ask instructions + memory ---------- */
.asksettings { padding: 0 16px 32px; max-width: 720px; margin: 0 auto; }
.asksettings .hint { color: #888; font-size: 14px; margin: 0 0 8px; }
.asksettings textarea {
  width: 100%; background: #1a1a1a; color: #eee; border: 1px solid #333; border-radius: 10px;
  padding: 10px; font: inherit; font-size: 15px; line-height: 1.4; resize: vertical;
}
.asksettings button {
  margin-top: 14px; padding: 10px 22px; font: inherit; font-weight: 600; color: #fff;
  background: #2f6fde; border: 0; border-radius: 10px; cursor: pointer;
}
.asksettings button:disabled { opacity: .55; }

/* Settings: same full-width rows as the Services list; Sign out set apart. */
.svcrows.settings-out { margin-top: 1.5rem; }
.svc-empty { color: #888; padding: 0 16px; }
