:root {
  color-scheme: dark;
  --android-app-cutout-top: 0px;
  --bg: #000000;
  --surface: #171b19;
  --surface-2: #202620;
  --text: #f5f1e8;
  --muted: #aaa89e;
  --line: #30362f;
  --green: #68c36b;
  --lime: #c7e86f;
  --gold: #f5bd55;
  --red: #ef746f;
  --blue: #72aee6;
  --neon: #68c36b;
  --neon-soft: rgba(104, 195, 107, 0.28);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
}

:root.light {
  color-scheme: light;
  --bg: #f6f5ef;
  --surface: #ffffff;
  --surface-2: #ecefe7;
  --text: #171b19;
  --muted: #62685f;
  --line: #d9ded2;
  --shadow: 0 18px 46px rgba(48, 55, 45, 0.12);
}

:root.neon-green {
  --neon: #68c36b;
  --neon-soft: rgba(104, 195, 107, 0.32);
}

:root.neon-gold {
  --neon: #f5bd55;
  --neon-soft: rgba(245, 189, 85, 0.34);
}

:root.neon-blue {
  --neon: #72aee6;
  --neon-soft: rgba(114, 174, 230, 0.34);
}

:root.neon-pink {
  --neon: #ff66c4;
  --neon-soft: rgba(255, 102, 196, 0.34);
}

:root.neon-white {
  --neon: #f5f1e8;
  --neon-soft: rgba(245, 241, 232, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 92px;
  background: #000000;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

@property --neon-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@keyframes terphub-neon-spin {
  to {
    --neon-angle: 360deg;
  }
}

.category-card,
.thread-item,
.home-column,
.story-bar,
.toolbar,
.home-temple-card,
.thread-detail-card,
.author-profile-card,
.grow-log-card,
.profile-preview-card,
.profile-panel,
.profile-story-albums,
.rank-card,
.medal-card,
.raffle-card,
.raffle-summary,
.raffle-ticket-board,
.affiliate-card,
.affiliate-page,
.app-download-card,
.chart-panel,
.admin-form,
.admin-list article,
.admin-metrics div,
.private-conversation,
.chat-message,
.composer,
.rules,
.rank-lock,
.rank-progress,
.intro,
.stats-panel,
.email-entry,
.settings-entry,
.messages-entry,
.email-panel,
.email-art,
.login-card,
.settings-panel,
.settings-banner,
.admin-dashboard,
.admin-tabs,
.auth-mode,
.feed-composer,
.feed-post-card,
.feed-music-search,
.feed-detail-panel {
  position: relative;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--neon) 34%, var(--line));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--neon) 12%, transparent),
    0 0 18px var(--neon-soft);
}

.category-card::before,
.thread-item::before,
.home-column::before,
.story-bar::before,
.toolbar::before,
.home-temple-card::before,
.thread-detail-card::before,
.author-profile-card::before,
.grow-log-card::before,
.profile-preview-card::before,
.profile-panel::before,
.profile-story-albums::before,
.rank-card::before,
.medal-card::before,
.raffle-card::before,
.raffle-summary::before,
.raffle-ticket-board::before,
.affiliate-card::before,
.affiliate-page::before,
.app-download-card::before,
.chart-panel::before,
.admin-form::before,
.admin-list article::before,
.admin-metrics div::before,
.private-conversation::before,
.chat-message::before,
.composer::before,
.rules::before,
.rank-lock::before,
.rank-progress::before,
.intro::before,
.stats-panel::before,
.email-entry::before,
.settings-entry::before,
.messages-entry::before,
.email-panel::before,
.email-art::before,
.login-card::before,
.settings-panel::before,
.settings-banner::before,
.admin-dashboard::before,
.admin-tabs::before,
.auth-mode::before,
.feed-composer::before,
.feed-post-card::before,
.feed-music-search::before,
.feed-detail-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  padding: 1px;
  border-radius: inherit;
  pointer-events: none;
  background: conic-gradient(
    from var(--neon-angle),
    transparent 0deg,
    transparent 62deg,
    var(--neon) 92deg,
    transparent 132deg,
    transparent 218deg,
    color-mix(in srgb, var(--neon) 75%, white) 260deg,
    transparent 310deg,
    transparent 360deg
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: terphub-neon-spin 5.5s linear infinite;
  opacity: 0.9;
}

.category-card > *,
.thread-item > *,
.home-column > *,
.story-bar > *,
.toolbar > *,
.home-temple-card > *,
.thread-detail-card > *,
.author-profile-card > *,
.grow-log-card > *,
.profile-preview-card > *,
.profile-panel > *,
.profile-story-albums > *,
.rank-card > *,
.medal-card > *,
.raffle-card > *,
.raffle-summary > *,
.raffle-ticket-board > *,
.affiliate-card > *,
.affiliate-page > *,
.app-download-card > *,
.chart-panel > *,
.admin-form > *,
.admin-list article > *,
.admin-metrics div > *,
.private-conversation > *,
.chat-message > *,
.composer > *,
.rules > *,
.rank-lock > *,
.rank-progress > *,
.intro > *,
.stats-panel > *,
.email-entry > *,
.settings-entry > *,
.messages-entry > *,
.email-panel > *,
.email-art > *,
.login-card > *,
.settings-panel > *,
.settings-banner > *,
.admin-dashboard > *,
.admin-tabs > *,
.auth-mode > *,
.feed-composer > *,
.feed-post-card > *,
.feed-music-search > *,
.feed-detail-panel > * {
  position: relative;
  z-index: 1;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 72px;
  padding:
    max(12px, calc(env(safe-area-inset-top) + 12px))
    max(clamp(16px, 4vw, 54px), env(safe-area-inset-right))
    12px
    max(clamp(16px, 4vw, 54px), env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
}

.terphub-android-app .topbar {
  padding-top: max(72px, calc(env(safe-area-inset-top) + 46px));
}

.terphub-android-app {
  --android-app-cutout-top: 68px;
  scroll-padding-top: calc(var(--android-app-cutout-top) + 96px);
}

.terphub-android-app .section-block,
.terphub-android-app .standalone-section,
.terphub-android-app .forum-home {
  scroll-margin-top: calc(var(--android-app-cutout-top) + 96px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.18rem;
  font-weight: 800;
}

.brand img {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
}

.story-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0 0 16px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  overflow: hidden;
}

.story-strip {
  display: flex;
  gap: 10px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.story-create,
.story-bubble {
  flex: 0 0 auto;
  display: grid;
  justify-items: center;
  gap: 6px;
  width: 72px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.story-create {
  color: var(--muted);
}

.story-create span {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 2px solid #777777;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface-2) 88%, transparent);
  font-size: 2rem;
  font-weight: 900;
}

.story-ring {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  padding: 3px;
  border-radius: 50%;
  background: var(--story-color);
}

.story-ring img,
.story-viewer-header img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface);
}

.story-bubble strong {
  max-width: 70px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-viewer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: #000000;
}

.story-source-shell,
.story-composer,
.story-recorder {
  position: fixed;
  inset: 0;
  z-index: 92;
}

.story-source-panel {
  position: relative;
  z-index: 2;
  width: min(100% - 28px, 420px);
  margin: 12vh auto 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.terphub-android-app .story-source-panel {
  margin-top: calc(var(--android-app-cutout-top) + 24px);
}

.story-source-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.story-recorder {
  --story-camera-frame-top: max(76px, calc(env(safe-area-inset-top) + 76px));
  --story-camera-frame-bottom: max(126px, calc(env(safe-area-inset-bottom) + 126px));
  display: block;
  overflow: hidden;
  padding: 0;
  background: #000000;
  touch-action: none;
}

.story-recorder video {
  position: absolute;
  top: var(--story-camera-frame-top);
  bottom: var(--story-camera-frame-bottom);
  left: 50%;
  width: min(520px, calc(100vw - 16px));
  height: calc(100dvh - var(--story-camera-frame-top) - var(--story-camera-frame-bottom));
  min-height: 0;
  border-radius: 18px;
  object-fit: contain;
  background: #000000;
  transform-origin: center center;
  transform: translateX(-50%) scale(var(--story-camera-zoom, 1));
  transition: transform 0.08s linear;
}

.story-recorder.story-camera-rotated video {
  transform: translateX(-50%) scale(var(--story-camera-zoom, 1));
}

.terphub-android-app .story-recorder {
  --story-camera-frame-top: calc(var(--android-app-cutout-top) + 76px);
}

.story-recorder-controls {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.story-recorder-controls .active {
  background: rgba(245, 189, 85, 0.96);
  color: #17110b;
}

.story-recorder-controls strong,
.story-recorder-controls span {
  position: absolute;
  color: #ffffff;
  font-weight: 900;
}

.story-recorder-controls strong {
  display: none;
}

#storyRecorderTime {
  left: 50%;
  bottom: max(104px, calc(env(safe-area-inset-bottom) + 104px));
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  transform: translateX(-50%);
}

.story-recorder:not(.story-video-mode) #storyRecorderTime {
  display: none;
}

.story-recorder-status {
  left: 50%;
  bottom: max(142px, calc(env(safe-area-inset-bottom) + 142px));
  max-width: min(520px, calc(100% - 28px));
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.48);
  font-size: 0.78rem;
  text-align: center;
  transform: translateX(-50%);
}

.story-recorder-status.error {
  color: #ffb2ae;
}

#storyRecordToggle,
#storyRecorderGallery,
#storyFlashToggle,
#storyModeToggle,
#storyCameraSwitch,
#storyMuteToggle,
#storyRecorderCancel {
  position: absolute;
  pointer-events: auto;
}

#storyRecordToggle {
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  width: 78px;
  height: 78px;
  min-height: 78px;
  border: 4px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: #e93333;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.46);
  transform: translateX(-50%);
}

#storyRecordToggle.recording {
  border-width: 8px;
  background: #ff4949;
}

#storyRecordToggle.video-mode {
  background: #d71920;
}

.story-camera-icon-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.story-camera-icon-button img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  display: block;
}

#storyRecorderGallery {
  left: max(18px, env(safe-area-inset-left));
  bottom: max(38px, calc(env(safe-area-inset-bottom) + 14px));
}

#storyFlashToggle {
  top: max(18px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
}

.story-mode-toggle {
  top: max(18px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
}

.story-mode-toggle.active {
  outline: 2px solid #ffffff;
  box-shadow: 0 0 0 3px rgba(104, 195, 107, 0.34), 0 8px 24px rgba(0, 0, 0, 0.28);
}

.terphub-android-app #storyFlashToggle,
.terphub-android-app .story-mode-toggle,
.terphub-android-app #storyRecorderCancel {
  top: calc(var(--android-app-cutout-top) + 18px);
}

.terphub-android-app #storyMuteToggle {
  top: calc(var(--android-app-cutout-top) + 76px);
}

#storyCameraSwitch {
  right: max(18px, env(safe-area-inset-right));
  bottom: max(38px, calc(env(safe-area-inset-bottom) + 14px));
}

#storyMuteToggle {
  top: max(76px, calc(env(safe-area-inset-top) + 76px));
  left: max(16px, env(safe-area-inset-left));
  width: auto;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(0, 0, 0, 0.42);
  color: #ffffff;
}

#storyMuteToggle.active {
  border-color: rgba(239, 116, 111, 0.66);
  color: #ffb2ae;
  background: rgba(80, 18, 18, 0.58);
}

#storyRecorderCancel {
  top: max(18px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
}

.story-composer {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding:
    max(14px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
  background: #000000;
}

.story-compose-preview {
  position: relative;
  width: 100%;
  height: calc(100dvh - max(14px, env(safe-area-inset-top)) - max(14px, env(safe-area-inset-bottom)));
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.72), transparent 22%, transparent 72%, rgba(0, 0, 0, 0.82)),
    #050505;
}

.story-compose-media {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(calc((100dvh - 176px) * 0.5625), calc(100vw - 92px), 520px);
  aspect-ratio: 9 / 16;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: #000000;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.58), 0 0 28px var(--neon-soft);
  transform: translate(-50%, -50%);
}

.story-compose-frame {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: #000000;
}

.story-compose-media img,
.story-compose-media video {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  object-fit: contain;
  background: #000000;
}

#storyDrawCanvas {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(calc((100dvh - 176px) * 0.5625), calc(100vw - 92px), 520px);
  height: auto;
  max-height: calc(100dvh - 176px);
  aspect-ratio: 9 / 16;
  transform: translate(-50%, -50%);
  touch-action: none;
  cursor: crosshair;
}

.story-text-overlay,
.story-view-text {
  position: absolute;
  left: 50%;
  top: 48%;
  z-index: 3;
  max-width: min(86%, 520px);
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.44);
  color: #ffffff;
  font-size: clamp(1.25rem, 4vw, 2.4rem);
  font-weight: 900;
  text-align: center;
  transform: translate(-50%, -50%);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
  cursor: grab;
  pointer-events: auto;
}

.story-mentioned-user,
.story-view-mention {
  position: absolute;
  left: 50%;
  top: 82%;
  z-index: 4;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.58);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 900;
  transform: translate(-50%, -50%);
  cursor: pointer;
}

.story-compose-tools {
  position: absolute;
  top: max(16px, calc(env(safe-area-inset-top) + 16px));
  right: max(16px, calc(env(safe-area-inset-right) + 16px));
  z-index: 8;
  display: grid;
  gap: 10px;
  justify-items: end;
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
  backdrop-filter: none;
}

.story-publish-bottom {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, calc(env(safe-area-inset-bottom) + 18px));
  z-index: 9;
  width: min(190px, calc(50% - 24px));
  min-height: 46px;
  border-radius: 999px;
  box-shadow: 0 0 24px var(--neon-soft);
  transform: none;
}

.story-cancel-bottom {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  bottom: max(18px, calc(env(safe-area-inset-bottom) + 18px));
  z-index: 9;
  width: min(190px, calc(50% - 24px));
  min-height: 46px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #ffffff;
  transform: none;
}

.story-status {
  position: absolute;
  left: 50%;
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 74px);
  z-index: 10;
  width: min(520px, calc(100% - 28px));
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.68);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 900;
  text-align: center;
  transform: translateX(-50%);
}

.story-status.error {
  border-color: rgba(239, 116, 111, 0.5);
  color: #ffb2ae;
}

.story-tool-rail {
  display: grid;
  gap: 10px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.56);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(16px);
}

.story-tool-button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: rgba(20, 22, 21, 0.88);
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.story-tool-button:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--neon) 62%, rgba(255, 255, 255, 0.16));
  box-shadow: 0 0 18px var(--neon-soft);
}

.story-tool-button img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  display: block;
}

.story-tool-button.active {
  border-color: var(--neon);
  color: var(--neon);
  background: color-mix(in srgb, var(--neon) 16%, rgba(20, 22, 21, 0.9));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--neon) 18%, transparent), 0 0 24px var(--neon-soft);
}

.story-tool-panel {
  position: absolute;
  top: 64px;
  right: 0;
  display: grid;
  gap: 12px;
  width: min(340px, calc(100vw - 92px));
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--neon) 36%, rgba(255, 255, 255, 0.12));
  border-radius: 12px;
  background: rgba(5, 6, 5, 0.88);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.52), 0 0 26px var(--neon-soft);
  backdrop-filter: blur(18px);
}

.story-tool-panel section {
  display: grid;
  gap: 8px;
}

.story-tool-panel section.hidden {
  display: none;
}

.story-compose-tools header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  min-width: 230px;
  padding: 7px 8px 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.56);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(16px);
}

.story-compose-tools header span {
  margin: 0;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 900;
}

.story-compose-tools label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.story-compose-tools input,
.story-compose-tools select {
  min-height: 42px;
  width: 100%;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(15, 17, 16, 0.94);
  color: var(--text);
}

.story-compose-tools input:focus,
.story-compose-tools select:focus {
  border-color: var(--neon);
  box-shadow: 0 0 0 3px var(--neon-soft);
  outline: 0;
}

.story-music-results {
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.story-music-result {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 52px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.story-music-result.active {
  border-color: var(--green);
  background: color-mix(in srgb, var(--green) 14%, var(--surface-2));
}

.story-music-result img {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
}

.story-music-result strong,
.story-music-result em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-music-result em {
  color: var(--muted);
  font-size: 0.76rem;
  font-style: normal;
}

.story-music-preview {
  width: 100%;
  min-height: 36px;
}

.story-drawing-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.story-audio {
  position: absolute;
  left: 50%;
  bottom: 96px;
  z-index: 4;
  width: min(420px, calc(100% - 28px));
  transform: translateX(-50%);
}

.story-sound-button {
  position: absolute;
  left: 50%;
  bottom: 154px;
  z-index: 8;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--neon) 58%, var(--line));
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.78);
  color: var(--text);
  font-weight: 900;
  transform: translateX(-50%);
  box-shadow: 0 0 18px var(--neon-soft);
  cursor: pointer;
}

.story-highlight-button {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: 154px;
  z-index: 8;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--neon) 58%, var(--line));
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.78);
  color: var(--text);
  font-weight: 900;
  box-shadow: 0 0 18px var(--neon-soft);
  cursor: pointer;
}

.story-highlight-remove {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: 202px;
  z-index: 8;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--red) 64%, var(--line));
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.78);
  color: var(--red);
  font-size: 0.76rem;
  font-weight: 900;
  box-shadow: 0 0 18px color-mix(in srgb, var(--red) 24%, transparent);
  cursor: pointer;
}

.story-viewer-media {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(86px, calc(env(safe-area-inset-top) + 86px)) 12px max(86px, calc(env(safe-area-inset-bottom) + 86px));
  background: #000000;
}

.story-view-frame {
  position: relative;
  width: min(calc((100dvh - 172px) * 0.5625), calc(100vw - 24px), 520px);
  aspect-ratio: 9 / 16;
  max-height: calc(100dvh - 172px);
  overflow: hidden;
  border-radius: 8px;
  background: #000000;
}

.story-view-frame > img,
.story-view-frame > video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000000;
}

.story-viewer-header {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  left: max(18px, env(safe-area-inset-left));
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.54);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.terphub-android-app .story-viewer-header,
.terphub-android-app .story-close {
  top: calc(var(--android-app-cutout-top) + 18px);
}

.story-viewer-header img {
  width: 34px;
  height: 34px;
}

.story-viewer-header strong,
.story-viewer-header span {
  display: block;
}

.story-viewer-header strong {
  font-size: 0.92rem;
}

.story-viewer-header span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.story-close {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  z-index: 3;
}

.story-delete {
  position: absolute;
  top: max(66px, calc(env(safe-area-inset-top) + 66px));
  right: max(18px, env(safe-area-inset-right));
  z-index: 3;
  min-width: 40px;
  min-height: 34px;
  padding: 0 8px;
  color: var(--red);
  font-size: 0.72rem;
}

.terphub-android-app .story-delete {
  top: calc(var(--android-app-cutout-top) + 66px);
}

.story-reply-bar {
  position: absolute;
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  max-width: 680px;
  margin: 0 auto;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(10px);
}

.story-reply-bar input {
  min-height: 42px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.story-like-button {
  min-height: 42px;
  min-width: 58px;
  display: inline-flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  cursor: pointer;
  font-weight: 900;
}

.story-like-button span {
  font-size: 1.15rem;
}

.story-like-button.active {
  border-color: color-mix(in srgb, var(--red) 70%, white);
  color: var(--red);
  background: color-mix(in srgb, var(--red) 18%, rgba(255, 255, 255, 0.08));
}

.story-youtube {
  position: absolute;
  left: 50%;
  bottom: 96px;
  z-index: 4;
  width: min(420px, calc(100% - 28px));
  min-height: 116px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.7);
  transform: translateX(-50%);
}

.story-youtube iframe {
  width: 100%;
  height: 78px;
  border: 0;
  border-radius: 6px;
}

.story-youtube a {
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
}

.story-hit {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1;
  width: 50%;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.story-hit-left {
  left: 0;
}

.story-hit-right {
  right: 0;
}

.nav {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.nav a,
.nav-button,
.icon-button,
.admin-entry,
.email-entry,
.settings-entry,
.messages-entry {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
}

.nav a,
.nav-button {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.icon-button:hover,
.admin-entry:hover,
.email-entry:hover,
.settings-entry:hover,
.messages-entry:hover {
  border-color: var(--line);
  color: var(--text);
  background: var(--surface-2);
}

.nav a:hover,
.nav-button:hover {
  border-color: transparent;
  color: var(--text);
  background: transparent;
  box-shadow: none;
}

.topbar .nav a,
.topbar .nav-button {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.nav-button {
  cursor: pointer;
  background: transparent;
}

.icon-button {
  width: 42px;
  cursor: pointer;
  background: var(--surface);
}

#themeToggle {
  margin-left: 8px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  transform: translateX(6px);
}

#themeToggle img {
  display: block;
  width: 24px;
  height: 24px;
  margin: 0 auto;
  object-fit: contain;
}

#themeToggle:hover {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.admin-entry {
  padding: 0 14px;
  cursor: pointer;
  background: linear-gradient(135deg, rgba(104, 195, 107, 0.18), rgba(245, 189, 85, 0.1));
  font-weight: 800;
}

.email-entry {
  padding: 0 14px;
  cursor: pointer;
  background: var(--surface);
  font-weight: 800;
}

.settings-entry {
  padding: 0 14px;
  cursor: pointer;
  background: color-mix(in srgb, var(--surface) 86%, var(--blue));
  font-weight: 800;
}

.messages-entry {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  cursor: pointer;
  background: color-mix(in srgb, var(--surface) 86%, var(--gold));
  font-weight: 800;
}

.messages-entry span {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-width: 5px;
  border-radius: 3px;
  font-size: 0;
}

.bottom-user-dock {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 44;
  display: grid;
  grid-template-columns: repeat(3, minmax(76px, 1fr));
  gap: 10px;
  width: min(430px, calc(100% - 28px));
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
}

body:has(.topic-shell:not(.hidden), .email-shell:not(.hidden), .password-shell:not(.hidden), .chat-shell:not(.hidden), .private-shell:not(.hidden), .settings-shell:not(.hidden), .profile-shell:not(.hidden), .story-album-shell:not(.hidden), .admin-shell:not(.hidden), .story-source-shell:not(.hidden), .story-composer:not(.hidden), .story-recorder:not(.hidden), .story-viewer:not(.hidden)) .bottom-user-dock {
  pointer-events: none;
  opacity: 0;
}

.dock-button {
  position: relative;
  min-height: 58px;
  display: grid;
  place-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  font-weight: 900;
}

.dock-button strong {
  font-size: 0.78rem;
}

.profile-dock-button img {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  object-fit: cover;
}

.notification-badge {
  position: absolute;
  top: 5px;
  right: 7px;
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--red);
  color: #ffffff;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
}

.notification-shell {
  position: fixed;
  inset: 0;
  z-index: 72;
}

.notification-panel {
  position: fixed;
  left: 50%;
  bottom: max(94px, calc(env(safe-area-inset-bottom) + 94px));
  z-index: 2;
  display: grid;
  gap: 12px;
  width: min(460px, calc(100% - 28px));
  max-height: min(640px, calc(100dvh - 130px));
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--neon) 42%, var(--line));
  border-radius: 8px;
  overflow: auto;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.notification-panel header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.notification-panel h2 {
  margin: 0;
  font-size: 1.3rem;
}

.notification-list {
  display: grid;
  gap: 8px;
}

.notification-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 60px;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--neon) 34%, var(--line));
  border-radius: 8px;
  cursor: pointer;
  background: color-mix(in srgb, var(--surface-2) 86%, transparent);
  color: var(--text);
  text-align: left;
}

.notification-item:hover {
  border-color: var(--neon);
  background: color-mix(in srgb, var(--neon) 12%, var(--surface-2));
}

.notification-item img {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  object-fit: cover;
}

.notification-item span {
  min-width: 0;
}

.notification-item strong,
.notification-item small {
  display: block;
}

.notification-item small,
.notification-empty {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.notification-empty {
  margin: 0;
  padding: 10px;
}

.profile-preview-shell {
  position: fixed;
  inset: 0;
  z-index: 70;
}

.profile-preview-card {
  position: fixed;
  left: 50%;
  bottom: max(94px, calc(env(safe-area-inset-bottom) + 94px));
  z-index: 2;
  display: grid;
  gap: 12px;
  width: min(420px, calc(100% - 28px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.profile-preview-card header {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.profile-preview-card header img {
  width: 58px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
}

.profile-preview-card h2,
.profile-preview-card p {
  margin: 0;
}

.profile-preview-card h2 {
  font-size: 1.1rem;
}

.profile-preview-card p {
  color: var(--muted);
  line-height: 1.35;
}

.profile-preview-stats,
.profile-preview-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.profile-preview-stats div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  text-align: center;
}

.profile-preview-stats strong,
.profile-preview-stats span {
  display: block;
}

.profile-preview-stats span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.profile-preview-actions {
  grid-template-columns: 1fr 1fr;
}

.bottom-user-dock .messages-entry,
.bottom-user-dock .dock-button {
  width: auto;
  min-width: 0;
  flex: initial;
  justify-content: center;
  padding: 6px 8px;
  white-space: normal;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.user-chip span {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: var(--rank-color, var(--green));
  box-shadow: 0 0 18px var(--rank-color, var(--green));
}

.user-chip strong {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
}

.user-chip button {
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 54px;
}

.category-home {
  margin-bottom: 24px;
}

.category-sidebar {
  position: fixed;
  inset: 0;
  z-index: 76;
}

.category-peek {
  position: fixed;
  left: 0;
  top: 50%;
  z-index: 9;
  width: 48px;
  height: 88px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, var(--lime));
  border-left: 0;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  background: linear-gradient(135deg, var(--lime), var(--gold));
  color: #101312;
  font-size: 2rem;
  font-weight: 900;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  transform: translateY(-50%);
}

.category-peek:hover {
  transform: translate(4px, -50%);
}

.category-sidebar-panel {
  position: relative;
  display: grid;
  gap: 12px;
  width: min(430px, calc(100% - 28px));
  height: calc(100vh - 28px);
  margin: 14px auto 14px 14px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--line) 74%, var(--lime));
  border-radius: 8px;
  overflow: auto;
  background: var(--bg);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
}

.terphub-android-app .category-sidebar-panel,
.terphub-android-app .chat-panel,
.terphub-android-app .private-panel,
.terphub-android-app .settings-panel,
.terphub-android-app .profile-panel {
  height: calc(100dvh - var(--android-app-cutout-top) - 28px);
  max-height: calc(100dvh - var(--android-app-cutout-top) - 28px);
  margin-top: calc(var(--android-app-cutout-top) + 14px);
}

.terphub-android-app .email-panel {
  margin-top: calc(var(--android-app-cutout-top) + 18px);
}

.terphub-android-app .admin-panel,
.terphub-android-app .topic-panel {
  padding-top: calc(var(--android-app-cutout-top) + 18px);
}

.category-sidebar-panel .section-heading {
  align-items: start;
}

.sidebar-section-list {
  display: grid;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.sidebar-section-card {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, var(--accent));
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 58%),
    color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 0 0 1px transparent, 0 8px 22px rgba(0, 0, 0, 0.22);
}

.sidebar-section-card:hover,
.sidebar-section-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 34%, transparent);
  outline: 0;
  transform: translateX(2px);
}

.sidebar-section-mark {
  width: 10px;
  height: 36px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 70%, transparent);
}

.sidebar-section-card strong,
.sidebar-section-card small {
  display: block;
}

.sidebar-section-card strong {
  font-size: 0.94rem;
  line-height: 1.15;
}

.sidebar-section-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.sidebar-category-title {
  display: grid;
  gap: 3px;
  padding: 3px 2px 0;
}

.sidebar-category-title strong {
  font-size: 0.95rem;
}

.sidebar-category-title span {
  color: var(--muted);
  font-size: 0.82rem;
}

.list-load-more {
  justify-self: center;
  width: min(220px, 100%);
  margin: 6px auto 0;
}

.forum-home {
  scroll-margin-top: 96px;
}

.home-columns {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.home-mobile-tabs {
  display: none;
}

.home-mode-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 16px 0 18px;
}

.home-mode-tabs button {
  min-width: 118px;
  min-height: 40px;
  border: 1px solid color-mix(in srgb, var(--line) 75%, var(--neon-color));
  border-radius: 999px;
  cursor: pointer;
  background: color-mix(in srgb, var(--surface-2) 92%, transparent);
  color: var(--text);
  font-weight: 900;
  box-shadow: 0 0 0 transparent;
}

.home-mode-tabs button.active {
  border-color: var(--neon-color);
  background: var(--neon-color);
  color: #101312;
  box-shadow: 0 0 22px color-mix(in srgb, var(--neon-color) 54%, transparent);
}

.feed-view {
  display: block;
}

body.feed-home-mode .intro,
body.feed-home-mode .toolbar,
body.feed-home-mode .content-grid {
  display: none;
}

.feed-shell {
  display: grid;
  gap: 18px;
  width: min(680px, 100%);
  margin: 0 auto;
}

.feed-open-editor {
  justify-self: center;
  min-width: min(260px, 100%);
}

.feed-composer,
.feed-post-card {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--line) 76%, var(--neon));
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--neon) 12%, transparent),
    0 0 22px var(--neon-soft);
}

.feed-composer-head,
.feed-post-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.feed-post-card > header,
.feed-detail-card > header {
  justify-content: flex-start;
}

.feed-delete-button {
  min-height: 32px;
  border: 1px solid color-mix(in srgb, var(--red) 64%, var(--line));
  border-radius: 999px;
  padding: 0 11px;
  cursor: pointer;
  background: color-mix(in srgb, var(--red) 13%, transparent);
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 900;
}

.feed-delete-button:hover {
  border-color: var(--red);
  background: color-mix(in srgb, var(--red) 22%, transparent);
}

.feed-composer h3 {
  margin: 0;
  font-size: 1.1rem;
}

.feed-composer textarea,
.feed-comment-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
}

.feed-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feed-editor-actions > * {
  flex: 1 1 180px;
}

.feed-music-search {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, var(--neon));
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-2) 88%, transparent);
}

.feed-music-search label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.feed-music-search input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
}

.feed-music-results {
  max-height: 260px;
  overflow: auto;
}

.feed-photo-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--neon-color);
  border-radius: 999px;
  cursor: pointer;
  background: color-mix(in srgb, var(--neon-color) 18%, transparent);
  color: var(--text);
  font-weight: 900;
}

.feed-photo-picker img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.feed-photo-picker input {
  display: none;
}

.feed-selected-media,
.feed-empty-comment {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

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

.feed-author {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.feed-author img {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  object-fit: cover;
  border: 2px solid var(--accent, var(--neon-color));
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent, var(--neon-color)) 55%, transparent);
}

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

.feed-author small {
  color: var(--muted);
  font-weight: 800;
}

.feed-carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}

.feed-photo-frame {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: #050505;
  scroll-snap-align: start;
}

.feed-photo-frame img,
.feed-photo-frame video {
  display: block;
  width: 100%;
  max-height: 760px;
  object-fit: contain;
  background: #050505;
}

.feed-photo-frame video[poster] {
  background-color: #050505;
}

.feed-carousel-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 44px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 900;
  text-align: center;
}

.feed-music-player {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  max-width: min(52%, 280px);
}

.feed-music-audio {
  display: none;
}

.feed-music-activate {
  display: block;
  max-width: 100%;
  min-height: 28px;
  border: 1px solid var(--neon);
  border-radius: 999px;
  padding: 0 10px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.72);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 28px;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 0 14px var(--neon-soft);
}

.feed-music-activate.playing {
  background: color-mix(in srgb, var(--neon) 24%, rgba(0, 0, 0, 0.78));
  color: #fff;
}

.feed-music-activate.hidden {
  display: none;
}

.feed-description {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
  cursor: pointer;
}

.feed-post-card .social-actions,
.feed-detail-card .social-actions {
  display: flex !important;
  flex-direction: row !important;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  width: 100%;
  margin-left: 0;
}

.feed-post-card .social-action,
.feed-detail-card .social-action {
  flex: 0 0 34px;
}

.feed-open-comments {
  justify-self: start;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  text-align: left;
}

.feed-comments {
  display: grid;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.feed-comment {
  display: flex;
  gap: 7px;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.feed-comment strong {
  color: var(--neon-color);
}

.feed-comment span {
  color: var(--muted);
}

.feed-comment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.feed-inline-comment-form {
  width: 100%;
  padding-top: 2px;
}

.feed-comment-form input {
  min-height: 38px;
  padding: 0 12px;
}

.feed-comment-form button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
  background: var(--neon-color);
  color: #101312;
  font-weight: 900;
}

.feed-detail-shell {
  position: fixed;
  inset: 0;
  z-index: 94;
}

.feed-detail-panel {
  position: relative;
  display: grid;
  width: min(920px, calc(100% - 28px));
  max-height: calc(100dvh - 32px);
  margin: 16px auto;
  overflow: auto;
  border: 1px solid color-mix(in srgb, var(--line) 70%, var(--neon));
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.7);
}

.feed-detail-close {
  position: sticky;
  top: 12px;
  z-index: 2;
  justify-self: end;
  margin: 12px 12px 0 0;
}

.feed-detail-body {
  padding: 0 16px 16px;
}

.feed-detail-card {
  position: relative;
  display: grid;
  gap: 14px;
}

.feed-detail-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.feed-detail-comments {
  max-height: 280px;
  overflow: auto;
  padding-right: 4px;
}

.home-column {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-content: start;
  gap: 12px;
  min-height: 420px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}

.column-heading {
  display: grid;
  gap: 4px;
}

.column-heading h3 {
  margin-bottom: 0;
  font-size: 1.02rem;
}

.column-heading span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.compact-thread-list .thread-item {
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
}

.compact-thread-list .vote {
  width: 8px;
  min-height: 100%;
}

.compact-thread-list .thread-item p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  margin-bottom: 10px;
}

.compact-thread-list .meta-row {
  font-size: 0.76rem;
}

.home-column-pager {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.home-column-pager button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 36px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 900;
}

.home-column-pager button:disabled {
  cursor: default;
  opacity: 0.36;
}

.home-column-pager span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
}

.chat-shell {
  position: fixed;
  inset: 0;
  z-index: 76;
}

.private-shell {
  position: fixed;
  inset: 0;
  z-index: 80;
}

.chat-peek {
  position: fixed;
  right: 0;
  top: 50%;
  z-index: 9;
  width: 48px;
  height: 88px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, var(--gold));
  border-right: 0;
  border-radius: 8px 0 0 8px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--gold), var(--lime));
  color: #101312;
  font-size: 2rem;
  font-weight: 900;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  transform: translateY(-50%);
}

.chat-peek:hover {
  transform: translate(-4px, -50%);
}

.chat-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(220px, 1fr) auto;
  gap: 14px;
  width: min(460px, calc(100% - 28px));
  height: calc(100vh - 28px);
  margin: 14px 14px 14px auto;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, var(--gold));
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.58);
}

.private-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  width: min(920px, calc(100% - 28px));
  height: calc(100vh - 28px);
  margin: 14px auto;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, var(--gold));
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.58);
}

.private-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}

.private-sidebar,
.private-chat {
  display: grid;
  gap: 10px;
  min-height: 0;
}

.private-sidebar {
  align-content: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.private-sidebar label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.private-sidebar input,
.private-sidebar select {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--bg);
  color: var(--text);
}

.private-conversation-list {
  display: grid;
  gap: 7px;
}

.private-conversation {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 800;
  text-align: left;
  padding: 7px 9px;
}

.private-conversation img {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface);
}

.private-conversation span {
  display: grid;
  min-width: 0;
}

.private-conversation strong,
.private-conversation small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.private-conversation small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.private-conversation.active {
  border-color: var(--gold);
  color: #101312;
  background: linear-gradient(135deg, var(--gold), var(--lime));
}

.private-conversation.active small {
  color: #26301d;
}

.private-chat {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.private-chat-title {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  font-weight: 900;
}

.private-message.own {
  border-color: color-mix(in srgb, var(--green) 65%, var(--line));
}

.private-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.private-media-grid img,
.private-media-grid video,
.private-media-grid audio {
  width: 100%;
  max-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #000000;
}

.chat-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.chat-header h2 {
  margin-bottom: 6px;
  font-size: clamp(1.6rem, 4vw, 2.8rem);
}

.chat-header p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--muted);
}

.chat-list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 260px;
  max-height: 52vh;
  overflow: auto;
  padding-right: 4px;
}

.chat-message {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.chat-message div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-message-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-delete-button {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid color-mix(in srgb, var(--red) 42%, var(--line));
  border-radius: 6px;
  cursor: pointer;
  background: color-mix(in srgb, var(--red) 12%, var(--surface));
  color: #ffb2ae;
  font-size: 0.72rem;
  font-weight: 900;
}

.chat-delete-button:hover {
  border-color: var(--red);
  background: color-mix(in srgb, var(--red) 22%, var(--surface));
}

.chat-message strong {
  font-size: 0.92rem;
}

.chat-message span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.chat-message p {
  margin-bottom: 0;
  color: var(--text);
  line-height: 1.45;
}

.temple-message {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 2px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.temple-message p {
  min-width: 0;
  overflow-wrap: anywhere;
}

.temple-message strong {
  font-size: 0.9rem;
}

.temple-message span {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
}

.temple-message small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.chat-form {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.chat-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.chat-form textarea {
  width: 100%;
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  background: var(--surface);
  color: var(--text);
  outline: 0;
}

.category-detail {
  margin-bottom: 24px;
  scroll-margin-top: 96px;
}

.thread-detail {
  margin-bottom: 24px;
  scroll-margin-top: 96px;
}

.category-detail-hero {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin: 12px 0 18px;
  padding: clamp(18px, 4vw, 30px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--detail-accent) 20%, transparent), transparent 55%),
    var(--surface);
  box-shadow: var(--shadow);
}

.category-detail-hero .category-icon {
  width: 68px;
  height: 68px;
}

.category-detail-hero h2 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 0.96;
}

.category-detail-hero p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.back-button {
  width: fit-content;
  padding: 0 14px;
}

.standalone-back,
.grow-section > .back-button {
  margin-bottom: 18px;
}

.follow-thread-button {
  margin-top: 12px;
}

.follow-thread-button.active {
  border-color: var(--lime);
  color: #101312;
  background: linear-gradient(135deg, var(--lime), var(--gold));
}

.social-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 8px 0 0 auto;
}

.social-action {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
}

.social-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
  pointer-events: none;
}

.social-action:hover,
.social-action.active {
  color: var(--neon);
  background: color-mix(in srgb, var(--neon) 10%, transparent);
  box-shadow: 0 0 14px var(--neon-soft);
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 24px;
  align-items: end;
  min-height: 310px;
  padding: clamp(26px, 5vw, 56px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(115deg, rgba(0, 0, 0, 0.86), rgba(0, 0, 0, 0.42)),
    url("assets/terphub-pattern-bg.jpg") center / cover no-repeat,
    var(--surface);
  box-shadow: var(--shadow);
}

:root.light .intro {
  background:
    linear-gradient(115deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.22)),
    url("assets/terphub-pattern-bg.jpg") center / cover no-repeat,
    var(--surface);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--lime);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(3.25rem, 8vw, 6.5rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.intro-copy p:not(.eyebrow) {
  max-width: 620px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.primary-action,
.secondary-action,
.submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-action,
.submit-button {
  border: 0;
  background: var(--green);
  color: #071008;
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.secondary-action {
  border: 1px solid var(--line);
  padding: 0 16px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
}

.button-link {
  cursor: pointer;
  color: var(--text);
}

.inline-link-button {
  width: fit-content;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: transparent;
  color: var(--gold);
  font-weight: 900;
  text-align: left;
}

.inline-link-button:hover {
  color: var(--green);
}

.inline-link-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.primary-action {
  padding: 0 18px;
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.stats-panel div {
  min-height: 94px;
  padding: 16px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
}

.stats-panel strong,
.stats-panel span {
  display: block;
}

.stats-panel strong {
  font-size: 1.65rem;
}

.stats-panel span {
  color: var(--muted);
  font-size: 0.85rem;
}

.toolbar {
  display: flex;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
  margin: 24px 0;
}

.home-temple-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  width: 100%;
  max-width: none;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--green) 10%, transparent), transparent 62%),
    var(--surface);
}

.home-temple-card .section-heading {
  margin: 0;
}

.home-chat-list {
  width: 100%;
  max-width: none;
  max-height: 280px;
  min-height: 150px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.home-chat-form {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  width: 100%;
  max-width: none;
}

.home-chat-form label {
  margin: 0;
  width: 100%;
}

.home-chat-form textarea {
  width: 100%;
  min-height: 72px;
}

.home-chat-form .submit-button {
  justify-self: end;
  width: min(180px, 100%);
}

.search {
  display: grid;
  gap: 8px;
  width: min(460px, 100%);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.search input,
.composer input,
.composer select,
.composer textarea,
.login-card input,
.admin-form input,
.admin-form select,
.admin-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: 0;
}

.search input {
  min-height: 46px;
  padding: 0 14px;
}

.search input:focus,
.composer input:focus,
.composer select:focus,
.composer textarea:focus,
.login-card input:focus,
.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(104, 195, 107, 0.18);
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  min-width: 280px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.segmented button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segmented button.active {
  background: var(--surface-2);
  color: var(--text);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

.section-block + .section-block,
.rules {
  margin-top: 24px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading h2,
.composer h2,
.rules h2 {
  margin-bottom: 0;
  font-size: 1.22rem;
}

.section-heading span {
  color: var(--muted);
  font-size: 0.9rem;
}

.category-list,
.thread-list {
  display: grid;
  gap: 10px;
}

.category-card,
.thread-item,
.composer,
.rules,
.rank-lock,
.rank-card,
.rank-progress {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}

.category-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.category-card:hover,
.category-card:focus-visible {
  border-color: var(--accent);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 52%),
    color-mix(in srgb, var(--surface) 94%, transparent);
  outline: 0;
  transform: translateY(-2px);
}

.category-icon {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: var(--accent);
  box-shadow: inset 0 -16px 28px rgba(0, 0, 0, 0.14);
}

.category-card h3,
.thread-item h3 {
  margin-bottom: 2px;
  font-size: 0.95rem;
  line-height: 1.22;
}

.thread-title-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.thread-title-line h2,
.thread-title-line h3 {
  margin-bottom: 0;
}

.thread-title-line > span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.thread-author {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 2px 8px 2px 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.thread-author img {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  object-fit: cover;
}

.thread-author:hover {
  color: var(--text);
  border-color: var(--accent);
}

.category-card p,
.thread-item p {
  margin: 6px 0 10px;
  color: var(--muted);
  line-height: 1.35;
  font-size: 0.9rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.meta-row span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--surface-2);
}

.thread-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.thread-item:hover,
.thread-item:focus-visible {
  border-color: var(--accent);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 52%),
    color-mix(in srgb, var(--surface) 94%, transparent);
  outline: 0;
  transform: translateY(-2px);
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}

.thread-detail-card,
.comment-form,
.comment-item,
.grow-form,
.grow-log-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}

.grow-section {
  scroll-margin-top: 96px;
}

.grow-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: stretch;
  padding: 14px;
  margin-bottom: 12px;
}

.grow-form label,
.grow-update-form {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.grow-form input,
.grow-form textarea,
.grow-update-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: 0;
}

.grow-form input {
  min-height: 42px;
  padding: 0 12px;
}

.grow-form textarea,
.grow-update-form textarea {
  min-height: 130px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.35;
}

.grow-editor-field {
  position: relative;
}

.grow-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: var(--surface-2);
}

.grow-editor-field textarea {
  border-radius: 0 0 8px 8px;
}

.grow-tool-button,
.grow-emoji-row button {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  background: var(--bg);
  color: var(--text);
  font-weight: 900;
}

.grow-tool-button.active {
  border-color: var(--lime);
  color: #071008;
  background: linear-gradient(135deg, var(--lime), var(--gold));
}

.grow-emoji-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.grow-selected-media {
  padding: 9px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.grow-poll-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.grow-poll-editor label:first-child {
  grid-column: 1 / -1;
}

.grow-poll-editor .ghost-button {
  grid-column: 1 / -1;
  width: fit-content;
}

.private-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.private-selected-media {
  margin-top: -2px;
}

.grow-log-list {
  display: grid;
  gap: 10px;
}

.grow-log-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
}

.grow-log-detail-card {
  cursor: default;
}

.grow-log-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.grow-log-card h3 {
  margin-bottom: 4px;
  font-size: 1rem;
}

.grow-log-card header > span {
  flex: 0 0 auto;
  min-height: 26px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.grow-author {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 900;
  cursor: pointer;
}

.grow-timeline {
  display: grid;
  gap: 0;
}

.grow-update {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  position: relative;
}

.grow-update:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 18px;
  bottom: -2px;
  width: 2px;
  background: var(--line);
}

.grow-dot {
  width: 18px;
  height: 18px;
  margin-top: 4px;
  border: 3px solid var(--green);
  border-radius: 50%;
  background: var(--surface);
  z-index: 1;
}

.grow-update div {
  padding: 8px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.grow-update small {
  color: var(--muted);
  font-weight: 800;
}

.grow-update p {
  margin: 4px 0 0;
  color: var(--text);
  line-height: 1.42;
  white-space: pre-wrap;
}

.grow-update-form {
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.6fr) auto;
  align-items: end;
}

.grow-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 160px));
  gap: 8px;
  margin-top: 8px;
}

.grow-media-grid img,
.grow-media-grid video,
.grow-media-grid audio {
  width: 100%;
  height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: var(--surface);
}

.grow-poll-card {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--lime) 55%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--lime) 10%, var(--surface));
}

.grow-poll-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
  padding: 0 10px;
}

.grow-poll-option.active {
  border-color: var(--lime);
  background: color-mix(in srgb, var(--lime) 20%, var(--surface));
}

.grow-poll-option em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
}

.affiliate-section {
  display: grid;
  gap: 16px;
}

.affiliate-tabs {
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}

.affiliate-open-editor {
  width: fit-content;
  padding: 0 18px;
}

.affiliate-creator {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.affiliate-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.affiliate-form label:nth-of-type(4),
.affiliate-rich-editor-field,
.affiliate-form .media-drop {
  grid-column: span 2;
}

.affiliate-rich-editor {
  min-height: 220px;
}

.affiliate-rich-toolbar {
  border-bottom: 1px solid var(--line);
}

.affiliate-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 220px));
  gap: 12px;
}

.affiliate-card {
  display: grid;
  gap: 8px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition:
    transform 0.16s ease;
}

.affiliate-card:hover,
.affiliate-card:focus-visible {
  transform: translateY(-2px);
  outline: 0;
}

.affiliate-card-image {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--green) 24%, transparent), transparent),
    var(--surface-2);
  color: var(--green);
  font-size: 1.4rem;
  font-weight: 900;
}

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

.affiliate-card h3 {
  margin: 0;
  text-align: center;
  font-size: 1rem;
  line-height: 1.18;
}

.affiliate-card span {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.app-download-section {
  display: grid;
  gap: 16px;
}

.app-download-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.app-download-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--green) 12%, transparent), transparent 62%),
    var(--surface);
}

.app-download-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--lime) 16%, var(--surface-2));
  color: var(--lime);
  font-weight: 900;
  font-size: 1.15rem;
}

.app-download-card h3,
.app-download-card p {
  margin: 0;
}

.app-download-card p {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.42;
}

.app-download-card .submit-button,
.app-download-card .ghost-button {
  grid-column: 1 / -1;
}

.apk-download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.browser-install-button {
  min-height: 42px;
}

.app-install-status {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--green) 44%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--green) 10%, var(--surface));
  color: var(--text);
  font-weight: 800;
  line-height: 1.4;
}

.affiliate-detail:empty {
  display: none;
}

.affiliate-page {
  display: grid;
  gap: 14px;
  margin-top: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.affiliate-page h3 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.affiliate-page-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.affiliate-edit-button {
  flex: 0 0 auto;
  padding: 0 14px;
}

.affiliate-banner {
  display: grid;
  place-items: center;
  min-height: clamp(150px, 28vw, 290px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--gold) 18%, transparent), transparent),
    #050505;
  color: var(--gold);
  font-size: clamp(1.4rem, 4vw, 2.8rem);
  font-weight: 900;
}

.affiliate-banner img {
  width: 100%;
  height: 100%;
  min-height: inherit;
  object-fit: cover;
}

.affiliate-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 14px;
  align-items: start;
}

.affiliate-description {
  min-height: 160px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  line-height: 1.6;
}

.affiliate-description p,
.affiliate-description ul,
.affiliate-description ol,
.affiliate-description blockquote {
  margin: 0 0 10px;
}

.affiliate-description blockquote {
  padding: 10px 12px;
  border-left: 3px solid var(--green);
  border-radius: 6px;
  background: color-mix(in srgb, var(--green) 10%, var(--surface-2));
}

.affiliate-description .affiliate-font-small,
.affiliate-rich-editor .affiliate-font-small {
  font-size: 0.86rem;
}

.affiliate-description .affiliate-font-medium,
.affiliate-rich-editor .affiliate-font-medium {
  font-size: 1rem;
}

.affiliate-description .affiliate-font-large,
.affiliate-rich-editor .affiliate-font-large {
  font-size: 1.28rem;
  line-height: 1.42;
}

.affiliate-description .topic-inline-image {
  margin: 12px 0;
}

.affiliate-description .topic-inline-image img {
  width: 100%;
  max-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #000000;
}

.affiliate-contact {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.affiliate-contact div {
  display: grid;
  gap: 3px;
}

.affiliate-contact span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.affiliate-contact strong {
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}

.compact-media-drop {
  min-height: 0;
  padding: 10px;
}

.thread-detail-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 16px;
  margin: 12px 0 18px;
  padding: clamp(18px, 4vw, 28px);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--thread-accent) 18%, transparent), transparent 55%),
    var(--surface);
  box-shadow: var(--shadow);
}

.thread-detail-card h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.18;
}

.thread-detail-card .thread-title-line span {
  font-size: 0.84rem;
}

.thread-detail-card p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.55;
}

.thread-owner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.author-profile-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-2) 76%, transparent);
}

.author-profile-card strong,
.author-profile-card span {
  display: block;
}

.author-profile-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.thread-media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.thread-media-grid:empty {
  display: none;
}

.thread-media-grid img,
.thread-media-grid video {
  width: 100%;
  max-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: #000000;
}

.comment-list {
  display: grid;
  gap: 10px;
}

.comment-item {
  padding: 14px;
}

.comment-item header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.comment-item strong {
  font-size: 0.94rem;
}

.comment-item span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.comment-item p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.comment-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 16px;
}

.comment-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.comment-form textarea {
  min-height: 118px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  background: var(--surface);
  color: var(--text);
  outline: 0;
}

.comment-form textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(104, 195, 107, 0.18);
}

.vote {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, var(--accent), transparent),
    var(--surface-2);
}

.side-column {
  position: sticky;
  top: 96px;
}

.composer,
.rules {
  padding: 18px;
}

.composer p {
  margin: 12px 0 16px;
  color: var(--muted);
  line-height: 1.45;
}

.composer form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.composer label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.composer input,
.composer select {
  min-height: 42px;
  padding: 0 12px;
}

.composer textarea {
  min-height: 132px;
  resize: vertical;
  padding: 12px;
}

.submit-button {
  width: 100%;
  cursor: pointer;
}

.rules ul {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.45;
}

.ranks-section,
.medals-section,
.hall-section {
  scroll-margin-top: 96px;
}

.vote-user-medal-button {
  width: fit-content;
  margin-bottom: 14px;
  padding: 0 18px;
}

.rank-lock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(114, 174, 230, 0.12), rgba(245, 189, 85, 0.08)),
    color-mix(in srgb, var(--surface) 94%, transparent);
}

.rank-lock h3 {
  margin-bottom: 6px;
}

.rank-lock p {
  margin-bottom: 0;
  color: var(--muted);
}

.rank-lock .submit-button {
  width: auto;
  padding: 0 16px;
  white-space: nowrap;
}

.rank-area {
  display: grid;
  gap: 12px;
}

.rank-progress {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  background: var(--line);
}

.rank-progress div {
  padding: 16px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}

.rank-progress span,
.rank-progress strong {
  display: block;
}

.rank-progress span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.rank-progress strong {
  margin-top: 6px;
  font-size: 1.25rem;
}

.rank-list,
.medal-list,
.raffle-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.raffle-list {
  grid-template-columns: 1fr;
}

.raffle-creator {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--green) 40%, var(--line));
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--green) 10%, transparent), transparent 58%),
    color-mix(in srgb, var(--surface) 94%, transparent);
}

.compact-heading {
  margin-bottom: 0;
}

.compact-heading h3 {
  margin: 0;
  font-size: 1.05rem;
}

.raffle-card {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--gold) 60%, var(--line));
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--gold) 12%, transparent), transparent 56%),
    color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
}

.raffle-summary {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
}

.raffle-summary h3 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.12;
}

.raffle-summary-grid {
  display: grid;
  gap: 8px;
}

.raffle-summary-grid div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.raffle-summary-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.raffle-summary-grid strong {
  color: var(--text);
  font-size: 0.86rem;
  text-align: right;
}

.raffle-winner-badge {
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--green) 55%, var(--line));
  border-radius: 8px;
  color: var(--green);
  background: color-mix(in srgb, var(--green) 12%, var(--surface));
  font-size: 0.86rem;
  font-weight: 900;
}

.raffle-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 14px;
  min-width: 0;
}

.raffle-main {
  display: grid;
  gap: 12px;
}

.raffle-description {
  color: var(--muted);
  line-height: 1.5;
}

.raffle-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.raffle-stats div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.raffle-stats strong {
  display: block;
  color: var(--gold);
  font-size: 1rem;
}

.raffle-stats span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.raffle-buy-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 180px) minmax(0, 140px);
  gap: 8px;
  align-items: center;
}

.raffle-buy-row input {
  min-height: 44px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.raffle-ticket-board {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.raffle-ticket-list {
  display: grid;
  gap: 6px;
  max-height: 360px;
  overflow: auto;
}

.raffle-ticket-list span {
  min-height: 30px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 800;
}

.raffle-ticket-list .winner-ticket {
  border-color: color-mix(in srgb, var(--green) 70%, var(--line));
  color: var(--green);
  background: color-mix(in srgb, var(--green) 12%, var(--surface));
}

.raffle-media:empty {
  display: none;
}

.rank-card,
.medal-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.rank-card.current {
  border-color: var(--rank-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rank-color) 20%, transparent);
}

.rank-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rank-badge {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.55), transparent 18px),
    linear-gradient(135deg, var(--rank-color), color-mix(in srgb, var(--rank-color) 50%, #101312));
}

.rank-image,
.medal-image {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
}

.rank-card h3 {
  margin-bottom: 4px;
}

.rank-threshold,
.rank-description {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.42;
}

.rank-card ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.medal-card {
  position: relative;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: start;
  gap: 10px 12px;
}

.medal-art {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.55), transparent 20px),
    linear-gradient(135deg, var(--medal-color), color-mix(in srgb, var(--medal-color) 45%, #101312));
  box-shadow: inset 0 -14px 28px rgba(0, 0, 0, 0.16);
}

.medal-card .medal-image {
  grid-column: 1;
  grid-row: 1;
  width: 56px;
  height: 56px;
}

.medal-card h3 {
  margin-bottom: 8px;
}

.medal-description,
.medal-requirement {
  margin-bottom: 6px;
  color: var(--muted);
  line-height: 1.32;
  font-size: 0.84rem;
}

.medal-description {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.medal-requirement {
  padding: 7px 9px;
  border: 1px solid color-mix(in srgb, var(--medal-color) 42%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--medal-color) 10%, var(--surface-2));
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.medal-card .meta-row {
  margin-top: 4px;
  font-size: 0.78rem;
}

.medal-vote {
  grid-column: 1 / -1;
  width: fit-content;
  padding: 0 14px;
}

.medal-vote.active {
  border-color: var(--medal-color);
  color: #101312;
  background: linear-gradient(135deg, var(--medal-color), var(--gold));
}

.hall-ranking {
  display: grid;
  gap: 10px;
}

.hall-row {
  display: grid;
  grid-template-columns: 44px 48px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--medal-color) 48%, var(--line));
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--medal-color) 14%, transparent), transparent),
    var(--surface);
}

.hall-row > strong {
  color: var(--medal-color);
  font-size: 1rem;
}

.hall-row img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.hall-row div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.hall-row button {
  width: fit-content;
  max-width: 100%;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
  font: inherit;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.hall-row span {
  color: var(--muted);
  font-size: 0.86rem;
}

.hall-medal-image {
  justify-self: end;
}

.medal-vote-panel select {
  width: 100%;
}

.danger-text {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 55%, var(--line));
}

.email-shell {
  position: fixed;
  inset: 0;
  z-index: 86;
}

.password-shell {
  position: fixed;
  inset: 0;
  z-index: 86;
}

.settings-shell {
  position: fixed;
  inset: 0;
  z-index: 82;
}

.profile-shell {
  position: fixed;
  inset: 0;
  z-index: 80;
}

.story-album-shell {
  position: fixed;
  inset: 0;
  z-index: 96;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  overflow: auto;
}

#storyAlbumShell {
  background: transparent;
  overflow: hidden;
}

#storyAlbumShell #storyAlbumBackdrop {
  background: transparent;
  backdrop-filter: none;
}

#storyAlbumShell .story-album-panel {
  width: min(340px, calc(100% - 36px));
  max-height: calc(100dvh - 48px);
  height: auto;
  min-height: 0;
  margin: 0;
  overflow: visible;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
}

.profile-panel {
  width: min(1120px, calc(100% - 28px));
}

.settings-panel {
  position: relative;
  display: grid;
  gap: 16px;
  width: min(760px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  margin: 14px auto;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, var(--blue));
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.45);
}

.settings-banner {
  position: relative;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 16px;
  align-items: end;
  min-height: 220px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.32)),
    var(--settings-banner, url("assets/terphub-logo.png")) center / cover no-repeat,
    var(--surface);
}

.settings-banner .icon-button {
  position: absolute;
  top: 12px;
  right: 12px;
}

.profile-settings-button {
  position: absolute;
  top: 12px;
  right: 58px;
  width: 38px;
  height: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 6px;
  border: 1px solid color-mix(in srgb, var(--neon) 48%, var(--line));
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.72);
  box-shadow: 0 0 16px var(--neon-soft);
  cursor: pointer;
}

.profile-settings-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.settings-banner h2 {
  margin-bottom: 6px;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 0.95;
}

.settings-banner p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--muted);
}

.settings-avatar {
  width: 88px;
  height: 88px;
  border: 2px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.settings-grid input[type="text"],
.settings-grid input[type="email"],
.settings-grid input[type="color"],
.settings-grid textarea {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: 0;
}

.settings-grid input[type="text"],
.settings-grid input[type="email"],
.settings-grid textarea {
  padding: 0 12px;
}

.settings-grid textarea {
  min-height: 108px;
  padding-top: 12px;
  resize: vertical;
  line-height: 1.45;
}

.wide-field {
  grid-column: 1 / -1;
}

.profile-visibility-field {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-2) 72%, transparent);
}

.profile-visibility-field > div:first-child {
  display: grid;
  gap: 4px;
}

.profile-visibility-field strong {
  color: var(--text);
  font-size: 0.92rem;
}

.profile-visibility-field span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.visibility-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.visibility-check {
  display: inline-flex !important;
  grid-auto-flow: column;
  align-items: center;
  gap: 7px !important;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text) !important;
  font-size: 0.82rem !important;
}

.visibility-check input {
  width: 14px;
  height: 14px;
  accent-color: var(--green);
}

.visibility-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.profile-bio {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}

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

.profile-medals-title,
.profile-medals-empty {
  grid-column: 1 / -1;
}

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

.profile-badges span {
  min-width: 42px;
  min-height: 34px;
  padding: 8px 10px;
  display: inline-grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--medal-color) 70%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--medal-color) 18%, var(--surface));
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 900;
}

.profile-medal-card {
  min-height: 96px;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--medal-color) 70%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--medal-color) 16%, var(--surface));
  text-align: center;
}

.profile-medal-card img {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.profile-medal-card span {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.2;
}

.profile-story-albums {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 168px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--neon) 34%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
}

.profile-story-albums header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-story-albums h3 {
  margin: 0 0 4px;
  font-size: 1rem;
  line-height: 1.2;
}

.profile-story-albums header span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.profile-story-album-list {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 186px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 2px 2px 18px;
  scrollbar-width: thin;
}

.profile-story-album {
  flex: 0 0 116px;
  display: grid;
  gap: 7px;
  align-content: start;
  text-align: center;
  position: relative;
}

.profile-story-album-cover {
  width: 94px;
  height: 94px;
  margin: 0 auto;
  padding: 3px;
  border: 2px solid var(--neon);
  border-radius: 999px;
  background: #000;
  color: var(--neon);
  box-shadow: 0 0 18px var(--neon-soft);
  cursor: pointer;
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.profile-story-album-add {
  display: grid;
  place-items: center;
  border-style: dashed;
  font-size: 2.25rem;
  font-weight: 900;
  line-height: 1;
}

.profile-story-album-create strong {
  color: var(--neon);
}

.profile-story-album-cover img,
.profile-story-album-cover video {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  background: #000;
}

.profile-story-album strong {
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.15;
}

.profile-story-album > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.profile-story-hint {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
}

.profile-story-album-menu {
  display: grid;
  gap: 6px;
  width: 100%;
  margin-top: 2px;
}

.profile-story-album-menu.hidden {
  display: none;
}

.profile-story-album-menu button {
  width: 100%;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--neon);
  border-radius: 999px;
  background: color-mix(in srgb, var(--neon) 16%, #000);
  color: var(--text);
  box-shadow: 0 0 14px var(--neon-soft);
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}

.profile-story-album-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.profile-story-album-actions .tiny-button {
  min-height: 28px;
  padding: 0 7px;
  font-size: 0.72rem;
}

.profile-story-album-actions .tiny-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.profile-story-empty {
  width: 100%;
  margin: 0;
  padding: 12px;
  border: 1px dashed color-mix(in srgb, var(--neon) 28%, var(--line));
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-align: center;
}

.story-album-panel,
.story-highlight-panel,
.story-album-pick-panel {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(440px, calc(100% - 28px));
  max-height: calc(100dvh - max(28px, env(safe-area-inset-top)) - max(28px, env(safe-area-inset-bottom)));
  margin-top: max(8vh, calc(env(safe-area-inset-top) + 18px));
  overflow: auto;
}

.story-album-panel {
  width: min(360px, calc(100% - 34px));
  max-height: none;
  height: auto;
  min-height: 0;
  margin: 0;
  align-content: start;
  overflow: visible;
}

.story-album-panel header,
.story-highlight-panel header,
.story-album-pick-panel header {
  padding-right: 44px;
}

.story-album-panel h2,
.story-highlight-panel h2,
.story-album-pick-panel h2 {
  margin: 2px 0 6px;
  font-size: clamp(1.8rem, 7vw, 2.6rem);
  line-height: 1;
}

.story-album-panel header p:last-child,
.story-highlight-panel header p:last-child,
.story-album-pick-panel header p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.story-album-panel > .icon-button,
.story-highlight-panel > .icon-button,
.story-album-pick-panel > .icon-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
}

.story-album-form {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.story-album-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
}

.story-album-form input[type="text"] {
  min-height: 46px;
  width: 100%;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--neon) 28%, var(--line));
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: 0;
}

.story-album-form input[type="text"]:focus {
  border-color: var(--neon);
  box-shadow: 0 0 0 3px var(--neon-soft);
}

.story-album-picker {
  justify-self: center;
  width: 116px;
  height: 116px;
  min-height: 116px;
  display: grid;
  place-items: center;
  padding: 4px;
  border: 2px dashed var(--neon);
  border-radius: 999px;
  background: #000;
  color: var(--neon);
  box-shadow: 0 0 24px var(--neon-soft);
  cursor: pointer;
  overflow: hidden;
}

.story-album-picker span {
  font-size: 2.8rem;
  font-weight: 900;
  line-height: 1;
}

.story-album-picker img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.story-album-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  min-width: 0;
}

.story-album-actions > button {
  width: 100%;
  min-width: 0;
}

.story-album-pick-list {
  display: grid;
  gap: 10px;
}

.story-album-pick-option {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--neon) 30%, var(--line));
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.story-album-pick-cover {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 2px solid var(--neon);
  border-radius: 999px;
  color: var(--neon);
  background: #000;
  overflow: hidden;
}

.story-album-pick-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.story-highlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
  max-height: min(46vh, 420px);
  overflow: auto;
  padding-right: 2px;
}

.story-highlight-option {
  display: grid;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}

.story-highlight-option.selected {
  border-color: var(--neon);
  color: var(--text);
  box-shadow: 0 0 18px var(--neon-soft);
}

.story-highlight-option img,
.story-highlight-option video {
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 6px;
  object-fit: cover;
  background: #000;
}

.profile-medals-title {
  color: var(--text);
  font-size: 0.9rem;
}

.profile-medals-empty {
  color: var(--muted);
  font-size: 0.86rem;
}

.profile-badges span {
  border-color: color-mix(in srgb, var(--rank-color) 70%, var(--line));
  background: color-mix(in srgb, var(--rank-color) 20%, var(--surface));
}

.profile-instagram {
  width: fit-content;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--gold);
  font-weight: 900;
  text-decoration: none;
  background: var(--surface-2);
}

.profile-instagram:hover {
  border-color: var(--gold);
}

.profile-activity {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.profile-activity-tabs {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.profile-activity-tabs button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  text-align: left;
  padding: 0 12px;
}

.profile-activity-tabs button.active {
  background: var(--surface-2);
  color: var(--text);
}

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

.profile-publications-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.profile-publication-tile {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--neon) 28%, var(--line));
  border-radius: 8px;
  padding: 0;
  cursor: pointer;
  background: #050505;
}

.profile-publication-tile img,
.profile-publication-tile video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-publication-tile span {
  position: absolute;
  right: 6px;
  bottom: 6px;
  max-width: calc(100% - 12px);
  overflow: hidden;
  border-radius: 999px;
  padding: 4px 7px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-activity-item {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}

.profile-activity-item:hover {
  border-color: var(--green);
}

.profile-activity-item h3 {
  margin: 0;
  font-size: 0.98rem;
}

.profile-activity-item span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.profile-activity-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.42;
}

.permission-fieldset {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.permission-fieldset legend {
  padding: 0 8px;
  color: var(--text);
  font-weight: 900;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.permission-check {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.2;
}

.permission-check input {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--green);
}

.permission-check span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.toggle-row {
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 58px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.toggle-row input {
  width: 22px;
  height: 22px;
}

.topic-shell {
  position: fixed;
  inset: 0;
  z-index: 86;
  overflow: auto;
  padding: 18px;
  background: #000000;
}

.topic-panel {
  display: grid;
  gap: 18px;
  width: min(1180px, 100%);
  min-height: calc(100vh - 36px);
  margin: 0 auto;
  border: 1px solid color-mix(in srgb, var(--line) 70%, var(--green));
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(104, 195, 107, 0.08), transparent 34%),
    var(--bg);
}

.topic-panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: clamp(18px, 3vw, 28px);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(110deg, rgba(23, 27, 25, 0.86), rgba(23, 27, 25, 0.58)),
    url("assets/terphub-logo.png") right 24px center / 120px no-repeat,
    var(--surface);
}

.topic-panel-header h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.95;
}

.topic-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
  padding: 0 clamp(18px, 3vw, 28px) clamp(18px, 3vw, 28px);
}

.topic-editor-main,
.topic-editor-side {
  display: grid;
  gap: 14px;
}

.topic-editor-main label,
.field-label,
.topic-editor-side label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.topic-editor-main input,
.topic-editor-main textarea,
.topic-editor-side select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: 0;
}

.topic-editor-main input,
.topic-editor-side select {
  min-height: 48px;
  padding: 0 14px;
}

.topic-editor-main textarea {
  min-height: min(54vh, 520px);
  padding: 16px;
  resize: vertical;
  line-height: 1.55;
}

.rich-editor-field {
  display: grid;
  gap: 8px;
  align-content: start;
}

.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: var(--surface);
}

.rich-toolbar button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  background: var(--bg);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 900;
}

.rich-toolbar button:hover {
  border-color: var(--green);
}

.image-editor-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--green) 45%, var(--line));
  border-bottom: 0;
  background: color-mix(in srgb, var(--green) 12%, var(--surface));
}

.image-editor-tools span {
  margin-right: 4px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 900;
}

.image-editor-tools button {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  background: var(--bg);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 900;
}

.image-editor-tools button:hover {
  border-color: var(--green);
}

.rich-editor {
  min-height: min(54vh, 520px);
  padding: 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  background: var(--surface);
  color: var(--text);
  line-height: 1.7;
  outline: 0;
}

.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}

.rich-editor:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(104, 195, 107, 0.18);
}

.rich-editor p,
.thread-content p {
  margin: 0 0 14px;
}

.thread-content {
  color: var(--text);
  line-height: 1.7;
}

.rich-editor blockquote,
.thread-detail-card blockquote {
  margin: 14px 0;
  padding: 12px 14px;
  border-left: 3px solid var(--green);
  border-radius: 0 8px 8px 0;
  background: var(--surface-2);
  color: var(--text);
}

.rich-editor ul,
.rich-editor ol,
.thread-detail-card ul,
.thread-detail-card ol {
  margin: 12px 0 16px;
  padding-left: 22px;
}

.rich-editor img,
.thread-content img {
  display: block;
  max-width: 100%;
  max-height: 520px;
  margin: 16px auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
}

.topic-inline-image {
  position: relative;
  margin: 18px 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  cursor: grab;
}

.topic-inline-image img {
  margin: 0 auto;
}

.topic-inline-image.image-small {
  width: min(260px, 100%);
}

.topic-inline-image.image-medium {
  width: min(520px, 100%);
}

.topic-inline-image.image-large {
  width: 100%;
}

.topic-inline-image.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(104, 195, 107, 0.18);
}

.topic-inline-image:focus,
.topic-inline-image:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(104, 195, 107, 0.18);
}

.topic-editor-main input:focus,
.topic-editor-main textarea:focus,
.rich-editor:focus,
.topic-editor-side select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(104, 195, 107, 0.18);
}

.topic-editor-side {
  position: sticky;
  top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}

.media-drop {
  min-height: 138px;
  align-content: center;
  padding: 14px;
  border: 1px dashed color-mix(in srgb, var(--line) 70%, var(--green));
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  cursor: pointer;
}

.media-drop input {
  width: 100%;
}

.media-drop span {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.4;
}

.media-preview-list {
  display: grid;
  gap: 10px;
}

.media-preview {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.media-preview img,
.media-preview video {
  display: block;
  width: 100%;
  max-height: 190px;
  object-fit: cover;
  background: #000000;
}

.media-preview span {
  display: block;
  padding: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.email-panel {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(480px, calc(100% - 28px));
  margin: min(9vh, 80px) auto;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, var(--gold));
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(245, 189, 85, 0.12), transparent 42%),
    var(--bg);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.45);
}

.email-art {
  min-height: 174px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(115deg, rgba(5, 5, 5, 0.88), rgba(5, 5, 5, 0.38)),
    url("assets/terphub-login-pattern.jpg") center / cover no-repeat,
    var(--surface);
}

:root.light .email-art {
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.7), rgba(236, 239, 231, 0.2)),
    url("assets/terphub-login-pattern.jpg") center / cover no-repeat,
    var(--surface);
}

.email-art h2 {
  margin-bottom: 8px;
  font-size: 2.15rem;
  line-height: 0.98;
}

.email-art p:not(.eyebrow) {
  max-width: 280px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.email-step {
  display: grid;
  gap: 14px;
}

.auth-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.auth-mode button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.auth-mode button.active {
  background: var(--surface-2);
  color: var(--text);
}

.email-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.email-panel input,
.email-panel select {
  min-height: 42px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: 0;
}

.email-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.verify-notice {
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, var(--gold));
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-2) 72%, transparent);
}

.verify-notice strong,
.verify-notice p {
  display: block;
  margin: 0;
}

.verify-notice p {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.4;
}

.hidden {
  display: none;
}

.admin-shell {
  position: fixed;
  inset: 0;
  z-index: 84;
  overflow: auto;
  background: var(--bg);
}

.admin-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(104, 195, 107, 0.2), transparent 34%),
    rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(10px);
}

.admin-panel {
  position: relative;
  display: grid;
  gap: 18px;
  width: 100%;
  min-height: 100dvh;
  margin: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(160deg, rgba(104, 195, 107, 0.12), transparent 38%),
    var(--bg);
  box-shadow: none;
}

.admin-hero {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: clamp(20px, 4vw, 34px);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(110deg, rgba(23, 27, 25, 0.94), rgba(32, 38, 32, 0.7));
}

:root.light .admin-hero {
  background: linear-gradient(110deg, rgba(255, 255, 255, 0.94), rgba(236, 239, 231, 0.74));
}

.admin-hero h2 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 0.95;
}

.admin-hero p:not(.eyebrow) {
  max-width: 560px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.login-card,
.admin-dashboard {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto 28px;
}

.login-card {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr auto;
  gap: 14px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}

.login-card h3 {
  margin-bottom: 6px;
}

.login-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.login-card label,
.admin-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.login-card input,
.admin-form input,
.admin-form select {
  min-height: 42px;
  padding: 0 12px;
}

.admin-form textarea {
  min-height: 110px;
  padding: 12px;
  resize: vertical;
}

.form-error {
  grid-column: 1 / -1;
  color: var(--red);
  font-weight: 800;
}

.admin-dashboard {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
}

.admin-tabs {
  display: grid;
  gap: 8px;
  align-self: start;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.admin-tabs button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  text-align: left;
  padding: 0 12px;
}

.admin-tabs button.active {
  background: var(--surface-2);
  color: var(--text);
}

.admin-view {
  display: grid;
  gap: 16px;
}

.admin-user-controls {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto auto minmax(140px, 1fr) auto auto;
  gap: 8px;
  align-items: end;
}

.admin-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
}

.moderation-icon {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.moderation-icon:hover {
  color: var(--text);
  border-color: var(--gold);
}

.moderation-icon.delete-user {
  color: var(--red);
}

.admin-user-assets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.admin-user-assets div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.admin-user-assets strong {
  color: var(--text);
  font-size: 0.75rem;
}

.admin-user-assets span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.admin-user-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.admin-user-controls select {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.mute-indicator {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border: 1px solid color-mix(in srgb, var(--red) 55%, var(--line));
  border-radius: 7px;
  background: color-mix(in srgb, var(--red) 12%, var(--surface));
  color: var(--red);
  font-size: 0.72rem;
  font-weight: 900;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.profile-panel .admin-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-metrics div,
.profile-metric-button,
.admin-form,
.admin-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}

.admin-helper {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.admin-security-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.admin-security-tools p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.admin-metrics div,
.profile-metric-button {
  min-height: 92px;
  padding: 16px;
}

.admin-metrics strong,
.admin-metrics span {
  display: block;
}

.admin-metrics strong {
  font-size: 1.8rem;
}

.admin-metrics span {
  color: var(--muted);
  font-size: 0.86rem;
}

.profile-metric-button {
  cursor: pointer;
  color: var(--text);
  font: inherit;
  text-align: left;
}

.profile-metric-button:hover {
  border-color: color-mix(in srgb, var(--green) 52%, var(--line));
  background: color-mix(in srgb, var(--green) 12%, var(--surface));
}

.profile-social-list {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--green) 40%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-2) 78%, transparent);
}

.profile-social-list header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profile-social-list h3 {
  margin: 0;
  font-size: 1rem;
}

.profile-social-list > div {
  display: grid;
  gap: 8px;
}

.profile-social-user {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  background: var(--surface);
  text-align: left;
}

.profile-social-user:hover {
  border-color: color-mix(in srgb, var(--green) 50%, var(--line));
}

.profile-social-user img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
}

.profile-social-user strong {
  overflow: hidden;
  font-size: 0.95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-dashboard {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.stat-card,
.chart-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(104, 195, 107, 0.08), transparent 42%),
    color-mix(in srgb, var(--surface) 94%, transparent);
}

.stat-card {
  min-height: 178px;
  padding: 16px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  overflow: hidden;
}

.stat-card span,
.stat-card small,
.chart-panel span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.stat-card strong {
  color: var(--text);
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  line-height: 1;
}

.stat-mini-chart {
  display: flex;
  align-items: end;
  gap: 6px;
  min-height: 70px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
}

.stat-mini-chart i {
  flex: 1;
  min-height: 8px;
  border-radius: 999px 999px 3px 3px;
  background: linear-gradient(180deg, var(--mini-color), color-mix(in srgb, var(--mini-color) 38%, transparent));
  box-shadow: 0 0 18px color-mix(in srgb, var(--mini-color) 28%, transparent);
}

.stat-donut {
  width: 86px;
  height: 86px;
  place-self: center;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--surface) 0 54%, transparent 55%),
    conic-gradient(var(--donut-color) var(--donut-value), color-mix(in srgb, var(--line) 70%, transparent) 0);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 900;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stats-line-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.chart-panel {
  min-height: 280px;
  padding: 16px;
}

.chart-panel header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  margin-bottom: 16px;
}

.line-stat-card {
  min-height: 330px;
}

.line-stat-card header {
  align-items: start;
}

.line-stat-card h3,
.line-stat-card span {
  display: block;
}

.range-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
}

.range-toggle button {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.range-toggle button.active {
  background: var(--green);
  color: #101312;
}

.line-stat-chart {
  min-height: 230px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  border-radius: 8px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 82%, transparent), color-mix(in srgb, var(--bg) 90%, transparent));
  overflow: hidden;
}

.line-stat-chart svg {
  display: block;
  width: 100%;
  height: 230px;
}

.line-grid line {
  stroke: color-mix(in srgb, var(--line) 72%, transparent);
  stroke-width: 1;
}

.line-grid text,
.line-labels text {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.line-labels text {
  text-anchor: middle;
}

.line-path {
  fill: none;
  stroke: var(--green);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
  filter: drop-shadow(0 0 8px rgba(104, 195, 107, 0.35));
}

.line-points circle {
  fill: var(--bg);
  stroke: var(--gold);
  stroke-width: 2.4;
}

.chart-panel h3 {
  margin: 0;
  font-size: 1rem;
}

.line-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  min-height: 190px;
  align-items: end;
}

.line-chart-day {
  display: grid;
  gap: 8px;
  align-items: end;
  min-width: 0;
}

.line-stack {
  height: 150px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 3px;
  padding: 8px 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.line-stack span {
  width: 8px;
  min-height: 4px;
  border-radius: 999px 999px 3px 3px;
}

.line-stack .visits {
  background: var(--green);
}

.line-stack .topics {
  background: var(--gold);
}

.line-stack .replies {
  background: var(--blue);
}

.line-chart-day small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-align: center;
}

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

.stat-bar-row {
  display: grid;
  gap: 7px;
}

.stat-bar-row > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.stat-bar-row strong {
  min-width: 0;
  color: var(--text);
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-bar-row span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.stat-bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg);
}

.stat-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--bar-color, var(--green));
}

.admin-form {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.compact-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-form label:nth-of-type(2),
.compact-form button {
  grid-column: 1 / -1;
}

.admin-list {
  display: grid;
  gap: 10px;
}

.admin-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
}

.user-admin-list article {
  grid-template-columns: minmax(0, 1fr);
}

.admin-list article.pending-review-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.pending-review-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.admin-topic-preview {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  margin-top: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.admin-topic-preview header {
  display: grid;
  gap: 3px;
}

.admin-topic-preview h4 {
  margin: 0;
  font-size: 1rem;
}

.admin-topic-preview header span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.admin-topic-preview .thread-media-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.admin-topic-preview .thread-media-grid img,
.admin-topic-preview .thread-media-grid video {
  object-fit: contain;
}

.admin-list h3 {
  margin-bottom: 4px;
  font-size: 0.98rem;
}

.admin-list p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.ghost-button,
.danger-button,
.tiny-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

.danger-button {
  width: fit-content;
  padding: 0 14px;
  border-color: rgba(239, 116, 111, 0.55);
  color: var(--red);
}

.tiny-button {
  min-height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 0.76rem;
}

.tiny-button.danger {
  color: var(--red);
}

.primary-action,
.submit-button,
.range-toggle button.active {
  background: var(--neon);
  color: #071008;
  box-shadow: 0 0 18px var(--neon-soft);
}

.primary-action:hover,
.submit-button:hover,
.range-toggle button.active:hover {
  background: color-mix(in srgb, var(--neon) 84%, #ffffff);
}

.grow-tool-button.active,
.social-action:hover,
.social-action.active {
  border-color: var(--neon);
  color: var(--neon);
  background: color-mix(in srgb, var(--neon) 10%, transparent);
  box-shadow: 0 0 16px var(--neon-soft);
}

.ghost-button:hover,
.tiny-button:hover,
.inline-link-button:hover,
.profile-activity-item:hover {
  border-color: var(--neon);
  color: var(--neon);
}

.permission-check input,
.toggle-row input,
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--neon);
}

.email-entry,
.settings-entry,
.messages-entry,
.icon-button,
.secondary-action,
.stats-panel,
.stats-panel div,
.email-panel,
.email-art,
.login-card,
.settings-panel,
.settings-banner,
.admin-dashboard,
.admin-tabs,
.auth-mode,
.profile-preview-stats div,
.author-profile-card div,
.raffle-stats div,
.permission-fieldset,
.permission-check,
.toggle-row,
.media-drop,
.rich-editor,
.editor-toolbar,
.private-editor-toolbar,
.grow-editor-toolbar,
.grow-poll-editor,
.raffle-ticket-list span,
.profile-activity-item,
.thread-author,
.chat-message,
.private-message-bubble,
.bottom-bar button,
.dock-button,
.profile-preview-card,
.profile-panel {
  border-color: color-mix(in srgb, var(--neon) 42%, var(--line));
}

.email-entry,
.settings-entry,
.messages-entry,
.icon-button,
.secondary-action {
  box-shadow: 0 0 12px color-mix(in srgb, var(--neon-soft) 72%, transparent);
}

.icon-button:hover,
.admin-entry:hover,
.email-entry:hover,
.settings-entry:hover,
.messages-entry:hover,
.secondary-action:hover,
.auth-mode button.active {
  border-color: var(--neon);
  color: var(--neon);
  background: color-mix(in srgb, var(--neon) 14%, var(--surface-2));
}

.email-panel input,
.email-panel select,
.login-card input,
.admin-form input,
.admin-form select,
.admin-form textarea,
.settings-grid input,
.settings-grid select,
.settings-grid textarea,
.composer input,
.composer select,
.composer textarea,
.private-message-form textarea,
.temple-chat-form input,
.home-chat-form input {
  border-color: color-mix(in srgb, var(--neon) 34%, var(--line));
}

.email-panel input:focus,
.email-panel select:focus,
.login-card input:focus,
.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus,
.settings-grid input:focus,
.settings-grid select:focus,
.settings-grid textarea:focus,
.composer input:focus,
.composer select:focus,
.composer textarea:focus,
.private-message-form textarea:focus,
.temple-chat-form input:focus,
.home-chat-form input:focus {
  border-color: var(--neon);
  box-shadow: 0 0 0 3px var(--neon-soft);
}

@media (max-width: 900px) {
  .intro,
  .content-grid,
  .home-columns,
  .topic-editor-grid,
  .grow-form,
  .admin-dashboard,
  .login-card,
  .rank-list,
  .medal-list,
  .app-download-grid {
    grid-template-columns: 1fr;
  }

  .affiliate-form,
  .affiliate-page-grid {
    grid-template-columns: 1fr;
  }

  .affiliate-rich-editor-field,
  .affiliate-form .media-drop {
    grid-column: auto;
  }

  .side-column {
    position: static;
  }

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

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

  .segmented {
    width: 100%;
    min-width: 0;
  }

  .admin-tabs {
    grid-template-columns: repeat(6, 1fr);
  }

  .admin-tabs button {
    text-align: center;
    padding: 0 8px;
  }

  .topic-editor-side {
    position: static;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
  }

  .nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    margin-left: 0;
  }

  .icon-button {
    margin-left: auto;
  }

    .email-entry,
    .admin-entry,
    .settings-entry,
    .messages-entry,
    .nav-button,
    .user-chip {
    order: 2;
  }

  main {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .intro {
    min-height: 0;
    padding: 24px;
    background-size: 230px;
    background-position: right -50px top 24px;
  }

  .category-sidebar-panel {
    width: calc(100% - 20px);
    height: calc(100vh - 20px);
    margin: 10px;
  }

  .chat-panel {
    width: calc(100% - 20px);
    height: calc(100vh - 20px);
    margin: 10px;
  }

  .category-peek,
  .chat-peek {
    top: 50%;
    bottom: auto;
    width: 42px;
    height: 72px;
    font-size: 1.7rem;
    transform: translateY(-50%);
  }

  .chat-peek {
    bottom: auto;
  }

  .home-column {
    min-height: 0;
  }

  .stats-panel {
    grid-template-columns: 1fr;
  }

  .rank-lock,
  .rank-progress,
  .settings-grid,
  .settings-banner,
  .author-profile-card,
  .chat-header,
  .email-actions {
    grid-template-columns: 1fr;
  }

  .chat-header {
    align-items: stretch;
    flex-direction: column;
  }

  .author-profile-card {
    align-items: stretch;
    flex-direction: column;
  }

  .rank-lock {
    align-items: stretch;
    flex-direction: column;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .category-card,
  .thread-item,
  .medal-card,
  .category-detail-hero,
  .thread-detail-card,
  .thread-media-grid {
    grid-template-columns: 1fr;
  }

  .admin-hero {
    background-size: auto;
    background-position: initial;
  }

  .admin-metrics,
  .raffle-card,
  .raffle-detail,
  .raffle-stats,
  .raffle-buy-row,
  .story-composer,
  .story-recorder-controls,
  .story-source-actions,
  .stats-dashboard,
  .stats-line-grid,
  .stats-grid,
  .grow-update-form,
  .admin-user-controls,
  .permission-grid,
  .compact-form,
  .admin-list article {
    grid-template-columns: 1fr;
  }

  .admin-tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .story-composer {
    padding: 10px;
  }

  .story-compose-tools {
    top: 10px;
    right: 10px;
    width: auto;
  }

  .story-compose-tools header {
    min-width: 0;
    width: 188px;
  }

  .story-tool-panel {
    width: min(310px, calc(100vw - 92px));
  }

  .story-compose-media,
  #storyDrawCanvas {
    width: min(calc((100dvh - 168px) * 0.5625), calc(100vw - 84px), 440px);
    max-height: calc(100dvh - 168px);
  }
}

@media (max-width: 720px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  *,
  *::before,
  *::after {
    max-width: 100%;
  }

  button,
  input,
  select,
  textarea {
    font-size: 16px;
  }

  .topbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    gap: 8px;
    min-height: 0;
    padding:
      max(14px, calc(env(safe-area-inset-top) + 14px))
      max(10px, env(safe-area-inset-right))
      10px
      max(10px, env(safe-area-inset-left));
  }

  .terphub-android-app .topbar {
    padding-top: max(76px, calc(env(safe-area-inset-top) + 50px));
  }

  .terphub-android-app {
    --android-app-cutout-top: 76px;
  }

  .topbar > * {
    min-width: 0;
  }

  .brand {
    min-width: 0;
    justify-self: start;
  }

  .brand img {
    width: 38px;
    height: 38px;
  }

  .brand span {
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav {
    grid-column: 1 / -1;
    order: 10;
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    width: 100%;
    margin: 0;
    padding: 2px 0 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .nav a,
  .nav-button,
  .admin-entry,
  .email-entry,
  .settings-entry,
  .messages-entry {
    min-height: 38px;
    flex: 1 1 calc(50% - 6px);
    justify-content: center;
    min-width: 0;
    padding: 0 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.82rem;
  }

  .nav a,
  .nav-button {
    flex: 0 0 auto;
    min-width: max-content;
    scroll-snap-align: start;
  }

  .icon-button {
    width: 40px;
    min-height: 40px;
    margin-left: 0;
  }

  #themeToggle {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    margin-left: 0;
    transform: translateX(0);
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  #adminOpen {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    width: auto;
    min-width: 0;
    max-width: 86px;
    padding: 0 10px;
  }

  .user-chip {
    grid-column: 1 / -1;
    order: 11;
    width: 100%;
    justify-content: space-between;
    padding: 6px 8px;
  }

  .user-chip strong {
    max-width: min(48vw, 220px);
  }

  main {
    width: min(100% - 18px, 1180px);
    padding: 16px 0 40px;
  }

  .intro {
    padding: 22px;
    background-position: center;
    background-size: cover;
  }

  h1 {
    font-size: 3rem;
    line-height: 0.95;
  }

  .intro-copy p:not(.eyebrow) {
    font-size: 1rem;
    line-height: 1.5;
  }

  .intro-copy {
    min-width: 0;
  }

  .intro-actions,
  .toolbar,
  .email-actions,
  .thread-owner-actions,
  .pending-review-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .intro-actions button,
  .toolbar button,
  .email-actions button,
  .thread-owner-actions button,
  .pending-review-actions button,
  .submit-button,
  .ghost-button,
  .danger-button {
    width: 100%;
    min-height: 44px;
  }

  .home-columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  .home-mobile-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 12px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
  }

  .home-mobile-tabs button {
    min-width: 0;
    min-height: 38px;
    padding: 0 6px;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    overflow: hidden;
    background: transparent;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .home-mobile-tabs button.active {
    background: linear-gradient(135deg, var(--green), var(--lime));
    color: #071008;
  }

  .home-column {
    display: none;
    min-width: 0;
    width: 100%;
  }

  .home-column.active {
    display: grid;
  }

  .category-card,
  .thread-item,
  .compact-thread-list .thread-item {
    grid-template-columns: 8px minmax(0, 1fr);
    gap: 11px;
    padding: 13px;
  }

  .category-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .category-icon {
    width: 42px;
    height: 42px;
  }

  .vote,
  .compact-thread-list .vote {
    width: 8px;
    min-height: 100%;
  }

  .thread-title-line {
    align-items: flex-start;
    flex-direction: column;
  }

  .thread-author {
    max-width: 100%;
  }

  .thread-author span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .meta-row {
    gap: 6px;
  }

  .meta-row span {
    min-height: 28px;
    padding: 0 7px;
    font-size: 0.76rem;
  }

  .category-detail-hero {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 12px;
    padding: 16px;
  }

  .category-detail-hero .category-icon {
    width: 48px;
    height: 48px;
  }

  .thread-detail-card {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
  }

  .thread-detail-card .vote {
    width: 100%;
    min-height: 8px;
  }

  .thread-content {
    line-height: 1.58;
    overflow-wrap: anywhere;
  }

  .thread-content img,
  .topic-inline-image {
    max-width: 100%;
  }

  .thread-media-grid,
  .grow-media-grid {
    grid-template-columns: 1fr;
  }

  .thread-media-grid img,
  .thread-media-grid video {
    max-height: 260px;
    object-fit: contain;
  }

  .category-sidebar-panel,
  .chat-panel,
  .private-panel,
  .settings-panel,
  .email-panel,
  .topic-panel,
  .admin-panel {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
    border-right: 0;
    border-left: 0;
    padding: max(14px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .terphub-android-app .category-sidebar-panel,
  .terphub-android-app .chat-panel,
  .terphub-android-app .private-panel,
  .terphub-android-app .settings-panel,
  .terphub-android-app .profile-panel,
  .terphub-android-app .email-panel,
  .terphub-android-app .topic-panel,
  .terphub-android-app .admin-panel {
    height: calc(100dvh - var(--android-app-cutout-top));
    max-height: calc(100dvh - var(--android-app-cutout-top));
    margin-top: var(--android-app-cutout-top);
    padding-top: 14px;
  }

  .category-sidebar-panel,
  .chat-panel,
  .private-panel {
    height: 100dvh;
  }

  .chat-list,
  .private-chat-list {
    max-height: none;
    min-height: 0;
  }

  .private-layout {
    grid-template-columns: 1fr;
  }

  .private-sidebar {
    max-height: 220px;
    overflow: auto;
  }

  .topic-shell {
    z-index: 86;
    padding: 0;
  }

  .topic-panel {
    overflow: auto;
    min-height: 100dvh;
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

  .topic-editor-grid {
    gap: 12px;
  }

  .rich-toolbar,
  .image-editor-tools {
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 0;
  }

  .rich-toolbar button,
  .image-editor-tools button {
    min-height: 38px;
    flex: 1 1 auto;
    min-width: 0;
  }

  .rich-editor {
    min-height: 48dvh;
  }

  .media-drop {
    min-height: 118px;
  }

  .settings-banner {
    min-height: 190px;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
  }

  .settings-avatar {
    width: 72px;
    height: 72px;
  }

  .settings-grid,
  .profile-medals,
  .profile-story-albums,
  .profile-activity,
  .stats-dashboard,
  .stats-line-grid,
  .stats-grid,
  .admin-metrics,
  .grow-form,
  .grow-poll-editor,
  .grow-update-form,
  .admin-user-controls,
  .permission-grid,
  .compact-form,
  .login-card,
  .admin-dashboard {
    grid-template-columns: 1fr;
  }

  .visibility-options,
  .admin-user-actions,
  .profile-activity-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .stats-dashboard {
    grid-template-columns: 1fr;
  }

  .profile-activity-tabs button {
    min-height: 38px;
    text-align: center;
    padding: 0 6px;
  }

  .profile-story-albums header {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .profile-story-albums header .ghost-button {
    width: 100%;
  }

  .profile-story-albums {
    min-height: 228px;
    padding: 12px;
    gap: 10px;
  }

  .profile-story-albums h3 {
    margin: 0;
    font-size: 0.98rem;
  }

  .profile-story-albums header span {
    display: block;
    font-size: 0.78rem;
    line-height: 1.25;
  }

  .profile-story-album-list {
    gap: 10px;
    min-height: 168px;
    overflow-y: visible;
    padding: 2px 2px 18px;
  }

  .profile-story-album {
    flex-basis: 96px;
    gap: 5px;
  }

  .profile-story-album-cover {
    width: 72px;
    height: 72px;
  }

  .profile-story-album-add {
    font-size: 1.85rem;
  }

  .profile-story-album strong {
    font-size: 0.76rem;
    overflow-wrap: anywhere;
  }

  .profile-story-album > span {
    font-size: 0.7rem;
  }

  .profile-story-album-menu {
    gap: 5px;
  }

  .profile-story-album-menu button {
    min-height: 28px;
    padding: 0 8px;
    font-size: 0.66rem;
  }

  .profile-story-album-actions {
    gap: 4px;
  }

  .profile-story-album-actions .tiny-button {
    min-height: 25px;
    padding: 0 6px;
    font-size: 0.66rem;
  }

  .story-highlight-panel,
  .story-album-pick-panel {
    width: min(100% - 22px, 420px);
    max-height: calc(100dvh - max(20px, env(safe-area-inset-top)) - max(20px, env(safe-area-inset-bottom)));
    margin: max(10px, calc(env(safe-area-inset-top) + 10px)) auto max(10px, calc(env(safe-area-inset-bottom) + 10px));
    padding: 16px;
    gap: 12px;
  }

  .story-album-panel {
    width: min(328px, calc(100% - 34px));
    max-height: none;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 14px;
    gap: 10px;
    overflow: visible;
  }

  #storyAlbumShell .story-album-panel {
    width: min(312px, calc(100% - 38px));
    max-height: calc(100dvh - 44px);
    padding: 12px;
  }

  .story-highlight-panel header,
  .story-album-pick-panel header {
    padding-right: 40px;
  }

  .story-album-panel header {
    padding-right: 38px;
  }

  .story-highlight-panel h2,
  .story-album-pick-panel h2 {
    font-size: 1.72rem;
  }

  .story-album-panel h2 {
    margin-bottom: 4px;
    font-size: 1.34rem;
  }

  .story-highlight-panel header p:last-child,
  .story-album-pick-panel header p:last-child {
    font-size: 0.84rem;
    line-height: 1.35;
  }

  .story-album-panel header p:last-child {
    font-size: 0.78rem;
    line-height: 1.25;
  }

  .story-album-form {
    gap: 12px;
  }

  .story-album-form input[type="text"] {
    min-height: 44px;
    font-size: 16px;
  }

  .story-album-picker {
    width: 86px;
    height: 86px;
    min-height: 86px;
  }

  .story-album-picker span {
    font-size: 2.2rem;
  }

  .story-album-actions {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .story-highlight-button {
    right: max(12px, env(safe-area-inset-right));
    bottom: 142px;
  }

  .story-highlight-remove {
    right: max(12px, env(safe-area-inset-right));
    bottom: 188px;
  }

  .story-highlight-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: 44vh;
  }

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

  .social-action {
    width: 34px;
    height: 34px;
    min-height: 34px;
  }

  .visibility-check,
  .moderation-icon {
    justify-content: center;
    min-height: 38px;
  }

  .admin-panel {
    gap: 14px;
  }

  .admin-hero {
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
    background: linear-gradient(110deg, rgba(23, 27, 25, 0.96), rgba(32, 38, 32, 0.78));
  }

  .admin-hero h2,
  .topic-panel-header h2,
  .settings-banner h2,
  .email-art h2 {
    font-size: 2rem;
    line-height: 1;
  }

  .admin-dashboard {
    width: 100%;
    margin-bottom: 0;
  }

  .admin-tabs {
    position: sticky;
    top: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    overflow: visible;
    padding: 8px;
  }

  .admin-tabs button {
    min-width: 0;
    min-height: 40px;
    padding: 0 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
  }

  .admin-list article,
  .admin-list article.pending-review-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .admin-topic-preview {
    padding: 12px;
  }
}

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

  .nav a,
  .nav-button,
  .admin-entry,
  .email-entry,
  .settings-entry,
  .messages-entry {
    padding: 0 9px;
  }

  .home-column {
    min-width: 0;
    width: 100%;
    padding: 12px;
  }

  .category-card,
  .thread-item,
  .compact-thread-list .thread-item {
    padding: 12px;
  }

  .category-card p,
  .thread-item p {
    font-size: 0.84rem;
  }

  .settings-banner {
    grid-template-columns: 1fr;
    align-items: end;
  }

  .settings-avatar {
    align-self: end;
  }

  .visibility-options,
  .admin-user-actions {
    grid-template-columns: 1fr;
  }
}

.hidden {
  display: none !important;
}

.bottom-user-dock .messages-entry,
.bottom-user-dock .dock-button {
  width: auto;
  min-width: 0;
  flex: initial;
  justify-content: center;
  padding: 6px 8px;
  white-space: normal;
}
