.tab-item.active {
  background: rgba(139,92,246,0.13);
  color: rgba(244,244,245,0.92);
  border-bottom-color: rgba(139,92,246,0.72);
  box-shadow: none;
}

.composer-panel-subtitle,
.dance-placeholder-desc,
.image-counter {
  color: var(--rb-muted);
}

.upload-card,
.video-upload-card,
.dance-placeholder-card {
  background:
    radial-gradient(circle at 24% 0%, rgba(139,92,246,0.09), transparent 38%),
    rgba(19,18,25,0.82);
  border-color: rgba(139,92,246,0.24);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 12px 28px rgba(0,0,0,0.2);
}

.upload-card:hover,
.video-upload-card:hover {
  background:
    radial-gradient(circle at 24% 0%, rgba(139,92,246,0.12), transparent 40%),
    rgba(22,20,30,0.9);
  border-color: rgba(139,92,246,0.38);
}

.image-thumb-wrapper,
.image-add-tile,
.dance-placeholder-box {
  background: rgba(15,14,20,0.82);
  border-color: rgba(255,255,255,0.11);
}

.image-add-tile,
.btn-add-image {
  color: rgba(226,220,239,0.88);
}

.image-add-tile:hover,
.btn-add-image:hover {
  background: rgba(139,92,246,0.12);
  border-color: rgba(139,92,246,0.38);
  box-shadow: 0 0 18px rgba(124,58,237,0.13);
}

.btn-add-image {
  background: rgba(255,255,255,0.06);
  border-color: rgba(139,92,246,0.24);
}

.prompt-textarea,
.media-mention-editor,
.setting-select-inline,
.model-selector-trigger {
  background: rgba(15,14,20,0.78);
  border-color: rgba(255,255,255,0.11);
  color: var(--rb-text);
}

.prompt-textarea:focus,
.media-mention-editor:focus,
.setting-select-inline:hover,
.setting-select-inline:focus,
.model-selector-trigger:hover {
  border-color: rgba(139,92,246,0.42);
  background: rgba(21,19,28,0.92);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 0 20px rgba(124,58,237,0.14);
}

.prompt-textarea::placeholder,
.media-mention-editor:empty::before {
  color: rgba(178,169,196,0.64);
}

.btn-send,
.btn-primary {
  overflow: hidden;
  background: linear-gradient(135deg, #6d28d9, #8b5cf6);
  box-shadow:
    0 10px 26px rgba(124,58,237,0.24),
    inset 0 1px 0 rgba(255,255,255,0.18);
}

.btn-primary {
  position: relative;
}

.btn-send::before,
.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 46%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.32), transparent);
  animation: rbShineSweep 5.8s ease-in-out infinite;
  pointer-events: none;
}

.btn-send:hover,
.btn-primary:hover {
  box-shadow:
    0 12px 30px rgba(124,58,237,0.32),
    inset 0 1px 0 rgba(255,255,255,0.2);
}

.video-send-btn {
  background: linear-gradient(135deg, #5b21b6, #7c3aed);
  box-shadow: 0 10px 26px rgba(124,58,237,0.22);
}

/* Points-cost chip: keep the unified Create-page reference style. */
.point-cost-preview {
  background: #181818;
  border-color: rgba(255,255,255,0.1);
}

.model-dropdown-inline,
.media-mention-popover {
  background: rgba(16,15,21,0.98);
  border-color: rgba(255,255,255,0.11);
}

.model-option-inline:hover,
.model-option-inline.selected,
.media-mention-option:hover,
.media-mention-option:focus-visible,
.media-mention-option.is-active {
  background: rgba(139,92,246,0.11);
  color: rgba(244,244,245,0.94);
}

.media-mention-chip {
  background: rgba(139,92,246,0.1);
  border-color: rgba(139,92,246,0.28);
  color: rgba(226,220,239,0.92);
}

.dance-placeholder-box,
.dance-placeholder-box span {
  background: rgba(139,92,246,0.08);
  border-color: rgba(139,92,246,0.2);
  color: rgba(226,220,239,0.9);
}

/* BorderGlow treatment for the media mode buttons */
.media-mode-btn {
  position: relative;
  z-index: 1;
  isolation: isolate;
  overflow: visible;
}

.media-mode-btn::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 1;
  border-radius: inherit;
  padding: 1px;
  background:
    conic-gradient(
      from var(--rb-border-angle),
      transparent 0deg,
      transparent 72deg,
      rgba(139,92,246,0.72) 116deg,
      rgba(226,220,239,0.68) 140deg,
      rgba(139,92,246,0.56) 164deg,
      transparent 214deg,
      transparent 360deg
    );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0.16;
  animation: rbBorderSpin 6.5s linear infinite;
  pointer-events: none;
  transition: opacity 0.24s ease, filter 0.24s ease;
}

.media-mode-btn span {
  position: relative;
  z-index: 3;
}

.media-mode-btn > .ui-icon {
  position: relative;
  z-index: 3;
  width: 18px;
  height: 18px;
}

.media-mode-btn:hover::before,
.media-mode-btn:focus-visible::before {
  opacity: 0.54;
  filter: drop-shadow(0 0 10px rgba(139,92,246,0.24));
}

.media-mode-btn.active::before {
  opacity: 0.86;
  filter: drop-shadow(0 0 12px rgba(139,92,246,0.34));
}

/* UI polish layer: keep the composer anchored while refining its studio surface. */
.input-panel {
  border: 1px solid rgba(255,255,255,0.1);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -24px 70px rgba(0,0,0,0.34), inset 0 1px 0 rgba(255,255,255,0.06);
}

.media-mode-switcher {
  padding: 5px;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 14px;
  background: rgba(255,255,255,0.035);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.media-mode-btn,
.tab-item { transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease; }
.media-mode-btn { border-radius: 10px; }
.media-mode-btn.active { box-shadow: 0 8px 22px rgba(124,58,237,0.2), inset 0 1px 0 rgba(255,255,255,0.12); }

.composer-panel-header { padding-bottom: 18px; }
.composer-panel-title { letter-spacing: 0; }

.tabs {
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(0,0,0,0.14);
}

.tab-item { border-radius: 9px; }
.tab-item.active { box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 6px 18px rgba(0,0,0,0.16); }

.prompt-area textarea:focus,
.prompt-area input:focus,
.settings-row select:focus {
  border-color: rgba(167,139,250,0.62);
  background: rgba(255,255,255,0.07);
  box-shadow: var(--rb-focus-ring);
}

.input-panel-content {
  gap: 18px;
}

.composer-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.composer-panel-subtitle {
  max-width: 560px;
  color: rgba(255,255,255,0.58);
}

.composer-panel-cues {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.composer-cue-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.09);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.72);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.upload-card,
.video-upload-card {
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(145deg, rgba(255,255,255,0.06), rgba(255,255,255,0.025));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.btn-add-image {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid rgba(168,85,247,0.24);
  border-radius: 10px;
  background: rgba(168,85,247,0.16);
  color: #ead9ff;
  font-weight: 700;
}

.btn-add-image:hover {
  box-shadow: 0 10px 24px rgba(124,58,237,0.18);
}

.image-counter {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.62);
}

.prompt-area {
  padding-top: 18px;
}

.prompt-textarea {
  min-height: 144px;
  padding-top: 16px;
  padding-bottom: 54px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.03));
}

.prompt-textarea::placeholder {
  color: rgba(255,255,255,0.34);
}

.prompt-support-copy {
  margin-top: 12px;
  padding-right: 88px;
  color: rgba(255,255,255,0.46);
  font-size: 12px;
  line-height: 1.5;
}

.btn-send {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(124,58,237,0.24);
}

.btn-send:hover {
  transform: translateY(-2px) scale(1.01);
}

.point-cost-preview {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1);
  background: #181818;
  color: #a3a3a3;
  box-shadow: inset 0 0.5px 0 rgba(255,255,255,0.16);
}

@media (min-width: 769px) {
  .btn-send {
    right: 24px;
    bottom: 14px;
  }

  .point-cost-preview {
    right: 82px;
    bottom: 19px;
  }
}

.settings-row {
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 16px;
  background: rgba(0,0,0,0.14);
}

.setting-select-inline,
.model-selector-trigger {
  min-height: 42px;
  border-radius: 12px;
  border-color: rgba(255,255,255,0.09);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.88);
  font-weight: 600;
}

.model-dropdown-inline {
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(20,18,28,0.98);
  box-shadow: 0 18px 36px rgba(0,0,0,0.34);
}

.model-option-inline {
  border-radius: 10px;
}

.model-option-inline.selected,
.model-option-inline:hover {
  background: rgba(168,85,247,0.18);
}

/* Create workspace select menus. The native select remains available to form logic. */
.create-select-shell {
  position: relative;
  width: 150px;
  min-width: 150px;
  max-width: 150px;
  flex: 0 0 150px;
}

.settings-row.has-open-select {
  position: relative;
  z-index: 40;
  overflow: visible;
}

.setting-select-inline.create-select-native {
  display: none !important;
}

.create-select-trigger {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.88);
  cursor: pointer;
  font: 600 15px/1 var(--app-font-ui);
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.create-select-trigger:hover,
.create-select-shell.is-open .create-select-trigger {
  border-color: rgba(139,92,246,0.52);
  background: rgba(27,23,37,0.96);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.08);
}

.create-select-trigger:active {
  transform: scale(0.985);
}

.create-select-trigger:focus-visible {
  outline: none;
  border-color: rgba(168,85,247,0.72);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.14);
}

.create-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.create-select-arrow {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  margin: -4px 2px 0 0;
  border-right: 2px solid rgba(255,255,255,0.48);
  border-bottom: 2px solid rgba(255,255,255,0.48);
  transform: rotate(45deg);
  transition: border-color 160ms ease, transform 180ms ease;
}

.create-select-shell.is-open .create-select-arrow {
  border-color: rgba(216,180,254,0.94);
  transform: translateY(4px) rotate(225deg);
}

.create-select-shell.is-disabled {
  opacity: 0.48;
}

.create-select-shell.is-disabled .create-select-trigger {
  cursor: not-allowed;
}

.create-select-menu {
  position: absolute;
  z-index: 1200;
  left: 0;
  bottom: calc(100% + 8px);
  width: max(100%, 174px);
  max-height: min(320px, calc(100vh - 180px));
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-sizing: border-box;
  padding: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 12px;
  background: rgba(20,18,28,0.98);
  box-shadow: 0 18px 38px rgba(0,0,0,0.42), inset 0 1px 0 rgba(255,255,255,0.035);
  backdrop-filter: blur(20px) saturate(120%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px) scale(0.985);
  transform-origin: left bottom;
  transition: opacity 160ms ease, transform 180ms ease, visibility 0s linear 180ms;
}

.create-select-shell.is-open .create-select-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition-delay: 0s;
}

.create-select-option {
  position: relative;
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,0.72);
  cursor: pointer;
  font: 600 14px/1.2 var(--app-font-ui);
  text-align: left;
  transition: color 140ms ease, background 140ms ease;
}

.create-select-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Aspect-ratio options use scaled frames so orientation is readable at a glance. */
.create-select-value,
.create-select-option-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.create-select-option-content {
  flex: 1 1 auto;
}

.aspect-ratio-preview {
  width: 34px;
  height: 26px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
}

.aspect-ratio-frame {
  width: var(--aspect-preview-width);
  height: var(--aspect-preview-height);
  min-width: 5px;
  min-height: 5px;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  border: 1.5px solid rgba(190, 164, 255, 0.72);
  border-radius: 2px;
  background: transparent;
  box-shadow: none;
}

.aspect-ratio-preview.is-auto .aspect-ratio-frame {
  width: 28px;
  height: 20px;
  border-style: dashed;
}

.aspect-ratio-copy {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.create-select-option.is-selected .aspect-ratio-frame,
.create-select-option:hover .aspect-ratio-frame,
.create-select-option.is-keyboard-active .aspect-ratio-frame {
  border-color: #d8caff;
  background: transparent;
}

.create-select-shell.is-aspect-ratio-select .create-select-menu {
  width: min(258px, calc(100vw - 24px));
  min-width: min(210px, calc(100vw - 24px));
  /* 15 cells pack into 5 rows of 60px (~332px with padding/gaps); the cap
     keeps the whole grid on one screen so no ratio is hidden behind a
     scrollbar. */
  max-height: min(340px, calc(100vh - 150px));
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.create-select-shell.is-aspect-ratio-select .aspect-ratio-preview {
  /* Grid frames are clamped to a 44x28 box (aspect-ratio-preview.js), so
     every ratio — 1:1, 21:9, 9:21 included — renders as a full frame.
     Option content stacks vertically, so the preview's flex-basis (the
     flex main axis) sizes the row height; a width-sized flex-basis
     stretched the box into a square and pushed the grid past the menu's
     max-height. */
  width: 44px;
  height: 28px;
  flex: 0 0 28px;
}

.create-select-shell.is-aspect-ratio-select .aspect-ratio-preview.is-auto .aspect-ratio-frame {
  width: 34px;
  height: 22px;
}

.create-select-shell.is-aspect-ratio-select .create-select-option {
  min-height: 60px;
  justify-content: center;
  padding: 6px 5px;
}

.create-select-shell.is-aspect-ratio-select .create-select-option-content {
  flex: 0 1 auto;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  text-align: center;
}

.create-select-shell.is-aspect-ratio-select .create-select-option > i {
  position: absolute;
  top: 7px;
  right: 7px;
  margin: 0;
}

.create-select-option:hover,
.create-select-option.is-keyboard-active {
  background: rgba(255,255,255,0.065);
  color: rgba(255,255,255,0.94);
}

.create-select-option.is-selected {
  background: rgba(139,92,246,0.18);
  color: #f3e8ff;
}

.create-select-option i {
  width: 6px;
  height: 10px;
  flex: 0 0 auto;
  margin: -2px 3px 0 0;
  border-right: 2px solid transparent;
  border-bottom: 2px solid transparent;
  transform: rotate(45deg);
}

.create-select-option.is-selected i {
  border-color: #c4b5fd;
}

.create-select-option:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(168,85,247,0.52);
}

.create-select-menu::-webkit-scrollbar {
  width: 6px;
}

.create-select-menu::-webkit-scrollbar-track {
  background: transparent;
}

.create-select-menu::-webkit-scrollbar-thumb {
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  background-clip: padding-box;
}

.create-select-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(196,181,253,0.42);
  background-clip: padding-box;
}

@media (max-width: 768px) {
  .input-panel {
    border-radius: 20px 20px 0 0;
  }

  .composer-panel-cues {
    gap: 6px;
  }

  .composer-cue-chip {
    min-height: 28px;
    padding: 0 10px;
    font-size: 11px;
  }

  .prompt-textarea,
  .media-mention-editor {
    height: 96px;
    min-height: 96px;
    padding: 12px 64px 12px 14px;
    font-size: 15px;
  }

  .prompt-support-copy {
    padding-right: 0;
  }

  .btn-send {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .point-cost-preview {
    position: static;
    width: fit-content;
    margin-top: 12px;
  }

  .settings-row {
    padding: 12px;
    border-radius: 14px;
  }
}

/* Narrow landscape phones (e.g. 769–820px wide in a short viewport): compress
   the composer stack so the full control set fits on one screen. The
   specification row scrolls horizontally instead of wrapping. */
@media (min-width: 769px) and (max-width: 820px) and (max-height: 480px) {
  .input-panel { min-height: 0; }

  .input-panel-content { padding-top: 52px; }

  .tabs {
    min-height: 34px;
    padding-top: 4px;
  }

  .tab-item {
    min-height: 28px;
    padding: 3px 12px;
    font-size: 12px;
  }

  .upload-card,
  .video-upload-card {
    height: 52px;
    min-height: 52px;
    margin-top: 4px;
    padding: 8px 10px;
  }

  .prompt-textarea,
  .media-mention-editor {
    height: 76px;
    min-height: 76px;
    padding: 10px 64px 10px 12px;
  }

  .point-cost-preview {
    position: static;
    width: fit-content;
    margin: 8px 0 0 auto;
  }

  .settings-row {
    margin-top: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .btn-send {
    top: 10px;
    right: 12px;
    bottom: auto;
  }
}

/* Clipboard paste feedback stays on the upload surface without adding permanent UI. */
.image-upload-area {
  outline: none;
}

.image-upload-area:focus-visible .upload-card {
  border-color: rgba(196,181,253,0.68);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.12), inset 0 1px 0 rgba(255,255,255,0.07);
}

.image-upload-area.is-clipboard-pasting .upload-card {
  animation: create-image-paste-pulse 520ms ease-out;
}

@keyframes create-image-paste-pulse {
  0% {
    border-color: rgba(196,181,253,0.38);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  }
  42% {
    border-color: rgba(216,180,254,0.94);
    box-shadow: 0 0 0 4px rgba(139,92,246,0.14), 0 12px 34px rgba(76,29,149,0.18), inset 0 1px 0 rgba(255,255,255,0.1);
  }
  100% {
    border-color: rgba(255,255,255,0.08);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  }
}

@media (prefers-reduced-motion: reduce) {
  .image-upload-area.is-clipboard-pasting .upload-card {
    animation: none;
    border-color: rgba(216,180,254,0.82);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.12), inset 0 1px 0 rgba(255,255,255,0.07);
  }
}
