/* Cracked Reels. The page reads like the client's own Instagram: their profile, a grid of reels, Reels to watch them.
   The brand only speaks on the sign-in screen. Light or dark follows the phone; the reels are always on black. */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #6b6b6b;
  --line: #dbdbdb;
  --chip: #efefef;
  --sheet: #ffffff;
  --blue: #0095f6;
  --ok: #18a957;
  --mark: #FF4F00;
  --bad: #e5374b;
  --ring: conic-gradient(from 210deg, #ffd60a, #ff7a00, #ff2d55, #c13584, #ffd60a);
  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --brand: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --paper: #F2F1EC; --ink: #121212; --rule: #d9d6cc; --quiet: #77746b; --signal: #FF4F00;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #000000; --fg: #f5f5f5; --muted: #a8a8a8; --line: #262626; --chip: #262626; --sheet: #161616; }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.4 var(--ui); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
svg { width: 24px; height: 24px; display: block; flex: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 48px 24px; margin: 0; }
.boot { min-height: 100dvh; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 10px; font-weight: 600; background: var(--chip); }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:disabled { opacity: .6; }
.btn.quiet, button.quiet { background: none; color: var(--muted); font-weight: 600; }
.icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; }
.center { min-height: 100dvh; display: grid; place-content: center; gap: 12px; text-align: center; padding: 24px; }
.lede { font-size: 18px; font-weight: 600; margin: 0; }

/* ---------------------------------------------------------------- sign in */
/* The Cracked Reels identity: paper and ink, a tight grotesk wordmark over a hairline and a running timecode, one
   digit in signal orange. */
.signin { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 10px;
  max-width: 400px; margin: 0 auto; padding: max(48px, env(safe-area-inset-top)) 24px 48px;
  background: var(--paper); color: var(--ink); font-family: var(--brand); }
html:has(.signin), body:has(.signin) { background: var(--paper); }
.wordmark { font: 700 clamp(58px, 17vw, 78px)/.9 var(--brand); letter-spacing: -.05em; margin: 0; color: var(--ink); }
.tc { display: flex; justify-content: space-between; gap: 12px; margin: 14px 0 26px; padding-top: 9px;
  border-top: 1.5px solid var(--ink); font: 500 13px/1 var(--mono); }
.tc b { font-weight: 500; color: var(--signal); }
.tc span:last-child { color: var(--quiet); }
.signin .lede { color: var(--quiet); font-weight: 400; font-size: 16px; line-height: 1.5; margin-bottom: 18px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label { font-weight: 600; }
.signin input { height: 52px; border-radius: 10px; border: 1px solid var(--rule); background: #fff; color: var(--ink);
  padding: 0 16px; font: 400 17px var(--brand); }
.signin input::placeholder { color: #a9a597; }
.signin input:focus { border-color: var(--ink); outline: none; }
#code { font: 500 26px var(--mono); letter-spacing: .3em; font-variant-numeric: tabular-nums; text-align: center; }
.signin .btn { min-height: 52px; font-size: 16px; border-radius: 10px; }
.signin .btn.primary { background: var(--ink); color: var(--paper); }
.signin .btn.quiet { color: var(--quiet); }
.err { color: #c2410c; min-height: 1.4em; margin: 0; }
.hint { margin: 2px 0 0; color: var(--quiet); font-size: 14px; }
.hint .link { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.hint .link:disabled { color: #a9a597; text-decoration: none; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- their page */
.profile { max-width: 935px; margin: 0 auto; padding-bottom: env(safe-area-inset-bottom); }
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  min-height: 48px; padding: env(safe-area-inset-top) 4px 0 16px; background: var(--bg); }
.handle { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.handle.switch { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; }
.handle.switch svg { width: 18px; height: 18px; margin-top: 2px; }
.head { display: grid; grid-template-columns: auto 1fr; gap: 14px 20px; align-items: center; padding: 8px 16px 18px; }
.avatar { width: 88px; height: 88px; border-radius: 50%; padding: 3px; background: transparent; }
.avatar.ring { background: var(--ring); }
.avatar > span { width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  background: var(--chip); border: 3px solid var(--bg); font-weight: 700; font-size: 26px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.stats { display: flex; justify-content: space-around; text-align: center; }
.stats > * { display: flex; flex-direction: column; align-items: center; min-width: 64px; }
.stats b { font-size: 18px; font-weight: 700; }
.stats span { font-size: 13px; color: var(--fg); }
.stats button:not(:disabled) span { color: var(--blue); font-weight: 600; }
.who { grid-column: 1 / -1; display: grid; gap: 2px; }
.name { font-weight: 600; }
.bio { white-space: pre-line; }
.sub { color: var(--muted); }
.tip { display: flex; align-items: center; gap: 8px; margin: 0 16px 14px; padding: 10px 4px 10px 14px; border-radius: 12px; background: var(--chip); }
.tip span { flex: 1; }
.tabs { display: flex; border-top: 1px solid var(--line); }
.tabs a { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; height: 46px; margin-top: -1px;
  text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  border-top: 1.5px solid transparent; }
.tabs a.on { color: var(--fg); border-top-color: var(--fg); }
.tabs svg { width: 18px; height: 18px; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.tile { position: relative; aspect-ratio: 3 / 4; overflow: hidden; background: var(--chip); color: #fff; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile:active img { opacity: .8; }
.tile .dur { position: absolute; left: 6px; bottom: 6px; display: flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.tile .dur svg { width: 14px; height: 14px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.tile .new { position: absolute; left: 6px; top: 6px; padding: 3px 7px; border-radius: 6px; background: var(--blue); font-size: 11px;
  font-weight: 700; letter-spacing: .02em; }
.badge { position: absolute; right: 6px; top: 6px; display: flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 700;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.5)); }
.badge svg { width: 22px; height: 22px; }
.badge.ok { color: var(--ok); }
.badge.notes svg { width: 18px; height: 18px; }

.ideas { padding: 16px; display: grid; gap: 12px; max-width: 640px; margin: 0 auto; }
.compose { display: grid; gap: 10px; padding-bottom: 8px; }
.compose label { font-size: 17px; font-weight: 700; }
textarea { font: 16px/1.4 var(--ui); color: var(--fg); background: var(--chip); border: 1px solid transparent; border-radius: 12px;
  padding: 12px 14px; resize: none; width: 100%; }
textarea:focus { outline: none; border-color: var(--fg); }
.idea { padding: 14px 0; border-top: 1px solid var(--line); }
.idea p { margin: 0 0 6px; white-space: pre-wrap; font-size: 15px; }
.meta { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; }
.meta button { padding: 2px 0 2px 8px; font-size: 13px; }

@media (min-width: 736px) {
  .bar { min-height: 60px; }
  .head { grid-template-columns: 150px 1fr; padding: 24px 32px 36px; gap: 18px 56px; }
  .avatar { width: 150px; height: 150px; grid-row: span 2; }
  .stats { justify-content: flex-start; gap: 36px; }
  .stats > * { flex-direction: row; gap: 6px; min-width: 0; }
  .stats b, .stats span { font-size: 16px; }
  .who { grid-column: 2; }
  .grid { gap: 4px; }
}

/* ---------------------------------------------------------------- the reels */
.feed { position: fixed; inset: 0; overflow-y: scroll; scroll-snap-type: y mandatory; background: #000; color: #fff;
  overscroll-behavior: contain; scrollbar-width: none; }
.feed::-webkit-scrollbar { display: none; }
.slide { height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always; display: grid; place-items: center; overflow: hidden; }
.frame { position: relative; height: min(100dvh, 177.78vw); aspect-ratio: 9 / 16; max-width: 100vw; }
.poster, .stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage { position: absolute; inset: 0; }
.tap { position: absolute; inset: 0; z-index: 1; }
.big-play { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .15s; }
.big-play svg { width: 76px; height: 76px; color: rgba(255,255,255,.9); filter: drop-shadow(0 2px 10px rgba(0,0,0,.5)); }
.slide.active.paused .big-play { opacity: 1; }
.frame::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 42%; pointer-events: none;
  background: linear-gradient(transparent, rgba(0,0,0,.55)); z-index: 1; }

.feedbar { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; gap: 4px;
  padding: env(safe-area-inset-top) 12px 0 4px; height: calc(52px + env(safe-area-inset-top)); color: #fff; pointer-events: none;
  background: linear-gradient(rgba(0,0,0,.45), transparent); }
.feedbar b { font-size: 20px; font-weight: 700; }
.feedbar .icon { pointer-events: auto; }

.rail { position: absolute; right: 8px; bottom: 96px; z-index: 3; display: flex; flex-direction: column; gap: 18px; align-items: center; }
.act { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 56px; font-size: 12px; font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.act svg { width: 32px; height: 32px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.45)); }
.act.approve.on { color: var(--ok); }
.act.approve.on span { color: #fff; }
.act:disabled { opacity: .5; }

.info { position: absolute; left: 12px; right: 84px; bottom: 30px; z-index: 3; display: grid; gap: 6px; pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.owner { display: flex; align-items: center; gap: 8px; }
.owner b { font-size: 14px; }
.mini { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; background: #333; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; border: 1px solid rgba(255,255,255,.6); }
.mini img { width: 100%; height: 100%; object-fit: cover; }
.ver { padding: 1px 6px; border-radius: 5px; background: rgba(255,255,255,.22); font-size: 12px; font-weight: 700; }
.title { font-size: 15px; font-weight: 600; }
.caption { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.status { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #e8e8e8; }
.status svg { width: 16px; height: 16px; color: var(--ok); }

.addnote { position: absolute; left: 50%; bottom: 112px; z-index: 4; transform: translate(-50%, 8px); display: none; align-items: center;
  gap: 6px; height: 44px; padding: 0 18px 0 12px; border-radius: 22px; background: #fff; color: #000; font-weight: 700;
  box-shadow: 0 6px 24px rgba(0,0,0,.4); opacity: 0; transition: opacity .15s, transform .15s; }
.addnote svg { width: 20px; height: 20px; }
.slide.active.paused .addnote { display: flex; opacity: 1; transform: translate(-50%, 0); }
.at { font-variant-numeric: tabular-nums; }

.scrub { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; height: 22px; display: flex; align-items: flex-end;
  touch-action: none; cursor: pointer; }
.track { position: relative; width: 100%; height: 3px; background: rgba(255,255,255,.3); transition: height .12s; }
.scrub.drag .track, .scrub:hover .track { height: 6px; }
.fill { position: absolute; inset: 0; background: #fff; transform-origin: left; transform: scaleX(0); }
.mark { position: absolute; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--mark);
  box-shadow: 0 0 0 1.5px rgba(0,0,0,.5); }
.mark.done { background: #9ae6b4; }

.stamp { position: absolute; inset: 0; z-index: 5; display: grid; place-content: center; justify-items: center; gap: 6px;
  pointer-events: none; opacity: 0; color: var(--ok); }
.stamp svg { width: 112px; height: 112px; filter: drop-shadow(0 6px 22px rgba(0,0,0,.35)); }
.stamp b { color: #fff; font: 900 34px/1 var(--brand); text-transform: uppercase; letter-spacing: .04em; text-shadow: 0 2px 12px rgba(0,0,0,.5); }
.stamp.go { animation: stamp 1.1s cubic-bezier(.2,.9,.25,1.2) both; }
@keyframes stamp { 0% { opacity: 0; transform: scale(.5) rotate(-8deg); } 18% { opacity: 1; transform: scale(1.08) rotate(0); }
  30% { transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: scale(1.02); } }

@media (min-width: 700px) {  /* a computer: the buttons sit beside the reel, like Instagram on the web */
  .frame { height: calc(100dvh - 32px); max-width: calc(100vw - 180px); border-radius: 8px; }
  .poster, .stage video { border-radius: 8px; }
  .rail { right: -76px; bottom: 24px; }
  .act, .act span { text-shadow: none; }
  .info { right: 16px; }
}

/* ---------------------------------------------------------------- sheets (notes, the menu) */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.scrim { position: absolute; inset: 0; background: rgba(0,0,0,.5); animation: fade .2s ease-out; }
.sheet { position: absolute; left: 0; right: 0; bottom: var(--kb, 0px); max-height: min(78dvh, calc(100dvh - var(--kb, 0px) - 40px));
  display: flex; flex-direction: column; background: var(--sheet); color: var(--fg); border-radius: 16px 16px 0 0;
  padding-bottom: env(safe-area-inset-bottom); animation: rise .26s cubic-bezier(.2,.8,.2,1); }
.sheet > header { display: flex; align-items: center; gap: 8px; padding: 8px 4px 8px 16px; border-bottom: 1px solid var(--line); }
.sheet > header b { font-size: 16px; }
.sheet > header .muted { flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet .pad { padding: 16px; display: grid; gap: 12px; }
.grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 0; flex: none; }
.sheet > header.center-head { justify-content: center; border-bottom: 0; padding: 10px 16px 6px; }
.accounts { overflow-y: auto; padding: 4px 8px 12px; }
.account { display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 8px; border-radius: 12px; text-align: left; }
.account:active { background: var(--chip); }
.account .pic { width: 56px; height: 56px; flex: none; border-radius: 50%; overflow: hidden; background: var(--chip);
  display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.account .pic img { width: 100%; height: 100%; object-fit: cover; }
.account .names { flex: 1; min-width: 0; display: grid; }
.account .names b { font-size: 15px; }
.account .names span { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account .tick svg { width: 26px; height: 26px; color: var(--blue); }
.account .radio { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line); flex: none; }
@media (min-width: 700px) { .sheet { left: calc(50% - 260px); right: auto; width: 520px; bottom: max(24px, var(--kb, 0px)); border-radius: 16px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }

.nlist { overflow-y: auto; padding: 4px 16px; flex: 1; min-height: 80px; }
.nlist h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 4px; }
.nlist .empty { padding: 24px 8px; }
.note { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.note:last-child { border-bottom: 0; }
.note .when { flex: none; align-self: flex-start; min-width: 54px; padding: 4px 8px; border-radius: 8px; background: var(--mark); color: #fff;
  font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; align-items: center; }
.note .when.whole { background: var(--chip); color: var(--fg); font-weight: 600; font-size: 12px; }
.note .when:disabled { cursor: default; }
.note .when small { font-weight: 600; font-size: 10px; opacity: .7; }
.note .body { flex: 1; min-width: 0; }
.note p { margin: 0 0 4px; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.note.is-done p { color: var(--muted); }
.done { color: var(--ok); }

.composer { border-top: 1px solid var(--line); padding: 10px 12px 12px; display: grid; gap: 8px; }
.composer .when { display: flex; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 12px; border-radius: 16px; background: var(--chip);
  font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.chip svg { width: 15px; height: 15px; }
.chip.on { background: var(--fg); color: var(--bg); }
.composer .row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; min-height: 44px; max-height: 140px; border-radius: 22px; padding: 11px 16px; }
.send { height: 44px; padding: 0 16px; border-radius: 22px; background: var(--blue); color: #fff; font-weight: 700; }
.send:disabled { opacity: .6; }

/* ---------------------------------------------------------------- toast */
.toast { position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); z-index: 100; transform: translate(-50%, 12px);
  max-width: calc(100vw - 32px); padding: 11px 16px; border-radius: 12px; background: #262626; color: #fff; font-weight: 600;
  box-shadow: 0 8px 28px rgba(0,0,0,.35); opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
