/* Public feed (P-24). Tokens from theme.css (design/tokens.json). Mobile first; nothing under 12px. */
.feed-page { overflow: auto; min-height: 100%; background: var(--bg); color: var(--text); }
.feed { padding: 24px 0 96px; }

.feed-hero { display: grid; gap: 24px; margin-bottom: 40px; }
.feed-hero h1 { font-size: clamp(40px, 7vw, 88px); letter-spacing: -0.04em; line-height: 1.02; margin: 12px 0 16px; }
.feed-lede { max-width: 40rem; margin: 0; font-size: 16px; line-height: 1.55; color: var(--muted); }

.feed-live { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.feed-live-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--subtle); }
.feed-live[data-state="live"] .feed-live-dot { background: var(--signal); animation: feed-pulse 1.8s var(--ease) infinite; }
.feed-live[data-state="stale"] .feed-live-dot { background: var(--warning); }
@keyframes feed-pulse { 50% { opacity: .35; } }

.feed-bounty { align-self: start; padding: 20px; border-radius: 20px; background: var(--ink); color: var(--ivory); box-shadow: var(--shadow-1); }
.feed-bounty-label { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: color-mix(in srgb, var(--ivory) 68%, transparent); }
.feed-bounty-value { margin: 8px 0 4px; font-size: 40px; font-weight: 700; letter-spacing: -0.02em; color: var(--signal);
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.feed-bounty-note { margin: 0 0 16px; font-size: 14px; color: color-mix(in srgb, var(--ivory) 68%, transparent); }
.feed-bounty-play { display: inline-block; padding: 12px 20px; border-radius: 999px; background: var(--signal); color: var(--on-signal);
  font-weight: 600; font-size: 16px; text-decoration: none; }
.feed-bounty-play:focus-visible, .feed button:focus-visible, .feed-share button:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

.feed-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 0; border-top: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 20; }
.feed-filters { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--soft); }
.feed-filters button { border: 0; background: transparent; color: var(--muted); font: 600 14px var(--font); padding: 8px 16px;
  border-radius: 999px; cursor: pointer; min-height: 40px; }
.feed-filters button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.feed-stats { margin: 0; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

.feed-new { display: block; margin: 0 auto 16px; border: 0; border-radius: 999px; padding: 10px 20px; background: var(--signal);
  color: var(--on-signal); font: 600 14px var(--font); cursor: pointer; }
.feed-status { margin: 24px 0; color: var(--muted); font-size: 16px; }

.feed-list { display: grid; gap: 16px; }
.feed-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 20px; display: grid; gap: 12px;
  scroll-margin-top: 88px; transition: border-color 250ms var(--ease), box-shadow 250ms var(--ease); }
.feed-card[data-highlight="true"] { border-color: var(--signal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 25%, transparent); }
.feed-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 14px; color: var(--muted); }
.feed-card-player { font-family: var(--mono); font-size: 14px; color: var(--text); }
.feed-verdict { margin-left: auto; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 12px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.feed-verdict[data-verdict="released"] { background: var(--success-bg); color: var(--success); }
.feed-verdict[data-verdict="error"] { background: var(--error-bg); color: var(--error); }
.feed-label { margin: 0 0 4px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.feed-argument p, .feed-reply p { margin: 0; font-size: 16px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.feed-reply { border-radius: 12px 12px 12px 4px; padding: 16px; background: var(--ink); color: var(--ivory); }
.feed-reply .feed-label { color: var(--signal); }
.feed-error-note { margin: 0; align-self: start; padding: 12px 16px; border-radius: 12px; background: var(--error-bg); color: var(--error); font-size: 14px; line-height: 1.55; }

.feed-card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.feed-card-actions button, .feed-older, .feed-share-actions button {
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 600 14px var(--font);
  padding: 10px 16px; border-radius: 999px; cursor: pointer; min-height: 44px; }
.feed-card-actions button:hover, .feed-older:hover, .feed-share-actions button:hover:not(:disabled) { background: var(--hover); }
.feed-older { display: block; margin: 24px auto 0; }
.feed-footnote { max-width: 44rem; margin: 40px 0 0; font-size: 12px; line-height: 1.55; color: var(--subtle); }

.feed-share { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); border: 0; border-radius: 20px; padding: 20px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-2); }
.feed-share::backdrop { background: color-mix(in srgb, var(--ink) 60%, transparent); }
.feed-share-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.feed-share-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.02em; word-spacing: normal; }
.feed-share-close { border: 0; background: var(--soft); color: var(--text); width: 40px; height: 40px; border-radius: 999px; font-size: 20px; cursor: pointer; }
.feed-share-preview img, .feed-share-preview canvas { display: block; width: 100%; height: auto; max-height: 60dvh; object-fit: contain; border-radius: 12px; }
.feed-share-status { min-height: 1.5em; margin: 12px 0; font-size: 14px; color: var(--muted); }
.feed-share-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* The main action: Post on X for a round attempt, Download for a practice receipt. */
.feed-share-x:not([hidden]), .feed-share-x[hidden] + #feed-share-download { background: var(--button); color: var(--button-text); border-color: var(--button); }
.feed-share-actions button:disabled { opacity: .5; cursor: default; }

@media (min-width: 820px) {
  .feed { padding-top: 40px; }
  .feed-hero { grid-template-columns: minmax(0, 1fr) 340px; align-items: end; gap: 40px; }
  .feed-card { padding: 24px; grid-template-columns: 1fr 1fr; column-gap: 20px; }
  .feed-card-meta,.feed-card-actions { grid-column: 1 / -1; }
}
@media (min-width: 1180px) {
  .feed-list { grid-template-columns: 1fr 1fr; align-items: start; }
  .feed-card { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .feed-live[data-state="live"] .feed-live-dot { animation: none; }
  .feed-card { transition: none; }
}

/* Best-losing-attempt vote (P-24b). */
.feed-top { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; padding: 4px 12px;
  border-radius: 999px; background: var(--accent-bg); color: var(--accent); }
.feed-vote { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.feed-card-actions .feed-vote button { border-color: var(--accent); color: var(--accent); }
.feed-card-actions .feed-vote button:disabled { opacity: .6; cursor: default; }
.feed-vote-status { font-size: 14px; color: var(--muted); }
.feed-vote-status a { color: var(--accent); font-weight: 600; }

/* Watch inside the shell: the hero and filters stay put, the attempts scroll in their own area. */
.shell-page>main.feed { display:flex;flex-direction:column;overflow:hidden;padding:clamp(16px,4vh,40px) 0 0; }
.shell-page .feed-hero { flex:none;margin-bottom:clamp(16px,3vh,32px);align-items:center; }
.shell-page .feed-hero h1 { font-size:clamp(40px,5.6vw,76px);margin-bottom:12px; }
.shell-page .feed-toolbar { flex:none;position:static; }
.shell-page .feed-scroll { flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;padding-bottom:24px; }
.shell-page .feed-status { margin:12px 0; }
.shell-page .feed-bounty-value { font-size:32px;margin:4px 0 2px; }
.shell-page .feed-status { padding:28px 24px;border:1px dashed var(--line);border-radius:16px;text-align:center;font-size:15px; }
@media(max-width:639px) {
  .shell-page .feed-hero { gap:14px; }
  .shell-page .feed-hero h1 { font-size:40px;margin:8px 0 8px; }
  .shell-page .feed-lede { font-size:14px; }
  .shell-page .feed-bounty { padding:14px 16px;border-radius:16px;display:grid;grid-template-columns:1fr auto;column-gap:12px;align-items:center; }
  .shell-page .feed-bounty>p { grid-column:1; }
  .shell-page .feed-bounty-play { grid-column:2;grid-row:1/4;font-size:14px;padding:10px 16px; }
  .shell-page .feed-bounty-value { font-size:26px; }
  .shell-footer .feed-footnote { font-size:11px; }
}

/* Empty feed: a dial keeps turning while the vault waits for its first public attempt, with the way in right under it. */
.shell-page .feed-status[data-empty='true']:before { content:'';display:block;width:44px;height:44px;margin:0 auto 14px;border-radius:50%;
  border:2px solid var(--line);border-top-color:var(--signal);animation:feed-dial 2.4s linear infinite; }
@keyframes feed-dial { to { transform:rotate(360deg); } }
.feed-status .feed-empty-cta { display:flex;width:fit-content;align-items:center;min-height:44px;margin:16px auto 0;padding:0 18px;border-radius:999px;
  background:var(--button);color:var(--button-text);font-size:14px;font-weight:500; }
.feed-status .feed-empty-cta:hover { background:color-mix(in srgb,var(--button) 86%,var(--signal)); }
/* An attempt that arrives while you watch slides in and glows once. */
.feed-card[data-fresh='true'] { animation:feed-card-in .6s var(--ease) both,feed-card-glow 1.8s var(--ease) .2s; }
@keyframes feed-card-in { from { opacity:0;transform:translateY(-8px); } }
@keyframes feed-card-glow { 0% { box-shadow:0 0 0 0 color-mix(in srgb,var(--signal) 40%,transparent); } 100% { box-shadow:0 0 0 10px transparent; } }
.feed-bounty-value[data-fresh='a'] { animation:bounty-flash 1.2s var(--ease); }
.feed-bounty-value[data-fresh='b'] { animation:bounty-flash-b 1.2s var(--ease); }
@keyframes bounty-flash { 20% { transform:scale(1.06); } }
@keyframes bounty-flash-b { 20% { transform:scale(1.06); } }
/* Vault system: the bounty is a plate; each attempt is a plain plate. */
body.vs .feed-bounty { position:relative; overflow:hidden; background:var(--surface); color:var(--text); border-radius:16px;
  box-shadow:0 0 0 1px var(--line), 0 18px 40px -26px #00000059; }
body.vs .feed-bounty-label,body.vs .feed-bounty-note { color:var(--muted); }
body.vs .feed-bounty-value { color:var(--text); }
body.vs .feed-bounty-play { min-height:44px; min-width:44px; background:var(--signal)!important; color:#121213!important; box-shadow:0 2px 0 #a8400f; }
body.vs .feed-card { position:relative; border:0; border-radius:12px; box-shadow:0 0 0 1px var(--line); }
body.vs .feed-filters { background:none; gap:6px; padding:0; }
body.vs .feed-filters button { border-radius:8px; background:var(--surface); box-shadow:inset 0 1px 0 var(--key-hi), 0 1px 2px var(--key-lo), 0 0 0 1px var(--line); }
body.vs .feed-filters button[aria-selected='true'] { background:var(--button); color:var(--button-text); box-shadow:0 0 0 1px var(--button); }
body.vs .shell-page .feed-status,body.vs .feed-status { background:var(--surface); border-style:solid; border-color:var(--line); }
/* Vault system, with data: plain sentence-case labels, no rule under the hero, no mono. */
body.vs .feed-label { font:600 13px var(--font); letter-spacing:0; text-transform:none; color:var(--muted); }
body.vs .feed-reply .feed-label,body.vs .feed-card [class*='reply'] .feed-label { color:inherit; opacity:.75; }
body.vs .feed-verdict { font:500 12px var(--font); letter-spacing:0; text-transform:none; border-radius:6px; }
body.vs .feed-card-player { font-family:var(--font); font-weight:600; font-variant-numeric:tabular-nums; }
body.vs .feed-toolbar { border-top:0; background:var(--bg); }
body.vs .feed-bounty .feed-bounty-value { font-family:var(--font); font-weight:700; font-variant-numeric:proportional-nums; letter-spacing:-.03em; }
body.vs .feed-card-actions :is(button,a) { min-height:44px; min-width:44px; padding:0 14px; border:0; border-radius:9px; background:var(--surface); color:var(--text); font:500 14px var(--font);
  box-shadow:inset 0 1px 0 var(--key-hi), 0 1px 2px var(--key-lo), 0 0 0 1px var(--line); }
/* The bounty never breaks inside the number; on narrow phones the call to action goes under it. */
body.vs .feed-bounty .feed-bounty-value { white-space:nowrap; font-size:clamp(26px,8vw,40px); }
@media (max-width:420px) { body.vs.shell-page .feed-bounty,body.vs .feed-bounty { grid-template-columns:1fr; row-gap:12px; justify-items:start; } }
@media (max-width:420px) {
  body.vs.shell-page .feed-bounty { grid-template-columns:minmax(0,1fr); }
  body.vs.shell-page .feed-bounty .feed-bounty-play { grid-column:1; grid-row:auto; justify-self:start; margin-top:4px; }
}
/* With the page scrolling, the filters stay in reach at the top while the attempts go by. */
body.vs.shell-page .feed-toolbar { position:sticky; top:0; z-index:20; padding-block:10px; background:var(--bg); }
/* Every attempt card has the same size: the argument and the reply share the space and long text scrolls inside its box,
   with a fade at the bottom while there is more to read. */
body.vs .feed-card { --card-h:440px; height:var(--card-h); display:flex; flex-direction:column; gap:12px; }
body.vs .feed-argument,body.vs .feed-reply,body.vs .feed-error-note { display:flex; flex-direction:column; flex:0 1 auto; min-height:0; max-height:46%; }
body.vs .feed-reply { padding:14px 16px; }
body.vs .feed-text { flex:0 1 auto; min-height:0; margin:0; padding-right:6px; overflow-y:auto; overscroll-behavior:auto; font-size:16px; line-height:1.55;
  white-space:pre-wrap; overflow-wrap:anywhere; scrollbar-width:thin; scrollbar-color:color-mix(in srgb,currentColor 28%,transparent) transparent; border-radius:4px; }
body.vs .feed-text::-webkit-scrollbar { width:6px; }
body.vs .feed-text::-webkit-scrollbar-thumb { border-radius:6px; background:color-mix(in srgb,currentColor 28%,transparent); }
body.vs .feed-text[data-more='true'] { -webkit-mask-image:linear-gradient(#000 calc(100% - 28px),transparent); mask-image:linear-gradient(#000 calc(100% - 28px),transparent); }
body.vs .feed-text[data-more='true']:focus-visible { -webkit-mask-image:none; mask-image:none; }
/* The reply keeps its dark material in both themes, so its focus ink is light too. */
body.vs .feed-reply { --text:var(--ivory); }
body.vs .feed-text:focus-visible { outline:2px solid var(--text); outline-offset:2px; }
body.vs .feed-card-actions { margin-top:auto; flex:none; }
body.vs .feed-card-meta { flex:none; }
/* Tablet: the argument and the reply sit side by side, each as tall as its text up to the card. */
@media (min-width:820px) and (max-width:1179px) {
  body.vs .feed-card { --card-h:300px; display:grid; grid-template-columns:1fr 1fr; grid-template-rows:auto minmax(0,1fr) auto; }
  body.vs .feed-argument,body.vs .feed-reply,body.vs .feed-error-note { align-self:start; max-height:100%; }
  body.vs .feed-card-actions { grid-column:1/-1; }
}
@media (min-width:1180px) { body.vs .feed-card { --card-h:400px; } }
@media (max-height:620px) and (max-width:819px) { body.vs .feed-card { --card-h:360px; } }

/* Pages of attempts: Newer and Older keys with the range between them. */
body.vs .feed-pager:not([hidden]) { display:flex; align-items:center; justify-content:center; gap:16px; margin:28px 0 8px; }
body.vs .feed-pager button { min-height:44px; min-width:96px; padding:0 18px; border:0; border-radius:9px; background:var(--surface); color:var(--text);
  font:500 15px var(--font); cursor:pointer; box-shadow:inset 0 1px 0 var(--key-hi), 0 1px 2px var(--key-lo), 0 0 0 1px var(--line);
  transition:transform 120ms var(--ease), background-color 160ms var(--ease); }
body.vs .feed-pager button:hover:not(:disabled) { background:var(--hover); }
body.vs .feed-pager button:active:not(:disabled) { transform:translateY(1px); box-shadow:0 0 0 1px var(--line); }
body.vs .feed-pager button:disabled { opacity:.45; cursor:default; }
body.vs .feed-pager button[aria-busy='true'] { opacity:.7; }
body.vs .feed-page { margin:0; min-width:9ch; text-align:center; font-size:14px; color:var(--muted); font-variant-numeric:tabular-nums; }
/* The bounty figure is sized by its plate, so it stays on one line however narrow the plate gets. */
body.vs .feed-bounty { container-type:inline-size; }
body.vs .feed-bounty .feed-bounty-value { font-size:clamp(22px,12cqi,40px); }
/* The page scrolls the window: the list is not its own scroll area, so the wheel over it moves the page. */
body.vs.shell-page .feed-scroll { overflow:visible; overscroll-behavior:auto; }
/* What the attempt added to the money, on the card's bottom row, linked to its transaction. */
body.vs .feed-card-actions { align-items:center; }
body.vs .feed-card-actions .feed-money { margin-left:auto; min-height:0; padding:0; border:0; background:none; box-shadow:none; font:600 14px var(--font); color:var(--muted);
  text-decoration:none; white-space:nowrap; }
body.vs .feed-card-actions .feed-money[data-kind='fee'] { color:var(--accent); }
body.vs .feed-card-actions a.feed-money { min-height:44px; min-width:44px; }
body.vs .feed-card-actions a.feed-money:hover { text-decoration:underline; text-underline-offset:3px; }
/* Tighter cards: sized for a typical attempt (two lines each side); longer text scrolls inside as before. */
body.vs .feed-card { --card-h:320px; }
@media (min-width:820px) and (max-width:1179px) { body.vs .feed-card { --card-h:230px; } }
@media (min-width:1180px) { body.vs .feed-card { --card-h:280px; } }
@media (max-height:620px) and (max-width:819px) { body.vs .feed-card { --card-h:300px; } }
