/* TradingX: one centred column of posts laid out like X. */
.tx-page {
  --tx-like: #f91880;
  --tx-like-soft: rgb(249 24 128 / 0.1);
  --tx-verified: #1d9bf0;
  width: min(100%, 620px);
  margin: 0 auto;
  padding: 20px 0 64px;
  color: var(--ws-text);
  letter-spacing: 0;
}
.tx-page *, .tx-viewer * { box-sizing: border-box; }
.tx-column {
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-card);
  background: var(--ws-surface);
  overflow: hidden;
}

.tx-topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--ws-border);
}
.tx-topbar > div { display: flex; flex-direction: column; }
.tx-topbar h1 { margin: 0; font-size: 20px; line-height: 1.3; font-weight: 750; }
.tx-topbar span { min-height: 18px; font-size: 13px; color: var(--ws-text-muted); }
.tx-back { color: var(--ws-text); margin-left: -6px; }
.tx-back:hover { background: var(--ws-surface-muted); }

.tx-verified { display: inline-flex; color: var(--tx-verified); flex: none; }
.tx-verified svg { width: 18px; height: 18px; }

.tx-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  object-fit: cover;
  flex: none;
}

/* Composer (owner only) */
.tx-composer {
  display: flex;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--ws-border);
}
.tx-composer-main { flex: 1; min-width: 0; }
.tx-composer textarea {
  display: block;
  width: 100%;
  min-height: 72px;
  padding: 8px 0;
  border: 0;
  border-radius: 6px;
  resize: vertical;
  background: transparent;
  color: var(--ws-text);
  font: inherit;
  font-size: 19px;
  line-height: 1.45;
}
.tx-composer textarea::placeholder { color: var(--ws-text-muted); }
/* The borderless box still shows where the keyboard is (F-04). */
.tx-composer textarea:focus-visible { outline: 2px solid var(--ws-brand); outline-offset: 2px; }
.tx-composer-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--ws-border);
}
.tx-count { margin-left: auto; font-size: 13px; color: var(--ws-text-muted); font-variant-numeric: tabular-nums; }
.tx-count.is-over { color: var(--ws-danger); font-weight: 650; }
.tx-post-button {
  min-height: 36px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--ws-text);
  color: var(--ws-surface);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.tx-count:empty + .tx-post-button { margin-left: auto; }
.tx-post-button:disabled { opacity: 0.45; cursor: default; }
.tx-composer-error { margin: 8px 0 0; font-size: 13px; color: var(--ws-danger); }
.tx-previews { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 6px 0 10px; }
.tx-previews-1 { grid-template-columns: 1fr; }
.tx-preview { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--ws-border); aspect-ratio: 16 / 10; }
.tx-previews-1 .tx-preview { aspect-ratio: auto; max-height: 420px; }
.tx-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tx-preview-remove {
  position: absolute;
  top: 6px;
  left: 6px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgb(15 20 25 / 0.75);
  color: #fff;
  cursor: pointer;
}

.tx-icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ws-brand);
  cursor: pointer;
}
.tx-icon-button:hover { background: var(--ws-brand-soft); }
.tx-icon-button.is-disabled { opacity: 0.4; pointer-events: none; }

/* Posts */
.tx-post {
  display: flex;
  gap: 12px;
  padding: 12px 16px 6px;
  border-bottom: 1px solid var(--ws-border);
  transition: background-color 160ms ease;
}
.tx-post[data-tx-action="open"] { cursor: pointer; }
@media (hover: hover) {
  .tx-post[data-tx-action="open"]:hover { background: var(--ws-surface-subtle); }
}
.tx-post.is-detail .tx-text { font-size: 17px; }
.tx-post-main { flex: 1; min-width: 0; }
.tx-post-head {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-size: 15px;
  line-height: 20px;
  white-space: nowrap;
}
/* The handle gives way first on a narrow screen, then the name. */
.tx-post-name { flex: none; max-width: 60%; font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.tx-post-handle { flex: 0 1 auto; min-width: 0; color: var(--ws-text-muted); overflow: hidden; text-overflow: ellipsis; }
.tx-dot, .tx-post-head time { color: var(--ws-text-muted); flex: none; }
.tx-post-time { flex: none; border-radius: 4px; }
.tx-post-time:hover time { text-decoration: underline; }
.tx-post-time:focus-visible { outline: 2px solid var(--ws-brand); outline-offset: 2px; }
.tx-owner-tools { display: inline-flex; gap: 2px; margin: -8px -8px -8px auto; flex: none; }
.tx-owner-tool { color: var(--ws-text-muted); }
.tx-owner-tool:hover { color: var(--ws-brand); }
.tx-delete:hover { color: var(--ws-danger); background: var(--ws-danger-soft); }
.tx-edited { color: var(--ws-text-muted); flex: none; }

/* Editing a post in place (owner only) */
.tx-post.is-editing { cursor: default; background: var(--ws-surface-subtle); }
.tx-editor { margin-top: 6px; }
.tx-editor textarea {
  display: block;
  width: 100%;
  min-height: 110px;
  padding: 10px 12px;
  border: 1px solid var(--ws-border-strong);
  border-radius: 12px;
  resize: vertical;
  background: var(--ws-surface);
  color: var(--ws-text);
  font: inherit;
  font-size: 15px;
  line-height: 1.6;
}
.tx-editor .tx-previews { margin-top: 10px; }
.tx-editor .tx-composer-bar { border-top: 0; }
.tx-editor .tx-retry { min-height: 36px; }
.tx-text {
  margin-top: 2px;
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.tx-text a { color: var(--tx-verified); text-decoration: none; }
.tx-text.is-clamped {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 8;
  line-clamp: 8;
  overflow: hidden;
}
.tx-more {
  display: block;
  padding: 2px 0 0;
  border: 0;
  background: none;
  color: var(--tx-verified);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.tx-more[hidden] { display: none; }
.tx-more:hover { text-decoration: underline; }
.tx-text a:hover { text-decoration: underline; }

.tx-media {
  display: grid;
  gap: 2px;
  margin-top: 12px;
  border: 1px solid var(--ws-border);
  border-radius: 16px;
  overflow: hidden;
  grid-template-columns: 1fr 1fr;
  aspect-ratio: 16 / 9;
}
.tx-media-1 { display: block; aspect-ratio: auto; }
.tx-media-3 .tx-media-item:first-child { grid-row: span 2; }
.tx-media-4 { grid-template-rows: 1fr 1fr; }
.tx-media-item {
  display: block;
  min-height: 0;
  padding: 0;
  border: 0;
  background: var(--ws-surface-muted);
  cursor: zoom-in;
}
.tx-media-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tx-media-1 .tx-media-item { width: 100%; }
.tx-media-1 .tx-media-item img { height: auto; max-height: 560px; object-fit: contain; }
.tx-media-1 .tx-media-item.is-loading img { width: 100%; min-height: 200px; object-fit: cover; }
.tx-media-item.is-loading img { filter: blur(12px); transform: scale(1.08); }
.tx-media-item.is-loading { overflow: hidden; }

/* A locked post: placeholder text and tiny thumbnails, blurred, under an unlock button. */
.tx-locked { position: relative; margin-top: 2px; }
.tx-locked-content { user-select: none; pointer-events: none; }
.tx-blur { filter: blur(6px); color: var(--ws-text-secondary); }
.tx-media.is-locked { aspect-ratio: 16 / 9; }
.tx-media.is-locked.tx-media-1 { display: block; }
.tx-media-item.is-locked { overflow: hidden; cursor: default; height: 100%; }
.tx-media-item.is-locked img { filter: blur(16px); transform: scale(1.2); }
.tx-unlock {
  position: absolute;
  top: 50%;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 16px);
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--ws-text);
  color: var(--ws-surface);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  box-shadow: var(--ws-shadow-md);
  transform: translate(-50%, -50%);
  cursor: pointer;
}
.tx-unlock span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-locked:not(:has(.tx-blur, .tx-media)) { min-height: 56px; }

.tx-actions { display: flex; justify-content: space-between; max-width: 420px; margin: 4px 0 0 -8px; }
.tx-action {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 64px;
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ws-text-muted);
  font: inherit;
  font-size: 13px;
}
button.tx-action { cursor: pointer; }
.tx-share { min-width: 0; }
.tx-action-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; transition: background-color 160ms ease; }
.tx-action-count { min-width: 1ch; font-variant-numeric: tabular-nums; }
.tx-like:hover, .tx-like.is-liked { color: var(--tx-like); }
.tx-like:hover .tx-action-icon { background: var(--tx-like-soft); }
.tx-share:hover { color: var(--tx-verified); }
.tx-share:hover .tx-action-icon { background: rgb(29 155 240 / 0.1); }
.tx-like.is-liked svg { fill: currentColor; animation: tx-like-pop 260ms ease; }
@keyframes tx-like-pop { 50% { transform: scale(1.25); } }

.tx-feed-status {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 26px 16px;
  font-size: 14px;
  color: var(--ws-text-muted);
  text-align: center;
}
.tx-feed-status p { margin: 0; }
.tx-empty strong { font-size: 20px; color: var(--ws-text); }
.tx-retry {
  min-height: 36px;
  padding: 0 18px;
  border: 1px solid var(--ws-border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ws-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.tx-spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--ws-brand-soft);
  border-top-color: var(--ws-brand);
  border-radius: 50%;
  animation: tx-spin 0.8s linear infinite;
}
@keyframes tx-spin { to { transform: rotate(360deg); } }

a.tx-retry { display: inline-flex; align-items: center; text-decoration: none; }
.tx-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--ws-mobile-nav) + 24px);
  z-index: 1500;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--tx-verified);
  color: #fff;
  font-size: 14px;
  box-shadow: var(--ws-shadow-md);
  transform: translateX(-50%);
}
.tx-toast[hidden] { display: none; }

/* Share as a picture */
.tx-share-sheet {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(0 0 0 / 0.6);
}
.tx-share-sheet, .tx-share-sheet * { box-sizing: border-box; }
.tx-share-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(100%, 480px);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 16px;
  border-radius: var(--ws-radius-overlay);
  background: var(--ws-surface);
  color: var(--ws-text);
  box-shadow: var(--ws-shadow-overlay);
}
.tx-share-head { display: flex; align-items: center; justify-content: space-between; }
.tx-share-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.tx-share-close { color: var(--ws-text); }
.tx-share-preview {
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  min-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--ws-border);
  border-radius: 12px;
  background: var(--ws-surface-subtle);
}
.tx-share-preview img { display: block; width: 100%; height: auto; align-self: start; }
.tx-share-error { margin: 0; padding: 16px; font-size: 14px; color: var(--ws-text-secondary); text-align: center; }
.tx-share-status { margin: 0; font-size: 13px; color: var(--ws-text-secondary); text-align: center; }
.tx-share-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* Full-size picture */
.tx-viewer {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 56px 16px;
  background: rgb(0 0 0 / 0.88);
}
/* Sized to the screen itself: a percentage height inside the overlay does not resolve, and a tall chart would run
   off the bottom. */
.tx-viewer img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 112px);
  max-height: calc(100dvh - 112px);
  object-fit: contain;
  border-radius: 4px;
}
.tx-viewer button {
  position: absolute;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.12);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}
.tx-viewer button:disabled { opacity: 0.3; cursor: default; }
.tx-viewer-close { top: 12px; left: 12px; }
.tx-viewer-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.tx-viewer-next { right: 12px; top: 50%; transform: translateY(-50%); }

@media (max-width: 640px) {
  .tx-page { padding-top: 0; }
  .tx-column { border-radius: 0; border-left: 0; border-right: 0; }
  .tx-composer textarea { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .tx-like.is-liked svg, .tx-spinner { animation: none; }
}
.tx-editor .tx-count:empty + .tx-retry { margin-left: auto; }
.tx-actions[hidden] { display: none; }
.tx-preview.is-loading img { filter: blur(12px); transform: scale(1.08); }
