/* The look of justin.getden.io (justin-chat-ui): black, Verdana 16px, a 680px column, small grey links on top, no boxes.
   Thread lines keep Den's colour per person (den-fiction chapter-player.css .av-line): a name once per run, words ruled. */
:root {
  --bg: #000; --fg: #ddd; --muted: #8a8a8a; --dim: #777; --faint: #555; --hover: #999;
  --line: #333; --line-focus: #666; --accent: #b55;
  --font: 16px/1.55 Verdana, Geneva, sans-serif; --max: 680px; --gutter: 16px;
  --c: var(--fg);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { background: var(--bg); color: var(--fg); font: var(--font); margin: 0; -webkit-text-size-adjust: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; }
.w { width: 100%; max-width: var(--max); margin: 0 auto; padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }

/* Top links: what the page picks between on the left (the feed's tabs), you on the right. */
.top { padding-top: max(10px, env(safe-area-inset-top)); font-size: 13px; display: flex; align-items: center; gap: 14px; }
.top a, .top button { display: inline-block; padding: 6px 0; color: var(--faint); font-size: 13px; white-space: nowrap; }
.top a:hover, .top button:hover { color: var(--hover); }
.top a[aria-current="page"] { color: var(--fg); }
/* The tabs scroll sideways when there are more groups than fit; you stay on the right. */
.top .tabs { display: flex; gap: 14px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.top .tabs::-webkit-scrollbar { display: none; }
.top .right { margin-left: auto; flex: none; }
.setup { flex: none; display: block; color: var(--accent); font-size: 13px; padding-top: 2px; padding-bottom: 4px; }
.setup:hover { color: #d77; }
.logout { margin-top: 18px; }

/* Pages that scroll (profile, invite). */
.page { padding-bottom: 48px; }
.page h1 { font-size: 16px; font-weight: normal; margin: 28px 0 12px; }
.mute { color: var(--dim); }
.note { color: var(--accent); }
.step { padding: 12px 0; }
.step b { font-weight: normal; color: var(--muted); display: block; }
code { display: block; color: var(--fg); word-break: break-all; cursor: copy; padding: 2px 0; }
.link { color: #bbb; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--fg); }

/* The profile. */
.who-big { color: var(--c); font-size: 22px; line-height: 1.3; margin: 36px 0 2px; }
.handle { color: var(--faint); margin-bottom: 28px; }
.stat { color: var(--muted); margin-bottom: 28px; }
.stat b { color: var(--fg); font-weight: normal; }
.label { color: var(--faint); font-size: 13px; margin-bottom: 8px; }
.topics { margin-bottom: 32px; }
.topic { display: block; text-align: left; padding: 2px 0 2px 10px; margin-bottom: 10px; border-left: 2px solid var(--c); color: var(--fg); }
.topic:hover { color: #fff; }
.topic[data-done]::after { content: "  copied"; color: var(--dim); font-size: 13px; }

/* Sign-in: one or two underlined fields, Enter submits. */
.login form { max-width: 320px; margin: 28vh auto 0; padding: 0 var(--gutter); }
.login input, .join input { display: block; width: 100%; padding: 10px 0; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; outline: 0; font: inherit; font-size: 16px; color: var(--fg); -webkit-appearance: none; appearance: none; }
.login input:focus, .join input:focus { border-bottom-color: var(--line-focus); }
.login input::placeholder, .join input::placeholder { color: var(--faint); }
.login p { max-width: 320px; margin: 10px auto; padding: 0 var(--gutter); color: var(--dim); }
.login p.small { font-size: 11px; line-height: 1.5; color: var(--faint); margin-top: 24px; }
/* One line per field: the input, then its "go", on one underline. */
.login .field, .join .field { display: flex; align-items: baseline; border-bottom: 1px solid var(--line); }
.login .field:focus-within, .join .field:focus-within { border-bottom-color: var(--line-focus); }
.login .field input, .login .field .phone, .join .field input, .join .field .phone { border-bottom: 0; flex: 1; min-width: 0; }
.login .go, .join .go { flex: none; padding: 10px 0 10px 16px; margin: -10px 0; min-height: 44px; color: var(--muted); }
.login .go:hover, .login .field:focus-within .go, .join .go:hover, .join .field:focus-within .go { color: var(--fg); }
.login form[aria-busy] .go { color: var(--faint); }

/* The thread: the page never scrolls, only #s does; #app is sized to the visible viewport (feed.js). */
html.thread, body.thread { height: 100%; overflow: hidden; touch-action: manipulation; }
#app { position: fixed; left: 0; right: 0; top: 0; height: 100%; display: flex; flex-direction: column; }
#app .top { flex: none; }
#s { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
#log { padding-top: 4px; }
/* A day's heading opens and closes it; the latest day is always open. */
.day { display: block; color: var(--faint); font-size: 13px; margin: 22px 0 10px; text-align: left; }
.day:not([aria-disabled]):hover { color: var(--hover); }
.day:not([aria-disabled])::after { content: " ▾"; color: var(--line-focus); }
.day[aria-expanded="false"]::after { content: " ▸"; }
.day[aria-disabled] { cursor: default; }
.day .count { color: var(--dim); }
.earlier { color: var(--dim); font-size: 13px; padding: 4px 0 28px; }
.earlier button { color: var(--dim); }
.earlier button:hover { color: var(--hover); }
.by { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.name { color: var(--c); font-size: 13px; }
.by time { color: var(--faint); font-size: 12px; cursor: default; }
.by .to { color: var(--dim); font-size: 12px; min-width: 0; overflow-wrap: anywhere; }
.by .not-on { color: var(--muted); border-bottom: 1px dotted var(--faint); }
.by .invite { color: var(--accent); }
.by .invite:hover { text-decoration: underline; }
.w2 { margin: 0; padding-left: 10px; border-left: 2px solid var(--c); position: relative; }
.w2[data-clamp] { display: -webkit-box; -webkit-line-clamp: 10; -webkit-box-orient: vertical; overflow: hidden; }
.meta { padding-left: 12px; color: var(--faint); font-size: 12px; margin-top: 3px; display: flex; gap: 12px; flex-wrap: wrap; white-space: normal; }
.meta .seen { display: inline-flex; align-items: center; gap: 2px; color: var(--dim); }
.meta .seen svg { display: block; }
.meta .seen[data-open] { color: var(--hover); }
.seen-list { display: grid; gap: 2px; padding: 4px 0 2px 12px; color: var(--dim); font-size: 12px; }
.meta button:hover { color: var(--hover); }
/* Where it came from, who has seen it, edit and delete: on hover; on a phone, behind ···. */
.meta .info { display: inline-flex; gap: 12px; flex-wrap: wrap; align-items: center; flex: 1; }
/* Where it came from sits at the far right. */
.meta .src { order: 9; margin-left: auto; }
.post:not(:hover):not(:focus-within) > .meta .info, .reply-row:not(:hover):not(:focus-within) > .meta .info { visibility: hidden; }
.meta .acts { display: none; }
.touch .meta .acts { display: inline; }
.touch .meta .info { display: none; }
.touch .meta[data-acts] .info { display: inline-flex; visibility: visible; }
.file { display: block; color: var(--dim); font-size: 13px; padding-left: 12px; margin-top: 2px; }
/* A paperclip before an attached file. */
.file::before { content: ""; display: inline-block; width: 13px; height: 13px; margin-right: 5px; vertical-align: -2px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48'/%3E%3C/svg%3E") center / contain no-repeat; }
.file:hover { color: var(--hover); }
.post textarea, .reply-row textarea { display: block; width: 100%; padding: 0 0 0 10px; border: 0; border-left: 2px solid var(--c); background: none; color: var(--fg); font: inherit; outline: 0; resize: none; }

/* The status line (Deleted · Undo). */
#t { color: var(--dim); font-size: 14px; margin: 8px 0 0; }
#t:empty { margin: 0; }

/* Threads: a thought, then its replies indented under it, each ruled in its author's colour. */
.post { margin: 0 0 18px; white-space: pre-wrap; overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }
.post[data-rises], .reply-row[data-rises] { animation: rise .6s cubic-bezier(.22, 1, .36, 1) both; }
.replies { margin: 8px 0 0 24px; }
.replies:empty { display: none; }
.reply-row { margin: 0 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.reply-row .w2 { border-left-width: 1px; font-size: 15px; }
.reply-row .name { font-size: 12px; }
.more-replies { color: var(--dim); font-size: 13px; margin: 0 0 10px; padding-left: 10px; }
.more-replies::before { content: "— "; color: var(--faint); }
.more-replies:hover { color: var(--hover); }
.meta .src { color: var(--dim); }
.meta .private { color: var(--accent); }
.meta .reply { color: var(--dim); }
.empty { color: var(--dim); margin-top: 28px; }
.replying { flex: none; display: flex; gap: 8px; align-items: baseline; color: var(--dim); font-size: 13px; padding-top: 8px; }
.replying button { color: var(--muted); font-size: 16px; padding: 0 6px; }
.replying button:hover { color: var(--fg); }

/* Add to Claude / Add to ChatGPT: Claude first and filled, ChatGPT outlined; a connected app is a quiet tick. */
.connect { display: grid; gap: 10px; margin: 18px 0 28px; max-width: 360px; }
.app { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 12px; font-size: 16px; text-align: left; }
.app svg { flex: none; }
.app.claude { background: #f5f2ec; color: #111; }
.app.claude:hover { background: #fff; }
.app.chatgpt { border: 1px solid var(--line-focus); color: var(--fg); }
.app.chatgpt:hover { border-color: var(--hover); }
.app.done { color: #8de06a; padding-left: 0; }
.connect .steps { margin: 2px 0 0; color: var(--fg); }
.connect .address { margin: 4px 0 0; font-size: 13px; }
.connect .address code { display: inline; font-size: 13px; color: var(--muted); }

/* Getting started. */
.page .try { margin: 6px 0; color: var(--muted); }
.page .ok { color: #8de06a; }
.page .done { margin-top: 36px; }
.step .link { display: inline-block; margin-top: 4px; }

/* The composer. */
.composer { flex: none; display: flex; align-items: flex-end; gap: 12px; padding-top: 12px; padding-bottom: 12px; border-bottom: 1px solid #1a1a1a; }
#s { padding-bottom: env(safe-area-inset-bottom); }
.composer textarea { flex: 1; display: block; min-width: 0; height: 25px; max-height: 40vh; margin: 0; padding: 0; background: transparent; border: 0; border-radius: 0; outline: 0; resize: none; overflow-y: auto; font: inherit; font-size: 16px; line-height: 1.55; color: var(--fg); caret-color: var(--fg); -webkit-appearance: none; appearance: none; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.composer textarea::placeholder { color: var(--faint); }
.composer button { flex: none; padding: 2px 0 2px 8px; font-size: 14px; line-height: 25px; color: #888; }
.composer #go { display: none; }
.touch .composer #go.on { display: block; }
.drop #s { outline: 1px dashed var(--line-focus); outline-offset: -8px; }

@keyframes rise { from { opacity: 0; translate: 0 12px; } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .post[data-rises], .reply-row[data-rises] { animation-name: fade; } }

/* Focus you can see from the keyboard, invisible to the mouse. */
:focus-visible { outline: 1px solid var(--line-focus); outline-offset: 3px; }
input:focus-visible, textarea:focus-visible { outline: none; }
::selection { background: #333; }
.btn { color: #bbb; text-decoration: underline; text-underline-offset: 3px; }
.login p.note { color: var(--accent); }
.login p.sub { margin: 10px 0 0; padding: 0; font-size: 13px; color: var(--faint); }
.login p.sub button { color: var(--dim); font-size: 13px; }
.login p.sub button:hover { color: var(--hover); }
.login form[aria-busy] input { color: var(--dim); }

/* The phone field: the country, then the number, on one underline. */
.phone { position: relative; display: flex; align-items: baseline; border-bottom: 1px solid var(--line); }
.phone:focus-within { border-bottom-color: var(--line-focus); }
.phone input { border-bottom: 0 !important; flex: 1; min-width: 0; }
.cc { flex: none; padding: 10px 10px 10px 0; color: var(--muted); font-size: 16px; white-space: nowrap; }
.cc:hover, .cc[aria-expanded="true"] { color: var(--fg); }
.cc .flag, .cc-list .flag { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.cc-pop { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 1px); background: var(--bg); border-bottom: 1px solid var(--line); }
.login .cc-pop input.cc-q { border-bottom: 1px solid var(--line); font-size: 16px; padding: 10px 0; }
.cc-list { list-style: none; margin: 0; padding: 4px 0; max-height: min(40vh, 320px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.cc-list li { display: flex; gap: 10px; align-items: baseline; padding: 6px 4px; color: var(--muted); cursor: pointer; }
.cc-list li[aria-selected="true"] { color: var(--fg); background: #111; }
.cc-list li[data-current] .cc-name::after { content: " ·"; color: var(--accent); }
.cc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-dial { color: var(--faint); font-size: 13px; }
.cc-none { color: var(--faint); cursor: default; }
.up { margin-top: 28px; display: grid; gap: 14px; justify-items: start; }
.up input[type="file"] { color: var(--muted); font: inherit; font-size: 14px; max-width: 100%; }
.up input[type="file"]::file-selector-button { font: inherit; color: var(--fg); background: none; border: 0; padding: 0 12px 0 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.up input[name="text"] { width: 100%; padding: 10px 0; background: transparent; border: 0; border-bottom: 1px solid var(--line); outline: 0; font: inherit; color: var(--fg); border-radius: 0; }
.up input[name="text"]:focus { border-bottom-color: var(--line-focus); }
.up input::placeholder { color: var(--faint); }
form[aria-busy] .link { color: var(--dim); }
.meta time { cursor: default; }
.login p.sub span, .login p.sub button { white-space: nowrap; }

/* Fingers: the same look, with targets you can hit (about 44pt), the extra space taken from padding, not layout. */
@media (pointer: coarse) {
  .top a, .top button, .top .right button { padding-top: 12px; padding-bottom: 12px; }
  .meta { gap: 4px 6px; }
  .meta > * { padding: 8px 6px; margin: -8px 0; }
  .meta > :first-child { padding-left: 0; }
  .composer button { padding-top: 10px; padding-bottom: 10px; margin: -10px 0; }
  .composer #add { padding-right: 8px; padding-left: 4px; margin-left: -4px; }
  .topic { padding-top: 8px; padding-bottom: 8px; margin-bottom: 6px; }
  .page .link, .login p.sub button { display: inline-block; padding: 10px 0; margin: -10px 0; }
  .cc-list li { padding: 11px 4px; }
}
/* The country list spans the whole line, "go" included. */
.login .field, .join .field { position: relative; }
.login .field .phone, .join .field .phone { position: static; }

/* A thought opened from its link. */
.focus > .w2 { background: #141414; }
.handle + .connect { margin-top: -10px; }
