:root {
  --paper: #fff;
  --card: #fff;
  --soft: #f4f4f5;
  --ink: #18181b;
  --muted: #63636b;
  --line: #e4e4e7;
  --accent: #d6401f;
  --accent-ink: #fff;
  --ok: #157347;
  --warn-bg: #fdece7;
  --radius: 16px;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.45 var(--sans); }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }

.brand { font: 700 18px/1 var(--mono); letter-spacing: -.02em; }
.brand::before { content: '#'; color: var(--accent); margin-right: 2px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.error { color: var(--accent); font-size: 14px; min-height: 20px; }
.mt { margin-top: 10px; }
.mb { margin-bottom: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--ink);
  background: var(--ink); color: var(--paper); font-weight: 650; cursor: pointer; text-decoration: none;
  transition: opacity .15s, border-color .15s, transform .1s;
}
.btn:hover { opacity: .88; }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); opacity: 1; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.wide { width: 100%; }
.btn.sm { min-height: 34px; padding: 0 10px; font-size: 14px; font-weight: 500; border-radius: 8px; }
.btn.copied { color: var(--ok); border-color: var(--ok); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, .track:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input[type=email], input[type=password], input[type=text], input[type=tel], textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card);
}
textarea { resize: vertical; min-height: 110px; }

/* Sign-in */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.gate form { width: 100%; max-width: 380px; display: grid; gap: 14px; }
.gate h1 { font-size: 30px; line-height: 1.12; letter-spacing: -.025em; margin-top: 18px; }

/* Worker */
.shell { max-width: 460px; margin: 0 auto; padding: 16px 16px 56px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.topbar .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar .email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { background: none; border: 0; padding: 8px 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 14px; flex: none; }

.progress { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 18px; }
.progress span { height: 4px; border-radius: 4px; background: var(--line); transition: background .3s; }
.progress span.on { background: var(--accent); }

.notice { background: var(--warn-bg); border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 14px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.next-card { padding: 22px 20px; display: grid; gap: 12px; margin-bottom: 16px; text-align: center; justify-items: center; }
.next-card h1 { font-size: 24px; line-height: 1.15; letter-spacing: -.02em; }
.next-card .btn { margin-top: 4px; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--muted); }
.timer { font: 700 46px/1 var(--mono); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.small-timer { font-size: 30px; }
.bar { width: 100%; height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 6px; transition: width 1s linear; }

/* A stack of cards standing in for the post, unseen until it is received. */
.stack { position: relative; width: 104px; height: 138px; margin: 4px 0 8px; }
.stack i, .stack b { position: absolute; inset: 0; border-radius: 12px; border: 1px solid var(--line); }
.stack i { background: var(--soft); }
.stack i:nth-child(1) { transform: rotate(-9deg) translateX(-12px); }
.stack i:nth-child(2) { transform: rotate(7deg) translateX(11px); }
.stack b {
  display: grid; place-items: center; background: linear-gradient(160deg, var(--accent), #8f2410);
  border: 0; color: #fff; font: 700 34px/1 var(--mono); letter-spacing: -.04em;
}

/* Post */
.post { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.post-label { display: flex; justify-content: space-between; padding: 12px 16px; font-size: 14px; color: var(--muted); }
.post-label strong { color: var(--ink); }
.carousel { position: relative; background: #000; }
.track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; aspect-ratio: 3 / 4; }
.track::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always; }
.slide img { display: block; width: 100%; height: 100%; object-fit: contain; }
.counter { position: absolute; top: 10px; right: 10px; padding: 3px 9px; border-radius: 99px; background: rgb(0 0 0 / .62); color: #fff; font: 600 13px var(--mono); }
.dots { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 5px; pointer-events: none; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: rgb(255 255 255 / .45); transition: background .2s; }
.dots i.on { background: #fff; }
.nav {
  position: absolute; top: 50%; translate: 0 -50%; width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: rgb(0 0 0 / .55); color: #fff; font-size: 24px; line-height: 1; cursor: pointer;
}
.nav.prev { left: 8px; }
.nav.next { right: 8px; }
@media (pointer: coarse) { .nav { display: none; } }

.post-body { padding: 16px; display: grid; gap: 12px; }
.post-body h2 { font-size: 19px; line-height: 1.25; letter-spacing: -.01em; overflow-wrap: anywhere; }
.caption { font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); opacity: .9; }
.tag { color: var(--accent); font-weight: 600; }
.copies { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.copies .btn { font-size: 14px; padding: 0 8px; }

/* Admin */
.admin { max-width: 1120px; margin: 0 auto; padding: 18px 20px 60px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tab[aria-selected=true] { color: var(--ink); border-color: var(--accent); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .value { font: 700 30px/1.1 var(--mono); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi .label { font-size: 14px; color: var(--muted); margin-top: 4px; }
.kpi.alert { background: var(--warn-bg); border-color: var(--accent); }
.kpi.alert .value { color: var(--accent); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
.panel h2 { font-size: 16px; margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.spread { justify-content: space-between; }
.filepick { position: relative; overflow: hidden; }
.filepick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.hint { font-size: 14px; color: var(--muted); margin: 10px 0 0; }
code { font: 13px var(--mono); background: var(--soft); padding: 1px 5px; border-radius: 5px; }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.inactive td { color: var(--muted); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 13px; background: var(--soft); border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { color: var(--ok); border-color: var(--ok); }
.pill.no { color: var(--accent); border-color: var(--accent); }

.upload { font-size: 14px; display: grid; gap: 6px; }
.upload progress { width: 100%; height: 6px; accent-color: var(--accent); }
.upload .error { min-height: 0; }

.qitem { display: grid; grid-template-columns: 34px 54px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--line); background: var(--card); }
.qitem:last-child { border-bottom: 0; }
.qitem[draggable=true] { cursor: grab; }
.qitem.dragging { opacity: .4; }
.qitem.dropline { box-shadow: 0 -2px 0 var(--accent); }
.qitem .pos { font: 600 14px var(--mono); color: var(--muted); text-align: right; }
.thumb { position: relative; width: 54px; aspect-ratio: 3 / 4; border-radius: 7px; overflow: hidden; background: #000; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb span { position: absolute; right: 3px; bottom: 3px; padding: 0 5px; border-radius: 99px; background: rgb(0 0 0 / .7); color: #fff; font: 600 11px var(--mono); }
.qitem .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.qitem .meta { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qitem .tools { display: flex; gap: 4px; }
.empty { padding: 26px; text-align: center; color: var(--muted); }

dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: min(520px, calc(100vw - 32px)); background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgb(28 26 23 / .45); }
dialog h2 { font-size: 18px; margin-bottom: 12px; }
dialog .fields { display: grid; gap: 10px; margin-bottom: 16px; }
dialog .row.end { justify-content: flex-end; }
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.pick { position: relative; aspect-ratio: 3 / 4; border-radius: 8px; overflow: hidden; background: #000; }
.pick img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pick .n { position: absolute; left: 4px; top: 4px; padding: 0 6px; border-radius: 99px; background: rgb(0 0 0 / .7); color: #fff; font: 600 11px var(--mono); }
.pick .acts { position: absolute; left: 0; right: 0; bottom: 0; display: flex; }
.pick .acts button { flex: 1; height: 26px; border: 0; background: rgb(0 0 0 / .68); color: #fff; cursor: pointer; font-size: 13px; }
.pick .acts button:disabled { opacity: .35; cursor: default; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100vw - 32px); z-index: 10;
}

@media (max-width: 640px) {
  .qitem { grid-template-columns: 24px 54px minmax(0, 1fr); }
  .qitem .tools { grid-column: 1 / -1; justify-content: flex-end; }
}

.note { font-size: 13px; color: var(--muted); margin-top: -4px; }
.shell { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }

.clip { min-width: 0; }
.next-pill { margin-right: 8px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; }
.chip { min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--card); font-size: 14px; cursor: pointer; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.linkbtn { padding: 4px 0; border: 0; background: none; text-align: left; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; cursor: pointer; }
.linkbtn:hover { color: var(--accent); text-decoration-color: currentColor; }
.hist-list { max-height: 55vh; overflow-y: auto; }
.hist { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.hist:last-child { border-bottom: 0; }
.hist .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.hist .meta { font-size: 13px; color: var(--muted); }

.gate form a, .done a { text-align: center; }
.done { width: 100%; max-width: 380px; display: grid; gap: 14px; }
.done h1 { font-size: 30px; line-height: 1.12; letter-spacing: -.025em; margin-top: 18px; }
.nowrap { flex-wrap: nowrap; }
td a { color: inherit; }
td a:hover { color: var(--accent); }

.btn.outline { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
.btn.outline:hover { background: var(--accent); color: var(--accent-ink); opacity: 1; }
.signup-cta { display: grid; gap: 12px; margin-top: 6px; padding-top: 22px; border-top: 1px solid var(--line); text-align: center; }
.signup-cta p { font-size: 18px; font-weight: 650; letter-spacing: -.01em; }

/* Several TikTok accounts in the sign-up form */
.accounts { display: grid; gap: 10px; }
.account-row { display: grid; grid-template-columns: 1fr 48px; gap: 8px; }
.account-remove { padding: 0; font-size: 22px; }
td .account-list { display: grid; gap: 2px; }
td .cell-stack { display: grid; gap: 2px; justify-items: start; }
.row.between { justify-content: space-between; }
.form-callout { padding: 12px 14px; border: 2px solid var(--accent); border-radius: 10px; font-size: 15px; line-height: 1.4; }
.form-callout strong { color: var(--accent); }
.form-note-red { margin: 0; color: #c81e1e; font-size: 14px; font-weight: 650; line-height: 1.4; }
.save-actions { display: grid; gap: 8px; }

/* A post, step by step: photos, text, audio */
.post-body { gap: 0; padding-top: 4px; padding-bottom: 4px; }
.post-step { display: grid; gap: 10px; padding: 16px 0; border-top: 1px solid var(--line); }
.post-step:first-child { border-top: 0; }
.post-step h3 { margin: 0; font-size: 17px; line-height: 1.25; }
.post-step .note { margin-top: 0; }
.sound-list { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.sound-ticks { display: grid; gap: 2px; }
.sound-tick { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; overflow-wrap: anywhere; cursor: pointer; }
.sound-tick input { width: 20px; height: 20px; flex: none; }
.sound-line { font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.sound-line strong { font-weight: 650; }
.sound-line a { color: inherit; }
.sound-must { margin: 0; color: #c81e1e; font-weight: 650; }
.sound-shot { display: block; width: 100%; height: auto; border-radius: 10px; }

/* Panel: photos at full size */
.zoom { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.zoom:hover img, .zoom:focus-visible img { opacity: .8; }
.thumb span { pointer-events: none; }
.photo-viewer { width: min(560px, 94vw); max-height: 94vh; padding: 12px; border: 0; border-radius: 14px; }
.photo-viewer::backdrop { background: rgb(0 0 0 / .75); }
.photo-viewer[open] { display: grid; gap: 10px; }
.photo-viewer img { display: block; width: 100%; max-height: 78vh; object-fit: contain; border-radius: 8px; background: #000; }
.photo-viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; overflow-wrap: anywhere; }
.photo-viewer-nav { display: flex; align-items: center; justify-content: center; gap: 14px; }

/* carousels: several photos that go together in one post */
.carousel-note { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: #fff4ef; border: 1px solid #f6cfc1; display: grid; gap: 6px; }
.carousel-note strong { font-size: 15px; }
.carousel-note p { margin: 0; font-size: 14px; line-height: 1.4; }
.carousel-note .small { color: var(--muted); font-size: 13px; }
.carousel-order { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0; padding: 0; list-style: none; counter-reset: none; }
.carousel-order li { font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #fff; border: 1px solid #f6cfc1; }
.carousel-order li + li::before { content: '→ '; color: var(--accent); }
.one-by-one { display: grid; gap: 6px; }
.one-by-one-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.one-by-one-buttons .btn { flex: 1 1 80px; }
