/* ================= 3D MODEL STYLES ================= */
/* Consolidated 3D model styles for chat messages, bubbles, and behavior */

:root {
  --chat-model-card-size: 520px;
}

@media (min-width: 1024px) {
  :root { --chat-model-card-size: 640px; }
}

@media (max-width: 768px) {
  :root { --chat-model-card-size: 400px; }
}

/* ================= BASE 3D MODEL WRAPPER & CONTAINER ================= */

.chat-model-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 0;
  border-radius: 6px;
  overflow: hidden;
  max-width: 100%;
  height: auto;
}

.chat-model-container {
  position: relative;
  width: 100%;
  height: auto;
  max-width: 100%;
  min-height: 200px;
}

.chat-model-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  cursor: pointer;
}

.chat-model-container canvas,
.chat-model-container model-viewer {
  width: 100% !important;
  height: auto !important;
  max-width: 100% !important;
  display: block;
  pointer-events: none;
  object-fit: contain;
}

.chat-model-overlay {
  position: absolute;
  inset: 0;
  cursor: pointer;
}

/* ================= CLEAN 3D MODEL STYLES (Image-like appearance) ================= */

.chat-model-wrapper-clean {
  position: relative;
  display: inline-block;
  margin-bottom: 0;
  border-radius: 8px;
  overflow: hidden;
  max-width: 100%;
  height: auto;
  background: transparent;
  min-height: unset;
  aspect-ratio: unset;
}

.chat-model-container-clean {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100%;
  min-height: unset;
  background: transparent;
  border-radius: 8px;
  overflow: hidden;
}

.chat-model-thumb-clean {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  cursor: pointer;
  border-radius: 8px;
}

.chat-model-container-clean canvas,
.chat-model-container-clean model-viewer {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  display: block;
  pointer-events: none;
  object-fit: contain;
  border-radius: 8px;
}

/* ================= ASSISTANT MESSAGE 3D MODEL STYLES ================= */

/* Keep 3D model capsules consistent with chat media sizing (no fixed 625px). */
.message.assistant .chat-model-wrapper-clean,
.message.assistant .chat-model-wrapper {
  display: block;
  width: 100%;
  max-width: var(--chat-model-card-size);
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: transparent;
}

@media (min-width: 1024px) {
  .message.assistant .chat-model-wrapper-clean,
  .message.assistant .chat-model-wrapper {
    max-width: 640px;
  }
}

@media (max-width: 768px) {
  .message.assistant .chat-model-wrapper-clean,
  .message.assistant .chat-model-wrapper {
    max-width: 400px;
  }
}

.message.assistant .chat-model-container-clean,
.message.assistant .chat-model-container {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  position: relative;
  overflow: hidden;
}

/* Loading and resolved states share one viewport. The former fixed 300px
 * loader caused a visible size jump when the model became available. */
.chat-model-container-clean.is-model-loading,
.chat-model-container.is-model-loading {
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.045), transparent 34%),
    linear-gradient(155deg, #14171b 0%, #101216 58%, #0c0e11 100%);
}

.chat-model-container-clean > canvas,
.chat-model-container > canvas {
  position: relative;
  z-index: 1;
}

.model-loading-stage {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 4.75%, 32px);
  box-sizing: border-box;
  pointer-events: none;
  background-color: #101216;
  background-image:
    radial-gradient(circle at 50% 46%, rgba(255, 255, 255, 0.035), transparent 34%),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: auto, 32px 32px, 32px 32px;
  background-position: center, center, center;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 380ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.model-loading-stage-content {
  display: flex;
  width: min(280px, 72%);
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.model-loading-stage-spinner {
  width: 34px;
  height: 34px;
  box-sizing: border-box;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-top-color: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  animation: model-loading-spin 900ms cubic-bezier(0.55, 0.12, 0.45, 0.88) infinite;
}

.model-loading-stage.is-completing {
  opacity: 0;
  transform: translateY(5px);
}

.model-loading-stage-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.model-loading-stage-kicker {
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.model-loading-stage-detail {
  min-width: 0;
  overflow: hidden;
  color: rgba(226, 230, 236, 0.58);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-loading-stage-meter {
  width: min(230px, 100%);
  height: 1px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
}

.model-loading-stage-fill {
  display: block;
  width: var(--model-load-progress, 16%);
  height: 100%;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
  transform-origin: left center;
  transition: width 240ms cubic-bezier(0.2, 0.7, 0.2, 1);
  animation: model-loading-breathe 1.8s ease-in-out infinite alternate;
}

@keyframes model-loading-breathe {
  from { opacity: 0.7; filter: saturate(0.8); }
  to { opacity: 1; filter: saturate(1.12); }
}

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

@media (prefers-reduced-motion: reduce) {
  .model-loading-stage-fill,
  .model-loading-stage-spinner { animation: none; }
}

.message.assistant .chat-model-container-clean canvas,
.message.assistant .chat-model-container-clean model-viewer,
.message.assistant .chat-model-container canvas,
.message.assistant .chat-model-container model-viewer {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  display: block !important;
  pointer-events: none !important;
  object-fit: contain !important;
}

/* Force canvas elements to respect container bounds */
.chat-model-container canvas[style*="width: 800px"],
.chat-model-container canvas[style*="height: 800px"],
.chat-model-container-clean canvas[style*="width: 800px"],
.chat-model-container-clean canvas[style*="height: 800px"] {
  width: 100% !important;
  height: auto !important;
  max-width: 100% !important;
}

/* ================= DESKTOP ADJUSTMENTS ================= */

@media (min-width: 1024px) {
  .message.assistant .chat-model-wrapper-clean {
    max-width: var(--chat-model-card-size);
  }
  
  .chat-model-wrapper {
    max-width: 640px;
  }
}

/* ================= MOBILE ADJUSTMENTS ================= */

@media (max-width: 768px) {
  .message.assistant .chat-model-wrapper-clean {
    max-width: var(--chat-model-card-size);
  }
  
  .chat-model-wrapper {
    max-width: 400px;
  }
}

/* ================= 3D MODEL RETRY BUTTON STYLING ================= */

.chat-model-container .retry-button,
.chat-model-container [style*="RETRY DOWNLOAD"] {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  color: #ffffff !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  text-align: center !important;
  cursor: pointer !important;
  background: rgba(0, 0, 0, 0.7) !important;
  padding: 12px 20px !important;
  border-radius: 8px !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  transition: background 0.16s ease, border-color 0.16s ease !important;
  z-index: 10 !important;
  width: auto !important;
  height: auto !important;
  max-width: calc(100% - 40px) !important;
  word-wrap: break-word !important;
  margin: 0 !important;
  line-height: 1.2 !important;
}

.chat-model-container .retry-button:hover,
.chat-model-container [style*="RETRY DOWNLOAD"]:hover {
  background: rgba(0, 0, 0, 0.9) !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
  transform: translate(-50%, -50%) !important;
}

/* ================= MODEL OPTION PILLS STYLES ================= */

/* Model option message surface sizing is governed by chat-contract.css. */

.message.assistant .model-option-pills-container {
  position: relative;
  overflow: visible !important;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 520px;
  min-width: min(360px, 100%);
  margin: 0 0 10px;
}

.model-dialog-intro {
  margin: 0 34px 10px 0;
  color: rgba(235, 238, 244, 0.86);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 500;
}

.model-option-pills-container .upscale-rollup-pill {
  position: relative;
  overflow: visible !important;
}

.model-option-pills-container .upscale-rollup-pill {
  transition: opacity 0.18s ease, filter 0.18s ease;
}

.model-option-pills-container .pill-tooltip {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(calc(-50% + 4px));
  background: rgba(18, 19, 22, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(231, 234, 240, 0.92);
  font-size: 10.6px;
  line-height: 1.35;
  padding: 7px 9px;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
  max-width: 260px;
  width: min(260px, calc(100vw - 140px));
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 2200 !important;
}

.model-option-pills-container .pill-tooltip .pill-tooltip-inner {
  display: block;
}

.model-option-pills-container .pill-tip-text {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: 20px;
  gap: 3px;
}

.model-option-pills-container .pill-tip-text::before {
  content: '?';
  position: absolute;
  left: 0;
  top: 1px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: rgba(244, 247, 252, 0.92);
  background: rgba(255, 255, 255, 0.05);
  text-align: center;
  line-height: 13px;
  font-size: 10px;
  font-weight: 700;
}

.model-option-pills-container .pill-tip-line {
  color: #e3e6ec;
}

.model-option-pills-container .pill-tip-title {
  font-weight: 700;
  color: #ffffff;
}

.model-option-pills-container .pill-tip-subtle {
  color: rgba(227,230,236,0.75);
}

.model-option-pills-container .upscale-rollup-pill.is-hovered .pill-tooltip,
.model-option-pills-container .upscale-rollup-pill:hover .pill-tooltip {
  opacity: 1;
  transform: translateY(-50%);
}

.model-option-pills-container .upscale-rollup-pill .pill-label {
  transition: color 0.14s ease;
  text-shadow: none !important;
}

.model-option-pills-container .upscale-rollup-pill.is-hovered .pill-label,
.model-option-pills-container .upscale-rollup-pill:hover .pill-label {
  color: rgba(255, 255, 255, 0.96);
  text-shadow: none !important;
}

.model-option-pills-container .upscale-rollup-pill.is-hovered .pill-label::after,
.model-option-pills-container .upscale-rollup-pill:hover .pill-label::after {
  content: none !important;
  display: none !important;
}

.model-option-pills-container .upscale-rollup-pill {
  transition: background 0.14s ease, border-color 0.14s ease;
}

.model-option-pills-container .upscale-rollup-pill:hover {
  transform: none;
}

.model-option-pills-container .upscale-rollup-pill .pill-shell {
  transition: box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.model-option-pills-container .upscale-rollup-pill.is-hovered .pill-shell,
.model-option-pills-container .upscale-rollup-pill:hover .pill-shell {
  box-shadow: none;
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.055);
}

/* Provider settings take only the space their active controls need. */
.model-provider-settings-stage {
  position: relative;
  width: 100%;
  height: auto;
  overflow: visible;
  box-sizing: border-box;
}

.model-provider-settings-panel {
  position: relative;
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(58px, auto);
  align-items: start;
  align-content: start;
  column-gap: 18px;
  row-gap: 8px;
  padding: 0;
  box-sizing: border-box;
  overflow: visible;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.model-provider-settings-panel.is-active {
  display: grid;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.model-provider-settings-panel > .upscale-rollup-pill,
.model-provider-settings-panel > .model-range-row {
  min-width: 0;
  width: 100%;
}

.model-provider-settings-panel .pill-label {
  display: block !important;
  min-width: 0;
  font-size: 9.5px !important;
  line-height: 1.25 !important;
  padding: 0 !important;
  color: rgba(196, 201, 211, 0.74) !important;
  letter-spacing: 0.08em !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
}

.model-provider-settings-panel .pill-shell {
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.model-provider-settings-panel > .model-control-wide,
.model-provider-settings-panel > .model-range-row {
  grid-column: 1 / -1;
}

.model-provider-settings-panel .upscale-option-button {
  min-width: 0 !important;
  padding: 4px 8px !important;
  font-size: 11px !important;
}

.model-provider-settings-panel .model-compact-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(12px, auto) 32px;
  align-items: stretch;
  align-content: start;
  gap: 6px !important;
  min-height: 58px;
  padding: 1px 0 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
}

.model-provider-settings-panel .model-compact-control .pill-shell {
  min-width: 0;
  width: 100%;
  justify-content: flex-start;
}

.model-compact-select {
  display: block;
  width: 100%;
  height: 32px;
  min-width: 0;
  max-width: 100%;
  padding: 0 30px 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #202125;
  color: rgba(242, 244, 248, 0.94);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.model-compact-select:hover,
.model-compact-select:focus-visible {
  border-color: rgba(255, 255, 255, 0.34);
  background: #25262a;
}

.model-compact-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  height: 32px;
  min-width: 66px;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(196, 201, 211, 0.8);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.model-compact-toggle-track {
  position: relative;
  display: block;
  width: 30px;
  height: 17px;
  border: 1px solid rgba(255, 255, 255, 0.23);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.model-compact-toggle-track > span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(232, 235, 241, 0.78);
  transition: transform 0.15s ease, background 0.15s ease;
}

.model-compact-toggle.is-on {
  color: rgba(242, 244, 248, 0.96);
}

.model-compact-toggle.is-on .model-compact-toggle-track {
  border-color: rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.18);
}

.model-compact-toggle.is-on .model-compact-toggle-track > span {
  transform: translateX(13px);
  background: #fff;
}

.model-compact-toggle-value {
  width: 20px;
  text-align: left;
}

.model-option-pills-container > .model-provider-picker .pill-shell {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.model-provider-picker .model-provider-grid {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px !important;
  width: 100%;
  min-width: 0;
}

.model-provider-picker .model-provider-grid > .model-provider-option {
  grid-column: auto;
  width: 100%;
  min-width: 0 !important;
  min-height: 34px;
  padding: 6px 8px !important;
  border-width: 1px !important;
  border-radius: 9px !important;
  font-size: 11.5px !important;
  line-height: 1;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap !important;
}

.model-provider-picker .model-provider-grid > .model-provider-option:nth-child(n + 4) {
  grid-column: auto;
}

.model-provider-picker .model-provider-option.is-new-provider {
  position: relative;
  padding-right: 19px !important;
  border-color: rgba(255, 144, 73, 0.58) !important;
  background: rgba(255, 124, 49, 0.075) !important;
  color: rgba(255, 194, 150, 0.98) !important;
  animation: model-provider-new-breathe 2.8s ease-in-out infinite;
}

.model-provider-picker .model-provider-option.is-new-provider::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ff974f;
  box-shadow: 0 0 0 3px rgba(255, 130, 55, 0.13);
  transform: translateY(-50%);
}

@keyframes model-provider-new-breathe {
  0%, 100% {
    border-color: rgba(255, 144, 73, 0.42);
    box-shadow: 0 0 0 0 rgba(255, 126, 48, 0);
  }
  50% {
    border-color: rgba(255, 163, 96, 0.88);
    box-shadow: 0 0 0 2px rgba(255, 126, 48, 0.1), inset 0 0 14px rgba(255, 126, 48, 0.055);
  }
}

.model-provider-picker .model-pill-provider-name {
  display: none;
}

.model-provider-description {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  margin: -1px 0 3px;
  padding: 0 2px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
}

.model-provider-description-label {
  color: rgba(242, 244, 248, 0.92);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.model-provider-description-text {
  min-width: 0;
  color: rgba(199, 203, 211, 0.75);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.model-dialog-content .model-input-thumb {
  width: 84px;
  height: 84px;
  min-width: 84px;
  min-height: 84px;
}

/* ================= MODEL CREDIT COST DISPLAY ================= */

.model-credit-cost-display {
  color: #b9bec7;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  white-space: nowrap;
  margin-left: auto;
}

/* ================= MODEL EXECUTE & CANCEL BUTTONS ================= */

.model-execute-button,
.model-cancel-button {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.94);
  padding: 9px 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, opacity 0.14s ease;
  box-shadow: none;
}

.model-cancel-button {
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(224, 228, 236, 0.82);
}

.model-execute-button:hover {
  background: rgba(255, 255, 255, 0.075);
  border-color: rgba(255, 255, 255, 0.3);
  transform: none;
}

.model-cancel-button:hover {
  background: rgba(255, 255, 255, 0.075);
  border-color: rgba(255, 255, 255, 0.3);
  transform: none;
}

.model-execute-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.model-dialog-content {
  position: relative;
}

.model-dialog-close-x {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(233, 237, 244, 0.92);
  font-size: 17px;
  line-height: 22px;
  text-align: center;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
  z-index: 3;
}

.model-dialog-close-x:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.26);
}

.model-dialog-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.075);
}

.model-pill-provider-name {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  color: rgba(185, 190, 199, 0.78);
  text-shadow: none;
}

.model-provider-option {
  display: inline-flex !important;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0;
  border-radius: 9px;
}

.model-input-preview-strip {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 11px;
  background: rgba(7, 8, 11, 0.22);
  box-sizing: border-box;
}

.model-input-preview-title {
  color: rgba(197, 202, 212, 0.82);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  width: 100%;
  text-align: left;
  padding: 0 1px;
}

.model-input-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  justify-content: flex-start;
  align-items: flex-start;
}

.model-input-thumb {
  position: relative;
  width: 112px;
  height: 112px;
  min-width: 112px;
  min-height: 112px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
}

.model-input-thumb img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  min-width: 100%;
  min-height: 100%;
  object-fit: cover !important;
  object-position: center;
  display: block;
  margin: 0 !important;
  border-radius: inherit;
}

.model-input-thumb.is-unused img {
  filter: grayscale(1) saturate(0) brightness(0.68);
}

.model-input-thumb.is-unused::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 16, 0.25);
}

.model-input-thumb-empty,
.model-input-dropzone {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 11px;
  color: rgba(227, 230, 236, 0.7);
}

.model-input-dropzone {
  padding: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.35);
  cursor: pointer;
  user-select: none;
}

.model-input-dropzone.is-dragover {
  border-color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.06);
}

.model-input-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(12, 12, 14, 0.72);
  color: #fff;
  font-size: 14px;
  line-height: 18px;
  padding: 0;
  cursor: pointer;
  z-index: 2;
}

.model-input-thumb-remove:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.32);
}

.model-input-thumb-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  min-width: 130px;
  max-width: 190px;
  padding: 6px 8px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(18, 20, 24, 0.9);
  color: #e5e8ee;
  font-size: 10.5px;
  line-height: 1.3;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 2300;
}

.model-input-thumb.is-unused:hover .model-input-thumb-tooltip {
  opacity: 1;
  transform: translateX(-50%);
}

.model-hidden-file-input {
  display: none;
}

.model-range-row {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 0 6px;
}

.model-range-label {
  color: #b9bec7;
  font-size: 11px;
  font-weight: 600;
}

.model-range-input {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  background: #3c3c3c;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.model-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

.model-range-input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

.model-range-input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.model-range-value {
  color: #fff;
  font-size: 12px;
  min-width: 70px;
  text-align: right;
  font-weight: 600;
}

/* ================= FACE LIMIT SLIDER ================= */

.face-limit-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px;
}

.face-limit-slider {
  flex: 1;
  height: 6px;
  background: #3c3c3c;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.face-limit-value {
  color: #ffffff;
  font-size: 12px;
  min-width: 70px;
  text-align: right;
  font-weight: 600;
}

@media (max-width: 768px) {
  .message.assistant .model-option-pills-container {
    max-width: 100%;
    min-width: 100%;
  }

  .model-provider-settings-panel {
    grid-template-columns: 1fr;
  }

  .model-provider-settings-panel > .model-control-wide,
  .model-provider-settings-panel > .model-range-row {
    grid-column: auto;
  }

  .model-provider-picker .model-provider-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .model-provider-picker .model-provider-grid > .model-provider-option,
  .model-provider-picker .model-provider-grid > .model-provider-option:nth-child(n + 4) {
    grid-column: span 1;
  }

  .model-provider-picker .model-provider-grid > .model-provider-option:last-child {
    grid-column: 1 / -1;
  }

  .model-provider-description {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .model-provider-settings-panel {
    transition: none;
    transform: none;
  }

  .model-provider-picker .model-provider-option.is-new-provider {
    animation: none;
  }
}
