:root {
  --edge: 16px;  /* gap between the + button and the screen's right and bottom edges */
  --plus: 56px;  /* the + button */
  --btn: 38px;   /* like / dislike / comment / share */
  --bg: #000;
  --fg: #f2f2f2;
  --dim: #8a8a8a;
  --line: rgba(255, 255, 255, 0.14);
  --glass: rgba(20, 20, 20, 0.6);
  --red: #ff3b4e;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.top {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: max(14px, env(safe-area-inset-top)) 16px 14px;
  background: linear-gradient(rgba(0,0,0,.6), transparent);
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.logo { font-weight: 700; letter-spacing: -0.02em; font-size: 18px; }

.icon-btn {
  width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center;
  background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
/* Icons are PNG cutouts used as masks, so their color follows the button state. */
.ico {
  display: block; width: 22px; height: 22px; background: var(--fg);
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
.i-sound { --icon: url(/icons/sound-off.png); width: 24px; height: 24px; }
.sound-on .i-sound { --icon: url(/icons/sound-on.png); }
.i-groups { --icon: url(/icons/groups.svg); width: 24px; height: 24px; }
.i-chat { --icon: url(/icons/comment.png); width: 24px; height: 24px; }
.i-arrow { --icon: url(/icons/chevron.png); width: 16px; height: 16px; }
.flip-r { transform: scaleX(-1); }

.pill {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 14px; border-radius: 999px; font-size: 13px;
  background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
a.pill { color: inherit; text-decoration: none; }
.pill.danger { color: var(--red); border-color: rgba(255, 59, 78, .5); }
#postBtn { margin-left: auto; }
.pill.solid { background: var(--fg); color: #000; border-color: var(--fg); font-weight: 600; }
.pill.wide { width: 100%; padding: 14px; cursor: pointer; }

/* Feed: one slide on screen; the next ones wait below and slide up. */
.feed { position: absolute; inset: 0; overflow: hidden; touch-action: none; }

.slide {
  position: absolute; inset: 0; transform: translateY(100%); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  display: flex; justify-content: center; align-items: center; background: var(--bg); overflow: hidden;
}
.slide.current { transform: none; }
.slide.out { transform: translateY(-100%); }
/* Centered 9:16 column, black bars either side on wide screens. */
.frame {
  position: relative; height: 100%; aspect-ratio: 9 / 16; max-width: 100%;
  background: #0b0b0b; overflow: hidden;
}
.frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.frame video.tall { object-fit: cover; }
/* A video's first frame, over it until it's playing (no black flash) */
.frame .cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.frame .cover.tall { object-fit: cover; }
.frame .cover.off { display: none; }
.frame .pic { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
/* Dead feed: next in line to be deleted. */
.frame::after {
  content: ""; position: absolute; inset: 0; border: 4px solid #ff2d2d; border-radius: inherit;
  pointer-events: none; display: none; z-index: 4;
}
.slide.dead .frame::after { display: block; } /* only posts that can be deleted: more dislikes than likes, or next out */

/* Phones: the video fills the screen, so sit just under the logo instead of on it. */
@media (min-width: 700px) {
  .slide { padding: 12px 0; }
  .frame { border-radius: 14px; }
}

/* Side buttons: a tight column hugging the right edge, above the + button. */
.side {
  position: absolute; right: calc(6px + env(safe-area-inset-right));
  bottom: calc(var(--edge) + var(--plus) + 12px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 0;
}
.side .count { line-height: 1.25; }
.vote {
  width: var(--btn); height: var(--btn); border-radius: 50%; display: grid; place-items: center;
  background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform .08s ease;
}
.vote:active { transform: scale(0.9); }
.vote .ico { --icon: url(/icons/thumb.png); width: 19px; height: 19px; }
.dislike .ico { transform: scaleY(-1); } /* same sprite, flipped */
.vote.on { background: var(--fg); }
.vote.on .ico { background: #000; }
.side .dislike, .side .talk, .side .share { margin-top: 3px; }
.count { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }

.dim { color: var(--dim); }

.create {
  position: fixed; z-index: 20;
  right: calc(var(--edge) + env(safe-area-inset-right)); bottom: calc(var(--edge) + env(safe-area-inset-bottom));
  width: var(--plus); height: var(--plus); border-radius: 50%;
  background: var(--fg); color: #000; font-size: 30px; line-height: 1; font-weight: 300;
  box-shadow: 0 6px 24px rgba(0,0,0,.5);
}

.sheet-title { font-weight: 600; }

/* Make something: full-screen page */
.sheet {
  position: fixed; inset: 0; z-index: 30; background: var(--bg);
  display: grid; grid-template-columns: 100%; place-items: center; padding: 16px;
}
.sheet-head { min-height: 44px; }

/* Picture crop: the picture moves behind a fixed phone-screen frame; outside it is dimmed. */
.sheet { overflow: hidden; }
#reviewImg, .sheet.framed #review {
  position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0;
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab;
}
#reviewImg:active, .sheet.framed #review:active { cursor: grabbing; }
.sheet.framed #review { object-fit: fill; pointer-events: none; }
.sheet.framed .trim-play { pointer-events: none; } /* tapping the video plays it; dragging moves it */
.sheet.framed .stage { overflow: visible; touch-action: none; border-color: transparent; background: #000; }
.crop-frame {
  position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit;
  border: 2px solid #fff; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .72);
}
.sheet.framed .sheet-head, .sheet.framed .controls, .sheet.framed .trim, .make-tools, .zoom-row, .hint { position: relative; z-index: 3; }
.sheet:not(.framed) .pic-only, .sheet:not(.framed) .crop-frame { display: none; }
.zoom-row {
  display: flex; align-items: center; gap: 10px; width: min(100%, calc(62dvh * 9 / 16)); margin: 0 auto;
  color: var(--dim); font-size: 18px;
}
.zoom-row input { flex: 1; accent-color: #fff; }
.hint { margin: 0; text-align: center; font-size: 12px; color: var(--dim); }
.sheet:not(.picture) #reviewImg,
.sheet.picture #review, .sheet.picture .trim, .sheet.picture .trim-play { display: none; }
.sheet-inner {
  width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 12px;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.x { font-size: 28px; width: 40px; height: 40px; color: var(--dim); }

.stage {
  position: relative; aspect-ratio: 9 / 16; width: min(100%, calc(62dvh * 9 / 16));
  margin: 0 auto; border-radius: 18px; overflow: hidden; background: #0b0b0b; border: 1px solid var(--line);
}
.stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage-msg {
  position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); font-size: 14px;
  background: #0b0b0b; pointer-events: none;
}
.sheet.loading .trim, .sheet.loading .trim-play { opacity: .3; pointer-events: none; }
/* Play / pause icon in the middle of a video (feed and trim screen). */
.center-icon {
  position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px;
  display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .5);
  opacity: 0; transition: opacity .3s ease; pointer-events: none; z-index: 3;
}
.center-icon svg { grid-area: 1 / 1; width: 36px; height: 36px; fill: #fff; }
.center-icon .i-pause, .center-icon.flash .i-play { display: none; }
.center-icon.flash .i-pause { display: block; }
.center-icon.paused, .center-icon.flash { opacity: 1; }
.center-icon.flash { transition: none; }
.trim-play { pointer-events: auto; }

.controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 76px; }
.controls .pill { min-width: 84px; }

/* Trimmer */
.trim { display: flex; flex-direction: column; gap: 8px; width: min(100%, calc(62dvh * 9 / 16)); margin: 0 auto; }
.trim-track {
  position: relative; height: 44px; border-radius: 10px; background: #161616; border: 1px solid var(--line);
  touch-action: none;
}
.trim-sel {
  position: absolute; top: -1px; bottom: -1px; border: 2px solid var(--fg); border-radius: 10px;
  background: rgba(255, 255, 255, 0.12); cursor: grab;
}
.trim-sel:active { cursor: grabbing; }
/* Where the video is right now. */
.trim-head {
  position: absolute; top: -8px; bottom: -8px; width: 3px; margin-left: -1.5px; z-index: 2;
  background: #fff; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.6); pointer-events: none;
}
.trim-head::before {
  content: ""; position: absolute; top: -4px; left: 50%; width: 11px; height: 11px; margin-left: -5.5px;
  border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.6);
}
.trim-handle {
  position: absolute; top: 50%; width: 18px; height: 52px; margin: -26px 0 0 -9px;
  border-radius: 6px; background: var(--fg); cursor: ew-resize; touch-action: none; z-index: 3;
}
.trim-handle::after {
  content: ""; position: absolute; inset: 16px 7px; border-left: 2px solid #000; border-right: 2px solid #000; opacity: .35;
}
.trim-info {
  display: flex; justify-content: space-between; font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums;
}
.trim-now { color: var(--fg); font-weight: 600; }

.rules { margin: 0; text-align: center; font-size: 12px; color: var(--dim); line-height: 1.5; }

.toast {
  position: fixed; z-index: 60; /* above the comments and other popups */ left: 50%; bottom: 96px; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px;
  background: #1c1c1c; border: 1px solid var(--line); font-size: 14px; text-align: center;
}
.vote.small { width: 34px; height: 34px; }
.vote.small .ico { width: 16px; height: 16px; }
.answering { display: block; font-size: 12px; color: var(--dim); margin-bottom: 2px; overflow-wrap: anywhere; }
.thread-toggle { display: block; margin: -2px 0 6px 46px; padding: 4px 0; font-size: 12px; font-weight: 600; color: var(--dim); }
.thread-toggle::before { content: ""; display: inline-block; width: 20px; height: 1px; margin-right: 8px; vertical-align: middle; background: var(--dim); }
.cv { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 34px; }
.cv .count { font-size: 11px; }
.vote.small.talk .ico { --icon: url(/icons/comment.png); width: 18px; height: 18px; }
.x.small { width: 28px; height: 28px; font-size: 20px; }

/* Share button */
.vote.share .ico { --icon: url(/icons/share.png); width: 19px; height: 19px; }

/* Small popup in the middle (e.g. a shared post that's been deleted) */
.notice {
  position: fixed; z-index: 50; left: 50%; top: 45%; transform: translate(-50%, -50%);
  max-width: calc(100% - 48px); padding: 16px 22px; border-radius: 16px; text-align: center;
  background: #1c1c1c; border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0,0,0,.6);
  font-size: 15px; font-weight: 600; opacity: 1; transition: opacity .5s ease;
}
.notice.fade { opacity: 0; } /* same arrow, mirrored */
/* Computers get side arrows on hover; phones swipe. */
@media (hover: hover) and (pointer: fine) {
  .frame:hover .nav { display: grid; }
}
/* Between items: nothing to trim or frame */
.sheet.empty #review, .sheet.empty #reviewImg, .sheet.empty .trim, .sheet.empty .pic-only,
.sheet.empty .trim-play, .sheet.empty .crop-frame { display: none !important; }
.sheet.empty .stage { background: #0b0b0b; border-color: var(--line); }

/* The hidden player that prepares videos for upload */
video.worker { position: fixed; left: 0; top: 0; width: 2px; height: 2px; opacity: 0; pointer-events: none; }

/* A post on its way up */
.upload-bar {
  position: fixed; z-index: 45; left: 50%; top: calc(12px + env(safe-area-inset-top)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; max-width: calc(100% - 120px); padding: 8px 14px;
  border-radius: 999px; overflow: hidden; background: #1c1c1c; border: 1px solid var(--line);
  font-size: 13px; white-space: nowrap; box-shadow: 0 6px 24px rgba(0,0,0,.5);
}
.upload-bar #uploadText { overflow: hidden; text-overflow: ellipsis; }
.upload-bar button { color: var(--fg); font-weight: 600; }
.upload-bar.failed { border-color: rgba(255, 59, 78, .5); }
/* The bar fills up behind the text as your post goes up */
.upload-bar > :not(.upload-fill) { position: relative; z-index: 1; }
.upload-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: color-mix(in srgb, var(--fg) 22%, transparent); border-right: 2px solid var(--fg); transition: width .2s ease; }
.upload-bar.failed .upload-fill { display: none; }

/* --- The three screens: groups, videos, chat ------------------------------- */
.pager {
  position: fixed; inset: 0; width: 300vw; display: flex; transform: translateX(0);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1); touch-action: pan-y;
}
.screen { position: relative; flex: 0 0 100vw; height: 100dvh; overflow: hidden; background: var(--bg); }
.side-screen { display: flex; flex-direction: column; padding: max(10px, env(safe-area-inset-top)) 12px 0; }
/* These sat against the page; now they sit on the center screen and move with it. */
.center .top, .center .create { position: absolute; }
.center .top { justify-content: flex-start; gap: 8px; }
.group-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 4px rgba(0, 0, 0, .7); }
.small { font-size: 12px; }
.icon-btn { position: relative; flex: none; }
.icon-btn.small { width: 40px; height: 40px; }
/* Something new on another screen */
.dot { position: absolute; top: 2px; right: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px #000; }
.screen-head { display: flex; align-items: center; gap: 10px; min-height: 48px; padding-bottom: 10px; }
.screen-title { font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The server you're in: a long name wraps onto more lines, in smaller letters */
#groupsScreen .screen-title { flex: 1; min-width: 0; white-space: normal; overflow: visible; overflow-wrap: anywhere; line-height: 1.15; }
#groupsScreen #accountBtn { margin-left: auto; }
body.admin #groupsScreen #adminLink { margin-left: auto; }
body.admin #groupsScreen #accountBtn { margin-left: 0; }

/* A post's code */
.post-code, .post-author {
  position: absolute; z-index: 5; left: calc(10px + env(safe-area-inset-left)); bottom: calc(26px + env(safe-area-inset-bottom));
  padding: 3px 8px; border-radius: 999px; background: var(--glass); font: 12px ui-monospace, Menlo, monospace; color: var(--fg);
}
/* The poster's name sits just above the code */
.post-author { bottom: calc(56px + env(safe-area-inset-bottom)); display: flex; align-items: center; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-author .badge { vertical-align: 0; }
.side .share { margin-top: 3px; }
.frame .del, .group-row .del { background: rgba(255, 59, 78, .85); border-color: transparent; }
.vote.del .ico { --icon: url(/icons/delete.svg); }
.side .del { margin-top: 10px; }

/* Only for admins */
.admin-only { display: none !important; }
body.admin .admin-only { display: grid !important; }
body.admin a.admin-only { display: inline-flex !important; }

/* --- Groups --------------------------------------------------------------- */
.server-btns { flex: none; margin-bottom: 10px; }
.group-list { flex: 1; min-height: 0; overflow-y: auto; touch-action: pan-y; padding-bottom: env(safe-area-inset-bottom); }
.group-row { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 12px; cursor: pointer; }
.group-row:hover { background: rgba(255, 255, 255, .05); }
.group-row.on { background: rgba(255, 255, 255, .1); }
.group-icon {
  width: 40px; height: 40px; flex: none; border-radius: 10px; overflow: hidden; display: grid; place-items: center;
  background: #1c1c1c; border: 1px solid var(--line); font-weight: 700; text-transform: uppercase;
}
.group-icon img { width: 100%; height: 100%; object-fit: cover; }
.group-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.group-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-row-name { font-weight: 600; }
.group-desc:empty { display: none; }

/* --- Chat ------------------------------------------------------------------ */
.chat-title { flex: 1; min-width: 0; }
/* Pops up for a few seconds in the top corner of the feed and chat. */
.post-notes {
  position: fixed; z-index: 15; right: 10px; top: calc(max(14px, env(safe-area-inset-top)) + 58px);
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: none;
}
body.on-groups .post-notes { display: none; }
.post-note {
  pointer-events: auto; padding: 6px 10px; border-radius: 10px; font-size: 13px;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: note-in .2s ease; transition: opacity .4s ease;
}
.post-note.fade { opacity: 0; }
@keyframes note-in { from { opacity: 0; transform: translateY(-6px); } }
.code-link { padding: 0; font: 12px ui-monospace, Menlo, monospace; color: #7fb6ff; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; touch-action: pan-y; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 6px; padding: 6px 0; }
/* A few messages sit at the bottom by the message box; older ones climb up. */
.chat-list > :first-child { margin-top: auto; }
.msg { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 6px 10px; border-radius: 10px; font-size: 15px; line-height: 1.35; }
.msg { align-self: flex-start; max-width: 85%; background: rgba(255, 255, 255, .06); }
/* Your own messages are on the right. */
.msg.mine { align-self: flex-end; background: rgba(255, 255, 255, .14); }
.msg.mine .sender, .msg.mine .small { margin-left: auto; }
.msg.private { background: rgba(127, 182, 255, .12); }
.msg.system { color: var(--dim); font-size: 13px; padding: 2px 8px; background: none; }
.sender { padding: 0; font: 600 12px ui-monospace, Menlo, monospace; color: var(--dim); }
.sender.is-admin { color: var(--red); }
.msg-body { flex: 1 1 100%; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
/* Five lines on screen, however wide the phone. Tapping shows the rest of a long one. */
.msg-body.clamped:not(.open) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden; }
body.admin .msg:not(.system) { padding-right: 28px; }
.msg-del { position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; place-items: center; color: var(--red); font-size: 18px; line-height: 1; }
.msg.mine .msg-del { right: auto; left: 2px; } /* your own: your name's on the right, so the × goes left */
/* Command auto-fill, above the message box */
.cmd-list { display: flex; flex-direction: column; margin-bottom: 6px; border-radius: 12px; overflow: hidden; background: #161616; border: 1px solid var(--line); }
.cmd { display: flex; align-items: baseline; gap: 10px; padding: 8px 12px; text-align: left; width: 100%; }
.cmd.on { background: rgba(255, 255, 255, .12); }
.cmd b { font: 600 13px ui-monospace, Menlo, monospace; flex: none; }
.cmd span { min-width: 0; color: var(--dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-form { flex: none; padding: 6px 0 max(10px, env(safe-area-inset-bottom)); }
.chat-bar { display: flex; align-items: flex-end; gap: 8px; }
.chat-bar textarea {
  flex: 1; min-width: 0; resize: none; max-height: 140px; padding: 10px 14px; border-radius: 18px; outline: 0;
  background: #161616; border: 1px solid var(--line); color: var(--fg); font-size: 16px; line-height: 1.3; font-family: inherit; /* 16px stops phones zooming in */
}
.falling { position: fixed; z-index: 95; pointer-events: none; will-change: transform; white-space: pre; color: var(--fg); }
.falling-pic { object-fit: contain; }

/* --- Dialogs and the warning ------------------------------------------------ */
/* Popups fill the part of the screen you can see: with a phone's keyboard open, that's
   the part above it (--vv-top / --vv-height, kept by the page). A popup taller than
   that scrolls, so the box you're typing in can always be brought into view. */
.modal {
  position: fixed; left: 0; right: 0; top: var(--vv-top, 0px); height: var(--vv-height, 100%); z-index: 40;
  display: flex; align-items: safe center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .6);
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.modal > .modal-box { margin: auto 0; flex: none; }
.modal-box { width: min(100%, 440px); display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 16px; background: #111; border: 1px solid var(--line); }
.modal-box p { margin: 0; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.new-group-body { display: flex; gap: 10px; }
.icon-pick { width: 76px; height: 76px; flex: none; border-radius: 16px; overflow: hidden; display: grid; place-items: center; background: #1c1c1c; border: 1px dashed rgba(255, 255, 255, .3); font-size: 26px; font-weight: 700; text-transform: uppercase; }
.icon-pick img { width: 100%; height: 100%; object-fit: cover; }
.fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.fields textarea { width: 100%; resize: none; padding: 9px 12px; border-radius: 10px; outline: 0; background: #161616; border: 1px solid var(--line); color: var(--fg); font-size: 16px; font-family: inherit; }
.gate { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: #000; }
/* Nothing chosen yet in the creator */
.sheet.empty #review, .sheet.empty #reviewImg, .sheet.empty .trim, .sheet.empty .pic-only, .sheet.empty .trim-play, .sheet.empty .crop-frame { display: none !important; }
.sheet.empty .stage { background: #0b0b0b; border-color: var(--line); }
.sheet.empty .stage { cursor: pointer; }
.pill:disabled { opacity: .35; cursor: default; }

/* Accounts */
.account-form, .signup-only { display: flex; flex-direction: column; gap: 10px; }
.account-form:not(.signup) .signup-only { display: none; }
.account-tabs { display: flex; gap: 6px; }
.account-tabs button { flex: 1; padding: 8px; border: 1px solid var(--line); color: var(--dim); background: none; font: inherit; cursor: pointer; }
.account-tabs button.on { color: #000; background: var(--fg); border-color: var(--fg); }
.field { width: 100%; padding: 10px 12px; border-radius: 10px; outline: 0; background: #161616; border: 1px solid var(--line); color: var(--fg); font-size: 16px; font-family: inherit; }
.field:focus { border-color: var(--fg); }
.lost-warning { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 2px solid var(--red, #ff2d2d); color: #fff; }
.lost-warning p { margin: 0; font-size: 13px; line-height: 1.4; }
.lost-warning .gate-warn { flex: none; width: 34px; height: 34px; }
.understood { display: flex; gap: 8px; align-items: center; font-size: 13px; color: #fff; cursor: pointer; }
.understood input { width: 18px; height: 18px; accent-color: var(--fg); flex: none; }
.turnstile-box:empty { display: none; }
.account-in { display: flex; flex-direction: column; gap: 12px; }
.account-in p { margin: 0; }
#accountBtn { max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Servers: join with a code */
.join-form { flex: none; display: flex; gap: 8px; margin-bottom: 10px; }
.join-form .field { flex: 1; min-width: 0; }
.join-form .pill { flex: none; padding: 0 18px; }
.kind-help ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--text); font-size: 14px; line-height: 1.4; }
.kind-help li::marker { color: var(--fg); }
.account-tabs button:disabled { opacity: .3; cursor: not-allowed; text-decoration: line-through; }
#kindHelpTitle { white-space: normal; overflow: visible; line-height: 1.3; }
.kind-help { max-height: 62vh; overflow-y: auto; }

/* Running an authoritarian server */
body.ruler .ruler-ok { display: grid !important; }
/* Your own posts and messages: their delete buttons show for you, whoever you are */
.manage-box { max-height: calc(100dvh - 32px); }
.manage-body { overflow-y: auto; display: flex; flex-direction: column; gap: 18px; padding-right: 2px; }
.manage-body section { display: flex; flex-direction: column; gap: 8px; }
.manage-body h3 { margin: 0; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg); }
.manage-code { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.manage-code b { font: 700 22px ui-monospace, Menlo, monospace; letter-spacing: .12em; color: var(--text); }
.manage-row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.manage-row-btns .pill, .manage-item .pill { padding: 7px 10px; }
.manage-list { display: flex; flex-direction: column; gap: 6px; }
.manage-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 40%, transparent); }
.manage-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.small-field { width: auto; padding: 6px 8px; font-size: 13px; }
.pill.danger { color: var(--red); }
.pill.wide.danger { border: 1px solid var(--red); }
/* Badges: placeholders until the dictator and aristocrat art is in */
/* Badges: your pixel art, at its own size and kept sharp */
.badge { display: inline-block; width: 25px; height: 20px; margin-right: 4px; vertical-align: -5px; background: center / 25px 20px no-repeat; image-rendering: pixelated; }
.badge-dictator { background-image: url(/icons/acid/badge-dictator.png); }
.badge-aristocrat { background-image: url(/icons/acid/badge-aristocrat.png); }
.badge-aristocrat.badge-n1 { background-image: url(/icons/acid/badge-aristocrat-1.png); }
.badge-aristocrat.badge-n2 { background-image: url(/icons/acid/badge-aristocrat-2.png); }
.badge-aristocrat.badge-n3 { background-image: url(/icons/acid/badge-aristocrat-3.png); }
.badge-aristocrat.badge-n4 { background-image: url(/icons/acid/badge-aristocrat-4.png); }
.badge-aristocrat.badge-n5 { background-image: url(/icons/acid/badge-aristocrat-5.png); }
.badge-aristocrat.badge-n6 { background-image: url(/icons/acid/badge-aristocrat-6.png); }
.badge-aristocrat.badge-n7 { background-image: url(/icons/acid/badge-aristocrat-7.png); }
.badge-aristocrat.badge-n8 { background-image: url(/icons/acid/badge-aristocrat-8.png); }
.badge-aristocrat.badge-n9 { background-image: url(/icons/acid/badge-aristocrat-9.png); }
/* Room for the delete × so it doesn't sit on the name */
body.admin .msg:not(.system), body.ruler .msg:not(.system) { padding-right: 28px; }

/* Deleted trials */
.group-row.frozen { opacity: .55; }
.group-row.frozen .group-desc { color: var(--red); }
.trial-gone-title { color: var(--red) !important; }
.gone-head { display: flex; align-items: center; gap: 10px; font-size: 18px; color: var(--text); }
.gone-head .gate-warn { flex: none; width: 34px; height: 34px; }

/* Trial or paid, each with an i for how it works */
/* Sizes on the new-server form */
.size-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.size-pick button { padding: 8px 4px; border: 1px solid var(--line); color: var(--dim); background: none; font: inherit; cursor: pointer; }
.size-pick button.on { color: #000; background: var(--fg); border-color: var(--fg); }
.size-detail { display: flex; align-items: stretch; border: 1px solid var(--line); }
.size-detail span { flex: 1; padding: 8px 10px; color: var(--text); font-size: 13px; }
.size-detail .info-btn { border: 0; border-left: 1px solid var(--line); }
/* Picking a size to pay for */
/* One row per size: name and price on top, what it holds underneath */
.size-cards { display: flex; flex-direction: column; gap: 6px; }
.size-card {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 10px;
  padding: 10px 12px; border: 1px solid var(--line); background: #000; color: var(--dim);
  font: inherit; font-size: 12px; text-align: left; cursor: pointer;
}
.size-card b { color: var(--text); text-transform: uppercase; letter-spacing: .08em; font-size: 13px; }
.size-card em { font-style: normal; color: var(--text); font-weight: 700; font-size: 15px; }
.size-card em::after { content: " / month"; font-weight: 400; font-size: 11px; color: var(--dim); }
.size-card span { grid-column: 1 / -1; }
.size-card.on { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); background: color-mix(in srgb, var(--fg) 10%, #000); }
.size-card.on b, .size-card.on em { color: var(--fg); }
#sizePoints ul { gap: 6px; font-size: 12px; color: var(--dim); line-height: 1.35; padding-left: 16px; }
#sizePop { z-index: 65; }
#sizePoints { max-height: 40vh; }
.info-btn { flex: none; width: 34px; border: 1px solid var(--line); border-left: 0; color: var(--fg); background: none; font: 700 14px ui-monospace, Menlo, monospace; font-style: italic; cursor: pointer; }
.confirm-btns { display: flex; gap: 8px; }
.confirm-btns .pill { flex: 1; padding: 12px; }
.pill:disabled { opacity: .4; cursor: not-allowed; }

/* Payment bars */
.pay-bar { flex: none; display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 8px 10px; border: 1px solid var(--line); background: #000; color: var(--text); font-size: 13px; }
.pay-bar .pill { flex: none; padding: 8px 12px; }
.pay-words { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pay-text { flex: 1; min-width: 0; }
.pay-bar.on-feed { position: absolute; z-index: 9; left: 12px; right: 12px; top: calc(max(14px, env(safe-area-inset-top)) + 58px); margin: 0; }
.pay-bar.warn { border-color: var(--fg); }
.pay-bar.urgent, .pay-bar.last { border: 2px solid var(--red); }
.pay-bar.urgent .pay-text, .pay-bar.last .pay-text { color: var(--red); font-weight: 700; }
.pay-bar.last { animation: pay-pulse 1s ease-in-out infinite alternate; }
@keyframes pay-pulse { from { box-shadow: 0 0 0 0 rgba(255, 45, 45, .0); } to { box-shadow: 0 0 18px 2px rgba(255, 45, 45, .55); } }

/* The checkout popup */
#payPop { z-index: 60; }
.pay-box { width: min(100%, 480px); max-height: calc(100dvh - 32px); }
.pay-box .modal-head { justify-content: flex-end; }
/* Read out by screen readers, not shown: Stripe's line already names what you're paying for */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pay-mount { overflow-y: auto; min-height: 120px; display: flex; flex-direction: column; gap: 10px; }
.pay-loading { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 48px 0; color: var(--fg); font-size: 13px; text-transform: lowercase; }
.spinner { width: 34px; height: 34px; border: 3px solid color-mix(in srgb, var(--fg) 25%, transparent); border-top-color: var(--fg); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Yes-or-no questions */
#ask { z-index: 70; }
.ask-text { margin: 0; color: var(--text); line-height: 1.45; }
.pill.solid.danger-solid { background: var(--red); color: #000; }

/* This server today, under the servers list */
.server-stats { flex: none; margin-top: 10px; margin-bottom: env(safe-area-inset-bottom); padding: 10px 12px; border: 1px solid var(--line); background: #000; display: flex; flex-direction: column; gap: 8px; }
.stats-main { display: flex; align-items: flex-end; gap: 10px; }
.stats-left { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.stats-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--text); font-size: 13px; text-transform: uppercase; letter-spacing: .12em; }
/* Pixel art at twice its size, kept sharp. All four share one 32x40 canvas, so they line up. */
.castle-btn { flex: none; width: 64px; height: 80px; padding: 0; background: center bottom / 64px 80px no-repeat; image-rendering: pixelated; cursor: pointer; }
.castle-bottom { background-image: url(/icons/acid/castle-bottom.png); }
.castle-middle { background-image: url(/icons/acid/castle-middle.png); }
.castle-top { background-image: url(/icons/acid/castle-top.png); }
.castle-top16 { background-image: url(/icons/acid/castle-top16.png); }
.stats-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.stats-nums div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stats-nums b { font: 700 20px ui-monospace, Menlo, monospace; color: var(--fg); }
.stats-nums span { font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; text-align: center; }
.stats-pay { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--text); text-align: center; border-top: 1px solid color-mix(in srgb, var(--line) 40%, transparent); padding-top: 7px; }
.stats-pay.soon { color: var(--red); font-weight: 700; }

/* Order of succession: fixed two-hour slots, moved with arrows */
.manage-item .slot { flex: none; width: 1.2em; text-align: right; color: var(--fg); font: 700 15px ui-monospace, Menlo, monospace; }
.manage-item .move-btn { padding: 5px 6px; min-width: 26px; }
#aristocratList .manage-item { gap: 6px; }
#aristocratList .manage-item .pill:not(.move-btn) { padding: 7px 8px; }
#newGroupForm .fields { justify-content: center; }

/* A server's name on its row */
.group-row-name { display: flex; align-items: baseline; gap: 6px; }
/* A long server name wraps under itself, in smaller letters, instead of trailing off */
.group-name-text { min-width: 0; overflow-wrap: anywhere; line-height: 1.2; }

/* Freedom flags */
.flag-btn { flex: none; width: 64px; height: 64px; padding: 0; cursor: pointer; background: none; }
.flag-btn canvas { width: 64px; height: 64px; image-rendering: pixelated; display: block; }
.flag-box { width: min(100%, 360px); align-items: center; }
.flag-big { width: 312px; max-width: 100%; height: auto; image-rendering: pixelated; cursor: crosshair; touch-action: manipulation; }
.flag-palette { display: flex; gap: 8px; justify-content: center; }
.flag-swatch { width: 38px; height: 38px; border: 2px solid var(--line); background: var(--swatch); cursor: pointer; position: relative; }
.flag-swatch.on { outline: 3px solid var(--fg); outline-offset: 2px; }
.flag-paint { margin: 0; color: var(--text); font-variant-numeric: tabular-nums; display: flex; justify-content: space-between; gap: 12px; }
.flag-box .modal-head, .flag-box p { align-self: stretch; }
.pay-more.free-now { color: var(--fg); }
/* Pay or upgrade, under the countdown in the stats box */
.stats-pay-area { display: flex; flex-direction: column; align-items: stretch; gap: 6px; text-align: center; }
.stats-pay-area .pill { padding: 10px; }
.stats-pay-area .free-now { color: var(--fg); }
.stats-pay:empty { display: none; }
/* Stripe's checkout stays hidden under the loader until its frame has loaded */
/* Stripe draws in place under the loading screen, which comes off once it's ready */
.pay-mount { position: relative; }
.pay-mount:has(.pay-stripe.loading) { min-height: 420px; }
.pay-loading.over { position: absolute; inset: 0; z-index: 2; justify-content: center; background: #000; }

/* Chat header: people in chat, and messages / cap */
.chat-counts { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }

/* Framing a server icon: the post screen, with a square frame, in front of the form */
.sheet.icon-mode { z-index: 55; }
.sheet.icon-mode .stage { aspect-ratio: 1 / 1; width: min(100%, 48dvh); }
.sheet.icon-mode .zoom-row { width: min(100%, 48dvh); }
.sheet.framed:not(.picture) .hint { margin-bottom: 4px; } /* room for the trim playhead */
/* The castle's code: the same copy link as the servers list, just bigger */
#manageCode .code-link { font-size: 22px; font-weight: 700; }
/* Pay button and "leave this server" share one line */
.stats-btns { display: flex; gap: 6px; }
.stats-btns .pill { flex: 1; min-width: 0; }
#sizePoints li.key { color: var(--fg); font-weight: 700; font-size: 13px; }
/* The checkout, drawn unseen behind the size menu until "continue to payment" */
#payPop.unseen { opacity: 0; pointer-events: none; }
/* The checkout's header: what's being paid for, one thing per line */
.pay-head { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; color: var(--text); font-size: 13px; text-align: left; }

.pay-head b { color: var(--fg); font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
/* Money already paid comes off: the normal price crossed out, then what it costs */
.size-card em s { color: var(--dim); font-weight: 400; font-size: 12px; margin-right: 2px; }
.size-card.off { opacity: .4; cursor: default; }
.size-card.off em::after { content: ""; }
/* "+ new server" and "public servers" side by side */
.server-btns { display: flex; gap: 6px; }
.server-btns .pill { flex: 1; min-width: 0; }
/* The public servers page */
.public-box { max-height: min(86dvh, 720px); display: flex; flex-direction: column; gap: 10px; }
.public-list { overflow-y: auto; min-height: 120px; }
.public-list .group-row { width: 100%; text-align: left; font: inherit; color: inherit; background: none; cursor: pointer; }
.public-empty { padding: 20px 4px; text-align: center; }
/* The "are you sure" popup sits over a checkout being readied behind it */
#confirmMake { z-index: 65; }
/* "share" at the end of the selected server's row */
.group-row .row-share { flex: none; margin-left: auto; padding: 4px 10px; font-size: 11px; }
/* Long names, smaller: set from how many characters the name has */
.name-long { font-size: .85em; }
.name-longer { font-size: .72em; }
html[data-acid] #groupsScreen .screen-title.name-long, html[data-acid] #groupsScreen .screen-title.name-longer { letter-spacing: .08em; }
/* The new-server form: a small label over each choice */
.pick-label { margin: 4px 0 -4px; font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: .12em; }
.pick-label[hidden] { display: none; }
/* Sizes on the new-server form: two by two */
.size-cards.two { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.size-cards.two .size-card { padding: 8px 10px; }
.size-cards.two .size-card span { font-size: 11px; line-height: 1.3; }
.size-cards.two .size-card em { font-size: 14px; }
.size-cards.two .size-card em::after { content: "/mo"; font-size: 10px; margin-left: 1px; }
.size-card.no-month em::after { content: ""; }
/* A plain text button: "how will this server work?" */
.text-btn { align-self: center; padding: 4px; border: 0; background: none; color: var(--fg); font: inherit; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
/* Short notes: small and dim, with the ones that matter most bright and bold */
.notes ul { gap: 6px; font-size: 12px; color: var(--dim); line-height: 1.35; padding-left: 16px; }
.notes li.key { color: var(--fg); font-weight: 700; font-size: 13px; }
/* On/off switches on the new-server form: anonymous, public */
.switches { display: flex; gap: 6px; }
.switch-row { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); cursor: pointer; user-select: none; -webkit-user-select: none; }
.switch-row[hidden] { display: none; }
.switch-row span { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-row i { position: relative; flex: none; width: 40px; height: 22px; border: 1px solid var(--line); background: #000; transition: background .15s, border-color .15s; }
.switch-row i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; background: var(--dim); transition: transform .15s, background .15s; }
.switch-row input:checked + i { background: var(--fg); border-color: var(--fg); }
.switch-row input:checked + i::after { transform: translateX(18px); background: #000; }
.switch-row:has(input:checked) span { color: var(--fg); }
.switch-row input:focus-visible + i { outline: 2px solid var(--fg); outline-offset: 2px; }
/* A switch that can't be turned on (anonymous, on an authoritarian server) */
.switch-row.locked { cursor: not-allowed; opacity: .4; }
/* Typing in chat on a phone: the screens shrink to the part above the keyboard, so the
   chat bar sits right on top of it with the newest messages just above. */
body.typing .pager { top: var(--vv-top, 0px); bottom: auto; height: var(--vv-height, 100%); }
body.typing .screen { height: calc(var(--vv-height, 100dvh) - var(--nav-h)); } /* still ends at the bottom bar (on a computer, where there's no keyboard) */
/* The castle's code row: new code, hide code and the public switch, spaced evenly */
.manage-row-btns.code-btns { flex-wrap: nowrap; justify-content: space-evenly; align-items: center; gap: 6px; }
.code-btns .switch-row { flex: none; padding: 5px 8px; gap: 8px; }
.code-btns .switch-row span { font-size: 11px; }
.code-btns .switch-row i { width: 34px; height: 20px; }
.code-btns .switch-row i::after { width: 12px; height: 12px; }
.code-btns .switch-row input:checked + i::after { transform: translateX(14px); }
.code-btns[hidden] { display: none; }
/* "copied", just after a code that was tapped */
.copied-note { margin-left: 8px; font-size: 11px; font-weight: 700; color: var(--fg); text-transform: uppercase; letter-spacing: .1em; transition: opacity .4s; }
.copied-note.fade { opacity: 0; }
/* Phones: scrolling and pinching, but no double-tap zoom. Pinching can only zoom out
   (the page stops zooming in), so a zoomed page can always be pinched back. The photo
   framing screen keeps its own pinch (touch-action: none there). */
html, body { touch-action: pan-x pan-y pinch-zoom; }
/* "members" with the "banned list" button on its right */
.manage-head-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.manage-head-row .pill { padding: 5px 10px; font-size: 11px; }
/* The banned list sits over the castle */
#bansPop { z-index: 45; }
/* Time left to pay, in the size menu and checkout headers */
.pay-timer { margin-left: auto; margin-right: 8px; font-variant-numeric: tabular-nums; }
.pay-timer.soon { color: var(--red); font-weight: 700; }
#waitPop { z-index: 66; }
#waitPop .pay-loading { padding: 28px 0; text-align: center; }
/* Replies and threads */
.msg-thread { flex-basis: 100%; display: block; margin-top: 4px; padding: 3px 0 0; border: 0; border-top: 1px solid var(--line); background: none; color: var(--dim); font: inherit; font-size: 11px; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.msg-thread b { color: var(--fg); }
/* A post's replies: a phone-wide box over the chat */
.thread-layer { position: relative; overflow: hidden; height: min(86dvh, 720px); display: flex; flex-direction: column; gap: 8px; }
#threadPop { z-index: 45; }
.thread-root .msg { max-width: 100%; }
.thread-list { flex: 1; min-height: 0; }
.thread-quote { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--dim); }
.thread-quote span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-empty { text-align: center; padding: 16px 0; }
#threadInput { flex: 1; resize: none; }
/* Room for the reply arrow, so it never sits on top of the words */
.post-thread-row, .post-thread-row .msg-body { cursor: pointer; } /* tap to open the post's thread */
/* The reply layer over a post: the post fills the background (dimmed a little so the
   words read). */
.thread-layer > :not(.thread-media) { position: relative; z-index: 1; }
.thread-media { position: absolute; inset: 0; z-index: 0; background: #000; }
.thread-media video, .thread-media img { width: 100%; height: 100%; object-fit: cover; } /* fills the box: no black bars */
.thread-layer.on-post .thread-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(0, 0, 0, .25), rgba(0, 0, 0, .55)); }
.thread-layer.on-post { background: #000; }
.thread-layer.on-post .thread-root { display: none; } /* the post is right there behind */
.thread-layer.on-post .thread-list { cursor: pointer; } /* the post behind: tap to go to it */
.thread-layer.on-post .thread-list .msg { cursor: auto; }


/* Rows with no name (a comment's "x replied to post y", "New post: …"): when you can
   delete one, its × gets a line of its own above the words instead of sitting on them. */
/* The top line of every message: the name on one side; the time it was sent and the ×
   on the other. Rows with no name get the same top line, with the time and ×. */
.msg > * { order: 5; } /* the words, and anything under them, go below */
.msg > .sender { order: 1; }
.msg > .small { order: 2; }
.msg > .msg-time { order: 3; margin-left: auto; }
.msg > .msg-del { order: 4; position: static; align-self: center; width: 20px; height: 20px; margin: -2px -4px -2px 0; }
.msg-time { align-self: center; font: 11px ui-monospace, Menlo, monospace; color: var(--dim); white-space: nowrap; }
/* Yours: the name is on the right, so the × and time are on the left */
.msg.mine > .msg-del { order: 1; margin: -2px 0 -2px -4px; }
.msg.mine > .msg-time { order: 2; margin-left: 0; }
.msg.mine > .sender { order: 3; margin-left: auto; }
.msg.mine > .small { order: 4; margin-left: 0; }
.msg.nameless.mine > .msg-time { margin-right: auto; }
body.admin .msg:not(.system) { padding-right: 10px; }

/* Double tap to like: a big like where you tapped, popping in and floating off */
.frame { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.tap-like { position: absolute; z-index: 6; width: 80px; height: 80px; margin: -40px 0 0 -40px; pointer-events: none; animation: tap-like .5s ease-out forwards; }
.tap-like .ico { --icon: url(/icons/thumb.png); width: 100%; height: 100%; filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .5)); }
/* Pops in and holds; then it shatters (app.js) */
@keyframes tap-like {
  0% { transform: scale(.3) rotate(-12deg); opacity: 0; }
  35% { transform: scale(1.15) rotate(5deg); opacity: 1; }
  60%, 100% { transform: scale(1) rotate(0); opacity: 1; }
}
.shard { filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .5)); }

/* The account menu, logged in to an admin account */
.account-admin { color: var(--red); font-size: 13px; }
.account-admin a { color: inherit; text-decoration: underline; }
#accountName.is-admin { color: var(--red); }
.side .reply { margin-top: 3px; } /* the comment button, above share */

/* The "are you sure?" box for a new server: its icon, then two short lines */
.confirm-icon { flex: none; width: 44px; height: 44px; display: grid; place-items: center; overflow: hidden; font-weight: 700; font-size: 20px; }
.confirm-icon img { width: 100%; height: 100%; object-fit: cover; }
#confirmBody p, #sizePoints p { margin: 0 0 8px; line-height: 1.4; }
#confirmBody b, #sizePoints b { color: var(--fg); }

/* Public servers: full screen, a grid of cards */
.modal.public-full { padding: 0; align-items: stretch; justify-content: stretch; }
.public-full .public-box { width: 100%; max-width: none; height: 100dvh; max-height: none; border-radius: 0; border: 0; box-shadow: none; padding: max(14px, env(safe-area-inset-top)) 16px 16px; }
.public-full .public-list { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); align-content: start; gap: 12px; padding: 2px 4px 12px 0; }
.public-card {
  display: flex; flex-direction: column; gap: 10px; padding: 12px; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: rgba(0, 0, 0, .82); border: 1px solid var(--line);
}
.public-card:hover { border-color: var(--fg); }
.public-card-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.public-card-top .group-icon { flex: none; width: 44px; height: 44px; }
.public-card-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.public-card-name { overflow-wrap: anywhere; }
.public-card-desc { font-size: 13px; line-height: 1.35; color: var(--text); overflow-wrap: anywhere; }
.public-card-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding-top: 8px; border-top: 1px solid var(--line); }
.public-card-stats > span { display: flex; flex-direction: column; align-items: center; text-align: center; }
.public-card-stats b { color: var(--fg); font-size: 15px; }
.public-card-stats span span { font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: .04em; line-height: 1.2; }
.desc-row { margin-top: -4px; }
.desc-row textarea { min-height: 54px; }
.desc-row textarea { white-space: pre-wrap; overflow-x: hidden; overflow-wrap: anywhere; }

/* Replies: a small plain quote of the message answered, on top. Tap it to jump there. */
.msg > .msg-quote { order: 0; flex: 0 0 100%; display: block; min-width: 0; margin: 0 0 3px; padding: 0; background: none; border: 0; border-radius: 0; color: var(--dim); font: inherit; font-size: 11px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.msg-quote::before, .reply-bar .quote-text::before { content: "↳ "; color: var(--fg); }
.msg-quote b { color: var(--fg); font-weight: 600; }
.msg-quote:hover, .msg-quote:active { color: var(--fg); }
.msg.flash { animation: msg-flash 1.4s ease-out; }
@keyframes msg-flash { 0%, 30% { box-shadow: 0 0 0 2px var(--fg); } 100% { box-shadow: 0 0 0 2px transparent; } }
/* The reply button, by the time */
.msg > .msg-reply { order: 3; margin-left: auto; padding: 0; background: none; border: 0; font: 11px ui-monospace, Menlo, monospace; color: var(--dim); cursor: pointer; }
.msg > .msg-reply ~ .msg-time { margin-left: 6px; }
.msg.mine > .msg-reply { order: 2; margin-left: 0; }
.msg-reply:hover, .msg-reply:active { color: var(--fg); }
/* Replying: above the chat bar */
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 0 4px 6px; }
.reply-bar .quote-text { flex: 1; min-width: 0; color: var(--dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar .quote-text b { color: var(--fg); font-weight: 600; }
.reply-x { flex: none; width: 24px; height: 24px; background: none; border: 0; color: var(--dim); font-size: 18px; line-height: 1; cursor: pointer; }
/* A post named in a message: its picture; tap it to go to the post */
.msg > .msg-preview { order: 5; flex: 0 0 100%; contain: inline-size; display: block; margin: 4px 0 2px; padding: 0; background: none; border: 0; text-align: left; cursor: pointer; }
.msg.mine > .msg-preview { text-align: right; }
.preview-frame { position: relative; display: inline-block; max-width: 100%; overflow: hidden; background: #000; vertical-align: top; }
.preview-frame img { display: block; width: 120px; height: 160px; object-fit: cover; } /* fixed size: the bubble stays snug and the chat never jumps as it loads */
.preview-frame .play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 26px; text-shadow: 0 1px 6px rgba(0, 0, 0, .7); }
.msg-preview:active .preview-frame { opacity: .8; }
.msg.nameless > .msg-preview { flex-basis: 100%; }

/* The camera (making a post on the site) */
.camera { position: fixed; inset: 0; z-index: 90; background: #000; color: #fff; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.camera { display: grid; place-items: center; }
.camera[hidden] { display: none; }
.cam-frame { position: relative; overflow: hidden; background: #000;
  width: min(100vw, calc(100dvh * 9 / 16)); height: min(100dvh, calc(100vw * 16 / 9)); }
.camera video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera video.mirror { transform: scaleX(-1); }
.cam-top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; z-index: 2; }
.cam-bottom { position: absolute; left: 0; right: 0; bottom: 40px; display: flex; justify-content: space-around; align-items: center; z-index: 2; }
.cam-round { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .45); border: 0; color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }
.cam-round svg { width: 24px; height: 24px; fill: currentColor; }
.cam-round.ghost { background: none; }
.shutter { width: 80px; height: 80px; border-radius: 50%; border: 5px solid #fff; display: grid; place-items: center; cursor: pointer; touch-action: none; -webkit-touch-callout: none;
  background: conic-gradient(var(--red, #ff3b30) calc(var(--p, 0) * 1turn), transparent 0); }
.shutter i { width: 62px; height: 62px; border-radius: 50%; background: rgba(255, 255, 255, .3); transition: transform .15s, background .15s; }
.shutter:active i { transform: scale(.9); }
.shutter.rec i { transform: scale(.7); background: var(--red, #ff3b30); }
.cam-hint { position: absolute; left: 0; right: 0; bottom: 12px; margin: 0; text-align: center; font-size: 12px; opacity: .75; z-index: 2; }

/* Made with the camera: no framing tools; tapping adds the text box */
.sheet.made-here .pic-only, .sheet.made-here .crop-frame { display: none !important; }
.sheet.made-here .stage { overflow: hidden; } /* only what will be posted: the phone-shaped frame */
.cap-box {
  position: absolute; z-index: 4; transform: translate(-50%, -50%); max-width: 80%; width: max-content;
  padding: .35em .6em; border-radius: 0; background: rgba(0, 0, 0, .6); color: #fff;
  font: 600 16px/1.25 -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif; text-align: center;
  white-space: pre-wrap; overflow-wrap: break-word; outline: none; cursor: grab; touch-action: none; caret-color: #fff;
}
.cap-box:focus { cursor: text; }
.cap-box.dragging { cursor: grabbing; user-select: none; -webkit-user-select: none; }
.make-choice { display: grid; gap: 10px; }
.cap-box:empty::before { content: "\200b"; } /* keeps its height while empty */

/* Under the picture: one panel with zoom (uploads), the trim bar (videos) and a hint */
.make-tools {
  display: flex; flex-direction: column; gap: 12px; width: min(100%, calc(62dvh * 9 / 16)); margin: 0 auto;
  padding: 12px 14px 10px; background: #000; border: 1px solid var(--line);
}
.sheet.empty .make-tools { display: none; }
.make-tools .trim, .make-tools .zoom-row { width: 100%; }
.zoom-row { gap: 10px; font-size: 13px; }
.tool-label { flex: none; width: 40px; font: 600 11px ui-monospace, Menlo, monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.zoom-step {
  flex: none; width: 30px; height: 30px; display: grid; place-items: center; padding: 0;
  background: none; border: 1px solid var(--line); color: var(--fg); font-size: 18px; line-height: 1; cursor: pointer;
}
.zoom-step:active { background: var(--line); }
.zoom-row input[type="range"] { -webkit-appearance: none; appearance: none; flex: 1; height: 30px; margin: 0; background: transparent; cursor: pointer; }
.zoom-row input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--line); }
.zoom-row input[type="range"]::-moz-range-track { height: 2px; background: var(--line); }
.zoom-row input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -7px; background: var(--fg); border: 0; }
.zoom-row input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; background: var(--fg); border: 0; border-radius: 0; }
.make-tools .trim-track { height: 40px; border-radius: 0; }
.make-tools .trim-sel { border-radius: 0; }
.make-tools .trim-handle { width: 14px; height: 46px; margin: -23px 0 0 -7px; border-radius: 0; }
.make-tools .trim-handle::after { inset: 14px 5px; }
.make-tools .trim-info { font: 11px ui-monospace, Menlo, monospace; }
.make-tools .hint { font: 11px ui-monospace, Menlo, monospace; color: var(--dim); letter-spacing: .02em; }
.make-tools .hint:empty { display: none; }
/* Just the controls: no time readouts or instructions */
.make-tools .trim-info, .make-tools .hint { display: none; }

/* Making a post on a phone: the picture as big as it can be. Only the × (top right),
   the zoom / trim panel and post (bottom right) around it. */
@media (max-width: 700px) {
  .sheet.make:not(.icon-mode) { padding: 0; place-items: stretch; }
  .sheet.make:not(.icon-mode) .sheet-inner {
    max-width: none; height: 100dvh; gap: 0; position: relative;
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  }
  .sheet.make:not(.icon-mode) .sheet-head { position: absolute; top: calc(env(safe-area-inset-top) + 10px); right: 10px; z-index: 6; min-height: 0; }
  .sheet.make:not(.icon-mode) #sheetGroup, .sheet.make:not(.icon-mode) #retakeBtn { display: none; }
  .sheet.make:not(.icon-mode) #closeSheet {
    width: 40px; height: 40px; min-width: 0; padding: 0; display: grid; place-items: center;
    font-size: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .5); box-shadow: none;
  }
  .sheet.make:not(.icon-mode) #closeSheet::before { content: "×"; font-size: 28px; line-height: 1; color: #fff; }
  .sheet.make:not(.icon-mode) #closeSheet::after { display: none; }
  .sheet.make:not(.icon-mode) .make-edit { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 0; }
  .sheet.make:not(.icon-mode) .stage {
    flex: 1 1 0; min-height: 0; width: auto; max-width: 100%; max-height: calc(100vw * 16 / 9); align-self: center; /* always exactly 9:16 */
    margin: 0; border: 0; border-radius: 0;
  }
  .sheet.make:not(.icon-mode) .make-tools { width: 100%; padding: 8px 12px; gap: 8px; border-width: 1px 0 0; }
  .sheet.make:not(.icon-mode) .controls { min-height: 0; padding: 8px 12px; justify-content: flex-end; }
}

/* Made on the site: no adjusting, it just plays (or shows the photo); text is added on it */
.sheet.made-here .make-tools { display: none !important; }
.cap-box { cursor: ns-resize; }

/* The speaker on the post screen: faded while muted, full with sound (its own state, not the feed's) */
.make-sound { position: absolute; z-index: 5; left: 10px; bottom: 10px; }
.sheet .make-sound .ico { opacity: .45 !important; }
.sheet .make-sound.on .ico { opacity: 1 !important; }
.sheet .make-sound[hidden] { display: none !important; }

/* --- Pictures in the chat --- */
/* + in the chat bar, right of send: picks a picture for the next message */
.chat-plus { flex: none; align-self: center; width: 30px; height: 30px; padding: 0; display: grid; place-items: center; background: none; border: 1px solid var(--line); color: var(--fg); font: 22px/1 ui-monospace, Menlo, monospace; cursor: pointer; }
.chat-plus:active { transform: scale(.92); }
/* The picked picture, waiting above the bar, with × to take it off */
.image-bar { display: flex; align-items: flex-start; gap: 6px; padding: 0 4px 6px; }
.image-bar img { display: block; width: 56px; height: 56px; object-fit: contain; border: 1px solid var(--line); }
.image-bar-x { width: 24px; height: 24px; padding: 0; background: none; border: 0; color: var(--dim); font-size: 18px; line-height: 1; cursor: pointer; }
/* In a message: a square as wide as a post card (120), the whole picture fitted inside;
   whatever it doesn't reach stays empty. Above the words. */
.msg > .msg-image { order: 5; flex: 0 0 100%; display: block; margin: 4px 0 2px; padding: 0; background: none; border: 0; cursor: zoom-in; text-align: left; }
.msg.mine > .msg-image { text-align: right; }
.msg-image img { display: inline-block; width: 120px; height: 120px; object-fit: contain; vertical-align: top; }
/* Tapped: the picture big, over everything; tap anywhere to close */
.image-view { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: rgba(0, 0, 0, .6); cursor: pointer; touch-action: none; }
.image-view-box { width: min(86vw, 70vh, 520px); aspect-ratio: 1; padding: 10px; box-sizing: border-box; background: #000; border: 1px solid var(--line); }
.image-view-box img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; pointer-events: none; }
/* Just a picture or just a post: the box is only as wide as it (its top line wraps to fit) */
.msg.card-only { width: min-content; }
.msg.has-image > .msg-image { text-align: left; }
.msg.card-only > .msg-preview { min-width: 120px; } /* the card keeps its full width */

/* A post's comments opened from the feed: a sheet pulled up from the bottom, the top of
   the post still peeking out above it (tap there to close). Newest at the bottom, like
   the live chat. */
#threadPop.bottom-sheet { align-items: flex-end; padding: 0; background: rgba(0, 0, 0, .25); animation: sheet-dim .38s ease-out; }
#threadPop.bottom-sheet > .modal-box { margin: 0; width: 100%; max-width: none; height: 70%; border-left: 0; border-right: 0; border-bottom: 0; border-radius: 16px 16px 0 0; box-shadow: none; animation: sheet-up .38s cubic-bezier(.2, .8, .2, 1); will-change: transform; }
@keyframes sheet-dim { from { background: rgba(0, 0, 0, 0); } }
/* A comment being selected fades into its white outline instead of snapping */
.thread-list .msg, .thread-list .msg .msg-body, .thread-list .msg .sender { transition: border-color .35s ease, color .35s ease; }
#threadPop.bottom-sheet .thread-root { display: none; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
/* The sheet: centered under the post (its width is set to the video's) */
#threadPop.bottom-sheet { justify-content: center; }
#threadPop.bottom-sheet > .modal-box { max-width: 100%; }
.code-title { cursor: pointer; text-transform: none; }
#threadPop.bottom-sheet > .modal-box { border-left-width: 1px; border-right-width: 1px; }

/* An empty server's feed */
.feed-empty { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
/* Same box as the little popups ("code copied") */
.feed-empty-box { max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px; background: #1c1c1c; border: 1px solid var(--line); font-size: 14px; text-align: center; }
.feed-empty[hidden] { display: none; }

/* A reply's quote: its own small grey message just above the reply, joined to it by a
   sharp-cornered line on the outer side (like iOS, but square). */
.msg.quote-row { display: block; max-width: 70%; padding: 4px 8px; background: rgba(255, 255, 255, .05); border: 1px solid #444; font-size: 12px; margin: 0 0 0 16px; }
.msg.mine.quote-row { margin: 0 16px 0 0; }
.msg.quote-row > .msg-quote { display: block; width: 100%; padding: 0; background: none; border: 0; color: #9a9a9a; font: inherit; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.msg.quote-row > .msg-quote::before { content: none; }
.msg.quote-row > .msg-quote b { color: #c8c8c8; font-weight: 600; margin-right: 4px; }
.msg.is-quoted { margin-left: 16px; }
.msg.mine.is-quoted { margin-left: 0; margin-right: 16px; }
/* The line: from the quote's middle, out to the side, down, and into the reply's top line. */
.msg.quote-row::after, .msg.is-quoted::before { content: ""; position: absolute; width: 9px; border: 0 solid #777; pointer-events: none; }
.msg.quote-row::after { top: 50%; bottom: -7px; left: -11px; border-top-width: 2px; border-left-width: 2px; }
.msg.is-quoted::before { top: -1px; height: 14px; left: -11px; border-left-width: 2px; border-bottom-width: 2px; }
.msg.mine.quote-row::after { left: auto; right: -11px; border-left-width: 0; border-right-width: 2px; }
.msg.mine.is-quoted::before { left: auto; right: -11px; border-left-width: 0; border-right-width: 2px; }

/* "(you can upgrade at any time)" next to SIZE: same small grey, but in plain lowercase */
.pick-label .pick-note { margin-left: 4px; text-transform: none; letter-spacing: 0; }

/* Pinching a post: the picture grows over everything in the post, and the buttons,
   code and name fade out until you let go. */
.frame > video, .frame > .cover, .frame > .pic { will-change: auto; }
.slide.zooming .frame > video, .slide.zooming .frame > .cover, .slide.zooming .frame > .pic { z-index: 5; }
.slide .frame > :is(.side, .post-code, .post-author, .sound-btn, .center-icon) { transition: opacity .15s; }
.slide.zooming .frame > :is(.side, .post-code, .post-author, .sound-btn, .center-icon) { opacity: 0; pointer-events: none; }

/* The bottom bar: servers / posts / chat. The screens end where it starts. */
:root { --nav-h: calc(52px + env(safe-area-inset-bottom)); }
.screen { height: calc(100dvh - var(--nav-h)); }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 12; height: var(--nav-h);
  display: flex; padding-bottom: env(safe-area-inset-bottom); background: #000; border-top: 1px solid var(--line);
}
.bottom-nav button { flex: 1; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--dim); }
.bottom-nav button.on { color: var(--fg); }
/* The old arrows: the bar does their job now */
#toGroups, #toChat, #toFeedL, #toFeedR { display: none !important; }

/* The comments slide up behind the bottom bar: the sheet ends where the bar starts
   (with a phone's keyboard up, the bar is under the keyboard, so it goes all the way). */
#threadPop.bottom-sheet { height: calc(var(--vv-height, 100%) - var(--nav-h)); }
body.kb-open #threadPop.bottom-sheet { height: var(--vv-height, 100%); }
/* The feedback button: everyone but admins (admins have the admin button there) */
body.admin .not-admin { display: none !important; }
#groupsScreen #feedbackBtn { margin-left: auto; }

/* A phone's keyboard is up: it goes over the bottom bar (hidden until the keyboard goes
   away), so the box you're typing in sits right on top of the keyboard. */
body.kb-open { --nav-h: 0px; }
body.kb-open .bottom-nav { display: none; }
