:root {
  --bg-paper: #f8f3e9;
  --bg-warm: #efe4cf;
  --bg-overlay: rgb(255 255 255 / 0.32);
  --bg-grid: rgb(0 0 0 / 0.015);
  --bg-accent-a: rgb(177 59 45 / 0.12);
  --bg-accent-b: rgb(31 49 87 / 0.12);
  --surface: #fffdf8;
  --surface-soft: #f4efe3;
  --ink: #232a36;
  --muted: #596070;
  --line: #d9cfbd;
  --line-strong: #c6baa4;
  --indigo: #1f3157;
  --indigo-soft: #2c436f;
  --vermilion: #b13b2d;
  --vermilion-strong: #8f2f24;
  --ok: #2d7a54;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-raised: 0 14px 26px rgb(68 51 30 / 0.16), inset 0 1px 0 rgb(255 255 255 / 0.78);
  --shadow-pressed: inset 0 2px 5px rgb(69 50 30 / 0.18), inset 0 -1px 0 rgb(255 255 255 / 0.62);
}

html.no-rounded-corners {
  --radius-sm: 0;
  --radius-md: 0;
  --radius-lg: 0;
}

html.no-rounded-corners *,
html.no-rounded-corners *::before,
html.no-rounded-corners *::after {
  border-radius: 0 !important;
}

html.no-rounded-corners .status::before,
html.no-rounded-corners .server-skeleton-feed .avatar {
  border-radius: 999px !important;
}

html,
body,
button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

body.custom-cursor-active {
  cursor: none !important;
}

body.custom-cursor-active * {
  cursor: none !important;
}

.custom-cursor {
  position: fixed;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  display: none;
  pointer-events: none;
  z-index: 2147483647;
  opacity: 0;
  transform: translate(-2px, -2px);
  transition: opacity 120ms ease;
  background-image: url("/image/cursor.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.custom-cursor.is-visible {
  display: block;
  opacity: 1;
}

.custom-cursor.is-interactive {
  width: 28px;
  height: 28px;
  transform: translate(-2px, -2px) scale(1.08);
  filter: drop-shadow(0 0 5px rgb(255 255 255 / 0.65));
}

html[data-theme="mono"] {
  --bg-paper: #f1f1f1;
  --bg-warm: #d8d8d8;
  --bg-overlay: rgb(255 255 255 / 0.2);
  --bg-grid: rgb(0 0 0 / 0.055);
  --bg-accent-a: rgb(92 92 92 / 0.14);
  --bg-accent-b: rgb(190 190 190 / 0.22);
  --surface: #fbfbfb;
  --surface-soft: #ececec;
  --ink: #1f1f1f;
  --muted: #575757;
  --line: #b8b8b8;
  --line-strong: #8f8f8f;
  --indigo: #313131;
  --indigo-soft: #494949;
  --vermilion: #636363;
  --vermilion-strong: #373737;
  --ok: #345a45;
}

html[data-theme="sea"] {
  --bg-paper: #d9f3ff;
  --bg-warm: #b9e7ff;
  --bg-overlay: rgb(245 255 255 / 0.2);
  --bg-grid: rgb(8 73 117 / 0.04);
  --bg-accent-a: rgb(38 146 200 / 0.18);
  --bg-accent-b: rgb(92 200 255 / 0.2);
  --surface: #f4fcff;
  --surface-soft: #e3f5ff;
  --ink: #103047;
  --muted: #31566f;
  --line: #98c9df;
  --line-strong: #64a5c6;
  --indigo: #14527a;
  --indigo-soft: #1c6a99;
  --vermilion: #1f86b8;
  --vermilion-strong: #125d83;
  --ok: #12756f;
}

html[data-theme="space"] {
  --bg-paper: #0f1222;
  --bg-warm: #1d1630;
  --bg-overlay: rgb(9 9 16 / 0.28);
  --bg-grid: rgb(255 255 255 / 0.02);
  --bg-accent-a: rgb(156 109 255 / 0.22);
  --bg-accent-b: rgb(78 129 255 / 0.18);
  --surface: #191b31;
  --surface-soft: #232744;
  --ink: #ecebff;
  --muted: #b4b1d8;
  --line: #3a3f68;
  --line-strong: #505689;
  --indigo: #b8adff;
  --indigo-soft: #9ca5ff;
  --vermilion: #9057ff;
  --vermilion-strong: #b48dff;
  --ok: #67d2b3;
}

html[data-theme="sunset"] {
  --bg-paper: #fff2d7;
  --bg-warm: #ffd4a8;
  --bg-overlay: rgb(255 255 255 / 0.16);
  --bg-grid: rgb(146 61 0 / 0.035);
  --bg-accent-a: rgb(255 101 72 / 0.2);
  --bg-accent-b: rgb(255 166 64 / 0.2);
  --surface: #fff7e8;
  --surface-soft: #ffecd2;
  --ink: #492c22;
  --muted: #7b5145;
  --line: #e3b88b;
  --line-strong: #cf9967;
  --indigo: #9a4631;
  --indigo-soft: #b3593f;
  --vermilion: #d35d2f;
  --vermilion-strong: #a33f1d;
  --ok: #2b7e57;
}

html[data-theme="forest"] {
  --bg-paper: #e5f2e2;
  --bg-warm: #cadfc6;
  --bg-overlay: rgb(255 255 255 / 0.2);
  --bg-grid: rgb(12 61 24 / 0.03);
  --bg-accent-a: rgb(63 141 84 / 0.2);
  --bg-accent-b: rgb(116 170 90 / 0.2);
  --surface: #f4fbf2;
  --surface-soft: #e1f0dc;
  --ink: #1f3526;
  --muted: #4b6652;
  --line: #a9c7ad;
  --line-strong: #86ae8d;
  --indigo: #22533a;
  --indigo-soft: #2d6b4a;
  --vermilion: #3a8a4b;
  --vermilion-strong: #2d6c3a;
  --ok: #1f7d58;
}

html[data-theme="mint"] {
  --bg-paper: #e3fff8;
  --bg-warm: #c9f2e8;
  --bg-overlay: rgb(255 255 255 / 0.18);
  --bg-grid: rgb(0 92 78 / 0.03);
  --bg-accent-a: rgb(29 194 172 / 0.2);
  --bg-accent-b: rgb(121 232 209 / 0.2);
  --surface: #f5fffc;
  --surface-soft: #dff9f2;
  --ink: #163a3a;
  --muted: #3b6666;
  --line: #9fd6c8;
  --line-strong: #7cbbaa;
  --indigo: #1f6f69;
  --indigo-soft: #298a83;
  --vermilion: #22a88f;
  --vermilion-strong: #1d806f;
  --ok: #1f7d65;
}

html[data-theme="candy"] {
  --bg-paper: #ffeef8;
  --bg-warm: #ffd9ee;
  --bg-overlay: rgb(255 255 255 / 0.2);
  --bg-grid: rgb(117 20 78 / 0.025);
  --bg-accent-a: rgb(240 73 171 / 0.2);
  --bg-accent-b: rgb(255 154 212 / 0.22);
  --surface: #fff7fc;
  --surface-soft: #ffe7f7;
  --ink: #40233a;
  --muted: #754f6d;
  --line: #dfb1d4;
  --line-strong: #cb8ec0;
  --indigo: #8e3c7b;
  --indigo-soft: #a24a8d;
  --vermilion: #d04ea6;
  --vermilion-strong: #a53f83;
  --ok: #2f7d5b;
}

html[data-theme="amber"] {
  --bg-paper: #fff5d9;
  --bg-warm: #ffe8ba;
  --bg-overlay: rgb(255 255 255 / 0.14);
  --bg-grid: rgb(102 67 0 / 0.03);
  --bg-accent-a: rgb(255 165 0 / 0.23);
  --bg-accent-b: rgb(255 214 102 / 0.22);
  --surface: #fffaf0;
  --surface-soft: #ffefcf;
  --ink: #433019;
  --muted: #786044;
  --line: #dfc08d;
  --line-strong: #cfa96f;
  --indigo: #8a5a15;
  --indigo-soft: #a06b1f;
  --vermilion: #cc7f12;
  --vermilion-strong: #935b0f;
  --ok: #2f7a4f;
}

html[data-theme="neon"] {
  --bg-paper: #090a12;
  --bg-warm: #0f1223;
  --bg-overlay: rgb(0 0 0 / 0.15);
  --bg-grid: rgb(0 255 231 / 0.05);
  --bg-accent-a: rgb(255 0 170 / 0.22);
  --bg-accent-b: rgb(0 188 255 / 0.2);
  --surface: #13172c;
  --surface-soft: #1c2342;
  --ink: #f1fcff;
  --muted: #9eb9d1;
  --line: #2d3b69;
  --line-strong: #44579e;
  --indigo: #53d7ff;
  --indigo-soft: #72f0ff;
  --vermilion: #ff4db8;
  --vermilion-strong: #ff87d3;
  --ok: #39d5a0;
}

html[data-theme="lavender"] {
  --bg-paper: #f4ecff;
  --bg-warm: #e7dcff;
  --bg-overlay: rgb(255 255 255 / 0.19);
  --bg-grid: rgb(89 56 153 / 0.03);
  --bg-accent-a: rgb(160 115 255 / 0.22);
  --bg-accent-b: rgb(194 159 255 / 0.2);
  --surface: #fbf8ff;
  --surface-soft: #eee7ff;
  --ink: #2c2447;
  --muted: #5d537e;
  --line: #c2b3e8;
  --line-strong: #a997db;
  --indigo: #5a4a9f;
  --indigo-soft: #6d5fba;
  --vermilion: #8758d6;
  --vermilion-strong: #6640a8;
  --ok: #2a7a61;
}

html[data-theme="midnight"] {
  --bg-paper: #0f1a2b;
  --bg-warm: #1a2b40;
  --bg-overlay: rgb(6 10 16 / 0.2);
  --bg-grid: rgb(163 196 255 / 0.03);
  --bg-accent-a: rgb(71 117 255 / 0.2);
  --bg-accent-b: rgb(96 147 209 / 0.2);
  --surface: #1e2e44;
  --surface-soft: #293b53;
  --ink: #ecf5ff;
  --muted: #b7c9dc;
  --line: #465f7c;
  --line-strong: #6181a6;
  --indigo: #a5c8ff;
  --indigo-soft: #8db5f1;
  --vermilion: #4e92df;
  --vermilion-strong: #81bcff;
  --ok: #61c5a7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  color: var(--ink);
  font-family: "Noto Sans Thai", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Segoe UI", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  background:
    linear-gradient(var(--bg-overlay), var(--bg-overlay)),
    repeating-linear-gradient(0deg, var(--bg-grid) 0 1px, transparent 1px 4px),
    radial-gradient(circle at 88% 8%, var(--bg-accent-a), transparent 25%),
    radial-gradient(circle at 12% 94%, var(--bg-accent-b), transparent 22%),
    linear-gradient(180deg, var(--bg-paper) 0%, var(--bg-warm) 100%);
}

input,
textarea,
[contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
}

.post-text,
.post-body,
.post-comment-text {
  -webkit-user-select: text;
  user-select: text;
}

img,
a {
  -webkit-user-drag: none;
  user-drag: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  width: auto;
  max-width: none;
  min-width: 0;
  padding: 10px 16px;
  margin: 0 10px;
  border-top: 4px solid var(--vermilion);
  border: 1px solid color-mix(in srgb, var(--line-strong) 72%, white 28%);
  border-bottom-width: 2px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 84%, white 16%);
  box-shadow: var(--shadow-raised);
  backdrop-filter: blur(8px);
}

.server-loading {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: block;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px) scale(0.985);
  transition: opacity 360ms cubic-bezier(0.16, 0.84, 0.44, 1), visibility 360ms ease, transform 360ms cubic-bezier(0.16, 0.84, 0.44, 1);
  background:
    linear-gradient(135deg, rgb(255 250 240 / 0.84), rgb(239 228 207 / 0.96)),
    repeating-linear-gradient(0deg, rgb(90 66 36 / 0.04) 0 1px, transparent 1px 5px);
  backdrop-filter: blur(10px);
}

.server-loading.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.server-loading.hidden {
  display: block !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px) scale(0.985);
}

.server-page-skeleton {
  position: relative;
  display: grid;
  gap: 20px;
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto;
  padding: 22px 0 28px;
  animation: skeleton-float 2.6s ease-in-out infinite;
}

.server-page-skeleton::before {
  content: "";
  position: absolute;
  inset: -8px;
  z-index: -1;
  border-radius: 24px;
  background: radial-gradient(circle at top left, rgb(177 59 45 / 0.16), transparent 42%), radial-gradient(circle at bottom right, rgb(31 49 87 / 0.12), transparent 38%);
  filter: blur(12px);
}

.server-page-skeleton span,
.server-page-skeleton article,
.server-skeleton-panel {
  display: block;
  position: relative;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 0.6);
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--surface-soft) 0%, #fffdf8 36%, var(--surface-soft) 72%, #fffdf8 100%);
  background-size: 220% 100%;
  box-shadow: 0 12px 24px rgb(68 51 30 / 0.12), inset 0 1px 0 rgb(255 255 255 / 0.72);
  animation: skeleton-sheen 1.15s linear infinite;
}

.server-skeleton-topbar {
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(150px, 210px) 1fr 42px 42px;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid rgb(255 255 255 / 0.65);
  border-radius: calc(var(--radius-lg) + 2px);
  background: rgb(255 253 248 / 0.78);
  backdrop-filter: blur(4px);
}

.server-skeleton-topbar span {
  height: 28px;
}

.server-skeleton-panel {
  min-height: 96px;
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgb(255 253 248 / 0.72);
}

.server-skeleton-panel span {
  height: 18px;
  width: min(460px, 82%);
}

.server-skeleton-panel .wide {
  width: min(620px, 100%);
}

.server-skeleton-panel .short {
  width: min(260px, 58%);
}

.server-skeleton-feed {
  display: grid;
  gap: 12px;
}

.server-skeleton-feed article {
  min-height: 168px;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: rgb(255 253 248 / 0.74);
}

.server-skeleton-feed .avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
}

.server-skeleton-feed article > div {
  display: grid;
  align-content: start;
  gap: 10px;
}

.server-skeleton-feed .name {
  width: min(180px, 48%);
  height: 18px;
}

.server-skeleton-feed .line {
  width: min(640px, 100%);
  height: 18px;
}

.server-skeleton-feed .line.short {
  width: min(320px, 62%);
}

.server-skeleton-feed .media {
  width: min(560px, 100%);
  height: 220px;
}

@keyframes skeleton-sheen {
  from {
    background-position: 180% 0;
  }
  to {
    background-position: -40% 0;
  }
}

@keyframes skeleton-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.mention-toast-stack {
  position: fixed;
  top: 84px;
  right: 12px;
  z-index: 40;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 24px));
  pointer-events: none;
}

.mention-toast {
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--indigo);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
  box-shadow: 0 10px 22px rgb(0 0 0 / 0.2);
  padding: 8px 10px;
  display: grid;
  gap: 3px;
  text-align: left;
  pointer-events: auto;
  cursor: pointer;
  animation: mention-toast-in 180ms ease-out both;
}

.mention-toast strong {
  color: var(--indigo);
  font-size: 13px;
}

.mention-toast span {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
}

.mention-tag {
  color: var(--indigo);
  font-weight: 800;
  background: color-mix(in srgb, var(--indigo) 12%, transparent 88%);
  padding: 0 2px;
}

.hashtag-tag {
  display: inline;
  border: 0;
  background: transparent;
  color: #1478d4;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 0 2px;
  text-decoration: none;
}

.hashtag-tag:hover {
  color: #0b56a0;
  text-decoration: underline;
}

@keyframes mention-toast-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.upload-toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
  z-index: 9999;
}

.upload-toast {
  border: 1px solid color-mix(in srgb, #23c574 50%, var(--line) 50%);
  background: linear-gradient(180deg, color-mix(in srgb, #e8fef0 80%, white 20%) 0%, color-mix(in srgb, #d4fce5 100%, white 20%) 100%);
  box-shadow: 0 6px 16px rgb(35 197 116 / 0.18);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: upload-toast-bounce 420ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
  pointer-events: auto;
}

@keyframes upload-toast-bounce {
  0% {
    opacity: 0;
    transform: translateY(100%) scale(0.8);
  }

  50% {
    transform: translateY(-8px) scale(1);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.upload-toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #23c574;
  color: white;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.upload-toast-text {
  color: #0b5a2a;
  font-size: 13px;
  font-weight: 600;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand,
.back,
.link-button,
.tab,
.mode-btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--indigo);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: transform 0.14s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.brand {
  font-size: 20px;
  letter-spacing: 0.2px;
  padding: 0;
}

.brand-logo {
  display: block;
  height: 60px;
  width: auto;
}

.mode-switch {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  padding: 4px;
  border-radius: var(--radius-md);
}

.mode-btn {
  padding: 7px 13px;
  color: var(--muted);
}

.mode-btn.active {
  color: #fff;
  background: linear-gradient(180deg, var(--indigo-soft) 0%, var(--indigo) 100%);
  box-shadow: 0 4px 10px rgb(31 49 87 / 0.25);
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fffdf8 0%, var(--surface-soft) 100%);
  padding: 0;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.icon-button img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.feedback-button img {
  width: 26px;
  height: 26px;
}

.notice-button img {
  width: 26px;
  height: 26px;
}

.donate-open-button img {
  width: 28px;
  height: 28px;
}

.report-open-button img {
  width: 25px;
  height: 25px;
}

.icon-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgb(0 0 0 / 0.12);
}

.icon-button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--indigo) 72%, white 28%);
  outline-offset: 2px;
}

.image-button {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fffdf8 0%, var(--surface-soft) 100%);
  padding: 0;
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.image-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.friend-unread-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #d31e1e;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  padding: 0 4px;
}

.account {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.verified-badge-inline {
  width: 12px;
  height: 12px;
  min-width: 12px;
  max-width: 12px;
  max-height: 12px;
  object-fit: contain;
  vertical-align: -1px;
}

.premium-badge-inline {
  width: 13px;
  height: 13px;
  min-width: 13px;
  max-width: 13px;
  max-height: 13px;
  object-fit: contain;
  vertical-align: -2px;
}

.donate-badge-inline {
  width: 13px;
  height: 13px;
  min-width: 13px;
  max-width: 13px;
  max-height: 13px;
  object-fit: contain;
  vertical-align: -2px;
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  max-width: 260px;
  padding: 5px 10px 5px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface-soft) 86%, white 14%);
  box-shadow: 0 5px 12px rgb(0 0 0 / 0.08);
  cursor: pointer;
}

.account-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgb(0 0 0 / 0.1);
}

.account-avatar {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  object-fit: cover;
  background: #ddd;
}

.special-admin-name {
  color: #0e6b3f !important;
  font-weight: 700;
}

.anonymous-name {
  color: #7a7a7a !important;
  font-weight: 700;
}

.link-button {
  font-size: 13px;
  padding: 4px 9px;
  border-color: var(--line);
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 6px 11px;
  border-color: var(--line-strong);
  background: linear-gradient(180deg, #fff9f0 0%, #f2e7d6 100%);
  color: var(--indigo);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.07);
}

.back::before {
  content: "\2190";
  font-size: 14px;
  line-height: 1;
}

.back:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgb(0 0 0 / 0.12);
  background: linear-gradient(180deg, #fffdf8 0%, #f6ebdc 100%);
}

.back:active {
  transform: translateY(0);
}

.back:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--indigo) 72%, white 28%);
  outline-offset: 2px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fffdf8 0%, var(--surface-soft) 100%);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.status::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9aa0ad;
  box-shadow: 0 0 0 0 rgb(154 160 173 / 0.5);
  animation: statusPulse 1.2s ease-out infinite;
}

html.no-rounded-corners .status::before {
  border-radius: 1px;
}

.status.online {
  color: var(--ok);
}

.status.online::before {
  background: #23c574;
  box-shadow: 0 0 0 0 rgb(35 197 116 / 0.55);
}

.status.offline {
  color: var(--vermilion-strong);
}

.status.loading {
  color: var(--indigo);
}

.status.loading::before {
  background: #d6a742;
  box-shadow: 0 0 0 0 rgb(214 167 66 / 0.5);
}

.status.offline::before {
  background: #e15656;
  box-shadow: 0 0 0 0 rgb(225 86 86 / 0.52);
}

@keyframes statusPulse {
  0% {
    transform: scale(0.95);
  }

  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgb(0 0 0 / 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgb(0 0 0 / 0);
  }
}

.layout {
  width: min(1100px, 100%);
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 20px 18px 18px;
}

.panel {
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface) 0%, #faf4e8 100%);
  box-shadow: var(--shadow-raised);
  padding: 18px;
}

.error-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 45%, #111827 100%);
}

.error-page .layout {
  padding: 30px 18px 24px;
}

.error-shell {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 24px;
  align-items: center;
  min-height: 360px;
}

.error-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  border-radius: 20px;
  background: rgb(255 255 255 / 0.08);
  border: 1px solid rgb(255 255 255 / 0.08);
  overflow: hidden;
}

.error-image {
  display: block;
  width: min(70%, 280px);
  height: auto;
  object-fit: contain;
  animation: bounceSpin 2.2s ease-in-out infinite;
  filter: drop-shadow(0 18px 30px rgb(0 0 0 / 0.28));
}

.error-copy {
  margin: 0;
  color: #cbd5e1;
  line-height: 1.6;
  font-size: 1rem;
}

.error-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgb(177 59 45 / 0.2);
  color: #fda4af;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.error-title {
  margin: 0 0 12px;
  font-size: clamp(1.4rem, 2.3vw, 2rem);
  color: #fff;
}

@keyframes bounceSpin {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  18% {
    transform: translateY(-18px) rotate(0deg);
  }
  34% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-12px) rotate(0deg);
  }
  66% {
    transform: translateY(0) rotate(0deg);
  }
  100% {
    transform: translateY(0) rotate(360deg);
  }
}

@media (max-width: 760px) {
  .error-shell {
    grid-template-columns: 1fr;
  }

  .error-stage {
    min-height: 240px;
  }
}

.section-head,
.room-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--line-strong) 78%, white 22%);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.room-head {
  justify-content: flex-start;
}

.room-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.room-search {
  display: grid;
  grid-template-columns: minmax(170px, 240px) auto;
  gap: 8px;
}

.room-id-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.favorite-room-button {
  display: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 22px;
  line-height: 1;
  place-items: center;
}

.favorite-room-button.is-active {
  color: #c48b12;
  border-color: #d0a64a;
  background: #fff6d6;
}

.tabs {
  display: flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.tab {
  min-height: 34px;
  padding: 7px 13px;
}

.tab.active {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--vermilion) 78%, white 22%) 0%,
    var(--vermilion) 100%
  );
  color: #fff;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  color: var(--indigo);
  font-size: 22px;
  letter-spacing: 0.1px;
}

.primary {
  min-height: 36px;
  border: 1px solid color-mix(in srgb, var(--vermilion-strong) 70%, black 30%);
  border-radius: var(--radius-sm);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--vermilion) 80%, white 20%) 0%,
    var(--vermilion) 100%
  );
  color: #fff;
  cursor: pointer;
  padding: 8px 15px;
  font: inherit;
  font-weight: 700;
  box-shadow: 0 6px 14px rgb(177 59 45 / 0.24), inset 0 1px 0 rgb(255 255 255 / 0.36);
}

.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgb(177 59 45 / 0.3);
}

.primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-pressed);
}

.primary:focus-visible,
.mode-btn:focus-visible,
.tab:focus-visible,
.link-button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--indigo) 72%, white 28%);
  outline-offset: 2px;
}

@media (hover: none) and (pointer: coarse) {
  .primary:focus-visible,
  .mode-btn:focus-visible,
  .tab:focus-visible,
  .link-button:focus-visible,
  .icon-button:focus-visible,
  .back:focus-visible {
    outline: none;
  }
}

.auth-form,
.create-form,
.post-form,
.message-form {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.auth-form {
  max-width: 520px;
}

.auth-tools {
  margin-bottom: 10px;
}

.create-form,
.post-form {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) auto;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.feedback-card {
  width: min(460px, 100%);
}

.download-layout {
  min-height: calc(100vh - 92px);
  display: grid;
  place-items: center;
}

.download-panel {
  width: min(520px, 100%);
  display: grid;
  gap: 18px;
  text-align: center;
}

.download-panel .section-head {
  justify-content: center;
}

.download-apk-button {
  display: inline-grid;
  place-items: center;
  min-height: 52px;
  padding: 12px 18px;
  text-decoration: none;
}

.theme-card {
  width: min(760px, 100%);
  gap: 14px;
}

.theme-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.theme-card-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.theme-card-actions .status {
  min-height: 34px;
}

.settings-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-nav-button {
  min-height: 34px;
  padding: 6px 11px;
}

.settings-nav-button.active {
  color: #fff;
  border-color: color-mix(in srgb, var(--vermilion-strong) 70%, black 30%);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--vermilion) 80%, white 20%) 0%,
    var(--vermilion) 100%
  );
}

.settings-section {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-soft) 75%, white 25%);
  padding: 12px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pressed);
}

.settings-section h3 {
  margin: 0;
  color: var(--indigo);
  font-size: 17px;
}

.settings-account-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.settings-account-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-account-secondary-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fffdf8 0%, var(--surface-soft) 100%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.72), 0 4px 9px rgb(40 32 22 / 0.08);
  color: var(--indigo);
  font-size: 13px;
  font-weight: 800;
}

.settings-toggle-row input {
  appearance: none;
  width: 48px;
  height: 26px;
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: linear-gradient(180deg, #d8cfbd 0%, #f7f0e4 100%);
  box-shadow: var(--shadow-pressed);
  cursor: pointer;
  position: relative;
}

.settings-toggle-row input::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border: 1px solid rgb(0 0 0 / 0.12);
  border-radius: 999px;
  background: linear-gradient(180deg, #fff 0%, #e7dccb 100%);
  box-shadow: 0 2px 5px rgb(0 0 0 / 0.2), inset 0 1px 0 rgb(255 255 255 / 0.9);
  transition: transform 0.16s ease;
}

.settings-toggle-row input:checked {
  border-color: color-mix(in srgb, var(--indigo) 62%, var(--line) 38%);
  background: linear-gradient(180deg, var(--indigo-soft) 0%, var(--indigo) 100%);
}

.settings-toggle-row input:checked::before {
  transform: translateX(22px);
}

.danger-button {
  border-color: color-mix(in srgb, var(--vermilion-strong) 45%, var(--line) 55%);
  color: var(--vermilion-strong);
}

.danger-button:hover {
  background: color-mix(in srgb, var(--vermilion) 14%, transparent);
  color: color-mix(in srgb, var(--vermilion-strong) 82%, black 18%);
}

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

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.theme-option {
  min-height: 40px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 8px 10px;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.theme-option:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgb(0 0 0 / 0.1);
}

.theme-option.active {
  color: #fff;
  border-color: color-mix(in srgb, var(--vermilion-strong) 70%, black 30%);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--vermilion) 80%, white 20%) 0%,
    var(--vermilion) 100%
  );
}

.support-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.support-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 10px;
}

.support-action-button img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex: 0 0 auto;
}

.support-action-button span {
  overflow-wrap: anywhere;
}

.feedback-form {
  display: grid;
  gap: 10px;
}

.feedback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.report-card {
  width: min(720px, 100%);
  max-height: min(82vh, 760px);
}

.report-reason-card {
  width: min(500px, 100%);
}

.report-card-head,
.reported-post-head,
.reported-post-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.reported-posts-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  max-height: min(62vh, 560px);
}

.reported-empty {
  color: var(--muted);
  font-size: 13px;
}

.reported-post-row {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 10px;
}

.reported-post-head {
  align-items: flex-start;
}

.reported-post-head strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.reported-post-head span,
.reported-post-body,
.reported-reasons span {
  color: var(--muted);
  font-size: 12px;
}

.reported-post-body {
  white-space: pre-wrap;
  word-break: break-word;
}

.reported-post-body .post-image-grid {
  width: min(320px, 100%);
  height: 180px;
}

.reported-reasons {
  display: grid;
  gap: 4px;
}

.report-reason-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.report-reason-card textarea {
  min-height: 110px;
}

.post-context-menu {
  position: fixed;
  z-index: 120;
  display: grid;
  min-width: 150px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: 0 12px 24px rgb(0 0 0 / 0.2);
  padding: 4px;
}

.post-context-menu button {
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
  text-align: left;
}

.post-context-menu button:hover {
  background: var(--surface-soft);
  color: var(--vermilion-strong);
}

.form-message {
  min-height: 20px;
  color: var(--indigo-soft);
  overflow-wrap: anywhere;
}

.form-message.is-loading {
  display: block;
  width: min(260px, 100%);
  height: 18px;
  overflow: hidden;
  color: transparent;
  border: 1px solid rgb(255 255 255 / 0.48);
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-soft) 0%, #fff 45%, var(--surface-soft) 90%);
  background-size: 220% 100%;
  box-shadow: var(--shadow-pressed);
  animation: skeleton-sheen 1.15s linear infinite;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--ink);
  padding: 9px 10px;
  font: inherit;
  line-height: 1.55;
  overflow-wrap: break-word;
  word-break: break-word;
}

textarea {
  resize: vertical;
}

.upload-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
}

.upload-field-row .upload-image-button {
  width: 44px;
  min-width: 44px;
  min-height: 42px;
  align-self: stretch;
  display: inline-grid;
  place-items: center;
  padding: 6px;
}

.upload-image-button img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  pointer-events: none;
}

.message-upload-row {
  align-items: start;
}

.message-upload-row .upload-image-button {
  align-self: start;
}

.char-count {
  margin-top: -2px;
  color: var(--muted);
  font-size: 12px;
  justify-self: end;
}

.char-count.near-limit {
  color: #8a6119;
  font-weight: 700;
}

.char-count.at-limit {
  color: var(--vermilion-strong);
}

.home-mode {
  animation: panelIn 0.24s ease;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.feed-list {
  display: grid;
  gap: 12px;
}

.feed-post,
.post,
.room-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fffdfa;
  box-shadow: 0 5px 14px rgb(0 0 0 / 0.06);
}

.feed-post {
  padding: 12px;
}

.x-post {
  border-left: 4px solid var(--indigo-soft);
}

.feed-post.is-highlighted {
  animation: postHighlightPulse 1.6s ease;
}

@keyframes postHighlightPulse {
  0%,
  100% {
    box-shadow: 0 5px 14px rgb(0 0 0 / 0.06);
  }

  35% {
    border-color: #d1a326;
    box-shadow: 0 0 0 4px rgb(229 181 39 / 0.22), 0 10px 24px rgb(0 0 0 / 0.14);
  }
}

.post-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 10px;
}

.post-avatar {
  width: 40px;
  height: 40px;
  border-radius: 0;
  object-fit: cover;
  border: 1px solid var(--line);
}

.post-author {
  display: grid;
  gap: 2px;
}

.post-author strong {
  color: var(--ink);
  font-size: 15px;
}

.post-author span {
  color: var(--muted);
  font-size: 12px;
}

.post-menu-button {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  padding: 4px 10px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.post-menu-button:hover {
  color: var(--vermilion-strong);
  border-color: #d2ada8;
  background: #fff6f5;
}

.post-text {
  margin-top: 8px;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}

.post-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.room-message-actions {
  margin-top: 8px;
}

.hashtag-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  border: 1px solid color-mix(in srgb, #1478d4 34%, var(--line) 66%);
  border-left: 4px solid #1478d4;
  background: color-mix(in srgb, #eaf4ff 78%, var(--surface) 22%);
  padding: 9px 11px;
}

.hashtag-filter strong {
  color: #115c9f;
  overflow-wrap: anywhere;
}

.post-action-button {
  border: 1px solid #d3d6df;
  background: #f5f7fb;
  color: #384861;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.post-action-button:hover {
  transform: translateY(-1px);
  background: #edf1f8;
  box-shadow: 0 4px 10px rgb(0 0 0 / 0.08);
}

.post-action-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
}

.post-action-count {
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.post-action-button.is-animating {
  transform: scale(1.06);
}

.post-action-button.is-animating .post-action-icon {
  animation: postActionPop 260ms ease;
}

@keyframes postActionPop {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.2);
  }

  100% {
    transform: scale(1);
  }
}

.post-like-button.liked {
  border-color: color-mix(in srgb, var(--vermilion-strong) 70%, black 30%);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--vermilion) 80%, white 20%) 0%,
    var(--vermilion) 100%
  );
  color: #fff;
  box-shadow: 0 6px 12px rgb(177 59 45 / 0.28);
}

.post-repost-button.reposted {
  border-color: color-mix(in srgb, var(--indigo) 70%, black 30%);
  background: linear-gradient(180deg, var(--indigo-soft) 0%, var(--indigo) 100%);
  color: #fff;
  box-shadow: 0 6px 12px rgb(31 49 87 / 0.24);
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffd792;
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.985);
  transition: opacity 620ms cubic-bezier(0.16, 0.84, 0.44, 1), visibility 620ms ease, transform 620ms cubic-bezier(0.16, 0.84, 0.44, 1);
}
.loading-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.loading-overlay.loading-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.985);
}
.loading-card {
  text-align: center;
  padding: 28px;
  border-radius: 12px;
}
.loading-logo {
  width: 160px;
  height: 160px;
  display: block;
  margin: 0 auto 14px auto;
  animation: spinBounce 800ms cubic-bezier(.2,.9,.3,1) infinite;
}
@keyframes spinBounce {
  0% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-8px) rotate(15deg); }
  50% { transform: translateY(0) rotate(0deg); }
  75% { transform: translateY(-6px) rotate(-10deg); }
  100% { transform: translateY(0) rotate(0deg); }
}
.loading-text {
  font-size: 18px;
  color: #333;
  font-weight: 700;
}
.loading-time {
  font-size: 22px;
  color: #222;
  font-weight: 800;
  margin: 8px 0 0;
}
.loading-text .dots {
  display: inline-block;
  margin-left: 8px;
}
.loading-text .dot { opacity: 0.25 }
.loading-text .dot:nth-child(1) { animation: dots 1.2s infinite 0s }
.loading-text .dot:nth-child(2) { animation: dots 1.2s infinite 0.2s }
.loading-text .dot:nth-child(3) { animation: dots 1.2s infinite 0.4s }
@keyframes dots {
  0% { opacity: 0.25; transform: translateY(0) }
  50% { opacity: 1; transform: translateY(-4px) }
  100% { opacity: 0.25; transform: translateY(0) }
}

@media (max-width: 480px) {
  .loading-logo { width: 120px; height: 120px }
  .loading-card { padding: 18px }
  .loading-text { font-size: 16px }
}

.post-report-button {
  color: var(--vermilion-strong);
}

.room-message-actions .post-action-button {
  width: 24px;
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  font-size: 12px;
  line-height: 1;
}

.verified-repost-badge {
  width: fit-content;
  margin-top: 8px;
  border: 1px solid color-mix(in srgb, #c79b24 65%, var(--line) 35%);
  background: linear-gradient(180deg, #fff8d8 0%, #f2df98 100%);
  color: #765400;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
}

.verified-repost-badge::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: #e5b527;
  box-shadow: 0 0 0 4px rgb(229 181 39 / 0.18);
}

html.no-rounded-corners .verified-repost-badge::before {
  border-radius: 1px;
}

.post-report-count-badge {
  width: fit-content;
  margin-top: 8px;
  border: 1px solid #d9c3a1;
  background: #fff6e5;
  color: #7d421b;
  font-size: 12px;
  font-weight: 900;
  padding: 4px 8px;
}

.post-comments {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  background: #f8f6ef;
  border: 1px solid var(--line);
  padding: 8px;
}

.post-comment {
  border-top: 1px dashed #d3cab8;
  padding-top: 8px;
  overflow-wrap: anywhere;
  color: #29374c;
}

.post-comment:first-child {
  border-top: 0;
  padding-top: 0;
}

.post-comment-time {
  color: var(--muted);
  font-size: 12px;
}

.post-comment-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

.post-comment-delete {
  margin-left: 6px;
  border: 0;
  background: transparent;
  color: var(--vermilion-strong);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.post-comment-delete:hover {
  text-decoration: underline;
}

.post-comment-form .primary {
  min-height: 34px;
  padding: 7px 13px;
}

.comment-submit {
  min-width: 78px;
}

.rooms {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.room-card {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 10px;
  min-height: 104px;
  padding: 10px;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.room-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--indigo-soft) 44%, var(--line-strong) 56%);
  box-shadow: 0 12px 20px rgb(0 0 0 / 0.11);
}

.room-card:hover h2 {
  color: var(--vermilion);
}

.room-card img {
  width: 84px;
  height: 84px;
  border: 1px solid var(--line);
  border-radius: 0;
  object-fit: cover;
  background: #ddd;
}

.room-card h2 {
  overflow-wrap: anywhere;
  color: var(--indigo);
  font-size: 16px;
  margin-bottom: 8px;
}

.room-copy-button {
  margin-top: 8px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--indigo);
}

.room-delete-button {
  margin-top: 8px;
  margin-left: 6px;
  border: 1px solid #e0c1bc;
  background: #fff6f5;
  color: var(--vermilion-strong);
}

.room-delete-button:hover {
  background: #ffefed;
}

.thread {
  display: grid;
  gap: 10px;
  margin-bottom: 0;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
}

.post {
  width: min(760px, 100%);
  max-width: 100%;
  padding: 9px 11px;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.op-badge {
  color: #1d8f57;
  font-weight: 700;
}

.post-meta img {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 0;
  object-fit: cover;
}

.post-meta img.verified-badge-inline,
.post-author img.verified-badge-inline,
.post-comment img.verified-badge-inline,
.account img.verified-badge-inline {
  width: 12px;
  height: 12px;
  min-width: 12px;
  max-width: 12px;
  max-height: 12px;
  border: 0;
  border-radius: 0;
  object-fit: contain;
}

.post-meta img.premium-badge-inline,
.post-meta img.donate-badge-inline,
.post-author img.premium-badge-inline,
.post-author img.donate-badge-inline,
.post-comment img.premium-badge-inline,
.post-comment img.donate-badge-inline,
.account img.premium-badge-inline,
.account img.donate-badge-inline {
  width: 13px;
  height: 13px;
  min-width: 13px;
  max-width: 13px;
  max-height: 13px;
  border: 0;
  border-radius: 0;
  object-fit: contain;
}

.post-body {
  margin-top: 8px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
  line-height: 1.55;
  max-width: 100%;
  overflow-x: hidden;
}

.post-body a {
  color: var(--indigo-soft);
}

.post-image,
.post-audio,
.post-video,
.post-video-embed {
  display: block;
  width: min(560px, 100%);
  margin-top: 8px;
  border: 1px solid var(--line);
  background: #ece9df;
}

.post-image {
  max-height: 320px;
  object-fit: contain;
}

.post-image-grid {
  display: grid;
  width: min(560px, 100%);
  height: clamp(210px, 42vw, 360px);
  margin-top: 8px;
  border: 1px solid var(--line);
  background: #ece9df;
  overflow: hidden;
}

.post-image-grid.image-count-1 {
  height: clamp(240px, 45vw, 420px);
}

.post-image-grid.image-count-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.post-image-grid.image-count-3 {
  grid-template-columns: 1.2fr 0.8fr;
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.post-image-grid.image-count-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.post-image-grid.image-count-3 .post-image-tile:first-child {
  grid-row: 1 / span 2;
}

.post-image-tile {
  position: relative;
  display: block;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 1px solid #fffdfa;
  background: #ece9df;
  cursor: zoom-in;
  overflow: hidden;
}

.post-image-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.16s ease;
}

.post-image-tile:hover img {
  transform: scale(1.03);
}

.post-image-more {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgb(22 27 34 / 0.58);
  color: #fff;
  font-size: clamp(28px, 6vw, 48px);
  font-weight: 800;
}

.messages .post-image-grid {
  width: min(420px, 100%);
  height: clamp(160px, 30vw, 260px);
}

.messages .post-image-grid.image-count-1 {
  height: clamp(180px, 32vw, 300px);
}

.dm-bubble-text .post-image-grid {
  width: min(260px, 100%);
  height: 170px;
}

.dm-bubble-text .post-image-grid.image-count-1 {
  height: 210px;
}

.pending-upload-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.pending-upload-item {
  position: relative;
  width: 72px;
  height: 72px;
  overflow: hidden;
}

.pending-upload-thumb {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 1px solid var(--line);
  background: #ece9df;
  cursor: zoom-in;
  overflow: hidden;
}

.pending-upload-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pending-upload-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 0.82);
  border-radius: 999px;
  background: rgb(185 69 60 / 0.94);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  line-height: 0;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.24);
}

.upload-skeleton-container {
  display: none;
  margin-top: 8px;
  padding: 12px 10px;
  background: #f5f7fb;
  border: 1px solid #e0e3eb;
  border-radius: var(--radius-sm);
}

.upload-skeleton-container.loading {
  display: block;
}

.upload-skeleton-item {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.upload-skeleton-item:last-child {
  margin-bottom: 0;
}

.upload-skeleton-thumb {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    90deg,
    #e0e3eb 0%,
    #f0f2f8 50%,
    #e0e3eb 100%
  );
  background-size: 200% 100%;
  animation: skeleton-sheen 1.15s linear infinite;
  flex-shrink: 0;
}

.upload-skeleton-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.upload-skeleton-line {
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    #e0e3eb 0%,
    #f0f2f8 50%,
    #e0e3eb 100%
  );
  background-size: 200% 100%;
  animation: skeleton-sheen 1.15s linear infinite;
}

.upload-skeleton-line:nth-child(1) {
  width: 60%;
}

.upload-skeleton-line:nth-child(2) {
  width: 40%;
}

html.no-rounded-corners .pending-upload-remove {
  border-radius: 1px;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  justify-items: center;
  padding: 32px;
  background: rgb(12 14 18 / 0.86);
  backdrop-filter: blur(6px);
  touch-action: none;
}

.image-viewer-frame {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  grid-template-rows: auto auto;
  min-width: 0;
  width: min(100%, 1080px);
  max-width: min(100%, 1080px);
  max-height: calc(100vh - 80px);
  place-items: center;
  margin: 0;
  touch-action: none;
}

.image-viewer-frame img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 1080px);
  max-height: calc(100vh - 110px);
  min-width: 0;
  min-height: 0;
  border: 1px solid rgb(255 255 255 / 0.18);
  background: #111;
  object-fit: contain;
  box-shadow: 0 18px 60px rgb(0 0 0 / 0.42);
  transform-origin: center center;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
}

.image-viewer-frame img.is-zoomed {
  cursor: grab;
}

.image-viewer-frame figcaption {
  margin-top: 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.image-viewer-frame figcaption:empty {
  display: none;
}

.image-viewer-close,
.image-viewer-nav {
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 0.18);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.12);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 0;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.image-viewer-close::before,
.image-viewer-nav::before {
  display: block;
  color: currentColor;
  line-height: 1;
}

.image-viewer-close::before {
  content: "×";
  font-size: 28px;
  transform: translateY(-1px);
}

.image-viewer-prev::before {
  content: "‹";
  font-size: 36px;
  transform: translateX(-1px) translateY(-2px);
}

.image-viewer-next::before {
  content: "›";
  font-size: 36px;
  transform: translateX(1px) translateY(-2px);
}

.image-viewer-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 26px;
  height: 26px;
}

.image-viewer-close img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.image-viewer-nav {
  position: absolute;
  top: 50%;
  width: 52px;
  height: 52px;
  transform: translateY(-50%);
}

.image-viewer-prev {
  left: 34px;
}

.image-viewer-next {
  right: 34px;
}

.image-viewer-close::before {
  content: none;
}

.image-viewer-prev::before {
  content: "<";
}

.image-viewer-next::before {
  content: ">";
}

.image-viewer-close:hover,
.image-viewer-nav:hover,
.image-viewer-close:focus-visible,
.image-viewer-nav:focus-visible {
  background: rgb(255 255 255 / 0.22);
  outline: none;
}

@media (max-width: 640px) {
  .image-viewer {
    grid-template-columns: 1fr;
    padding: 18px 10px;
  }

  .image-viewer-frame {
    width: 100%;
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 56px);
  }

  .image-viewer-frame img {
    max-width: 100%;
    max-height: calc(100vh - 76px);
  }

  .image-viewer-nav {
    width: 36px;
    height: 36px;
    font-size: 30px;
  }

  .image-viewer-prev {
    left: 10px;
  }

  .image-viewer-next {
    right: 10px;
  }

  .image-viewer-close {
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
  }
}

.post-video {
  max-height: 420px;
}

.post-video-embed {
  aspect-ratio: 16 / 9;
  min-height: 280px;
}

.message-delete-button {
  margin-top: 8px;
  color: var(--vermilion-strong);
}

.room-view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  max-height: calc(100vh - 112px);
}

#messageForm {
  position: sticky;
  bottom: 0;
  z-index: 6;
  margin-bottom: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  min-width: 0;
  max-width: 100%;
  background: linear-gradient(180deg, rgb(255 253 248 / 0), rgb(255 253 248 / 92%) 24%, var(--surface) 100%);
}

.hidden {
  display: none !important;
}

.rule-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(18 22 30 / 0.55);
  backdrop-filter: blur(6px);
}

.rule-modal-card {
  width: min(560px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface) 0%, #faf4e8 100%);
  box-shadow: 0 18px 35px rgb(0 0 0 / 0.24);
  padding: 18px;
  display: grid;
  gap: 12px;
}

.rule-modal-card h2 {
  margin: 0;
  color: var(--indigo);
  font-size: 21px;
}

.rule-modal-card p {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
}

.welcome-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(18 22 30 / 0.55);
  overflow-y: auto;
}

.welcome-modal-card {
  width: min(760px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface) 0%, #faf4e8 100%);
  box-shadow: 0 18px 35px rgb(0 0 0 / 0.24);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.welcome-head {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
}

.welcome-title {
  margin: 0;
  color: var(--indigo);
  font-size: 23px;
}

.welcome-image {
  display: block;
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border: 1px solid var(--line);
  background: #FFD6D6;
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.welcome-image.is-switching {
  opacity: 0.18;
  transform: translateY(4px) scale(0.992);
}

.welcome-gallery-controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}

.welcome-counter {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.welcome-actions {
  display: flex;
  justify-content: flex-end;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(18 22 30 / 0.62);
  backdrop-filter: blur(2px);
}

.confirm-modal-card {
  width: min(460px, 100%);
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--vermilion);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
  box-shadow: 0 22px 45px rgb(0 0 0 / 0.3);
  padding: 18px;
  display: grid;
  gap: 12px;
  animation: confirm-pop 220ms ease-out both;
}

.confirm-modal-card h2 {
  margin: 0;
  color: var(--indigo);
  font-size: 21px;
}

.confirm-modal-card p {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
  word-break: break-word;
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.confirm-modal-actions .link-button,
.confirm-modal-actions .primary {
  min-width: 104px;
}

.delete-account-card input {
  width: 100%;
}

.delete-account-card .form-message {
  min-height: 20px;
}

.danger-primary {
  border-color: color-mix(in srgb, var(--vermilion-strong) 80%, black 20%);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--vermilion) 78%, white 22%) 0%,
    var(--vermilion-strong) 100%
  );
}

.edit-post-card {
  width: min(760px, 100%);
  max-height: min(92vh, 860px);
  overflow: auto;
}

.edit-post-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.edit-post-close {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 6px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
}

.edit-post-close img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  pointer-events: none;
}

.edit-post-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.edit-post-card label > span,
.edit-post-preview-wrap > strong {
  color: var(--indigo);
  font-size: 13px;
}

.edit-post-preview-wrap {
  display: grid;
  gap: 8px;
}

.edit-post-preview {
  min-height: 150px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.48), rgb(255 255 255 / 0.2)),
    var(--surface-soft);
  padding: 12px;
}

.edit-post-preview .post-text {
  margin-top: 0;
}

.edit-post-preview .post-image-grid {
  width: min(440px, 100%);
}

.edit-post-preview-empty {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.profile-peek-card {
  width: min(460px, 100%);
  gap: 14px;
}

.profile-peek-trigger {
  cursor: pointer;
}

.profile-peek-trigger:hover {
  text-decoration: underline;
}

.profile-peek-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profile-peek-head h2 {
  margin: 0;
}

.profile-peek-avatar-wrap {
  display: flex;
  justify-content: center;
}

#profilePeekAvatar {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface-soft);
}

.profile-peek-grid {
  display: grid;
  gap: 10px;
}

.profile-peek-grid p {
  margin: 0;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  padding: 10px 12px;
}

.profile-peek-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.profile-peek-grid strong {
  color: var(--ink);
  font-size: 15px;
}

#profilePeekDescriptionValue {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

#profilePeekStatusValue {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: color-mix(in srgb, var(--surface) 80%, white 20%);
}

#profilePeekStatusValue::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #8f9aad;
  box-shadow: 0 0 0 0 rgb(143 154 173 / 0.45);
  animation: statusPulse 1.2s ease-out infinite;
}

#profilePeekStatusValue.is-online {
  color: #0f6a43;
  border-color: color-mix(in srgb, #22b26c 42%, var(--line) 58%);
  background: linear-gradient(180deg, #f4fff9 0%, #eafaf2 100%);
}

#profilePeekStatusValue.is-online::before {
  background: #22c374;
  box-shadow: 0 0 0 0 rgb(34 195 116 / 0.52);
}

#profilePeekStatusValue.is-offline {
  color: #9b2d2d;
  border-color: color-mix(in srgb, #d76a6a 45%, var(--line) 55%);
  background: linear-gradient(180deg, #fff7f7 0%, #ffefef 100%);
}

#profilePeekStatusValue.is-offline::before {
  background: #dc5a5a;
  box-shadow: 0 0 0 0 rgb(220 90 90 / 0.5);
}

.profile-peek-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-level-admin {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-soft) 82%, white 18%);
  padding: 10px;
}

.profile-level-admin label {
  display: grid;
  gap: 4px;
}

.profile-level-admin input {
  width: 100%;
}

.profile-peek-actions .link-button,
.profile-peek-actions .primary {
  min-width: 138px;
}

.profile-peek-action-message {
  min-height: 18px;
  margin: 0;
}

.friends-card {
  width: min(460px, 100%);
  gap: 12px;
}

.friends-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.friends-card-head h2 {
  margin: 0;
}

.friends-tabs {
  display: flex;
  gap: 8px;
}

.friends-tabs .link-button {
  min-width: 90px;
}

.friends-tabs .link-button.is-active {
  color: #fff;
  border-color: var(--indigo);
  background: var(--indigo);
}

.friends-list {
  display: grid;
  gap: 8px;
  max-height: min(55vh, 460px);
  overflow: auto;
}

.friend-add-box {
  display: grid;
  gap: 10px;
}

.friend-add-box h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}

.friend-add-form {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
}

.friend-add-form input {
  min-width: 0;
}

.friends-request-block {
  display: grid;
  gap: 8px;
}

.friends-request-block h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}

.friend-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 8px;
}

.friend-row > img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #ddd;
  position: relative;
}

.friend-avatar-online {
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px #23c574 !important;
}

.friend-avatar-offline {
  opacity: 0.65;
}

.friend-row-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.friend-row-name {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-row-status {
  font-size: 12px;
  color: var(--muted);
}

.dm-typing-indicator {
  color: var(--indigo-soft) !important;
  font-weight: 600;
  animation: typingBlink 1.4s infinite;
}

@keyframes typingBlink {
  0%, 60%, 100% {
    opacity: 1;
  }
  30% {
    opacity: 0.5;
  }
}

.friend-row-time {
  font-size: 11px;
  color: var(--muted);
}

.friend-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.friend-row-actions .primary,
.friend-row-actions .link-button {
  min-height: 32px;
  white-space: nowrap;
}

.friend-row-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.dm-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

.dm-window {
  position: fixed;
  width: min(340px, calc(100vw - 24px));
  min-height: 280px;
  max-height: min(74vh, 560px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: 0 12px 24px rgb(0 0 0 / 0.18);
  pointer-events: auto;
  overflow: hidden;
  min-width: 320px;
  min-height: 320px;
  max-width: min(86vw, 860px);
  max-height: min(90vh, 920px);
}

.dm-window.is-active {
  box-shadow: 0 15px 32px rgb(0 0 0 / 0.24);
}

.dm-window-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  cursor: move;
  user-select: none;
}

.dm-window-head strong {
  color: var(--ink);
  font-size: 13px;
}

.dm-window-head .link-button {
  padding: 4px 10px;
  border-color: var(--line-strong);
}

.dm-window-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dm-window-head-actions .link-button:last-child {
  color: #fff;
  border-color: var(--vermilion);
  background: var(--vermilion);
}

.dm-thread {
  margin: 0;
  padding: 10px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.dm-bubble {
  display: grid;
  gap: 2px;
  max-width: 92%;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 7px 8px;
}

.dm-bubble-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dm-bubble-avatar {
  width: 20px;
  height: 20px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #ddd;
}

.dm-bubble.own {
  margin-left: auto;
  border-color: color-mix(in srgb, var(--indigo) 45%, var(--line) 55%);
  background: color-mix(in srgb, var(--indigo) 10%, var(--surface) 90%);
}

.dm-bubble-author {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.dm-delete-button {
  margin-left: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  padding: 1px 6px;
  cursor: pointer;
}

.dm-delete-button:hover {
  color: #fff;
  background: var(--vermilion);
  border-color: var(--vermilion);
}

.dm-verified-badge {
  width: 12px;
  height: 12px;
  min-width: 12px;
  flex: 0 0 12px;
  vertical-align: -1px;
}

.friend-row-name .verified-badge-inline,
.dm-bubble-author .verified-badge-inline,
.dm-window-head strong .verified-badge-inline {
  width: 12px;
  height: 12px;
  min-width: 12px;
  flex: 0 0 12px;
  object-fit: contain;
}

.dm-skeleton {
  display: grid;
  gap: 8px;
  width: min(260px, 78%);
}

.dm-skeleton span {
  display: block;
  height: 16px;
  border: 1px solid rgb(255 255 255 / 0.48);
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-soft) 0%, #fff 45%, var(--surface-soft) 90%);
  background-size: 220% 100%;
  box-shadow: var(--shadow-pressed);
  animation: skeleton-sheen 1.15s linear infinite;
}

.dm-skeleton span:nth-child(1) {
  width: 88%;
}

.dm-skeleton span:nth-child(2) {
  width: 100%;
}

.dm-skeleton span:nth-child(3) {
  width: 68%;
}

.dm-skeleton span:nth-child(4) {
  width: 80%;
}

.dm-bubble-text {
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.dm-bubble-text-deleted {
  color: var(--muted);
  font-style: italic;
}

.dm-bubble-time {
  font-size: 10px;
  color: var(--muted);
}

.dm-form {
  border-top: 1px solid var(--line);
  padding: 8px;
  display: grid;
  gap: 6px;
}

.dm-form textarea {
  min-height: 66px;
  max-height: 130px;
  resize: vertical;
}

.dm-upload-row {
  grid-template-columns: minmax(0, 1fr) 44px;
}

.dm-form .primary {
  justify-self: end;
  min-width: 94px;
}

@keyframes confirm-pop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 760px) {
  .brand-logo {
    display: none;
  }

  .topbar {
    grid-template-columns: 1fr;
    justify-items: start;
    gap: 10px;
    width: auto;
    max-width: none;
    overflow: hidden;
  }

  .mention-toast-stack {
    top: 72px;
    right: 8px;
    width: min(96vw, 360px);
  }

  .top-left {
    display: none;
  }

  .mode-switch {
    order: 2;
    justify-self: start;
  }

  .top-actions {
    order: 1;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    justify-content: flex-start;
    overflow: hidden;
  }

  .image-button {
    width: 40px;
    height: 40px;
  }

  .favorite-room-button {
    display: inline-grid;
  }

  .account-chip {
    max-width: min(62vw, 250px);
  }

  .settings-account-grid {
    grid-template-columns: 1fr;
  }

  .layout {
    padding: 12px;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .room-view {
    width: 100%;
    overflow-x: hidden;
    max-height: calc(100vh - 96px);
  }

  .panel,
  .thread,
  .messages,
  #messageForm,
  .message-form,
  .post,
  .post-body,
  .post-image-grid,
  .messages .post-image-grid {
    max-width: 100%;
    min-width: 0;
  }

  .thread,
  .messages {
    overflow-x: hidden;
  }

  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .room-search,
  .create-form,
  .post-form,
  .post-comment-form,
  .upload-field-row {
    grid-template-columns: 1fr;
  }

  .upload-field-row .upload-image-button {
    width: 44px;
    justify-self: start;
  }

  .hashtag-filter {
    align-items: stretch;
    flex-direction: column;
  }

  .room-card {
    grid-template-columns: 72px 1fr;
  }

  .room-card img {
    width: 72px;
    height: 72px;
  }

  .welcome-modal {
    padding: 12px;
  }

  .welcome-image {
    max-height: 62vh;
  }

  .confirm-modal {
    padding: 12px;
  }

  .confirm-modal-card {
    padding: 14px;
  }

  .dm-layer {
    pointer-events: none;
  }

  .dm-window {
    left: 8px !important;
    right: 8px !important;
    top: 76px !important;
    width: auto !important;
    max-width: none;
    min-width: 0;
    min-height: 280px;
    max-height: calc(100dvh - 84px);
  }

  .dm-window-head {
    cursor: default;
  }

  .dm-thread {
    max-height: none;
  }

  .dm-form {
    grid-template-columns: 1fr;
  }

  .dm-upload-row {
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  .dm-form textarea {
    min-height: 84px;
  }

  .dm-form .primary {
    width: 100%;
    justify-self: stretch;
  }

  .profile-level-admin {
    grid-template-columns: 1fr;
  }

  .friend-add-form {
    grid-template-columns: 1fr;
  }
}

/* ======================================================================
   CLASSIC 2011 SKEUOMORPHIC BUTTONS (v2 — deeper gloss, real bevel)
   A true "glass cap" highlight via ::after, a solid dark stroke border,
   layered inset/outer shadows for physical thickness, and a press state
   that actually pushes the button down into the surface. Still driven
   by the theme variables above, so every color theme keeps working.
   The cream base tone is kept literal on purpose, matching how the
   original file already anchored these buttons to a light tone rather
   than the theme surface color, so controls stay tactile even on the
   dark themes.
   ====================================================================== */

.primary,
.link-button,
.icon-button,
.image-button,
.back,
.favorite-room-button,
.room-copy-button,
.room-delete-button,
.mode-btn,
.tab {
  position: relative;
}

.primary { --r: 8px; }
.link-button { --r: 8px; }
.icon-button { --r: 10px; }
.image-button { --r: 10px; }
.back { --r: 10px; }
.favorite-room-button { --r: 10px; }
.room-copy-button { --r: 8px; }
.room-delete-button { --r: 8px; }
.mode-btn { --r: 999px; }
.tab { --r: 0px; }

/* the glass dome: sits behind the label (z-index -1) so text stays crisp */
.primary::after,
.link-button::after,
.icon-button::after,
.image-button::after,
.back::after,
.favorite-room-button::after,
.room-copy-button::after,
.room-delete-button::after,
.mode-btn.active::after,
.tab.active::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  top: 1px;
  height: 48%;
  z-index: -1;
  pointer-events: none;
  border-radius: var(--r) var(--r) 60% 60% / var(--r) var(--r) 100% 100%;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.95) 0%, rgb(255 255 255 / 0.55) 45%, rgb(255 255 255 / 0.08) 100%);
  transition: height 0.15s ease, opacity 0.15s ease;
}

/* ---------- neutral / cream buttons ---------- */
.link-button,
.icon-button,
.image-button,
.back,
.favorite-room-button,
.room-copy-button,
.room-delete-button {
  border: 1px solid color-mix(in srgb, var(--line-strong) 60%, black 25%);
  border-radius: var(--r);
  background-image: linear-gradient(
    180deg,
    #fffefb 0%,
    #fff6e8 32%,
    var(--surface-soft) 68%,
    color-mix(in srgb, var(--surface-soft) 78%, black 16%) 100%
  );
  box-shadow:
    inset 0 1px 1px rgb(255 255 255 / 0.95),
    inset 0 -3px 5px rgb(0 0 0 / 0.08),
    0 0 0 1px rgb(255 255 255 / 0.4),
    0 2px 3px rgb(0 0 0 / 0.18),
    0 8px 16px rgb(0 0 0 / 0.16);
  text-shadow: 0 1px 0 rgb(255 255 255 / 0.95);
}

.link-button:hover,
.icon-button:hover,
.image-button:hover,
.back:hover,
.favorite-room-button:hover,
.room-copy-button:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 1px rgb(255 255 255 / 1),
    inset 0 -3px 5px rgb(0 0 0 / 0.06),
    0 0 0 1px rgb(255 255 255 / 0.55),
    0 3px 6px rgb(0 0 0 / 0.2),
    0 13px 22px rgb(0 0 0 / 0.18);
}

.link-button:hover::after,
.icon-button:hover::after,
.image-button:hover::after,
.back:hover::after,
.favorite-room-button:hover::after,
.room-copy-button:hover::after {
  height: 54%;
}

.link-button:active,
.icon-button:active,
.image-button:active,
.back:active,
.favorite-room-button:active,
.room-copy-button:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 5px 9px rgb(0 0 0 / 0.28),
    inset 0 -1px 0 rgb(255 255 255 / 0.65),
    0 0 0 1px rgb(255 255 255 / 0.3);
}

.link-button:active::after,
.icon-button:active::after,
.image-button:active::after,
.back:active::after,
.favorite-room-button:active::after,
.room-copy-button:active::after {
  opacity: 0.45;
  height: 40%;
}

.room-delete-button,
.danger-button {
  border-color: color-mix(in srgb, var(--vermilion-strong) 55%, black 20%);
}

.favorite-room-button.is-active {
  background-image: linear-gradient(180deg, #fffcf0 0%, #fff0bd 32%, #ffe08a 68%, #e8b94c 100%);
  border-color: #a9791f;
}

/* ---------- primary (vermilion) filled buttons + active tab ---------- */
.primary,
.tab.active {
  border: 1px solid color-mix(in srgb, var(--vermilion-strong) 70%, black 25%);
  background-image: linear-gradient(
    180deg,
    color-mix(in srgb, var(--vermilion) 55%, white 45%) 0%,
    color-mix(in srgb, var(--vermilion) 88%, white 12%) 32%,
    var(--vermilion) 68%,
    var(--vermilion-strong) 100%
  );
  box-shadow:
    inset 0 1px 1px rgb(255 255 255 / 0.6),
    inset 0 -3px 5px rgb(0 0 0 / 0.22),
    0 0 0 1px rgb(255 255 255 / 0.28),
    0 2px 4px rgb(0 0 0 / 0.3),
    0 9px 18px rgb(177 59 45 / 0.42);
  text-shadow: 0 -1px 1px rgb(0 0 0 / 0.4);
}

.primary:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 1px rgb(255 255 255 / 0.75),
    inset 0 -3px 5px rgb(0 0 0 / 0.2),
    0 0 0 1px rgb(255 255 255 / 0.35),
    0 3px 6px rgb(0 0 0 / 0.32),
    0 13px 24px rgb(177 59 45 / 0.5);
}

.primary:hover::after {
  height: 54%;
}

.primary:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 5px 10px rgb(0 0 0 / 0.45),
    inset 0 -1px 0 rgb(255 255 255 / 0.25);
}

.primary:active::after {
  opacity: 0.4;
  height: 40%;
}

/* settings nav's selected pill borrows the primary recipe */
.settings-nav-button.active {
  border: 1px solid color-mix(in srgb, var(--vermilion-strong) 70%, black 25%);
  background-image: linear-gradient(
    180deg,
    color-mix(in srgb, var(--vermilion) 55%, white 45%) 0%,
    color-mix(in srgb, var(--vermilion) 88%, white 12%) 32%,
    var(--vermilion) 68%,
    var(--vermilion-strong) 100%
  );
  box-shadow:
    inset 0 1px 1px rgb(255 255 255 / 0.6),
    inset 0 -3px 5px rgb(0 0 0 / 0.22),
    0 0 0 1px rgb(255 255 255 / 0.28),
    0 2px 4px rgb(0 0 0 / 0.3),
    0 9px 18px rgb(177 59 45 / 0.42);
  text-shadow: 0 -1px 1px rgb(0 0 0 / 0.4);
}

/* ---------- mode switch: carved trough + glossy indigo pill ---------- */
.mode-switch {
  border-radius: 999px;
  border-color: color-mix(in srgb, var(--line-strong) 70%, black 15%);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--line-strong) 35%, var(--surface-soft) 65%) 0%,
    var(--surface) 18%,
    var(--surface-soft) 100%
  );
  box-shadow:
    inset 0 3px 6px rgb(0 0 0 / 0.22),
    inset 0 -1px 0 rgb(255 255 255 / 0.75),
    0 1px 0 rgb(255 255 255 / 0.5);
}

.mode-btn:hover:not(.active) {
  background: rgb(255 255 255 / 0.55);
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.08);
}

.mode-btn.active {
  border: 1px solid color-mix(in srgb, var(--indigo) 70%, black 25%);
  background-image: linear-gradient(
    180deg,
    color-mix(in srgb, var(--indigo-soft) 55%, white 45%) 0%,
    color-mix(in srgb, var(--indigo-soft) 88%, white 12%) 32%,
    var(--indigo-soft) 68%,
    var(--indigo) 100%
  );
  box-shadow:
    inset 0 1px 1px rgb(255 255 255 / 0.55),
    inset 0 -3px 5px rgb(0 0 0 / 0.28),
    0 0 0 1px rgb(255 255 255 / 0.22),
    0 2px 4px rgb(0 0 0 / 0.3),
    0 8px 16px rgb(31 49 87 / 0.45);
  text-shadow: 0 -1px 1px rgb(0 0 0 / 0.4);
}

.mode-btn.active:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 1px rgb(255 255 255 / 0.7),
    inset 0 -3px 5px rgb(0 0 0 / 0.25),
    0 0 0 1px rgb(255 255 255 / 0.3),
    0 3px 6px rgb(0 0 0 / 0.32),
    0 12px 22px rgb(31 49 87 / 0.5);
}

.mode-btn.active:hover::after {
  height: 54%;
}

.mode-btn.active:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 5px 10px rgb(0 0 0 / 0.5),
    inset 0 -1px 0 rgb(255 255 255 / 0.2);
}

.mode-btn.active:active::after {
  opacity: 0.4;
  height: 40%;
}

/* ---------- disabled state ---------- */
.primary:disabled,
.link-button:disabled {
  filter: grayscale(0.5) brightness(0.97);
  transform: none;
  cursor: not-allowed;
}

.primary:disabled::after,
.link-button:disabled::after {
  opacity: 0.3;
}