/*
 * Palette matches the board's Midnight theme so the docked window does not
 * clash with the page it floats over. Everything is driven from the block
 * below, so a restyle is a change to the tokens rather than a sweep of the
 * file.
 *
 * A NOTE ON FLEX SIZING, because it has bitten this file once already:
 * every element in the chain from <body> down to a scrolling list carries
 * min-height:0 AND min-width:0. A flex item defaults to min-*:auto on the
 * container's main axis, meaning it refuses to shrink below its own content --
 * so a single missing min-height anywhere in the chain makes the list grow to
 * fit every message and stop being a scroll container at all. #main switches
 * axis at the breakpoint, so both axes have to be covered.
 */

:root {
  --bg: #15171c;
  --panel: #1e2128;
  --panel-2: #252932;
  --panel-3: #2b303b;
  --border: #2c313c;
  --text: #c8ccd4;
  --muted: #8b93a1;
  --accent: #7aa2f7;
  --accent-soft: rgba(122, 162, 247, 0.16);
  --name: #7dcfa0;
  --danger: #f7768e;
  --badge: #e0546a;
  --radius: 6px;
  --radius-lg: 10px;

  /* A little overshoot on things that appear; none on things that move away. */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-back: cubic-bezier(0.34, 1.42, 0.64, 1);
  --fast: 0.14s;
  --normal: 0.24s;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Helvetica, Arial,
    sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid #3a4152;
  border-radius: var(--radius);
  padding: 5px 12px;
  cursor: pointer;
  font: inherit;
  transition: background var(--fast) var(--ease), border-color var(--fast)
    var(--ease), transform var(--fast) var(--ease), color var(--fast) var(--ease);
}

button:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--panel-3);
}

/* Press is faster than release: a button that gives instantly and returns
   softly feels responsive, the reverse feels laggy. */
button:active:not(:disabled) {
  transform: scale(0.95);
  transition-duration: 0.04s;
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #dbe6ff;
}

input,
textarea {
  background: #1a1d23;
  color: var(--text);
  border: 1px solid #333a47;
  border-radius: var(--radius);
  padding: 6px 9px;
  font: inherit;
  min-width: 0;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast)
    var(--ease);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.error {
  color: var(--danger);
  margin: 4px 10px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  margin: 14px 12px;
  text-align: center;
  line-height: 1.6;
}

.iconButton {
  background: none;
  border: 0;
  padding: 2px 6px;
  line-height: 1;
  color: var(--muted);
  border-radius: var(--radius);
}

.iconButton:hover:not(:disabled) {
  background: var(--panel-3);
  color: var(--text);
  border-color: transparent;
}

#soundToggle svg {
  display: block;
}

.soundSlash {
  display: none;
}

#soundToggle.muted {
  opacity: 0.6;
}

#soundToggle.muted .soundSlash {
  display: inline;
}

/* Scrollbars, so the two scrolling lists do not each carry a bright default
   bar across a dark panel. */
#inboxList, #threadList {
  scrollbar-width: thin;
  scrollbar-color: var(--panel-3) transparent;
}

#inboxList::-webkit-scrollbar, #threadList::-webkit-scrollbar {
  width: 8px;
}

#inboxList::-webkit-scrollbar-thumb, #threadList::-webkit-scrollbar-thumb {
  background: var(--panel-3);
  border-radius: 4px;
}

/* Auth bar */
#authBar {
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

#authForm {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

#authNote {
  color: var(--muted);
  font-size: 12px;
}

/* Layout */
#main {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  position: relative;
  overflow: hidden;
}

#inbox {
  width: 260px;
  flex: 0 0 260px;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--border);
}

#threadPane {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Inbox */
#findForm {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

#findInput {
  flex: 1;
}

#inboxList {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.inboxRow {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: background var(--fast) var(--ease), transform var(--fast)
    var(--ease);
}

.inboxRow:hover {
  background: var(--panel-2);
  transform: translateX(2px);
}

.inboxRow[aria-current="true"] {
  background: var(--panel-2);
}

/* Grown from zero rather than shown, so the current row reads as selected
   without the whole row shifting when selection moves. */
.inboxRow::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform var(--normal) var(--ease-back);
}

.inboxRow[aria-current="true"]::before {
  transform: scaleY(1);
}

.publicRow .rowName::before {
  content: "# ";
  color: var(--muted);
}

.rowTop {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.rowName {
  color: var(--name);
  font-weight: bold;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rowTime {
  color: var(--muted);
  font-size: 11px;
  flex: 0 0 auto;
}

.rowBadge {
  display: none;
  min-width: 17px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--badge);
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  line-height: 17px;
  text-align: center;
  flex: 0 0 auto;
}

.rowBadge.on {
  display: block;
}

.rowPreview {
  color: var(--muted);
  font-size: 12px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* >greentext, same colour as the boards' .greenText */
.msgBody .greenText {
  color: #789922;
}

/* DM "name is typing" -- sits between the list and the composer. The dots
   cycle . -> .. -> ... by revealing the 2nd and 3rd in turn. */
#typingLine {
  flex: 0 0 auto;
  padding: 2px 12px 4px;
  font-size: 12px;
  color: var(--muted);
}

#typingLine b {
  color: var(--name);
}

.typingDots i {
  font-style: normal;
  font-weight: bold;
}

.typingDots i:nth-child(2) {
  animation: typingDot2 1.2s steps(1) infinite;
}

.typingDots i:nth-child(3) {
  animation: typingDot3 1.2s steps(1) infinite;
}

@keyframes typingDot2 {
  0% { opacity: 0; }
  33% { opacity: 1; }
}

@keyframes typingDot3 {
  0% { opacity: 0; }
  66% { opacity: 1; }
}

#updateBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-top: 1px solid var(--border);
  background: rgba(158, 206, 106, 0.12);
  color: #9ece6a;
  font-size: 12px;
  font-weight: 600;
  flex: 0 0 auto;
}

#updateBar[hidden] {
  display: none;
}

#updateVersions {
  font-weight: 400;
  opacity: 0.85;
  margin-left: 4px;
}

#siteVersion {
  color: var(--muted, #6b7280);
  font-size: 11px;
  opacity: 0.8;
}

#updateButton {
  padding: 3px 10px;
  font-size: 12px;
}

#accountBar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex: 0 0 auto;
  font-size: 12px;
}

#userLabel {
  color: var(--name);
  font-weight: bold;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#logoutButton {
  padding: 3px 8px;
  font-size: 12px;
}

#connDot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  flex: 0 0 auto;
  transition: background var(--normal) var(--ease);
}

#connDot.on {
  background: var(--name);
}

/* Only the bad state moves. A dot pulsing while everything is fine is just a
   thing blinking at you. */
#connDot:not(.on) {
  animation: connPulse 1.4s ease-in-out infinite;
}

/* Thread */
#threadHead {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex: 0 0 auto;
}

#threadTitle {
  font-weight: bold;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#threadNote {
  color: var(--muted);
  font-size: 11px;
  flex: 0 0 auto;
}

#backButton {
  display: none;
  font-size: 20px;
  padding: 0 6px;
}

#threadList {
  list-style: none;
  margin: 0;
  padding: 10px 12px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;

  /* Chrome's scroll anchoring adjusts scrollTop when content is inserted, which
     fights the pin-to-bottom logic in app.js. */
  overflow-anchor: none;
}

/*
 * Sits a short conversation on the FLOOR of the pane rather than hanging it
 * from the ceiling with a screen of nothing underneath.
 *
 * This is a spacer flex item rather than justify-content:flex-end on the list,
 * because that combination famously clips the top of the content once it
 * overflows and becomes scrollable -- there would be no way to scroll back to
 * the first message. An auto margin instead collapses to zero the moment the
 * content is taller than the box, so the overflowing case is untouched.
 */
#threadList::before {
  content: "";
  margin-top: auto;
}

.msg {
  padding: 2px 0;
  overflow-wrap: anywhere;
  max-width: 86%;
  flex: 0 0 auto;
}

.msg.grouped {
  padding-top: 0;
}

.msgHead {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 6px;
}

.msgName {
  color: var(--name);
  font-weight: bold;
}

/* Only names that can be messaged advertise it. */
.msgName[data-user] {
  cursor: pointer;
  border-radius: 3px;
  transition: color var(--fast) var(--ease);
}

.msgName[data-user]:hover {
  color: var(--accent);
  text-decoration: underline;
}

.msgTime {
  color: var(--muted);
  font-size: 11px;
}

.msgBody {
  white-space: pre-wrap;
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 5px 9px;
  margin-top: 2px;
  width: fit-content;
  max-width: 100%;
}

/* Your own messages hug the other edge and take the accent. Two cues rather
   than one, because colour alone disappears at a glance in a narrow window. */
.msg.mine {
  align-self: flex-end;
}

.msg.mine .msgHead {
  flex-direction: row-reverse;
}

.msg.mine .msgName {
  color: var(--accent);
}

.msg.mine .msgBody {
  background: var(--accent-soft);
  margin-left: auto;
}

/* Attached image, shown as a thumbnail; a click opens the full-screen viewer
   (app.openImageViewer). object-fit:contain keeps the aspect ratio inside the cap. */
.msgImageLink {
  display: inline-block;
  margin-top: 3px;
  max-width: 100%;
  width: fit-content;
  line-height: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.msgImage {
  display: block;
  max-width: min(100%, 220px);
  max-height: 160px;
  object-fit: contain;
  background: var(--panel);
  cursor: zoom-in;
  transition: opacity var(--fast) var(--ease);
}

.msgImageLink:hover .msgImage {
  opacity: 0.92;
}

.msg.mine .msgImageLink {
  margin-left: auto;
}

/* Attached .md file (DMs only): an icon, the filename, size and the first line
   of text. A click opens the reading viewer (app.openMarkdownViewer). */
.msgFile {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 3px;
  width: min(100%, 300px);
  padding: 9px 12px 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--fast) var(--ease),
    background var(--fast) var(--ease);
}

.msgFile:hover {
  border-color: var(--accent);
  background: var(--panel-3);
}

.msg.mine .msgFile {
  margin-left: auto;
}

.msgFileIcon {
  flex: 0 0 auto;
  display: flex;
  color: var(--accent);
}

.msgFileInfo {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}

.msgFileName {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msgFileMeta {
  color: var(--muted);
  font-size: 12px;
}

.msgFilePreview {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msgFilePreview:empty {
  display: none;
}

/* Composer */
#composer {
  display: flex;
  /* Buttons stay on the bottom line while the box grows up above them. */
  align-items: flex-end;
  gap: 8px;
  padding: 9px 10px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  flex: 0 0 auto;
}

/* Starts one line tall; app.autosizeComposer sets the height to fit the text,
   one line at a time, up to max-height, after which it scrolls. */
#composerInput {
  flex: 1;
  display: block;
  resize: none;
  line-height: 1.4;
  max-height: calc(8 * 1.4em + 14px);
  overflow-y: hidden;
}

#composerSend {
  padding: 5px 14px;
  font-size: 15px;
  line-height: 1.4;
}

#composerSend::after {
  content: "\27A4";
}

/* Attach button: same quiet icon-button treatment as the sound toggle, sitting
   at the start of the composer row. */
#composerAttach {
  flex: 0 0 auto;
  align-self: stretch;
  padding: 0 8px;
}

/* Pending-attachment tray: the thumbnail + status shown above the composer
   between staging an image and sending it. */
#attachTray {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  flex: 0 0 auto;
}

#attachTray[hidden] {
  display: none;
}

#attachThumbWrap {
  position: relative;
  flex: 0 0 auto;
  line-height: 0;
}

#attachThumb {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel-2);
}

#attachThumb[hidden] {
  display: none;
}

/* Stands in for the thumbnail when the staged attachment is an .md file. */
#attachFileIcon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--accent);
}

#attachFileIcon[hidden] {
  display: none;
}

/* The remove control overlaps the top-right corner of the thumbnail. */
#attachRemove {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 20px;
  height: 20px;
  padding: 0;
  font-size: 14px;
  line-height: 18px;
  border-radius: 50%;
  background: var(--panel-3);
  border: 1px solid var(--border);
  color: var(--text);
}

#attachRemove:hover {
  background: var(--danger);
  color: #11151f;
}

#attachStatus {
  color: var(--muted);
  font-size: 12px;
}

/* Drop target overlay: covers the thread pane while a file is dragged over it.
   pointer-events:none so the drop still reaches the pane's own handler. */
#dropOverlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(21, 23, 28, 0.82);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-lg);
}

#dropOverlay[hidden] {
  display: none;
}

#dropOverlay span {
  color: var(--accent);
  font-weight: bold;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

/* Jump-to-newest pill: the counterpart to not yanking a scrolled-up reader
   down. It sits over the list, above the composer. */
#jumpLatest {
  position: absolute;
  left: 50%;
  bottom: 62px;
  transform: translateX(-50%);
  z-index: 3;
  background: var(--accent);
  color: #11151f;
  border: 0;
  border-radius: 14px;
  font-size: 12px;
  font-weight: bold;
  padding: 4px 12px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45);
  animation: pillIn var(--normal) var(--ease-back);
}

#jumpLatest[hidden] {
  display: none;
}

#threadPane {
  position: relative;
}

/* Narrow: one pane at a time.
   The panes are moved, never display:none'd -- a hidden element measures zero,
   which would clamp the thread's scroll position to the top every time the
   inbox was visited. Off-screen but laid out, it keeps its scroll offset. */
@media (max-width: 619px) {
  #inbox, #threadPane {
    position: absolute;
    inset: 0;
    width: 100%;
    flex: 1 1 auto;
    border-right: 0;
    transition: transform var(--normal) var(--ease), opacity var(--normal)
      var(--ease), visibility 0s linear var(--normal);
  }
  #backButton {
    display: block;
  }
  body.viewInbox #inbox, body.viewThread #threadPane {
    transform: none;
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
  }
  body.viewInbox #threadPane {
    transform: translateX(12%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
  /* The outgoing list slides a shorter distance than the incoming pane, which
     is what makes it read as one layer sliding over another rather than two
     things swapping places. */
  body.viewThread #inbox {
    transform: translateX(-8%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

/*
 * Docked inside the board's messages window.
 *
 * The dock draws its own title bar and the window is small, so every row of
 * chrome here is a row of messages not shown.
 */
body.embedded #authBar {
  padding: 6px 8px;
}

body.embedded #authNote {
  display: none;
}

body.embedded #threadHead {
  padding: 5px 8px;
}

/* Juice */
@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.msg.entering {
  animation: msgIn 0.28s var(--ease-back) both;
}

@keyframes badgePop {
  0% {
    transform: scale(0.4);
  }
  60% {
    transform: scale(1.25);
  }
  100% {
    transform: scale(1);
  }
}

.rowBadge.pop {
  animation: badgePop 0.34s var(--ease-back);
}

@keyframes sendPop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(0.9) rotate(-6deg);
  }
  100% {
    transform: scale(1);
  }
}

#composerSend.pop {
  animation: sendPop 0.3s var(--ease-back);
}

/* A sweep rather than a flat highlight, so several rows lighting up in
   sequence stay tellable apart. */
@keyframes rowFlash {
  0% {
    background: var(--accent-soft);
  }
  100% {
    background: transparent;
  }
}

.inboxRow.flash {
  animation: rowFlash 1.1s var(--ease);
}

@keyframes pillIn {
  from {
    opacity: 0;
    transform: translate(-50%, 10px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes connPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* --- standing unread glow ------------------------------------------------ */

/*
 * rowFlash is a one-shot sweep saying "this just arrived". This is the standing
 * "you still have not read this" state, so it runs until app.applyGlow takes
 * the class off rather than until the animation ends.
 *
 * box-shadow and a translucent wash are animated rather than `background`
 * outright, so the pulse layers over the hover and aria-current backgrounds
 * instead of fighting them for the same property.
 */
@keyframes unreadGlow {
  0%, 100% {
    box-shadow: inset 3px 0 0 var(--badge), 0 0 0 0 rgba(224, 84, 106, 0);
  }
  50% {
    box-shadow: inset 3px 0 0 var(--badge), 0 0 14px 1px rgba(224, 84, 106, 0.4);
  }
}

@keyframes unreadWash {
  0%, 100% {
    background-color: rgba(224, 84, 106, 0.05);
  }
  50% {
    background-color: rgba(224, 84, 106, 0.14);
  }
}

.inboxRow.unreadGlow {
  animation: unreadGlow 1.9s var(--ease) infinite, unreadWash 1.9s var(--ease)
    infinite;
}

.inboxRow.unreadGlow .rowName {
  color: #fff;
  text-shadow: 0 0 9px rgba(224, 84, 106, 0.6);
}

/* The count itself breathes with the row it belongs to. */
@keyframes badgeBreathe {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(224, 84, 106, 0);
  }
  50% {
    transform: scale(1.12);
    box-shadow: 0 0 10px 2px rgba(224, 84, 106, 0.55);
  }
}

.inboxRow.unreadGlow .rowBadge.on {
  animation: badgeBreathe 1.9s var(--ease) infinite;
}

/* --- close a conversation ------------------------------------------------ */

/*
 * Parked in the corner and only fully opaque on hover/focus, so a wall of X's
 * does not compete with the names for attention. It stays reachable by keyboard
 * at all times -- opacity, not display, is what changes.
 */
/*
 * The X lives in a gutter reserved on the row, not in the top-right corner:
 * the corner already belongs to the timestamp and the unread count, and an X
 * placed there sat directly on top of the time (measured overlap, not a
 * guess). Reserving the space permanently also means nothing shifts when the
 * button fades in on hover.
 */
.inboxRow.closable {
  padding-right: 28px;
}

.rowClose {
  position: absolute;
  top: 50%;
  right: 5px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 18px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-50%) scale(0.7);
  transition: opacity var(--fast) var(--ease), transform var(--fast)
    var(--ease-back), background var(--fast) var(--ease), color var(--fast)
    var(--ease);
}

.inboxRow:hover .rowClose,
.inboxRow:focus-within .rowClose,
.rowClose:focus-visible {
  opacity: 0.75;
  transform: translateY(-50%) scale(1);
}

.rowClose:hover,
.rowClose:focus-visible {
  opacity: 1;
  background: var(--danger);
  color: #fff;
  transform: translateY(-50%) scale(1.15) rotate(90deg);
}

.rowClose:active {
  transform: translateY(-50%) scale(0.85) rotate(90deg);
}

/* --- extra juice --------------------------------------------------------- */

/* Rows take a press, so a tap feels like it landed even before the pane swaps. */
.inboxRow:active {
  transform: translateX(2px) scale(0.985);
}

/* The message box lights up when it has the caret -- the same box whose click
   acknowledges the glow, so the two cues share a colour. */
#composerInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft), 0 0 12px rgba(122, 162, 247, 0.25);
}

#composerSend:not(:disabled):hover {
  transform: scale(1.08);
}

#composerSend:not(:disabled):active {
  transform: scale(0.92);
}

#composerSend {
  transition: transform var(--fast) var(--ease-back), background var(--fast)
    var(--ease);
}

/* A message lifts slightly under the pointer, which also makes it obvious
   which bubble a hover-revealed control belongs to. */
.msg {
  transition: transform var(--fast) var(--ease), background var(--fast)
    var(--ease);
}

.msg:hover {
  transform: translateX(2px);
}

/* Names are clickable (they open a DM), so they should say so. */
.msgName {
  transition: color var(--fast) var(--ease), text-shadow var(--fast) var(--ease);
}

.msgName:hover {
  color: #fff;
  text-shadow: 0 0 8px rgba(125, 207, 160, 0.6);
}

/* --- compact mode (mounted in the side column) ---------------------------- */

/*
 * Turned on by the dock when this frame is mounted in the right-hand rail,
 * where it only gets half the height and shares the width with the quick
 * reply. Everything here buys vertical room: padding, line-height and font
 * size come down, and the chrome that is merely nice to have shrinks first so
 * the messages themselves keep as much space as possible.
 */
body.compact {
  font-size: 12px;
}

body.compact #findForm {
  padding: 4px;
}

body.compact #findInput {
  padding: 4px 6px;
}

body.compact .inboxRow {
  padding: 4px 8px;
}

body.compact .inboxRow.closable {
  padding-right: 24px;
}

body.compact .rowPreview {
  font-size: 11px;
}

body.compact #threadHead {
  padding: 3px 6px;
}

body.compact #threadList {
  padding: 4px 6px;
}

body.compact .msg {
  margin-bottom: 3px;
}

body.compact .msgBody {
  padding: 3px 7px;
  line-height: 1.32;
}

body.compact .msgHead {
  margin-bottom: 1px;
}

body.compact .msgTime {
  font-size: 10px;
}

body.compact #composer {
  padding: 4px;
  gap: 4px;
}

body.compact #composerInput {
  padding: 5px 7px;
}

body.compact #accountBar {
  padding: 3px 6px;
  font-size: 11px;
}

/* The rail is short; a full-size button here costs a message. */
body.compact #composerSend {
  width: 28px;
  height: 28px;
}

/*
 * One switch for all of it. Everything above is decoration over a layout that
 * works statically, so this turns the decoration off rather than substituting
 * anything for it.
 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .inboxRow:hover {
    transform: none;
  }

  /*
   * The pulse is decoration, but "you have not read this" is information, so it
   * gets a flat, static form here rather than being turned off with the rest.
   */
  .inboxRow.unreadGlow {
    background-color: rgba(224, 84, 106, 0.12) !important;
    box-shadow: inset 3px 0 0 var(--badge) !important;
  }

  .inboxRow:active,
  .msg:hover,
  .rowClose:hover {
    transform: none;
  }

  /* Never hover-to-reveal without motion to explain it: always visible. */
  .rowClose {
    opacity: 0.75;
    transform: translateY(-50%);
  }
}

/* test update 2026-10-07T17:02:37+11:00 */

/* test update 2026-10-07T17:13:34+11:00 */

/* ---- Encrypted DMs (2026-11-03) ---------------------------------------- */

#threadMenuButton {
  font-size: 18px;
  padding: 0 8px;
  flex: 0 0 auto;
}

#threadMenu {
  position: absolute;
  top: 40px;
  right: 8px;
  z-index: 6;
  width: min(330px, calc(100% - 16px));
  max-height: calc(100% - 56px);
  overflow-y: auto;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 12px 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  font-size: 13px;
}

#threadMenu[hidden] {
  display: none;
}

.menuNote {
  margin: 0 0 10px;
  color: var(--name);
  line-height: 1.45;
}

.menuLabel {
  font-weight: bold;
  margin: 6px 0 6px;
}

.menuHint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 6px 0 10px;
}

.ttlChoices {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.ttlChoice {
  padding: 3px 9px;
  font-size: 12px;
}

.ttlChoice.on,
.menuButton.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #dbe6ff;
}

.menuButton {
  display: block;
  width: 100%;
  text-align: left;
  margin-top: 8px;
}

button.danger {
  border-color: rgba(247, 118, 142, 0.55);
  color: var(--danger);
}

button.danger:hover:not(:disabled),
button.danger.armed {
  background: rgba(247, 118, 142, 0.16);
}

.safetyBox {
  margin-top: 8px;
}

.safetyNumber {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  letter-spacing: 0.04em;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  text-align: center;
}

.confirmBox {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(247, 118, 142, 0.45);
  border-radius: var(--radius);
  background: rgba(247, 118, 142, 0.07);
}

.confirmBox p {
  margin: 0 0 8px;
  line-height: 1.45;
}

.confirmRow {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

/* System lines: "X cleared the chat", timer changes, new-device warnings. */
.msg.system {
  align-self: center;
  max-width: 92%;
  margin: 8px 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.msg.system.warn {
  border-radius: var(--radius-lg);
  color: #e0af68;
  border: 1px solid rgba(224, 175, 104, 0.4);
}

.msgExpiry,
.msgStatus {
  color: var(--muted);
  font-size: 10.5px;
  margin-top: 2px;
}

.msg.mine .msgExpiry,
.msg.mine .msgStatus {
  text-align: right;
}

.msg.held .msgBody {
  opacity: 0.6;
  border: 1px dashed var(--border);
}

.msgFailed {
  color: var(--muted);
  font-style: italic;
}

.msgImage.decrypting {
  min-width: 120px;
  min-height: 80px;
  background: var(--panel);
  border-radius: var(--radius);
}

/* Delete for both: out of the way until the message is hovered (or tapped,
   which focuses it on touch screens). */
.msgDelete {
  display: block;
  margin-top: 2px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 10.5px;
  opacity: 0;
  transition: opacity var(--fast) var(--ease), color var(--fast) var(--ease);
}

.msg.mine .msgDelete {
  margin-left: auto;
}

.msg:hover .msgDelete,
.msg:focus-within .msgDelete,
.msgDelete.armed {
  opacity: 1;
}

.msgDelete:hover:not(:disabled),
.msgDelete.armed {
  color: var(--danger);
  background: none;
}

@media (hover: none) {
  .msgDelete {
    opacity: 0.55;
  }
}

#devicesButton {
  padding: 3px 8px;
  font-size: 12px;
}

#devicesPanel {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 11, 14, 0.7);
  padding: 12px;
}

#devicesPanel[hidden] {
  display: none;
}

#devicesCard {
  width: min(440px, 100%);
  max-height: 100%;
  overflow-y: auto;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
}

#devicesHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#devicesClose {
  font-size: 20px;
}

#devicesList {
  list-style: none;
  margin: 0;
  padding: 0;
}

.deviceRow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.deviceInfo {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.deviceMeta {
  color: var(--muted);
  font-size: 11.5px;
}

.deviceThis {
  color: var(--name);
  font-size: 11.5px;
}

#devicesButton,
#logoutButton {
  white-space: nowrap;
  flex: 0 0 auto;
}
