/* Social Classroom - Student Page Styles */
/* Mobile-first, social media aesthetic */

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #eef2ff;
  --primary-glow: rgba(99, 102, 241, 0.15);
  --bg: #f4f4f8;
  --surface: #ffffff;
  --surface-hover: #fafafe;
  --border: #e8e8ee;
  --border-light: #f0f0f5;
  --text: #1a1a2e;
  --text-secondary: #6b7089;
  --text-muted: #9d9db5;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --heart: #ef4444;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.08);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.screen { display: none; }
.screen.active { display: flex; flex-direction: column; min-height: 100vh; }
.hidden { display: none !important; }

/* ========== JOIN SCREEN ========== */

#join-screen {
  background: linear-gradient(160deg, #6366f1 0%, #4f46e5 40%, #3730a3 100%);
  justify-content: center;
  align-items: center;
}

.join-container {
  width: 100%;
  max-width: 420px;
  padding: 40px 28px;
  text-align: center;
}

.join-logo {
  width: 72px;
  height: 72px;
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 32px;
  backdrop-filter: blur(10px);
}

.join-container h1 {
  font-size: 32px;
  font-weight: 800;
  color: white;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.join-subtitle {
  color: rgba(255,255,255,0.7);
  font-size: 15px;
  margin-bottom: 36px;
}

.code-input-wrapper {
  position: relative;
  margin-bottom: 20px;
}

#room-code-input {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 32px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  letter-spacing: 8px;
  padding: 18px 20px;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.1);
  color: white;
  text-transform: uppercase;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

#room-code-input::placeholder {
  color: rgba(255,255,255,0.35);
  letter-spacing: 4px;
  font-size: 18px;
}

#room-code-input:focus {
  outline: none;
  border-color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.15);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.1);
}

.join-btn {
  display: block;
  width: 100%;
  background: white;
  color: var(--primary-dark);
  border: none;
  padding: 16px 32px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-md);
}

.join-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.join-btn:active {
  transform: translateY(0);
}

.join-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  filter: grayscale(30%);
}

.join-error {
  color: #e53e3e;
  font-size: 13px;
  margin-top: 12px;
  min-height: 20px;
}

.join-footer {
  margin-top: 40px;
  color: rgba(255,255,255,0.7);
  font-size: 12px;
}

/* ========== CHARACTER SELECT SCREEN ========== */

#character-screen {
  background: var(--bg);
}

.character-container {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 20px;
}

.character-container h2 {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.character-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.name-input-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
}

.name-input-section label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.name-input-section input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: var(--transition);
}

.name-input-section input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.name-input-section .privacy-note {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}

#character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.character-option {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px 18px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.character-option:hover:not(.claimed) {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.character-option:active:not(.claimed) {
  transform: translateY(-1px);
}

.character-option.claimed {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--bg);
}

.character-option .char-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 22px;
  margin: 0 auto 10px;
  color: white;
  box-shadow: var(--shadow-sm);
}

.character-option .char-name {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 2px;
}

.character-option .char-role {
  font-size: 12px;
  color: var(--text-muted);
}

.character-option .char-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 4px;
  font-weight: 400;
}

.character-option .char-taken {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
}

/* Avatar colors by index */
.avatar-color-0 { background: #6366f1; }
.avatar-color-1 { background: #ec4899; }
.avatar-color-2 { background: #f59e0b; }
.avatar-color-3 { background: #10b981; }
.avatar-color-4 { background: #3b82f6; }
.avatar-color-5 { background: #8b5cf6; }
.avatar-color-6 { background: #ef4444; }
.avatar-color-7 { background: #14b8a6; }

/* ========== FEED SCREEN ========== */

#feed-screen {
  background: var(--bg);
}

.feed-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(12px);
}

.feed-topbar .topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.feed-topbar .topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  color: white;
}

.feed-topbar .topbar-name {
  font-weight: 700;
  font-size: 15px;
}

.feed-topbar .topbar-label {
  font-size: 11px;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
}

.online-count {
  font-size: 12px;
  color: var(--text-muted);
}

.feed-container {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  padding: 0 12px 80px;
}

/* Teacher Prompt Banner */
.teacher-prompt {
  background: linear-gradient(135deg, var(--primary-light), #faf5ff);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
  position: relative;
}

.teacher-prompt .prompt-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary-dark);
  margin-bottom: 6px;
}

.teacher-prompt .prompt-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
}

/* Compose Box */
.compose-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin: 16px 0;
  box-shadow: var(--shadow-sm);
}

.compose-top {
  display: flex;
  gap: 10px;
}

.compose-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
}

.compose-box textarea {
  flex: 1;
  border: none;
  resize: none;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  outline: none;
  min-height: 44px;
  color: var(--text);
  background: transparent;
}

.compose-box textarea::placeholder {
  color: var(--text-muted);
}

.compose-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
}

.compose-tools {
  display: flex;
  gap: 4px;
}

.compose-tool-btn {
  background: none;
  border: none;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 18px;
  color: var(--text-muted);
  transition: var(--transition);
}

.compose-tool-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.post-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 22px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.post-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.02);
}

.post-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.char-counter {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: 8px;
}

.char-counter.near-limit { color: var(--warning); }
.char-counter.at-limit { color: var(--danger); font-weight: 700; }

/* ========== FEED POSTS ========== */

.feed-post {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.feed-post.highlighted {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow), var(--shadow-sm);
}

.feed-post.new-post {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.post-avatar-wrap {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.post-avatar-wrap svg,
.comment-avatar-wrap svg,
.char-avatar-wrap svg {
  border-radius: 50%;
  background: var(--bg);
}

.comment-avatar-wrap {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.char-avatar-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.post-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: white;
  flex-shrink: 0;
}

.post-author-info {
  flex: 1;
  min-width: 0;
}

.post-author-name {
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.post-author-handle {
  font-size: 13px;
  color: var(--text-muted);
}

.post-timestamp {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.post-content {
  font-size: 15px;
  line-height: 1.65;
  margin-bottom: 12px;
  word-wrap: break-word;
  white-space: pre-wrap;
}

/* Reactions Bar */
.reactions-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
  min-height: 32px;
}

.reaction-btn:hover {
  background: var(--primary-light);
  border-color: #c7d2fe;
}

.reaction-btn.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 600;
}

.reaction-btn .reaction-emoji { font-size: 15px; }
.reaction-btn .reaction-count { font-size: 12px; font-weight: 600; }

/* Comment Section */
.comment-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  transition: var(--transition);
}

.comment-toggle:hover { color: var(--primary); }

.comments-section {
  border-top: 1px solid var(--border-light);
  margin-top: 10px;
  padding-top: 12px;
}

.comment {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
  color: white;
  flex-shrink: 0;
}

.comment-body {
  flex: 1;
  min-width: 0;
}

.comment-author {
  font-weight: 700;
  font-size: 13px;
  display: inline;
}

.comment-text {
  font-size: 13px;
  display: inline;
  margin-left: 4px;
}

.comment-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.comment-input-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

.comment-input-row input {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  transition: var(--transition);
  min-height: 36px;
}

.comment-input-row input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.comment-send-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  transition: var(--transition);
}

.comment-send-btn:hover { background: var(--primary-dark); }

/* ========== SESSION ENDED SCREEN ========== */

#ended-screen {
  background: var(--bg);
  justify-content: center;
  align-items: center;
}

.ended-container {
  text-align: center;
  padding: 40px 28px;
  max-width: 400px;
}

.ended-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.ended-container h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.ended-container p {
  color: var(--text-secondary);
  font-size: 15px;
}

/* ========== UTILITIES ========== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 400px) {
  #character-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .join-container h1 { font-size: 26px; }
  #room-code-input { font-size: 26px; letter-spacing: 6px; }
}

@media (min-width: 768px) {
  #character-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ========== DRAFT RANKING ========== */

.draft-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
  cursor: grab;
  transition: var(--transition);
  user-select: none;
  -webkit-user-select: none;
}

.draft-item:active { cursor: grabbing; }

.draft-item.dragging {
  opacity: 0.5;
  border-color: var(--primary);
}

.draft-item.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.draft-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

.draft-rank.low { background: var(--text-muted); }

.draft-char-info { flex: 1; min-width: 0; }
.draft-char-name { font-weight: 700; font-size: 15px; }

.draft-arrows {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.draft-arrow-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 28px;
  height: 22px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  color: var(--text-secondary);
}

.draft-arrow-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.draft-status {
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
}

.draft-status p { margin-top: 12px; font-size: 14px; }

/* ========== WAITING SCREEN ========== */

.spinner-lg {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

/* ========== STUDENT AVATAR BUILDER ========== */

.avatar-builder-student { text-align: center; }

.avatar-preview-student {
  display: flex;
  justify-content: center;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.avatar-preview-student svg {
  border-radius: 50%;
  background: white;
  box-shadow: var(--shadow-md);
  padding: 4px;
}

.avatar-options-student { text-align: left; margin-top: 16px; }

.avatar-options-student .avatar-option-group { margin-bottom: 14px; }

.avatar-options-student .avatar-option-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.avatar-options-student .color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.avatar-options-student .color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
}

.avatar-options-student .color-swatch:hover { transform: scale(1.15); }
.avatar-options-student .color-swatch.selected {
  border-color: var(--text);
  box-shadow: 0 0 0 2px white, 0 0 0 4px var(--text);
}

.avatar-options-student .option-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.avatar-options-student .option-pill {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
}

.avatar-options-student .option-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.avatar-options-student .option-pill.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
}

.btn-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: white;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transition: transform 0.3s ease-out;
  pointer-events: none;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
}

/* ========== SCENE CARD COMPOSER ========== */

.compose-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.compose-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 2px solid transparent;
}

.compose-tab:hover { color: var(--text-secondary); }

.compose-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.compose-mode.hidden { display: none; }

/* Template Picker (Step 1) */
.scene-step-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

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

.template-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s ease;
}

.template-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.template-card:active {
  transform: translateY(0);
}

.template-icon {
  font-size: 28px;
  line-height: 1;
}

.template-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.template-desc {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
}

/* Customize Step (Step 2) */
.scene-preview-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}

.scene-preview-wrap svg {
  display: block;
  width: 100%;
  height: auto;
}

.scene-controls-new {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.scene-control-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.scene-control-group.hidden { display: none; }

/* Expression Grid — emoji-first, compact */
.scene-expression-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.expression-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.12s ease;
  min-width: 52px;
}

.expression-btn:hover {
  border-color: var(--primary);
  background: var(--primary-glow);
}

.expression-btn.selected {
  border-color: var(--primary);
  background: var(--primary);
}

.expression-btn.selected .expression-label {
  color: white;
}

.expression-emoji {
  font-size: 20px;
  line-height: 1;
}

.expression-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Background & mood option pills */
.scene-option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.scene-option-btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
}

.scene-option-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.scene-option-btn.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.scene-control-group input[type="text"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: var(--transition);
  box-sizing: border-box;
}

.scene-control-group input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Back button pill */
.btn-pill {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}

.btn-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-secondary-pill {
  background: transparent;
}

/* Scene card in feed */
.post-scene-card {
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.post-scene-card svg {
  display: block;
  width: 100%;
  height: auto;
}

/* ========== ACCESSIBILITY ========== */

:focus-visible {
  outline: 2px solid var(--primary, #6366f1);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
