/* Stories (Nov 4, SPEC_STORIES.md): the lit-up ring on a profile photo, Home's row of circles (the owner's pick A: 66 px
   circles with the name under them, about 100 px tall), the full-screen viewer, Add to your story, Seen by, and a story
   reply's line in Messages. */

:root { --story-ring: linear-gradient(45deg, #f5a524 0%, #e5262a 55%, #b5179e 100%); --story-seen: var(--line); }

/* the ring around any photo */
.story-ring { position: relative; display: inline-grid; place-items: center; flex: none; padding: 3px; border-radius: 50%;
  background: var(--story-ring); line-height: 0; cursor: pointer; text-decoration: none; color: inherit; }
.story-ring > .avatar { box-shadow: 0 0 0 2px var(--bg); }
.story-ring.is-seen { background: var(--story-seen); }
.story-ring.is-add { background: none; padding: 0; }
.story-ring:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.story-plus { position: absolute; right: 0; bottom: 0; width: 24px; height: 24px; display: grid; place-items: center;
  border-radius: 50%; background: var(--accent); color: #fff; font: 700 18px/1 var(--font); box-shadow: 0 0 0 3px var(--bg); }

/* Home's row */
.st-row { margin: 4px 0 8px; }
.st-row-list { display: flex; gap: 14px; list-style: none; margin: 0; padding: 4px 2px 6px; overflow-x: auto;
  scrollbar-width: none; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.st-row-list::-webkit-scrollbar { display: none; }
.st-row-item { flex: none; }
.st-circle { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 72px;
  text-decoration: none; color: var(--text); }
.st-circle-ring { display: grid; place-items: center; width: 66px; height: 66px; border-radius: 50%; padding: 3px;
  box-sizing: border-box; background: var(--story-ring); }
.st-circle-ring > .avatar { box-shadow: 0 0 0 2px var(--bg); }
.st-circle.is-seen .st-circle-ring { background: var(--story-seen); }
.st-circle.is-add .st-circle-ring { background: none; }
.st-circle .story-plus { right: 2px; bottom: 20px; width: 22px; height: 22px; font-size: 17px; }
.st-circle-name { max-width: 72px; font-size: 12px; line-height: 16px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; color: var(--text-2); }
.st-circle:not(.is-seen):not(.is-add) .st-circle-name { color: var(--text); }
.st-circle:hover .st-circle-ring, .st-circle:focus-visible .st-circle-ring { filter: brightness(1.08); }
.st-circle:focus-visible { outline: none; }
.st-circle:focus-visible .st-circle-ring { outline: 2px solid var(--focus); outline-offset: 2px; }

/* the viewer: full screen over the page */
html.st-open, html.st-open body { overflow: hidden; }
.st-view { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; gap: 16px;
  background: #0a0a0c; color: #fff; }
.st-stage { position: relative; width: 100%; height: 100%; max-width: 100%; overflow: hidden; background: #000;
  display: flex; flex-direction: column; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
@media (min-width: 700px) {
  .st-stage { height: min(94vh, 900px); width: auto; aspect-ratio: 9 / 16; border-radius: 12px; }
}
.st-bars { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; gap: 4px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 8px 0; }
.st-bar { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.35); overflow: hidden; }
.st-bar > i { display: block; height: 100%; width: 0; background: #fff; }
.st-bar.is-done > i { width: 100%; }
.st-head { position: absolute; top: calc(18px + env(safe-area-inset-top, 0px)); left: 0; right: 0; z-index: 4; display: flex;
  align-items: center; justify-content: space-between; gap: 8px; padding: 0 6px 0 12px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.st-who { display: flex; align-items: center; gap: 8px; min-width: 0; color: #fff; text-decoration: none; font-size: 14px; }
.st-who strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-ago { color: rgba(255, 255, 255, 0.75); white-space: nowrap; }
.st-tools { display: flex; align-items: center; flex: none; }
.st-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: none; color: #fff; cursor: pointer; list-style: none; }
.st-btn::-webkit-details-marker { display: none; }
.st-btn:hover { background: rgba(255, 255, 255, 0.12); }
.st-btn .icon { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); }
.st-more { position: relative; }
.st-menu { position: absolute; right: 0; top: 46px; z-index: 6; min-width: 240px; padding: 8px; border-radius: 12px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow); text-shadow: none; }
.st-menu-item, .st-menu-label { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border: 0;
  border-radius: 8px; background: none; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.st-menu-item:hover { background: var(--hover); }
.st-report { display: grid; gap: 8px; }
.st-report .select-wrap select { width: 100%; }
/* the story's 9:16 frame (the camera's own): the photo or video and what's drawn on it (story_layers.js). Phones: as
   wide as the screen allows under the safe area, room for the reply box under it; computers: the whole stage. */
.st-frame { position: absolute; inset: 0; overflow: hidden; container-type: size; background: #000; }
@media (max-width: 699px) {
  .st-view { --st-fw: min(100vw, calc((100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 64px) * 0.5625)); }
  @supports (height: 100dvh) {
    .st-view { --st-fw: min(100vw, calc((100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 64px) * 0.5625)); }
  }
  @supports (width: 1cqw) {
    .st-view { container-type: size; }
    .st-stage { --st-fw: min(100cqw, calc((100cqh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 64px) * 0.5625)); }
  }
  .st-frame { inset: auto; top: env(safe-area-inset-top, 0px); left: 50%; width: var(--st-fw); height: calc(var(--st-fw) * 16 / 9);
    transform: translateX(-50%); border-radius: 12px; }
}
.st-layers { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.st-media { position: absolute; inset: 0; display: grid; place-items: center; background: #000; }
.st-media > img, .st-media > video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.st-caption { margin: 0 2px; padding: 8px 12px; border-radius: 10px; background: rgba(0, 0, 0, 0.55); font-size: 16px;
  line-height: 1.35; text-align: center; overflow-wrap: anywhere; }
.st-media > .is-fill { object-fit: cover; }
.st-media > .sl-mirror { transform: scaleX(-1); }
.st-tap { position: absolute; top: 72px; bottom: 80px; z-index: 2; border: 0; padding: 0; background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent; }
.st-tap-prev { left: 0; width: 30%; }
.st-tap-next { right: 0; width: 70%; }
.st-tap:focus-visible { outline: 2px solid var(--focus); outline-offset: -4px; }
.st-foot { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; flex-direction: column; gap: 8px;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent); }
.st-reacts { display: flex; justify-content: space-between; gap: 4px; }
.st-react { flex: 1; min-width: 0; height: 40px; border: 0; border-radius: 20px; background: rgba(255, 255, 255, 0.12);
  font-size: 22px; line-height: 1; cursor: pointer; }
.st-react:hover, .st-react.is-picked { background: rgba(255, 255, 255, 0.28); }
.st-react.is-picked { transform: scale(1.08); }
.st-reply { display: flex; align-items: center; gap: 6px; }
.st-reply input { flex: 1; min-width: 0; height: 44px; padding: 0 16px; border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 22px; background: rgba(0, 0, 0, 0.35); color: #fff; font: inherit; font-size: 16px; }
.st-reply input::placeholder { color: rgba(255, 255, 255, 0.75); }
.st-seen { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; min-height: 44px; padding: 0 14px;
  border: 0; border-radius: 22px; background: rgba(0, 0, 0, 0.45); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.st-signin { align-self: center; }
.st-person { display: none; }
@media (min-width: 700px) {
  .st-person { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: rgba(255, 255, 255, 0.14);
    color: #fff; }
  .st-person:hover { background: rgba(255, 255, 255, 0.24); }
}
.st-note { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); z-index: 1001; transform: translateX(-50%);
  max-width: min(92vw, 420px); margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--text); color: var(--bg);
  font-size: 14px; text-align: center; }
.st-note a { color: var(--toast-action); font-weight: 700; margin-left: 8px; }
.st-sheet { width: min(100vw, 440px); max-height: min(80vh, 640px); margin: auto auto 0; padding: 0; border: 0;
  border-radius: 16px 16px 0 0; background: var(--surface); color: var(--text); }
@media (min-width: 700px) { .st-sheet { margin: auto; border-radius: 16px; } }
.st-sheet::backdrop { background: rgba(0, 0, 0, 0.55); }
.st-sheet-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 16px;
  background: var(--surface); }
.st-sheet-head h2 { margin: 0; font-size: 18px; }
.st-sheet-body { padding: 0 16px 16px; }
.st-viewers { list-style: none; margin: 0; padding: 0; }
.st-viewer-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; }
.st-viewer-row > a { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none; }
.st-viewer-who { display: grid; min-width: 0; }
.st-viewer-who strong, .st-viewer-who span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-viewer-react { font-size: 22px; }
.st-viewers-anon { margin: 8px 0 0; }

/* Add to your story */
.st-new { max-width: 520px; margin: 0 auto; display: grid; gap: 10px; }
.st-left { margin: 0; font-weight: 600; }
.st-left.is-full { color: var(--danger-text); }
.st-new-form { display: grid; gap: 10px; }
.st-pick { position: relative; display: grid; place-items: center; width: min(100%, 220px); aspect-ratio: 9 / 16; margin: 0 auto;
  border: 2px dashed var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; cursor: pointer; }
.st-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.st-pick-empty { display: grid; justify-items: center; gap: 8px; color: var(--text-2); font-weight: 600; padding: 16px; text-align: center; }
.st-preview { position: absolute; inset: 0; pointer-events: none; }
.st-preview img, .st-preview video { width: 100%; height: 100%; object-fit: cover; }
.st-progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.st-progress-bar { display: block; height: 100%; width: 0; background: var(--accent); }

/* a reply to a story, in Messages */
.trc-story { display: block; margin: 0 0 4px; font-size: 13px; line-height: 1.4; color: var(--text-2); }
.trc-story > .icon { vertical-align: -2px; margin-right: 4px; }
.trc-story > .link { white-space: nowrap; }

/* what the camera adds on a story (story_layers.js, story_edits.py): inside a 9:16 frame with container-type: size, so
   a layer's size (--s, a share of the frame's width) and place (--x, --y) look the same at every size */
@font-face { font-family: "Story Marker"; src: url("fonts/permanent-marker-regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Story Sora"; src: url("fonts/sora-latin-wght-normal.woff2") format("woff2"); font-weight: 100 800;
  font-display: swap; }
.sl { position: absolute; left: var(--x, 50%); top: var(--y, 50%); transform: translate(-50%, -50%) rotate(var(--r, 0deg));
  transform-origin: 50% 50%; font-size: calc(var(--s, 0.08) * 100cqw); line-height: 1.15; text-align: center;
  white-space: nowrap; color: #fff; -webkit-user-select: none; user-select: none; }
.sl-text { width: max-content; max-width: 11em; white-space: pre-wrap; overflow-wrap: anywhere; font-weight: 700; }
.sl-text > span { color: var(--c, #fff); text-shadow: 0 0.04em 0.14em rgba(0, 0, 0, 0.5); }
.sl-text.is-dark > span { text-shadow: 0 0 0.14em rgba(255, 255, 255, 0.35); }
.sl-pill > span { background: var(--bg); padding: 0.1em 0.36em; border-radius: 0.26em; text-shadow: none;
  -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.sl-f-classic { font-family: var(--font, system-ui, sans-serif); }
.sl-f-strong { font-family: "Barlow Condensed", var(--font, sans-serif); font-weight: 800; font-style: italic; text-transform: uppercase;
  letter-spacing: 0.01em; line-height: 1.02; }
.sl-f-marker { font-family: "Story Marker", "Marker Felt", cursive; font-weight: 400; }
.sl-f-modern { font-family: "Story Sora", var(--font, sans-serif); font-weight: 700; letter-spacing: -0.01em; }
.sl-f-typewriter { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 600; }
.sl-emoji { line-height: 1; }
.sl-badge > span { display: inline-block; padding: 0.08em 0.42em 0.02em; border: 0.07em solid #fff; border-radius: 0.16em;
  font-family: "Barlow Condensed", var(--font, sans-serif); font-weight: 800; font-style: italic; text-transform: uppercase;
  line-height: 1; box-shadow: 0.07em 0.07em 0 #111; }
.sl-pr > span { background: #e5262a; color: #fff; font-size: 1.15em; }
.sl-rx > span { background: #111; color: #fff; }
.sl-norep > span { background: #fff; color: #e5262a; border-color: #e5262a; box-shadow: 0.07em 0.07em 0 #111; }
.sl-chip { display: inline-flex; align-items: center; gap: 0.28em; padding: 0.26em 0.5em; border-radius: 0.45em; background: #fff;
  color: #111; font-family: "Barlow Condensed", var(--font, sans-serif); font-weight: 800; text-transform: uppercase;
  line-height: 1; box-shadow: 0 0.06em 0.2em rgba(0, 0, 0, 0.3); }
.sl-chip > svg { width: 0.95em; height: 0.95em; flex: none; }
.sl-workout > svg { color: #e5262a; }
.sl-time { background: #111; color: #fff; letter-spacing: 0.02em; }
.sl-place > svg { color: #e5262a; }
.sl-draw { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
