@font-face {
  font-family: Figtree;
  src: url(/assets/figtree.woff2) format('woff2');
  font-weight: 300 900;
  font-display: swap;
}
@font-face {
  font-family: Outfit;
  src: url(/assets/outfit.woff2) format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --gutter: clamp(16px, 5vw, 32px);
  --bar-height: calc(56px + env(safe-area-inset-top));
  --rail-width: 248px;
}
html[data-brand=rollert] {
  --bg: #0b151d;
  --surface: #111f29;
  --raised: #1b2c38;
  --line: #2c3d49;
  --edge: #405460;
  --text: #f3f7f9;
  --soft: #b5c3cd;
  --muted: #97aab7;
  --accent: #00e701;
  --ink: #09200c;
  --font: Figtree, system-ui, sans-serif;
}
html[data-brand=onyxjack] {
  --bg: #100f0e;
  --surface: #1a1816;
  --raised: #27241f;
  --line: #39352f;
  --edge: #514b40;
  --text: #faf7f1;
  --soft: #d0c8bb;
  --muted: #b3a99b;
  --accent: #deb268;
  --ink: #21180a;
  --font: Outfit, system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--bar-height) + 12px);
}
body { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
button, select, a {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 140ms ease-out, border-color 140ms ease-out, transform 140ms ease-out;
}
button, select { font: inherit; color: inherit; }
button, select, a[href] { cursor: pointer; }
button { border: 0; background: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
button:disabled, select:disabled { cursor: default; }
button:disabled:not(#gen), select:disabled { opacity: .64; }

header, .drawer-head { display: flex; align-items: center; gap: 10px; }
header {
  position: sticky;
  z-index: 3;
  top: 0;
  min-height: var(--bar-height);
  padding: env(safe-area-inset-top) max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: var(--soft);
}
#menu { margin-left: -10px; }
.mark { font-size: 19px; font-weight: 740; letter-spacing: -.045em; }
#shade { position: fixed; inset: 0; z-index: 4; background: rgb(0 0 0 / .62); }
.drawer-open, .drawer-open body { overflow: hidden; overscroll-behavior: none; }
#side {
  position: fixed;
  z-index: 5;
  inset: 0 auto 0 0;
  width: min(308px, calc(100% - 56px));
  padding: env(safe-area-inset-top) 14px max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border-right: 1px solid var(--line);
  visibility: hidden;
  transform: translateX(-100%);
  transition: transform 160ms ease-out, visibility 0s linear 160ms;
}
#side.open { visibility: visible; transform: none; transition-delay: 0s; }
.drawer-head {
  min-height: 56px;
  padding-left: 12px;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
#side nav { display: grid; gap: 4px; padding: 18px 0; }
#side a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 10px 14px;
  min-height: 46px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--soft);
  font-weight: 580;
}
#side a[aria-current=page] { color: var(--text); background: var(--raised); }
#side a[aria-current=page] .icon { color: var(--accent); }
.account { margin-top: auto; border-top: 1px solid var(--line); padding: 16px 10px 0; }
#who { display: block; font-size: 14px; font-weight: 650; overflow-wrap: anywhere; }
#disconnect {
  min-height: 44px;
  margin-left: -8px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  border-radius: 6px;
  font-size: 14px;
}

main, footer {
  width: 100%;
  max-width: calc(720px + 2 * var(--gutter));
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
main { flex: 1; padding-top: clamp(20px, 3vw, 36px); padding-bottom: 28px; }
footer { padding-block: 14px max(20px, env(safe-area-inset-bottom)); color: var(--muted); text-align: center; font-size: 12px; }
footer a { color: inherit; text-decoration: underline; text-underline-offset: 3px; padding-block: 12px; }
footer a:hover { color: var(--text); }
.brands {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.brands button {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 4px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
}
.brands img { display: block; width: 109px; max-width: 100%; opacity: .63; }
.brands [data-brand=onyxjack] img { width: 113px; }
.brands [aria-selected=true] { border-color: var(--edge); background: var(--raised); }
.brands [aria-selected=true] img { opacity: 1; }
.brands [aria-selected=true]::after {
  content: '';
  position: absolute;
  bottom: -1px;
  width: 24px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.view, #off { margin-top: clamp(24px, 4vw, 40px); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(32px, 5vw, 44px); line-height: 1.08; letter-spacing: -.045em; font-weight: 730; }
h2 { margin: 30px 0 8px; font-size: 21px; line-height: 1.25; letter-spacing: -.025em; font-weight: 680; }
p { color: var(--soft); }
#off { max-width: 56ch; }
#off h1 { max-width: 18ch; }
#off p { margin: 14px 0 24px; }
.btn, .actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}
.btn { width: 100%; min-height: 52px; padding: 12px 18px; background: var(--accent); color: var(--ink); text-decoration: none; }
#gen:disabled { color: var(--soft); background: var(--raised); box-shadow: inset 0 0 0 1px var(--line); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; min-width: 0; }
.fields:has(#code-field[hidden]) { grid-template-columns: minmax(0, 1fr); }
.style-note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.35; }
.field { position: relative; display: block; min-width: 0; }
.field span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 13px; font-weight: 600; }
.field::after {
  content: '';
  position: absolute;
  right: 15px;
  bottom: 24px;
  width: 6px;
  height: 6px;
  border: solid var(--soft);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  pointer-events: none;
}
.pick {
  display: block;
  width: 100%;
  height: 52px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--edge);
  border-radius: 7px;
  background: var(--surface);
  text-align: left;
}
.pick b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pick[aria-expanded=true] { border-color: var(--accent); }
.menu {
  position: absolute;
  z-index: 5;
  top: calc(100% + 6px);
  right: 0;
  width: max(100%, 232px);
  padding: 6px;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--raised);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .5);
}
.menu .opt { display: block; flex: 1; width: 100%; min-height: 46px; padding: 0 12px; border-radius: 7px; text-align: left; font-weight: 600; }
.menu .opt[aria-current=true] { color: var(--accent); background: var(--surface); }
.opt-row { display: flex; gap: 4px; }
#code-menu { right: auto; left: 0; }
#code-list .opt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#code-list:not(:empty) + .new, #code-list:not(:empty) ~ .make { margin-top: 6px; }
.menu .new { color: var(--accent); box-shadow: inset 0 0 0 1px var(--line); }
.make { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.make input { min-width: 0; height: 46px; padding: 0 12px; border: 1px solid var(--edge); border-radius: 7px; background: var(--surface); color: var(--text); font: inherit; font-size: 16px; font-weight: 600; text-transform: uppercase; }
.make input:focus-visible { outline: 0; border-color: var(--accent); }
.make button { height: 46px; padding: 0 16px; border-radius: 7px; background: var(--accent); color: var(--on-accent, #04130a); font-weight: 700; }
.make button:disabled { opacity: .6; }
.make p { grid-column: 1 / -1; margin: 2px 2px 4px; color: var(--danger, #ff8a8a); font-size: 14px; line-height: 1.35; }
.menu .more { flex: none; display: grid; place-items: center; width: 46px; min-height: 46px; border-radius: 7px; color: var(--soft); box-shadow: inset 1px 0 0 var(--line); }
.menu .more .icon { transition: transform 140ms ease-out; }
.menu .more[aria-expanded=true] { color: var(--text); }
.menu .more[aria-expanded=true] .icon { transform: rotate(90deg); }
.sub { margin: 2px 0 2px 12px; padding-left: 6px; border-left: 1px solid var(--line); }
.sub .opt { font-weight: 500; }
select {
  appearance: none;
  display: block;
  width: 100%;
  height: 52px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--edge);
  border-radius: 7px;
  background: var(--surface);
  text-overflow: ellipsis;
  font-weight: 600;
}
.post-card { padding: 5px; border: 1px solid var(--edge); border-radius: 12px; background: var(--surface); }
.shot { overflow: hidden; border-radius: 7px; background: var(--raised); }
#pic, #skeleton { display: block; width: 100%; }
#pic { height: auto; }
#skeleton { aspect-ratio: 1600 / 1067; }
#pic { object-fit: contain; animation: reveal-picture 360ms cubic-bezier(.2, .7, .2, 1); }
#skeleton { display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); font-size: 14px; }
#skeleton.empty { gap: 8px; border: 1px dashed var(--edge); border-radius: inherit; background: var(--surface); }
#skeleton span { max-width: 26ch; text-align: center; line-height: 1.4; }
/* While a post is being made: a soft light sweeping over the box, a ring that fills as the work goes on with a bright
   arc circling it, and one line saying what is happening right now. */
#skeleton:not(.empty) {
  background: linear-gradient(105deg, transparent 38%, rgb(255 255 255 / 5%) 50%, transparent 62%) 0 0 / 250% 100% no-repeat, var(--raised);
  animation: sheen 1.9s linear infinite;
}
#skeleton:not(.empty) > .icon, #skeleton.empty > .ring { display: none; }
#skeleton:not(.empty) span { color: var(--text, #fff); font-size: 16px; font-weight: 650; letter-spacing: 0; }
.ring { overflow: visible; }
.ring circle { fill: none; stroke-width: 6; stroke-linecap: round; transform-origin: 36px 36px; }
.ring-track { stroke: rgb(255 255 255 / 9%); }
.ring-fill { stroke: var(--accent); stroke-dasharray: 188.5; stroke-dashoffset: 188.5; transform: rotate(-90deg); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 55%, transparent)); animation: ring-fill 22s cubic-bezier(.12, .7, .25, 1) forwards; }
.ring-comet { stroke: #fff; stroke-width: 3; stroke-dasharray: 26 162.5; opacity: .85; animation: spin 1.05s linear infinite; }
#gen .spin { display: none; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 38 19; transform-origin: center; }
#gen:disabled .icon:not(.spin) { display: none; }
/* a finished post that has not gone to X yet: the green button IS "Post on X" */
#gen .go, #gen.to-x .icon:not(.go) { display: none; }
#gen.to-x:not(:disabled) .go { display: block; }
.actions.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#gen:disabled .spin { display: block; animation: spin .9s linear infinite; }
@keyframes sheen { from { background-position: 120% 0, 0 0; } to { background-position: -60% 0, 0 0; } }
@keyframes ring-fill { to { stroke-dashoffset: 14; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes reveal-picture { from { opacity: 0; transform: scale(.985); filter: blur(6px); } }
.caption { padding: 15px 12px 12px; white-space: pre-wrap; overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; }
.actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.actions button { min-height: 44px; font-size: 14px; gap: 5px; padding: 6px 3px; border: 1px solid var(--line); color: var(--text); background: var(--surface); }
.actions button:last-child { background: var(--raised); border-color: var(--edge); }
.actions .confirmed { color: var(--accent); border-color: var(--edge); }
.error { color: #ffb0a8; margin-top: 12px; font-size: 14px; }
.note { color: var(--muted); margin: 10px 4px 0; font-size: 14px; line-height: 1.4; }
.clipboard-fallback { position: fixed; top: 0; left: 0; opacity: 0; pointer-events: none; }

.page p, .steps, .plain { max-width: 65ch; }
.page .lead { color: var(--soft); margin-top: 12px; font-size: clamp(17px, 2vw, 19px); line-height: 1.5; }
.page a:not(.btn) { position: relative; display: inline-block; color: var(--accent); text-underline-offset: 3px; }
.page a:not(.btn)::after { content: ''; position: absolute; inset: 50% 0 auto; height: 44px; transform: translateY(-50%); }
.page .btn { margin-top: 20px; }
.steps, .plain { margin: 12px 0 0; padding: 0; list-style: none; color: var(--soft); }
.steps { counter-reset: step; }
.steps li, .plain li { position: relative; padding: 14px 0 14px 40px; border-bottom: 1px solid var(--line); }
.steps li { counter-increment: step; }
.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 16px;
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.plain li { padding-left: 18px; }
.plain li::before { content: ''; position: absolute; left: 0; top: 24px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.page b { color: var(--text); }
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.stats > div { min-width: 0; padding: clamp(14px, 3vw, 22px); }
.stats > div:nth-child(even) { border-left: 1px solid var(--line); }
.stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
.stats span, .stats i { display: block; color: var(--muted); font-size: 13px; }
.stats span { font-weight: 600; }
.stats b {
  display: block;
  margin: 6px 0 2px;
  min-height: 1.15em;
  font-size: clamp(28px, 4.5vw, 37px);
  line-height: 1.15;
  font-weight: 650;
  letter-spacing: -.04em;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.stats #e-ready { color: var(--accent); }
.stats i { font-style: normal; }
.pending-rate { visibility: hidden; }
.note { margin-top: 10px; font-size: 14px; }
.codes { width: 100%; border-collapse: collapse; table-layout: fixed; font-variant-numeric: tabular-nums; }
.codes th, .codes td { text-align: right; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.codes th { width: 18%; padding: 7px 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.codes td { padding: 12px 0; font-size: 15px; }
.codes th:first-child, .codes td:first-child { text-align: left; width: 64%; padding-right: 8px; }
.codes td:first-child { font-weight: 600; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (hover: hover) {
  .icon-button:hover, #disconnect:hover, #side a:hover, .brands button:hover, .actions button:hover { background-color: var(--raised); color: var(--text); }
  .actions button:hover, select:hover { border-color: var(--edge); }
  .menu .opt:hover, .menu .more:hover { background: var(--surface); }
  .btn:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, white); }
}
.btn:active:not(:disabled) {
  transform: scale(.97);
  background-color: color-mix(in srgb, var(--accent) 84%, black);
  transition-duration: 90ms;
}
:is(.icon-button, #disconnect, #side a, .brands button, .actions button):active:not(:disabled) {
  transform: scale(.98);
  background-color: var(--edge);
  transition-duration: 90ms;
}
@media (width < 900px) {
  html:has(#view-posts:not([hidden])) {
    --posts-inset: var(--generate-bar-height, calc(69px + env(safe-area-inset-bottom)));
    scroll-padding-bottom: var(--posts-inset);
  }
  body:has(#view-posts:not([hidden])) { padding-bottom: var(--posts-inset); }
  main:has(#view-posts:not([hidden])) { padding-top: 14px; }
  #view-posts { margin-top: 14px; }
  #posts-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .actions { grid-template-columns: minmax(0, 1.1fr) repeat(2, minmax(0, 1fr)); }
  .fields { margin-bottom: 14px; }
  .fields:has(+ .style-note:not([hidden])) { margin-bottom: 8px; }
  .style-note { margin-bottom: 14px; }
  /* two fields share the row: the small label sits above the value inside the box, so the value has the whole width */
  .field span { position: absolute; left: 13px; top: 8px; margin: 0; font-size: 11px; line-height: 1; letter-spacing: .02em; pointer-events: none; }
  .field select, .field .pick { padding: 15px 30px 0 12px; font-size: 16px; }
  .field::after { right: 13px; bottom: 22px; }
  #generate-bar {
    position: fixed;
    z-index: 2;
    inset: auto 0 0;
    padding: 8px max(var(--gutter), env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: var(--bg);
  }
  #generate-bar > * { max-width: 720px; margin-inline: auto; }
  #generate-bar #error { margin-block: 0 8px; overflow-wrap: anywhere; }
  .drawer-open #generate-bar { visibility: hidden; }
}
@media (min-width: 900px) {
  html { scrollbar-gutter: stable; }
  .has-side:not(.rail-collapsed) body { padding-left: var(--rail-width); }
  .has-side:not(.rail-collapsed) header { margin-left: calc(-1 * var(--rail-width)); }
  #side { top: var(--bar-height); width: var(--rail-width); padding-top: 8px; transition: none; }
  .has-side:not(.rail-collapsed) #side { visibility: visible; transform: none; }
  .drawer-head, #shade { display: none; }
  header { padding-inline: 24px; }
  #side a { font-size: 16px; min-height: 44px; padding-block: 9px; }
  .page { font-size: 17px; line-height: 1.6; }
  .post-tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
    gap: 12px;
    margin: 16px 0;
  }
  #generate-bar { display: contents; }
  #gen { grid-area: 1 / 2; }
  .fields { grid-area: 1 / 1; gap: 12px; }
  .style-note { grid-area: 2 / 1 / 3 / -1; margin-top: -4px; }
  #error { grid-column: 1 / -1; margin: 0; }
  .caption { padding: 18px; }
  .actions { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
