/* ==========================================================================
   Doomscroll — vertical feed surface (vanilla CSS, CSP-clean)
   --------------------------------------------------------------------------
   IDENTITY. The archive subdomain is EDITORIAL: flat near-black, hairlines,
   one red accent, no blur, no motion. This surface is deliberately the
   opposite — an immersive APP stage: pure-black media canvas, a centred
   stage column, frosted-glass chrome, a cyan accent and gentle motion. One
   product, two moods; neither borrows the other's vocabulary.

   The desktop stage is the structural centrepiece. The video is portrait,
   so on a wide screen it floats in a sea of black while the action rail and
   the caption would otherwise be pinned to the VIEWPORT edges — visually
   detached from the video they belong to. `.dcard__frame` fixes that: the
   media + all its chrome live in one centred column (`.dcard__frame`), and
   only the blurred backdrop reaches the viewport edges.

   Rules of the house:
   - no `fill:` anywhere — the sprite symbols carry their own `fill` /
     `stroke` (Tabler outline vs. filled), and a stylesheet `fill` would
     blob the outline glyphs or kill the filled ones;
   - every interactive target ≥ 44px;
   - nothing depends on JS being present: native video controls, the
     plain next-page link and the visible captions are all in the markup.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* canvas — the video owns the screen, so the page itself is pure black */
  --bg: #000;
  --surface: #0b0c10;        /* sheets, panels */
  --surface-2: #12141a;      /* raised rows, fields */
  --glass: rgb(12 14 19 / .62);
  --glass-hi: rgb(255 255 255 / .10);

  /* ink */
  --ink: #f5f7fa;
  --muted: #9aa5b4;
  --muted-2: #6d7787;

  /* hairlines */
  --line: rgb(255 255 255 / .14);
  --line-soft: rgb(255 255 255 / .07);

  /* accents — cyan is the interaction colour; the social states get their
     own hues so "liked" never reads as "the accent is on" */
  --accent: #4fe3ff;
  --accent-ink: #04212a;
  --like: #ff5d73;
  --save: #ffc65d;
  --ok: #7ee2a8;
  --danger: #ff8573;
  --focus: #8fd8ff;

  --shadow: 0 18px 50px rgb(0 0 0 / .6);
  --radius: 18px;
  --radius-sm: 12px;
  --pill: 999px;

  --bar-h: 56px;
  --rail-w: 62px;

  /* the centred stage column — full width on phones, a column on desktop */
  --stage-w: 100%;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 15px/1.5 var(--font);
  background: var(--bg);
  color: var(--ink);
  overflow: hidden; /* the feed (or the /me pane) is the only scroller */
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* No global fill/stroke rules — the sprite symbols own their paint.
   1em + font-size keeps every glyph on the text grid. */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 1em; height: 1em; flex: none; }

.main {
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------------------------------------------------- a11y helpers */

.vh {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 90;
  padding: 10px 16px;
  border-radius: var(--pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  transform: translateY(-160%);
  transition: transform .16s ease;
}

.skip:focus-visible { transform: translateY(0); }

/* ------------------------------------------------------------ topbar */

.brandbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: calc(var(--bar-h) + var(--safe-t));
  padding: var(--safe-t) max(14px, var(--safe-r)) 0 max(14px, var(--safe-l));
  background: linear-gradient(rgb(0 0 0 / .72), rgb(0 0 0 / .34) 62%, transparent);
  transition: transform .24s ease, opacity .24s ease;
  pointer-events: none;
}

.brandbar > * { pointer-events: auto; }

/* Feed only: the bar steps aside while you watch and returns the moment you
   scroll back up (JS toggles .is-away on the feed, never on /me). */
.brandbar.is-away { transform: translateY(-102%); opacity: 0; }

.brandbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -.02em;
}

/* the signature mark: a small cyan disc that breathes */
.brandbar__mark {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgb(79 227 255 / .55);
  animation: dsbeat 3.4s ease-out infinite;
}

@keyframes dsbeat {
  0%   { box-shadow: 0 0 0 0 rgb(79 227 255 / .5); }
  60%  { box-shadow: 0 0 0 9px rgb(79 227 255 / 0); }
  100% { box-shadow: 0 0 0 0 rgb(79 227 255 / 0); }
}

.brandbar__nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* one pill component for every chrome affordance */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -.01em;
  white-space: nowrap;
}

.pill svg { font-size: 15px; }

/* "you are here" on /me */
.pill.is-on {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: transparent;
}

.brandbar__logout { margin: 0; }

/* Leaving the experiment is deliberately quieter than the wordmark. */
.brandbar__link--archive { color: var(--muted); }

.brandbar__locales {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--pill);
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.brandbar__loc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  padding: 0 6px;
  border-radius: var(--pill);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  color: var(--muted);
}

.brandbar__loc.is-on {
  color: var(--accent-ink);
  background: var(--accent);
}

/* ---------------------------------------------------------------- feed */

.feed {
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.feed::-webkit-scrollbar { width: 0; }

@media (hover: hover) and (pointer: fine) {
  .feed { scroll-snap-type: y proximity; }
}

/* ---------------------------------------------------------------- card */

.dcard {
  position: relative;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: var(--bg);
}

/* Blurred poster backdrop — the only element allowed to reach the edges. */
.dcard__bg {
  position: absolute;
  inset: -6%;
  width: 112%;
  height: 112%;
  object-fit: cover;
  filter: blur(34px) saturate(1.15) brightness(.5);
  transform: scale(1.06);
  opacity: 0;
  transition: opacity .5s ease;
}

.dcard__bg.is-loaded { opacity: 1; }

/* the centred stage column: media + rail + caption + progress */
.dcard__frame {
  position: relative;
  width: min(100%, var(--stage-w));
  height: 100%;
  margin: 0 auto;
  isolation: isolate;
}

.dcard__stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.dcard__video {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--bg);
}

/* Full-stage tap target (JS removes the native controls). */
.dcard__tap {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  -webkit-tap-highlight-color: transparent;
}

.dcard__pulse {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.dcard__pulse-icon {
  grid-area: 1 / 1;
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: rgb(6 8 12 / .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-size: 34px;
  opacity: 0;
  transform: scale(.7);
}

/* The pulse glyphs are Tabler outline shapes; they keep the paint their
   <symbol> carries. Only the disc behind them is ours. */

.dcard__pulse.is-show .dcard__pulse-icon.is-on { animation: dspulse .5s ease; }

@keyframes dspulse {
  0%   { opacity: 0; transform: scale(.6); }
  22%  { opacity: 1; transform: scale(1.03); }
  70%  { opacity: .92; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.14); }
}

/* ------------------------------------------------------------ rail */

.dcard__rail {
  position: absolute;
  right: max(8px, var(--safe-r));
  bottom: calc(92px + var(--safe-b));
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.rail__btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  min-width: var(--rail-w);
  min-height: var(--rail-w);
  border-radius: var(--radius);
  color: #fff;
}

/* Frosted backing behind the glyph — outline icons stay legible over a
   bright or busy frame. The button is top-anchored so the disc and the
   glyph share one centre without the layout having to be guessed: the
   glyph starts 8px down (26px tall ⇒ centre at 21px) and the disc is
   42px tall from the top edge (also centred at 21px). `translate` keeps
   the centring apart from `transform`, so the hover scale has it free. */
.rail__btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  translate: -50% 0;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgb(8 10 14 / .46);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: scale .18s ease, background .18s ease;
}

.rail__btn > * { position: relative; z-index: 1; }
.rail__btn > svg { margin-top: 8px; }

.rail__btn svg {
  font-size: 26px;
  filter: drop-shadow(0 2px 5px rgb(0 0 0 / .55));
  transition: transform .18s ease;
}

.rail__lbl {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  text-shadow: 0 1px 4px rgb(0 0 0 / .8);
}

.rail__n {
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.01em;
  text-shadow: 0 1px 4px rgb(0 0 0 / .8);
}

/* two glyphs per toggle: outline at rest, filled (or the alt state) when
   pressed. Purely CSS — JS only flips aria-pressed. */
.rail__on { display: none; }
.rail__btn[aria-pressed="true"] .rail__off { display: none; }
.rail__btn[aria-pressed="true"] .rail__on { display: block; }

.rail__btn--like.is-on { color: var(--like); }
.rail__btn--save.is-on { color: var(--save); }
.rail__btn.is-on svg { transform: scale(1.06); }
.rail__btn.is-on::before { background: rgb(8 10 14 / .6); }

.rail__btn--primary {
  background: linear-gradient(165deg, var(--accent), #26b6d4);
  color: var(--accent-ink);
}

.rail__btn--primary::before { display: none; }
.rail__btn--primary svg { color: var(--accent-ink); }

.rail__dur {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--pill);
  background: rgb(0 0 0 / .55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
}

.rail__dur svg { font-size: 13px; }

/* --------------------------------------------------------------- info */

.dcard__info {
  position: absolute;
  left: 0;
  right: calc(var(--rail-w) + 12px);
  bottom: 0;
  z-index: 4;
  padding: 64px max(16px, var(--safe-l)) calc(34px + var(--safe-b));
  background: linear-gradient(transparent, rgb(0 0 0 / .82) 62%);
  pointer-events: none;
}

.dcard__info a { pointer-events: auto; }

.dcard__channel {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 7px;
  font-size: 12.5px;
  font-weight: 750;
  letter-spacing: -.01em;
  color: var(--accent);
}

.dcard__channel svg { font-size: 16px; }

.dcard__title {
  margin: 0 0 12px;
  font-size: clamp(17px, 4.6vw, 22px);
  line-height: 1.24;
  font-weight: 800;
  letter-spacing: -.022em;
  text-wrap: balance;
  text-shadow: 0 2px 12px rgb(0 0 0 / .75);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dcard__chips { margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 13px;
  border-radius: var(--pill);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.chip--out {
  border: 1px solid rgb(255 255 255 / .26);
  background: rgb(255 255 255 / .1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
}

/* ----------------------------------------------------------- progress */

.dcard__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  height: 3px;
  background: rgb(255 255 255 / .14);
}

.dcard__progress-bar {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  box-shadow: 0 0 12px rgb(79 227 255 / .5);
}

/* ------------------------------------------------------- feed extras */

/* keyboard map for pointer devices — retired on first interaction */
.feed__keys {
  position: fixed;
  top: calc(var(--bar-h) + var(--safe-t) + 2px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 38;
  display: none;
  margin: 0;
  padding: 6px 14px;
  border-radius: var(--pill);
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
  transition: opacity .3s ease;
}

.feed__keys.is-gone { opacity: 0; }

/* First-run affordance, retired on the first scroll/keypress. It sits
   clear of the caption block below it (`.dcard__info` runs up to ~250px
   on a three-line title) and to the left of the action rail. */
.feed__hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(248px + var(--safe-b));
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 0;
  pointer-events: none;
  color: rgb(255 255 255 / .82);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  text-shadow: 0 2px 8px rgb(0 0 0 / .8);
  transition: opacity .3s ease, transform .3s ease;
}

.feed__hint svg {
  font-size: 22px;
  animation: dsnudge 2.2s ease-in-out infinite;
}

.feed__hint.is-gone { opacity: 0; transform: translateY(8px); }

@keyframes dsnudge {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}

.feed__empty,
.feed__end {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: min(100%, var(--stage-w));
  margin: 0 auto;
  padding: 24px;
  text-align: center;
}

.feed__empty { height: 100vh; height: 100dvh; }
.feed__end {
  min-height: 44vh;
  scroll-snap-align: center;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 650;
}

.feed__empty-icon { font-size: 30px; color: var(--muted-2); }
.feed__empty-title { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.02em; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -.01em;
}

.btn--sm { min-height: 38px; padding: 0 15px; font-size: 13px; }
.btn--sm svg { font-size: 15px; }
.btn--ghost { background: var(--glass-hi); color: var(--ink); }

.feed__next {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: min(100% - 24px, calc(var(--stage-w) - 24px));
  min-height: 44vh;
  margin: 0 auto;
  scroll-snap-align: center;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 700;
}

.feed__next span {
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--ink);
}

.feed__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 18vh;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.feed__loading::before {
  content: "";
  width: 16px; height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: dsspin .7s linear infinite;
}

@keyframes dsspin { to { transform: rotate(360deg); } }

/* ------------------------------------------------- step buttons (desktop) */

.stepnav {
  position: fixed;
  right: max(16px, var(--safe-r));
  bottom: calc(24px + var(--safe-b));
  z-index: 45;
  display: none;
  flex-direction: column;
  gap: 10px;
}

.stepnav__btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
}

.stepnav__btn svg { font-size: 20px; }

/* ------------------------------------------------------------- states */

/* JS is what swaps the native controls for the tap target, what steps the
   feed from the keyboard and what retires the hint — without it, none of
   them should be on screen. */
.no-js .dcard__tap,
.no-js .stepnav,
.no-js .feed__hint { display: none; }

/* ================================================================
   Social layer — rail counters, sheets (comments + save lists), /me
   ================================================================ */

/* Locked body behind an open sheet (the feed is the scroller). */
body.ds-locked .feed { overflow: hidden; }

/* -------------------------------------------------------------- sheets */

.dsheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.dsheet[hidden] { display: none; }

.dsheet__scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgb(0 0 0 / .6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.dsheet__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: min(78dvh, 760px);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 0;
  box-shadow: var(--shadow);
  animation: dssheet .24s cubic-bezier(.22, 1, .36, 1);
}

@keyframes dssheet {
  from { transform: translateY(18px); opacity: .3; }
  to   { transform: translateY(0); opacity: 1; }
}

.dsheet__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 11px;
  border-bottom: 1px solid var(--line-soft);
}

.dsheet__title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.02em;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.dsheet__count { font-size: 12.5px; font-weight: 700; color: var(--muted); }

.dsheet__close {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 12px;
  color: var(--muted);
}

.dsheet__close svg { font-size: 20px; }
.dsheet__close:hover { background: var(--glass-hi); color: var(--ink); }

.dsheet__scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 10px 16px calc(12px + var(--safe-b));
}

.dsheet__foot {
  border-top: 1px solid var(--line-soft);
  padding: 10px 16px calc(10px + var(--safe-b));
  background: var(--surface);
}

/* ------------------------------------------------------- comment sheet */

.cs__list { margin: 0; }

.cs__replies {
  margin: 2px 0 0;
  padding: 0 0 0 40px;
  border-left: 1px solid var(--line-soft);
  margin-left: 17px;
}

.cs__row { display: flex; gap: 10px; padding: 10px 0; }
.cs__row--reply { padding: 6px 0; }

.cs__avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px; height: 34px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: #06131a;
}

.cs__avatar--lg { width: 58px; height: 58px; font-size: 21px; border-radius: 18px; }
.cs__avatar--0 { background: #4fe3ff; }
.cs__avatar--1 { background: #ffc65d; }
.cs__avatar--2 { background: #9d8cff; }
.cs__avatar--3 { background: #7ee2a8; }
.cs__avatar--4 { background: #ff9d8c; }

.cs__body { flex: 1; min-width: 0; }

.cs__meta {
  margin: 0 0 2px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.cs__name { font-size: 13px; font-weight: 800; letter-spacing: -.01em; }
.cs__time { font-size: 11.5px; color: var(--muted-2); }

.cs__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.cs__actions { display: flex; gap: 2px; margin-top: 3px; }

.cs__act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 9px;
  border-radius: var(--pill);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.cs__act svg { font-size: 14px; }
.cs__act:hover { background: var(--glass-hi); color: var(--ink); }
.cs__act.is-on { color: var(--like); }
.cs__act--danger:hover { color: var(--danger); }

.cs__empty, .cs__loading, .ss__loading {
  padding: 26px 0;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

.cs__more {
  display: block;
  width: 100%;
  min-height: 42px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.cs__more:hover { color: var(--ink); border-color: rgb(255 255 255 / .3); }

/* ----------------------------------------------------------- composer */

.cform__row { display: flex; align-items: flex-end; gap: 8px; }

.cform__input {
  flex: 1;
  resize: none;
  max-height: 120px;
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
}

.cform__input::placeholder { color: var(--muted-2); }

.cform__send {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px; height: 44px;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-ink);
}

.cform__send:disabled { opacity: .45; }
.cform__send svg { font-size: 19px; }

.cform__replying {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.cform__replying span {
  padding: 3px 9px;
  border-radius: var(--pill);
  background: var(--glass-hi);
  font-weight: 700;
  color: var(--ink);
}

.cform__cancel { font-size: 12px; font-weight: 800; color: var(--accent); }
.cform__guest { margin: 0; display: flex; justify-content: center; }

/* --------------------------------------------------------- save sheet */

.ss__rows { margin: 0 0 14px; }
.ss__row { border-bottom: 1px solid var(--line-soft); }

.ss__label {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.ss__box { width: 19px; height: 19px; accent-color: var(--accent); flex: none; }
.ss__name { overflow-wrap: anywhere; }

.ss__create { display: flex; gap: 8px; }

.ss__input {
  flex: 1;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
}

.ss__error { margin: 10px 0 0; font-size: 12.5px; color: var(--danger); }

/* --------------------------------------------------------------- toast */

.ds-toast {
  position: fixed;
  left: 50%;
  bottom: calc(26px + var(--safe-b));
  z-index: 80;
  transform: translateX(-50%) translateY(10px);
  max-width: min(420px, calc(100% - 32px));
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: rgb(18 20 26 / .97);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 650;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.ds-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------------------------------------------------------- /me */

.me {
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  /* its own reading width — deliberately NOT --stage-w, which the feed
     block sets to the portrait video column at the same breakpoint */
  max-width: 680px;
  margin: 0 auto;
  padding: calc(var(--bar-h) + var(--safe-t) + 20px) max(18px, var(--safe-r)) calc(48px + var(--safe-b)) max(18px, var(--safe-l));
}

.me__head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.me__id { min-width: 0; flex: 1; }
.me__name {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}

.me__handle { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.me__saved {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgb(126 226 168 / .12);
  color: var(--ok);
  font-size: 13px;
  font-weight: 700;
}

.me__tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 22px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.me__tabs::-webkit-scrollbar { height: 0; }

.me__tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 15px;
  border-radius: var(--pill);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.me__tab.is-on { color: var(--accent-ink); background: var(--accent); border-color: transparent; }
.me__tab svg { font-size: 15px; }

.me__empty { color: var(--muted); font-size: 14px; padding: 24px 0; }

.me__list { margin-bottom: 30px; }

.me__list-title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.me__badge {
  padding: 3px 9px;
  border-radius: var(--pill);
  background: var(--glass-hi);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.me__cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}

.me__card {
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  transition: border-color .18s ease;
}

.me__card:hover { border-color: var(--line); }
.me__card-link { display: block; }

.me__card-poster {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  background: var(--surface-2);
}

.me__card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: 8px 10px 10px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
}

.me__rows { margin: 0 0 16px; }
.me__row { padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.me__row-body { margin: 0 0 5px; font-size: 14px; overflow-wrap: anywhere; }

.me__row-meta {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.me__form-card {
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
}

.me__form-title { margin: 0 0 16px; font-size: 15px; font-weight: 800; letter-spacing: -.02em; }

.fld { display: block; margin-bottom: 14px; }

.fld__label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--muted);
}

.fld__input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
}

.fld__error { margin: 6px 0 0; font-size: 12.5px; color: var(--danger); }

/* ================================================================
   Responsive
   ================================================================ */

/* Phones: the stage column is the viewport. */
@media (max-width: 719px) {
  .rail__lbl { display: none; }
}

/* Desktop: the stage becomes a centred column so the rail and the caption
   hug the VIDEO instead of the viewport edges. */
@media (min-width: 720px) {
  :root { --stage-w: 460px; }

  .dcard__frame { box-shadow: 0 0 0 1px rgb(255 255 255 / .06); }

  .stepnav {
    right: auto;
    left: max(16px, calc(50% - var(--stage-w) / 2 - 68px));
  }
}

/* …and only a real pointer gets the keyboard map (a phone has no keys to
   advertise, and the swipe hint already sits on the first card). */
@media (min-width: 720px) and (hover: hover) and (pointer: fine) {
  .feed__keys { display: block; }
}

@media (min-width: 1100px) {
  :root { --stage-w: 520px; }
}

/* Short landscape phones: keep the video visible, shrink the chrome. */
@media (max-height: 460px) and (orientation: landscape) {
  .dcard__info { padding-top: 34px; padding-bottom: calc(16px + var(--safe-b)); }
  .dcard__title { -webkit-line-clamp: 1; font-size: 15px; }
  .dcard__rail { bottom: calc(50px + var(--safe-b)); gap: 6px; }
  .rail__btn { min-width: 44px; min-height: 44px; }
  .dcard__channel { display: none; }
  .feed__hint { display: none; }
}

/* Wider screens: the comment/save sheet docks right instead of bottom. */
@media (min-width: 900px) {
  .dsheet { align-items: stretch; justify-content: flex-end; }

  .dsheet__panel {
    width: min(440px, 100%);
    max-height: none;
    height: 100%;
    border-radius: 0;
    border: 0;
    border-left: 1px solid var(--line);
    animation: dssheet-side .24s cubic-bezier(.22, 1, .36, 1);
  }

  @keyframes dssheet-side {
    from { transform: translateX(22px); opacity: .3; }
    to   { transform: translateX(0); opacity: 1; }
  }
}

/* Pointer devices get hover affordances; coarse pointers keep tap-only. */
@media (hover: hover) and (pointer: fine) {
  .stepnav { display: flex; }
  .rail__btn:hover::before { background: rgb(8 10 14 / .7); scale: 1.12; }
  .rail__btn:hover svg { transform: translateY(-1px); }
  .pill:hover { border-color: rgb(255 255 255 / .34); }
  .brandbar__link--archive:hover { color: var(--ink); }
  .brandbar__loc:not(.is-on):hover { color: var(--ink); }
  .me__tab:not(.is-on):hover { color: var(--ink); border-color: rgb(255 255 255 / .3); }
  .chip--out:hover { background: rgb(255 255 255 / .18); }
  .feed__next:hover span { border-color: rgb(255 255 255 / .32); }
  .stepnav__btn:hover { border-color: rgb(255 255 255 / .34); }
}

/* Everything that moves, stops on request. */
@media (prefers-reduced-motion: reduce) {
  .feed { scroll-snap-type: none; }
  .dcard__bg { transition: none; }
  .brandbar { transition: none; }
  .brandbar__mark { animation: none; }
  .feed__hint svg { animation: none; }
  .feed__hint.is-gone { transition: none; }
  .dcard__pulse.is-show .dcard__pulse-icon.is-on {
    animation: none;
    opacity: 1;
    transform: scale(1);
  }
  .dsheet__panel { animation: none; }
  .feed__loading::before { animation: none; }
  .skip { transition: none; }
}
