/* SpaceGram 3.1 package "social": every selector starts with the package prefix. */

.so-hint { margin: 8px 0; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.so-warn { margin: 4px 0 8px; color: #e0703a; font-size: 12.5px; }
.so-wide { width: 100%; margin-top: 12px; }
.sg-row .so-select { flex: 0 1 auto; max-width: 55%; margin-left: auto; }
.so-input {
  width: 100%;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg, var(--surface-2));
  color: var(--text);
  font: inherit;
  box-sizing: border-box;
}
.so-input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.so-above { z-index: 70; }

/* chips */
.so-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.so-chip {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2, var(--surface));
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
}
.so-chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast, #fff); }

/* ——— stories list ——— */
.so-story-list { display: flex; flex-direction: column; gap: 2px; }
.so-story-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 6px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.so-story-item:hover { background: var(--hover); }
.so-ring { display: inline-flex; padding: 2px; border-radius: 50%; border: 2px solid var(--border); }
.so-story-item.unseen .so-ring { border-color: var(--accent); }
.so-story-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  flex: none;
}
.so-story-text { display: flex; flex-direction: column; min-width: 0; }
.so-story-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-story-meta { color: var(--muted); font-size: 12.5px; }

/* story card (composer preview + viewer) */
.so-story-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px 20px;
  border-radius: 18px;
  color: #fff;
  text-align: center;
  overflow: hidden;
}
.so-bg-blue { background: linear-gradient(160deg, #2f80ed, #1b4fa8); }
.so-bg-violet { background: linear-gradient(160deg, #7b61ff, #3d2a99); }
.so-bg-rose { background: linear-gradient(160deg, #f06292, #a3264f); }
.so-bg-sunset { background: linear-gradient(160deg, #ff9a3d, #d1365b); }
.so-bg-mint { background: linear-gradient(160deg, #1fbf8f, #0f7457); }
.so-bg-ocean { background: linear-gradient(160deg, #13a3c9, #0b4f80); }
.so-bg-night { background: linear-gradient(160deg, #26304f, #0b1020); }
.so-bg-gold { background: linear-gradient(160deg, #d6a23a, #7a5414); }
.so-size-s .so-story-body, .so-size-s .so-story-input { font-size: 18px; }
.so-size-m .so-story-body, .so-size-m .so-story-input { font-size: 24px; }
.so-size-l .so-story-body, .so-size-l .so-story-input { font-size: 32px; }
.so-story-body { font-weight: 600; line-height: 1.3; white-space: pre-wrap; overflow-wrap: anywhere; }
.so-story-caption { font-size: 14px; opacity: 0.9; }

.so-compose-preview { min-height: 220px; }
.so-story-input {
  width: 100%;
  min-height: 160px;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-align: center;
  resize: none;
  outline: none;
}
.so-story-input::placeholder { color: rgba(255, 255, 255, 0.7); }
.so-swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.so-swatch { width: 32px; height: 32px; border: 2px solid transparent; border-radius: 50%; cursor: pointer; }
.so-swatch.on { border-color: var(--text); }
.so-sizes { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.so-size-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2, var(--surface));
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}
.so-size-btn[data-size='s'] { font-size: 12px; }
.so-size-btn[data-size='l'] { font-size: 18px; }
.so-size-btn.on { border-color: var(--accent); color: var(--accent); }

/* ——— viewer ——— */
.so-viewer { background: #000; color: #fff; align-items: center; justify-content: center; outline: none; }
.so-viewer-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 440px);
  height: 100%;
  max-height: 860px;
  padding: 10px 10px 14px;
  box-sizing: border-box;
  gap: 10px;
}
.so-bars { display: flex; gap: 4px; }
.so-bar { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.3); overflow: hidden; }
.so-bar-fill { display: block; width: 0; height: 100%; background: #fff; }
.so-viewer-head { display: flex; align-items: center; gap: 8px; }
.so-viewer-who { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.so-viewer-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-viewer-time { color: rgba(255, 255, 255, 0.7); font-size: 12.5px; flex: none; }
.so-viewer .icon-btn { color: #fff; }
.so-viewer-card { flex: 1; min-height: 0; user-select: none; touch-action: none; cursor: pointer; }
.so-viewer-foot { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; min-height: 44px; }
.so-viewer-foot .so-chip { background: rgba(255, 255, 255, 0.14); border-color: transparent; color: #fff; }
.so-react {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  font-size: 21px;
  cursor: pointer;
}
.so-react.on { background: rgba(255, 255, 255, 0.38); }

/* ——— friends ——— */
.so-friends { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.so-friend {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 6px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
}
button.so-friend { cursor: pointer; }
button.so-friend:hover { background: var(--hover); }
.so-av { position: relative; display: inline-flex; flex: none; }
.so-av.online::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  width: 11px;
  height: 11px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: #2fbf71;
}
.so-friend-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.so-friend-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-friend-meta { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-friend-react { font-size: 20px; }

/* ——— profile ——— */
.so-status-row { display: flex; gap: 8px; }
.so-emoji-input { flex: 0 0 64px; text-align: center; }
.so-links-edit { display: flex; flex-direction: column; gap: 8px; }
.so-link-row { display: flex; align-items: center; gap: 6px; }
.so-link-title { flex: 0 0 34%; }
.so-card-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.so-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.so-status { margin: 4px 0 12px; font-size: 16px; overflow-wrap: anywhere; }
.so-link { display: block; padding: 8px 0; color: var(--accent); overflow-wrap: anywhere; text-decoration: none; }
.so-link:hover { text-decoration: underline; }

/* ——— chat themes ——— */
#chat-view.so-chat-theme .chat-body { background: linear-gradient(160deg, var(--so-bg1), var(--so-bg2)) !important; }
#chat-view.so-chat-theme .bubble { background: var(--so-in) !important; color: var(--so-in-text) !important; }
#chat-view.so-chat-theme .msg-row.out .bubble { background: var(--so-out) !important; color: var(--so-out-text) !important; }
.so-theme-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(160deg, var(--so-bg1), var(--so-bg2));
}
.so-pv-in, .so-pv-out { max-width: 75%; padding: 7px 12px; border-radius: 16px; font-size: 14px; }
.so-pv-in { align-self: flex-start; background: var(--so-in); color: var(--so-in-text); border-bottom-left-radius: 6px; }
.so-pv-out { align-self: flex-end; background: var(--so-out); color: var(--so-out-text); border-bottom-right-radius: 6px; }
.so-preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 8px; }
.so-preset {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 56px;
  padding-bottom: 8px;
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
}
.so-preset.on { border-color: var(--accent); }
.so-preset-dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15); }
.so-color { width: 44px; height: 32px; margin-left: auto; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: none; }
.so-buttons { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.so-theme-body .sg-section-title { margin-top: 16px; }
