/**
 * Preview Remix CSS Styles
 * Styles for runtime remix UI components
 */

/* Pixel font import for retro game aesthetic */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* Liquid Glass Effect Variables */
:root {
  /* Background gradients */
  --liquid-glass-bg-primary: linear-gradient(135deg, 
    rgba(15, 15, 35, 0.6) 0%,
    rgba(25, 27, 45, 0.4) 30%,
    rgba(44, 85, 153, 0.2) 70%,
    rgba(25, 27, 45, 0.5) 100%);
  
  --liquid-glass-bg-panel: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.08) 0%,
    rgba(44, 85, 153, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 100%);
  
  /* Blur and effects */
  --liquid-glass-blur-strong: blur(40px) saturate(200%) brightness(1.2);
  --liquid-glass-blur-medium: blur(30px) saturate(180%) contrast(1.1);
  --liquid-glass-blur-light: blur(15px) saturate(150%);
  
  /* Borders and shadows */
  --liquid-glass-border: 2px solid rgba(255, 255, 255, 0.2);
  --liquid-glass-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(44, 85, 153, 0.3),
    inset 0 2px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

/* Liquid Glass Utility Classes */
.liquid-glass-overlay {
  background: var(--liquid-glass-bg-primary);
  backdrop-filter: var(--liquid-glass-blur-strong);
  -webkit-backdrop-filter: var(--liquid-glass-blur-strong);
}

.liquid-glass-panel {
  background: var(--liquid-glass-bg-panel);
  backdrop-filter: var(--liquid-glass-blur-medium);
  -webkit-backdrop-filter: var(--liquid-glass-blur-medium);
  border: var(--liquid-glass-border);
  border-radius: 24px !important;
  box-shadow: var(--liquid-glass-shadow);
}

.liquid-glass-element {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: var(--liquid-glass-blur-light);
  -webkit-backdrop-filter: var(--liquid-glass-blur-light);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.liquid-glass-button {
  background: rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: var(--liquid-glass-blur-light) !important;
  -webkit-backdrop-filter: var(--liquid-glass-blur-light) !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
  border-radius: 8px !important;
  transition: all 0.3s ease !important;
}

.liquid-glass-button:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(44, 85, 153, 0.3) !important;
}

.liquid-glass-input {
  background: rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: var(--liquid-glass-blur-light) !important;
  -webkit-backdrop-filter: var(--liquid-glass-blur-light) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
  border-radius: 6px !important;
}

/* Apply pixel font to all preview-remix elements */
.preview-remix-dialog *,
.preview-remix-floating-btn,
.remix-notification,
.runtime-asset-picker-overlay,
.runtime-asset-picker-overlay *,
.runtime-asset-picker-content,
.runtime-asset-picker-content *,
.runtime-asset-picker-header,
.runtime-asset-picker-header *,
.runtime-asset-card,
.runtime-asset-card *,
.runtime-asset-picker-controls,
.runtime-asset-picker-controls *,
.runtime-asset-picker-pagination,
.runtime-asset-picker-pagination *,
.model-switch-slider *,
.model-toggle-switch * {
  font-family: 'Press Start 2P', 'Courier New', monospace !important;
  line-height: 1.4 !important;
}

/* Floating button */
.preview-remix-floating-btn {
  position: fixed;
  bottom: 40px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, 
    rgba(44, 85, 153, 0.9) 0%, 
    rgba(30, 53, 72, 0.95) 100%);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 
    0 8px 32px rgba(44, 85, 153, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  z-index: 10000;
  transition: all 0.3s ease;
}

.preview-remix-floating-btn:hover {
  transform: scale(1.05);
  box-shadow: 
    0 12px 40px rgba(44, 85, 153, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.preview-remix-floating-btn:active {
  transform: scale(0.95);
  transition: transform 0.1s ease;
}

.preview-remix-floating-btn:active {
  transform: scale(0.95);
}

/* Dialog overlay - Using unified liquid glass */
.preview-remix-dialog {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--liquid-glass-bg-primary);
  backdrop-filter: var(--liquid-glass-blur-strong);
  -webkit-backdrop-filter: var(--liquid-glass-blur-strong);
  z-index: 10001;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

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

/* Main panel - Using unified liquid glass */
.remix-panel {
  background: var(--liquid-glass-bg-panel);
  backdrop-filter: var(--liquid-glass-blur-medium);
  -webkit-backdrop-filter: var(--liquid-glass-blur-medium);
  border: var(--liquid-glass-border);
  border-radius: 24px !important;
  box-shadow: var(--liquid-glass-shadow);
  width: 80%;
  max-width: 700px;
  height: 85%;
  max-height: 700px;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Header - Use same styles as asset picker */
.remix-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: none;
  background: transparent;
  border-radius: 0;
}

.remix-header h2 {
  margin: 0;
  color: #ffffff;
  font-size: 12px;
  font-weight: normal;
}

/* Use same layout as asset picker */
.remix-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.remix-header-right {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 120px;
}

.remix-header button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 20px;
  cursor: pointer;
  color: #ffffff;
  padding: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
  font-family: 'Press Start 2P', 'Courier New', monospace !important;
  line-height: 1 !important;
}

.remix-header button:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* Toggle Switch Tabs */
.remix-tabs {
  display: flex;
  justify-content: center;
  padding: 16px 24px;
  flex-shrink: 0;
  background: transparent;
  position: static;
  z-index: auto;
}

.tab-toggle-switch {
  position: relative;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  padding: 4px;
  display: flex;
  align-items: center;
}

.tab-toggle-switch input {
  display: none;
}

.tab-switch-slider {
  position: relative;
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 25px;
  overflow: hidden;
}

.tab-switch-slider label {
  padding: clamp(4px, 1vw, 6px) clamp(8px, 2vw, 12px);
  cursor: pointer;
  font-size: clamp(4px, 1vw, 6px);
  font-weight: normal;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: clamp(0.2px, 0.1vw, 0.5px);
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
  user-select: none;
  white-space: nowrap;
}

.tab-switch-slider::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: #2C5599;
  border-radius: 25px;
  transition: transform 0.3s ease;
  z-index: 1;
}

#tab-behaviors:checked ~ .tab-switch-slider::before {
  transform: translateX(100%);
}

#tab-objects:checked ~ .tab-switch-slider label[for="tab-objects"],
#tab-behaviors:checked ~ .tab-switch-slider label[for="tab-behaviors"] {
  color: #ffffff;
}

/* Model toggle switch styles - compact version */
.model-toggle-switch {
  position: relative;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  width: fit-content;
}

.model-toggle-switch input {
  display: none;
}

.model-switch-slider {
  position: relative;
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  overflow: hidden;
}

.model-switch-slider::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: #2C5599;
  border-radius: 14px;
  transition: transform 0.3s ease;
  z-index: 1;
}

.model-switch-slider label {
  padding: clamp(4px, 1.5vw, 6px) clamp(8px, 2.5vw, 12px);
  cursor: pointer;
  font-size: clamp(4px, 1vw, 6px);
  font-weight: normal;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: clamp(0.2px, 0.1vw, 0.5px);
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
  user-select: none;
  white-space: nowrap;
}

.model-switch-slider label:hover {
  color: rgba(255, 255, 255, 0.9);
}

#model-wanaka:checked ~ .model-switch-slider::before {
  transform: translateX(100%);
}

#model-general:checked ~ .model-switch-slider label[for="model-general"],
#model-wanaka:checked ~ .model-switch-slider label[for="model-wanaka"] {
  color: #ffffff;
}

/* Old tab styles removed - using toggle switch now */

/* Content area - Dark theme */
.remix-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: transparent;
}

.remix-panels {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  min-height: 0;
  position: relative;
  z-index: auto;
  background: transparent;
}

.remix-panel-content {
  animation: fadeIn 0.2s ease;
  position: static;
  z-index: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Object items */
.object-item {
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  transition: box-shadow 0.2s;
}

.object-item:hover {
  opacity: 0.9;
}

.object-item strong {
  color: #333;
  font-size: 16px;
}

/* Behavior groups */
.behavior-group {
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.behavior-group h3 {
  margin: 0 0 16px 0;
  color: #ffffff;
  font-size: 18px;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 8px;
}

.behavior-group h4 {
  margin: 0 0 12px 0;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
}

/* Input fields */
input[type="text"],
input[type="number"] {
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: #2C5599;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 3px rgba(44, 85, 153, 0.2);
}

/* Buttons */
button {
  transition: all 0.2s;
}

.remix-btn-primary {
  padding: 10px 20px;
  background: #2C5599;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.remix-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.remix-btn-secondary {
  padding: 10px 20px;
  background: #f5f5f5;
  color: #666;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.remix-btn-secondary:hover {
  background: #efefef;
  border-color: #ccc;
}

/* Footer removed */

/* Property rows */
.remix-prop-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  padding: 8px;
  background: transparent;
  border-radius: 6px;
}

.remix-prop-row label {
  width: 140px;
  font-size: 14px;
  color: #555;
  font-weight: 500;
}

.remix-prop-row input {
  width: 120px;
}

.remix-prop-row button {
  padding: 6px 14px;
  background: #2C5599;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.remix-prop-row button:hover {
  background: #3A66B8;
}

/* Notifications */
.remix-notification {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 14px 28px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10002;
  font-size: 10px;
  animation: slideInUp 0.3s ease;
}

@keyframes slideInUp {
  from {
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

/* Scrollbar styling */
.remix-content::-webkit-scrollbar {
  width: 8px;
}

.remix-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.remix-content::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.remix-content::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Mobile-specific overrides for objects grid */
@media (max-width: 480px) {
  .objects-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(110px, 35%), 1fr));
    gap: clamp(4px, 1vw, 6px);
    padding: clamp(4px, 1vw, 8px);
  }
}

/* Toggle buttons responsive layout - when space is limited */
@media (max-width: 400px) {
  /* Runtime Remix header wrap layout */
  .remix-header-right {
    min-width: unset;
    width: 100%;
    justify-content: center;
    margin-top: 8px;
  }
  
  .tab-switch-slider label {
    padding: clamp(4px, 1.5vw, 6px) clamp(8px, 3vw, 12px);
    font-size: clamp(4px, 1.5vw, 6px);
  }
  
  /* Asset picker header wrap layout */
  .runtime-asset-picker-header-right {
    min-width: unset;
    width: 100%;
    justify-content: center;
    margin-top: 8px;
  }
  
  .model-switch-slider label {
    padding: clamp(3px, 1.5vw, 5px) clamp(6px, 3vw, 10px);
    font-size: clamp(3px, 1.2vw, 5px);
  }
}

/* Very small screens - force wrap */
@media (max-width: 320px) {
  .remix-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .remix-header-left {
    justify-content: flex-start;
    margin-bottom: 4px;
  }
  
  .remix-header-right {
    justify-content: center;
    margin-top: 0;
  }
  
  .runtime-asset-picker-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .runtime-asset-picker-header-left {
    justify-content: flex-start;
    margin-bottom: 4px;
  }
  
  .runtime-asset-picker-header-right {
    justify-content: center;
    margin-top: 0;
  }
}

/* Mobile Support - Keep popup style */
@media (max-width: 600px) {
  /* Keep popup style on mobile */
  .remix-panel {
    width: 90%;
    max-width: 90%;
    height: 90%;
    max-height: 90%;
    border-radius: 24px !important;
  }
  
  /* Header sticky at top */
  .remix-header {
    padding: 12px;
    position: static !important;
    background: transparent !important;
    flex-shrink: 0;
  }
  
  .remix-header h2 {
    font-size: 6px;
  }
  
  /* Tabs in mobile - normal flow, not sticky */
  .remix-tabs {
    padding: 12px 16px;
    position: static;
    background: transparent !important;
    flex-shrink: 0;
  }
  
  .tab-switch-slider label {
    padding: 8px 12px !important;
    font-size: 6px !important;
  }
  
  /* Old tab styles removed */
  
  /* Content scrollable area - remove padding since tabs and panels have their own */
  .remix-content {
    padding: 0;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }
  
  .remix-panels {
    flex: 1;
    overflow-y: auto;
    padding: 0;
  }
  
  /* Behavior property rows responsive layout */
  .behavior-property-row {
    padding-left: 6px !important;
    padding-right: 6px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  
  .behavior-item {
    padding-left: 6px !important;
    padding-right: 6px !important;
  }
  
  /* Property items responsive layout */
  .property-item {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
    margin-bottom: 8px !important;
    padding: 8px 10px !important;
    background: transparent !important;
    border-radius: 4px !important;
    box-sizing: border-box !important;
  }
  
  .property-label {
    flex: 0 0 auto !important;
    width: 100px !important;
    color: #ffffff !important;
    font-size: 8px !important;
    font-weight: normal !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  
  .property-input {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }
  
  .property-input input {
    width: 100% !important;
    min-width: 40px !important;
    padding: 4px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 4px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    color: #ffffff !important;
    font-size: 8px !important;
    box-sizing: border-box !important;
  }
  
  .property-group-header {
    color: #ffffff !important;
    font-weight: normal !important;
    margin: 12px 0 8px 0 !important;
    border-bottom: 1px solid #ddd !important;
    padding-bottom: 4px !important;
    font-size: 8px !important;
  }
  
  .behavior-group {
    padding: 12px !important;
    margin-left: 8px !important;
    margin-right: 8px !important;
  }
  
  /* Scene section mobile */
  .scene-title {
    font-size: 10px;
    padding: 8px 8px;
    margin: 0;
  }
  
  /* Objects Grid - let columns adjust naturally based on screen width */
  .objects-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(130px, 45%), 1fr));
    gap: clamp(6px, 1.5vw, 10px);
    padding: clamp(8px, 1.5vw, 12px);
  }
  
  /* Mobile optimizations for asset picker */
  .runtime-asset-picker-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100px, 45%), 1fr));
  }
  
  /* Behaviors panel mobile */
  .object-behavior-card {
    flex-direction: column !important;
    gap: 6px !important;
    padding: 8px !important;
    margin-bottom: 8px !important;
  }
  
  .object-thumbnail-section {
    width: 100% !important;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
  
  .object-thumbnail-section .object-thumbnail {
    width: 70px !important;
    height: 70px !important;
    margin: 0 !important;
    padding: 2px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }
  
  .object-thumbnail-section .object-name {
    flex: 1;
    text-align: left;
    font-size: 8px !important;
  }
  
  .properties-section {
    width: 100% !important;
  }
  
  .property-group-header {
    font-size: 8px;
    margin: 10px 0 6px 0 !important;
  }
  
  .property-item {
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 4px 8px !important;
    margin-bottom: 4px !important;
  }
  
  .property-label {
    flex: 0 0 auto !important;
    width: auto !important;
    white-space: nowrap !important;
    font-size: 8px !important;
    font-weight: normal !important;
    color: #ffffff !important;
  }
  
  .property-input {
    flex: 1 !important;
  }
  
  .property-input input {
    width: 100% !important;
    padding: 6px 8px !important;
    font-size: 8px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
  }
  
  /* Footer removed */
  
  /* Asset picker mobile - match remix panel on mobile */
  .runtime-asset-picker-content {
    width: 90%;
    max-width: 90%;
    height: 90%;
    max-height: 90%;
    border-radius: 24px !important;
  }
  
  .runtime-asset-picker-header {
    padding: 12px;
  }
  
  .runtime-asset-picker-header h3 {
    font-size: 6px;
  }
  
  .runtime-asset-picker-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 10px;
  }
  
  .runtime-asset-card {
    padding: 4px;
  }
  
  .runtime-asset-card img {
    height: 50px;
  }
  
  .runtime-asset-card-title {
    font-size: 5px;
  }
  
  /* Notification mobile */
  .remix-notification {
    width: calc(100% - 32px);
    max-width: 300px;
    padding: 10px 14px;
    font-size: 10px;
    bottom: 20px;
  }
  
  /* Floating button mobile */
  .preview-remix-floating-btn {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    font-size: 20px;
    background: linear-gradient(135deg, #2C5599 0%, #1e3548 100%);
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .remix-header h2 {
    font-size: 6px;
  }
  
  .remix-tab {
    padding: 10px 8px;
    font-size: 12px;
  }
  
  /* Smaller screens - reduce min size but maintain auto-fit */
  .objects-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(120px, 40%), 1fr));
    gap: clamp(4px, 1vw, 8px);
    padding: clamp(6px, 1vw, 10px);
  }
  
  .object-name {
    font-size: clamp(9px, 2vw, 11px);
    margin: 0;
    padding: 2px 0;
  }
  
  .object-buttons {
    gap: clamp(2px, 0.5vw, 4px);
    max-width: clamp(70px, 14vw, 80px);
  }
  
  .replace-btn, .upload-btn {
    padding: clamp(4px, 1vw, 6px) clamp(1px, 0.5vw, 2px);
    font-size: clamp(6px, 1.5vw, 7px);
  }
  
  /* Asset picker 3 columns minimum */
  .runtime-asset-picker-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(80px, 28%), 1fr));
  }
}

/* Very small devices (width < 375px) */
@media (max-width: 374px) {
  .objects-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100px, 30%), 1fr));
    gap: clamp(3px, 0.8vw, 5px);
    padding: clamp(3px, 0.8vw, 6px);
  }
}

/* Enhanced header layout for both portrait and landscape */

/* Runtime Remix header layout */
.remix-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 6px !important;
  background: transparent;
  border-radius: 0;
  flex-wrap: wrap;
  gap: 8px;
}

.remix-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.remix-header-right {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 150px;
}

/* Asset picker header layout */
.runtime-asset-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 6px !important;
  border-bottom: none;
  flex-wrap: wrap;
  gap: 8px;
}

.runtime-asset-picker-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.runtime-asset-picker-header-right {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 120px;
}

/* Asset picker header button styling */
.runtime-asset-picker-header button {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #ffffff;
  padding: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
  font-family: 'Press Start 2P', 'Courier New', monospace !important;
  line-height: 1 !important;
}

.runtime-asset-picker-header button:hover {
  transform: scale(1.1);
}

/* Mobile landscape - optimize for horizontal space */
@media (max-width: 600px) and (orientation: landscape) {
  .remix-panel {
    width: 95%;
    height: 95%;
    max-width: 95vw;
    max-height: 95vh;
  }
  
  /* Runtime Remix header - compact horizontal layout */
  .remix-header {
    padding: 6px 4px !important;
    min-height: 36px;
  }
  
  .remix-header-left h2 {
    font-size: 6px !important;
    margin: 0 !important;
    white-space: nowrap !important;
  }
  
  .remix-header-left button {
    width: 24px !important;
    height: 24px !important;
    font-size: 12px !important;
    padding: 0 !important;
    margin-right: 4px !important;
    font-family: 'Press Start 2P', 'Courier New', monospace !important;
  }
  
  .remix-header-right .tab-switch-slider label {
    padding: 3px 6px !important;
    font-size: 3px !important;
    line-height: 1.1 !important;
  }
  
  /* Maximize content area */
  .remix-content {
    flex: 1 !important;
    min-height: 0 !important;
  }
  
  .remix-panels {
    flex: 1 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 4px !important;
  }
  
  /* Asset picker - compact horizontal layout */
  .runtime-asset-picker-content {
    width: 95%;
    height: 95%;
    max-width: 95vw;
    max-height: 95vh;
  }
  
  .runtime-asset-picker-header {
    padding: 8px !important;
    min-height: 40px;
  }
  
  .runtime-asset-picker-header-left h3 {
    font-size: 6px !important;
    margin: 0 !important;
    white-space: nowrap !important;
  }
  
  .runtime-asset-picker-header button {
    font-size: 12px !important;
    width: 24px !important;
    height: 24px !important;
    padding: 0 !important;
    font-family: 'Press Start 2P', 'Courier New', monospace !important;
  }
  
  .runtime-asset-picker-header-right .model-switch-slider label {
    padding: 4px 8px !important;
    font-size: 4px !important;
  }
  
  /* Maximize asset picker content */
  .runtime-asset-picker-body {
    flex: 1 !important;
    overflow: hidden !important;
  }
  
  .runtime-asset-picker-grid {
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 4px;
    padding: 4px;
    height: calc(100% - 30px) !important;
    overflow-y: auto !important;
  }
  
  .runtime-asset-card {
    min-height: 65px;
    padding: 2px;
  }
  
  .runtime-asset-card img {
    height: 30px !important;
  }
  
  .runtime-asset-card-title {
    font-size: 4px !important;
    line-height: 1.1;
  }
}

/* Additional styles extracted from RuntimeRemixUI.js inline CSS */

/* New CSS classes for cleaned up RuntimeRemixUI.js */
.remix-panel-content.hidden {
  display: none !important;
}

.thumbnail-img {
  max-width: 60px;
  max-height: 60px;
  object-fit: contain;
}

.object-info-text {
  color: #666;
  font-size: 12px;
}

.fallback-text {
  color: #999;
  font-size: 12px;
  display: none;
  text-align: center;
}

/* Enhanced remix panel styles - removed duplicate */

/* Enhanced remix header - removed duplicate, using main definition above */

.remix-header h2 {
  margin: 0;
  color: #ffffff;
}

.remix-header #remix-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #ffffff;
}

/* Enhanced remix tabs */
.remix-tabs {
  display: flex;
  padding: 0 20px;
}

.remix-tab {
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #ffffff;
  margin-right: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.remix-tab.active {
  background: #2C5599;
  color: #ffffff;
}

/* Enhanced content area */
.remix-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: transparent;
}

.remix-panel-content[style*="display: none"] {
  display: none !important;
}

/* Enhanced footer removed */

/* Enhanced notification styles */
.remix-notification {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 12px 24px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 10002;
  font-size: 10px;
  transition: opacity 0.3s;
}

/* Object panel specific styles - Grid Layout */
.objects-list {
  /* Container for all scenes and object items */
  padding: 0;
  margin: 0;
}

.scene-section {
  margin: 0;
  padding: 0;
}

.scene-title {
  margin: 0;
  padding: 8px 12px;
  background: none;
  border: none;
  font-size: 12px;
  font-weight: normal;
  color: #ffffff;
  clear: both;
}

.objects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
  gap: clamp(8px, 2vw, 12px);
  padding: clamp(12px, 2vw, 16px);
  /* Same liquid glass effect as object-behavior-card */
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: var(--liquid-glass-blur-light);
  -webkit-backdrop-filter: var(--liquid-glass-blur-light);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  margin: 0 0 16px 0;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.object-card {
  background: transparent;
  border: none;
  border-radius: 16px;
  padding: clamp(2px, 0.5vw, 4px);
  text-align: center;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  min-height: max(160px, 20vw);
  border-radius: 16px;
  border: none;
}

.object-card:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

.object-card:active {
  transform: translateY(0) scale(0.98);
  transition: transform 0.1s ease;
}

.object-thumbnail {
  flex: 1;
  aspect-ratio: 1 / 1;
  max-width: 100%;
  border-radius: 16px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto clamp(4px, 0.5vw, 6px) auto;
  position: relative;
  overflow: hidden;
  padding: clamp(2px, 0.5vw, 4px);
  box-sizing: border-box;
  border: none;
  cursor: pointer;
}

/* Loading state for thumbnails */
.thumbnail-loading {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: 6px;
  z-index: 1;
  font-size: 8px;
  color: #ffffff;
  top: 0;
  left: 0;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.object-thumbnail img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
  z-index: 2;
  display: block;
  padding: 2px;
  box-sizing: border-box;
}

.thumbnail-fallback {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  font-size: 10px;
  z-index: 2;
  width: 100%;
  height: 100%;
  border-radius: 6px;
  background: #fff;
  position: absolute;
  top: 0;
  left: 0;
}

.object-type-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.object-type-text {
  font-size: 7px;
  text-align: center;
  line-height: 1;
  position: absolute;
  bottom: 2px;
  left: 0;
  right: 0;
  opacity: 0.6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
}

.object-details {
  flex: 1;
}

.object-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.object-header strong {
  font-weight: bold;
}

.object-header span {
  color: #666;
  font-size: 12px;
}

.object-preview {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
}

.object-info {
  flex: 1;
}

.object-name {
  font-weight: normal;
  margin: 0;
  padding: clamp(2px, 0.5vw, 4px) 0;
  font-size: clamp(8px, 2vw, 10px);
  color: #ffffff;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
  flex-shrink: 0;
}

/* Behavior panel object cards */
.object-behavior-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: var(--liquid-glass-blur-light);
  -webkit-backdrop-filter: var(--liquid-glass-blur-light);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

/* Boolean property switch styles */
.property-switch {
  position: relative;
  display: inline-block;
}

.property-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 40px;
  height: 20px;
  cursor: pointer;
  z-index: 3;
  margin: 0;
}

.switch-label {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
  cursor: pointer;
  pointer-events: none;
}

.switch-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  transition: all 0.3s;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  top: 2px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: all 0.3s;
}

.property-switch input:checked + .switch-label .switch-slider {
  background-color: rgba(44, 85, 153, 0.8);
  border-color: rgba(44, 85, 153, 1);
}

.property-switch input:checked + .switch-label .switch-slider:before {
  transform: translateX(20px);
  background-color: #ffffff;
}

/* Thumbnail overlay for buttons */
.thumbnail-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.thumbnail-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 80%;
}

.thumbnail-btn {
  padding: 6px 12px;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  cursor: pointer;
  font-size: 6px;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
}

.thumbnail-btn.replace-btn {
  background: rgba(44, 85, 153, 0.8);
  border-color: rgba(44, 85, 153, 0.9);
}

.thumbnail-btn.upload-btn {
  background: rgba(51, 122, 183, 0.8);
  border-color: rgba(51, 122, 183, 0.9);
}

.thumbnail-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Desktop hover effect */
@media (hover: hover) and (pointer: fine) {
  .object-thumbnail:hover .thumbnail-overlay {
    opacity: 1;
  }
}

/* Mobile: Simple click to show buttons */
@media (hover: none) and (pointer: coarse) {
  /* Hide overlay by default on mobile - use display none to prevent clicks */
  .thumbnail-overlay {
    display: none;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
  }
  
  /* Show overlay when clicked */
  .object-card.show-overlay .thumbnail-overlay {
    display: flex;
    opacity: 1;
  }
  
  /* Make buttons larger and more touch-friendly on mobile - vertical layout */
  .object-card.show-overlay .thumbnail-buttons {
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    gap: 8px;
    width: 85%;
    height: 85%;
    padding: 0;
    box-sizing: border-box;
  }
  
  .object-card.show-overlay .thumbnail-btn {
    flex: 1;
    width: 100%;
    padding: 8px 6px;
    font-size: 10px;
    font-weight: 600;
    max-height: 35px;
    border-radius: 4px;
    text-align: center;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .object-card.show-overlay .thumbnail-btn.replace-btn {
    background: rgba(44, 85, 153, 0.9);
    border-color: rgba(44, 85, 153, 1);
  }
  
  .object-card.show-overlay .thumbnail-btn.upload-btn {
    background: rgba(51, 122, 183, 0.9);
    border-color: rgba(51, 122, 183, 1);
  }
  
  .object-card.show-overlay .thumbnail-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }
}

.object-buttons {
  display: none; /* Hidden since buttons are now in overlay */
}

.replace-btn, .upload-btn {
  flex: 1;
  padding: clamp(6px, 1.5vw, 8px) clamp(2px, 1vw, 4px);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: clamp(7px, 2vw, 8px);
  font-weight: 500;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  box-sizing: border-box;
  min-width: 0;
}

.replace-btn {
  background: #2C5599;
  border: none;
}

.replace-btn:hover {
  transform: translateY(-1px);
  background: #3A66B8;
  box-shadow: 0 2px 8px rgba(44, 85, 153, 0.6);
}

.upload-btn {
  background: #2C5599;
  border: none;
}

.upload-btn:hover {
  transform: translateY(-1px);
  background: #3A66B8;
  box-shadow: 0 2px 8px rgba(44, 85, 153, 0.6);
}

.no-objects-message {
  padding: 20px;
  text-align: center;
  color: #666;
}

.object-controls {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.object-controls input[type="url"] {
  flex: 1;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.object-controls button {
  padding: 8px 16px;
  background: #2C5599;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.object-controls button:hover {
  background: #3A66B8;
}

.object-controls .file-input-wrapper {
  position: relative;
  overflow: hidden;
  display: inline-block;
}

.object-controls .file-input-wrapper input[type="file"] {
  position: absolute;
  left: -9999px;
}

.object-controls .file-input-wrapper label {
  padding: 8px 16px;
  background: #28a745;
  color: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.object-controls .file-input-wrapper label:hover {
  background: #218838;
}

/* Behavior panel specific styles */
.behaviors-list {
  /* Container for all behavior items */
  padding: 0;
  box-sizing: border-box;
  overflow-x: hidden;
}

.behavior-group {
  background: transparent;
  border: none;
  border-radius: 4px;
  padding: 15px;
  margin-bottom: 15px;
  margin-left: 20px;
  margin-right: 20px;
  box-sizing: border-box;
  max-width: 100%;
}

.behavior-group h4 {
  margin: 0 0 15px 0;
  color: #ffffff;
  display: flex;
  justify-content: space-between;
}

.behavior-group h4 span {
  color: #ffffff;
  font-size: 8px;
  font-weight: normal;
}

.behavior-item {
  margin-bottom: 15px;
  padding-left: 10px;
  padding-right: 10px;
  border-left: 2px solid #f0f0f0;
}

.behavior-item h5 {
  margin: 0 0 10px 0;
  color: #ffffff;
  font-size: 9px;
}

.behavior-item h5 span {
  font-weight: normal;
  color: #ffffff;
}

.behavior-property-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  padding-left: 10px;
  padding-right: 10px;
  box-sizing: border-box;
  width: 100%;
}

.behavior-property-row label {
  flex: 0 0 auto;
  width: 80px;
  font-size: 7px;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.behavior-property-row input[type="number"] {
  flex: 1 1 auto;
  min-width: 40px;
  width: 0;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  font-size: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  box-sizing: border-box;
}

.behavior-property-row button {
  flex: 0 0 auto;
  padding: 4px 8px;
  background: #2C5599;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 7px;
  white-space: nowrap;
}

.behavior-property-row button:hover {
  background: #3A66B8;
}

/* Property items desktop layout */
.property-item {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px 10px;
  background: transparent;
  border-radius: 4px;
  box-sizing: border-box;
}

.property-label {
  flex: 0 0 auto;
  width: 120px;
  color: #ffffff;
  font-size: 8px;
  font-weight: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.property-input {
  flex: 1 1 auto;
  min-width: 0;
}

.property-input input {
  width: 100%;
  min-width: 60px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  font-size: 8px;
  box-sizing: border-box;
}

.property-group-header {
  color: #ffffff;
  font-weight: normal;
  margin: 12px 0 8px 0;
  border-bottom: 1px solid #ddd;
  padding-bottom: 4px;
  font-size: 8px;
}

.no-properties {
  margin-left: 10px;
  color: #999;
  font-style: italic;
  font-size: 12px;
}

.no-behaviors-message {
  padding: 40px 20px;
  text-align: center;
  color: #666;
  font-style: italic;
}

/* Asset Picker Item Liquid Glass Effect */
.runtime-asset-item {
  background: var(--liquid-glass-bg-panel) !important;
  backdrop-filter: var(--liquid-glass-blur-light) !important;
  -webkit-backdrop-filter: var(--liquid-glass-blur-light) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 16px !important;
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.runtime-asset-item:hover {
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.15) 0%,
    rgba(44, 85, 153, 0.3) 50%,
    rgba(255, 255, 255, 0.12) 100%) !important;
  border-color: rgba(44, 85, 153, 0.5) !important;
  transform: translateY(-5px) scale(1.05) !important;
  box-shadow: 
    0 15px 35px rgba(44, 85, 153, 0.3),
    0 5px 15px rgba(0, 0, 0, 0.3),
    inset 0 2px 0 rgba(255, 255, 255, 0.3) !important;
}

.runtime-asset-item:active {
  transform: translateY(-2px) scale(1.02) !important;
  transition: transform 0.1s ease !important;
}

/* Asset Picker Modal Styles */
.runtime-asset-picker-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--liquid-glass-bg-primary);
  backdrop-filter: var(--liquid-glass-blur-strong);
  -webkit-backdrop-filter: var(--liquid-glass-blur-strong);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10003;
  animation: fadeIn 0.3s ease;
}

.runtime-asset-picker-content {
  background: var(--liquid-glass-bg-panel);
  backdrop-filter: var(--liquid-glass-blur-medium);
  -webkit-backdrop-filter: var(--liquid-glass-blur-medium);
  border: var(--liquid-glass-border);
  border-radius: 24px !important;
  box-shadow: var(--liquid-glass-shadow);
  width: 80%;
  max-width: 700px;
  height: 85%;
  max-height: 700px;
  padding: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}

.runtime-asset-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: none;
}

.runtime-asset-picker-header h3 {
  margin: 0;
  color: #ffffff;
  font-size: 8px;
  font-weight: normal;
}

.runtime-asset-picker-close {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #ffffff;
}

.runtime-asset-picker-close:hover {
  color: #cccccc;
}

.runtime-asset-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr));
  gap: clamp(8px, 2vw, 12px);
  padding: clamp(12px, 2vw, 16px);
  overflow-y: auto;
}

.runtime-asset-card {
  border: none;
  border-radius: 6px;
  padding: clamp(6px, 1.5vw, 8px);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  display: flex;
  flex-direction: column;
  min-height: clamp(100px, 25vw, 120px);
  box-sizing: border-box;
}

.runtime-asset-card:hover {
  background: rgba(255, 255, 255, 0.05);
}

.runtime-asset-card img {
  width: calc(100% - 8px);
  height: clamp(55px, 16vw, 75px);
  object-fit: contain;
  border-radius: 4px;
  margin: 4px auto clamp(4px, 1vw, 6px) auto;
  flex-shrink: 0;
  display: block;
}

.runtime-asset-card-title {
  font-size: clamp(6px, 1.5vw, 7px);
  color: #ffffff;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: normal;
}

/* Asset Picker Modal Enhancements */
.runtime-asset-picker-controls {
  padding: 16px;
  border-bottom: none;
  background: #191B1D;
}

.runtime-asset-picker-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 8px;
  font-weight: normal;
  color: #ffffff;
}

.runtime-asset-picker-controls input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #007cff;
}

.runtime-asset-picker-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.runtime-asset-picker-pagination {
  padding: 16px;
  border-top: none;
  display: flex;
  justify-content: center;
  gap: 16px;
  align-items: center;
  background: #191B1D;
}

.runtime-asset-picker-pagination button {
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 6px;
  font-weight: normal;
  transition: all 0.2s;
}

.runtime-asset-picker-pagination button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

.runtime-asset-picker-pagination button:disabled {
  background: rgba(255, 255, 255, 0.02);
  color: #666;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.1);
}

.runtime-asset-picker-pagination span {
  margin: 0 16px;
  font-weight: normal;
  color: #ffffff;
  font-size: 6px;
}

/* Replace Character Dialog Styles */
.preview-remix-buttons-container {
  position: fixed;
  bottom: 40px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10000;
}

/* Close Button and Share Button Styles */
/* Note: Close button (.close-btn) and Share button (.share-btn) styles are dynamically injected via JavaScript */
/* These buttons are positioned symmetrically on the left and right sides of the game canvas */
/* Both use pixel-perfect positioning relative to the game display area */

/* Stack buttons inside container instead of overlapping fixed positions */
.preview-remix-buttons-container .preview-remix-floating-btn {
  position: static;
  bottom: auto;
  right: auto;
}

/* Replace Character floating button - Use Replace button style with regular font */
.preview-replace-character-btn {
  /* Position will be controlled by JavaScript */
  z-index: 10000 !important;
  
  /* Replace button styling */
  min-width: 120px !important;
  width: auto !important;
  height: 40px !important;
  border-radius: 20px !important;
  border: 3px solid rgba(255,255,255,0.9) !important;
  background: linear-gradient(180deg, #72d36b 0%, #57b44c 100%) !important;
  box-shadow: 0 6px 12px rgba(87,180,76,0.35), inset 0 1px 0 rgba(255,255,255,0.6) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  font-size: 12px !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase !important;
  padding: 0 16px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  
  /* Reset circular button styles */
  border-radius: 20px !important;
}

/* Button container positioning will be controlled by JavaScript */
.preview-remix-buttons-container {
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-replace-character-btn:hover {
  transform: translateY(-1px) !important;
  filter: brightness(1.05) !important;
  box-shadow: 0 8px 16px rgba(87,180,76,0.45), inset 0 1px 0 rgba(255,255,255,0.7) !important;
}

.preview-replace-character-btn:active {
  transform: translateY(0) scale(0.98) !important;
  transition: transform 0.1s ease !important;
}

/* Replace Character Dialog - Full Screen Mobile Layout */
.replace-character-dialog {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('/wanaka-remix/assets/remix-bg.jpg') center center / cover no-repeat;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  z-index: 10002;
  flex-direction: column;
  animation: fadeIn 0.3s ease;
  /* REMOVED overflow: hidden to allow inner scrolling */
}

.replace-character-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.replace-character-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  z-index: 10;
  background: transparent;
}

.replace-character-btn-back,
.replace-character-btn-replace {
  cursor: pointer;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 10px;
  transition: all 0.2s ease;
}

.replace-character-btn-back,
.replace-character-btn-reset {
  width: 46px !important;
  height: 46px !important;
  min-width: 46px !important;
  min-height: 46px !important;
  max-width: 46px !important;
  max-height: 46px !important;
  border-radius: 50%;
  border: 3px solid #ffffff;
  box-shadow: 0 6px 12px rgba(0,0,0,0.25), 0 0 0 2px rgba(255,255,255,0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 24px;
  font-weight: bold;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  cursor: pointer;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  transition: all 0.2s ease;
}

.replace-character-btn-back {
  background: radial-gradient(100% 100% at 30% 30%, #6be5ff 0%, #39b6e6 70%, #1f9acb 100%);
}

.replace-character-btn-reset {
  background: radial-gradient(100% 100% at 30% 30%, #ffb74d 0%, #fb8c00 70%, #e65100 100%);
  font-size: 20px; /* Slightly smaller icon for reset loop */
}

.replace-character-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.replace-character-btn-replace {
  min-width: 120px;
  height: 40px;
  border-radius: 20px;
  border: 3px solid rgba(255,255,255,0.5);
  background: #b0b0b0;
  box-shadow: none;
  color: rgba(255,255,255,0.8);
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: capitalize;
  padding: 0 16px;
  -webkit-text-stroke: 0.5px transparent;
  cursor: not-allowed;
  transition: all 0.2s ease;
}

.replace-character-btn-replace.enabled {
  border: 3px solid rgba(255,255,255,0.9);
  background: linear-gradient(180deg, #72d36b 0%, #57b44c 100%);
  box-shadow: 0 6px 12px rgba(87,180,76,0.35), inset 0 1px 0 rgba(255,255,255,0.6);
  color: #ffffff;
  cursor: pointer;
  -webkit-text-stroke: 0.5px #ffffff;
}

.replace-character-btn-back:hover,
.replace-character-btn-reset:hover,
.replace-character-btn-replace.enabled:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.replace-character-btn-replace:disabled {
  /* Ensure disabled state styles persist */
  background: #b0b0b0;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.replace-character-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  /* REMOVED padding to allow edge-to-edge content */
  padding: 0;
  gap: 0;
  background: var(--liquid-glass-bg-primary);
  min-height: 0;
  height: 100%;
}

.replace-layout-portrait .replace-character-content {
  padding-bottom: 0;
}

/* Orientation layouts */
.replace-layout-portrait {
  flex-direction: column;
}

.replace-layout-landscape {
  flex-direction: row;
  align-items: stretch;
}

/* Preview Section - Top Half */
.replace-character-preview-section {
  flex: 0 0 50%;
  height: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px;
  gap: 0;
  position: relative;
  min-height: 0;
  box-sizing: border-box;
}

/* Portrait-specific sizing */
.replace-layout-portrait .replace-character-preview-section {
  padding: 0;
  overflow: hidden;
}

/* Landscape-specific sizing */
.replace-layout-landscape .replace-character-preview-section {
  height: 100%;
  min-height: 0;
  padding: 24px 16px 24px 12px;
  flex: 0 0 40%;
  justify-content: center;
  gap: 12px;
}

.replace-character-preview-label {
  display: none;
}

/* Portrait label overlay - Removed as label is hidden */
/* .replace-layout-portrait .replace-character-preview-label { ... } */

.replace-character-preview {
  width: 70%;
  height: 70%;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
}

.replace-layout-landscape .replace-character-preview {
  width: 70%;
  height: 70%;
  max-width: 100%;
  max-height: 100%;
  margin: 0 auto;
}

/* Portrait preview - Full fill remaining space after header */
.replace-layout-portrait .replace-character-preview {
  width: 100%;
  height: auto;
  flex: 1 1 auto;
  border-radius: 0;
  margin: 0;
  padding-bottom: 16px; /* Add padding at bottom to separate from models card */
  box-sizing: border-box;
}

.replace-character-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Portrait Header - In flow */
.replace-layout-portrait .replace-character-header {
  position: relative;
  width: 100%;
  padding: 60px 16px 16px 16px; /* Increased top padding for Dynamic Island */
  box-sizing: border-box;
  z-index: 10;
  justify-content: space-between;
  flex: 0 0 auto;
}

.replace-layout-landscape .replace-character-header {
  padding: 14px 16px 14px 60px; /* Increased left padding for Dynamic Island */
}

.replace-character-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: transparent;
  font-size: 0;
  /* Animated WebP loader (replaces the old GIF; preserves soft alpha). */
  background: url('/wanaka-remix/assets/remix-loading.webp') no-repeat center center;
  background-size: 40px;
}

.replace-character-loading::after {
  display: none;
}


.replace-character-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #ffffff;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 8px;
}

.replace-character-fallback-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.replace-character-fallback-text {
  font-size: 10px;
}

/* Models Section - Bottom Half with Pull-up Panel */
.replace-character-models-section {
  flex: 0 0 50%;
  height: 50%;
  min-height: 0; /* Critical: allows flex child to shrink below content size */
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.12);
  overflow: hidden;
  max-height: none;
  margin-bottom: 0;
  box-sizing: border-box;
}

.replace-layout-portrait .replace-character-models-section {
  border-radius: 20px 20px 0 0;
  min-height: 0; /* Ensure proper flex shrinking in portrait */
  height: 100%;
  max-height: none; 
}

/* Landscape drawer on the right */
.replace-layout-landscape .replace-character-models-section {
  flex: 0 0 60%;
  max-height: none;
  height: 100%;
  margin-top: 0;
  border-radius: 20px 0 0 20px;
}

.replace-character-handle {
  width: 60px;
  height: 6px;
  background: rgba(0,0,0,0.15);
  border-radius: 999px;
  margin: 10px auto 6px;
}

.replace-layout-landscape .replace-character-handle {
  margin: 12px auto 8px;
}

.replace-character-models-label {
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 10px;
  color: #333333;
  padding: 10px 20px 12px;
  text-align: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: transparent;
}

.replace-character-models-panel {
  flex: 1;
  min-height: 0; /* Critical: allows flex child to shrink */
  overflow-y: auto;
  overflow-x: hidden; /* Prevent horizontal scroll */
  padding: 12px 12px 16px 12px;
  height: auto; /* Changed from 100% to auto for better flex behavior */
  /* Enable smooth scrolling on touch devices */
  -webkit-overflow-scrolling: touch;
}

.replace-layout-landscape .replace-character-models-panel {
  padding: 12px 20px 16px 20px;
}

.replace-character-loading-more {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
  color: transparent;
  font-size: 0;
  background: url('/wanaka-remix/assets/remix-loading.webp') no-repeat center center;
  background-size: 24px;
  min-height: 40px;
}

.replace-character-models-loading,
.replace-character-no-models {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  padding: 0 40px;
  box-sizing: border-box;
  color: #666666;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 14px; /* Increased size */
  font-weight: 500;
  line-height: 1.6;
  text-align: center;
  opacity: 0.8;
}

.replace-character-models-loading {
  color: transparent;
  font-size: 0;
  background: url('/wanaka-remix/assets/remix-loading.webp') no-repeat center center;
  background-size: 40px;
}

.replace-character-models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  padding-bottom: 12px;
  width: 100%;
  box-sizing: border-box;
}

.replace-character-model-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  background: #F2F2F2;
  border: 4px solid transparent; /* Reserve space for border to avoid jump */
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0px 6px 0px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}

.replace-character-model-item:hover {
  transform: translateY(-2px);
  filter: brightness(0.98);
}

.replace-character-model-item.selected {
  box-sizing: border-box;
  background: #EBFFF0;
  border: 4px solid #55C972;
  box-shadow: 0px 6px 0px #4AAF63;
  border-radius: 24px;
}

.replace-character-model-thumbnail {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
  position: relative;
}

.replace-character-model-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.replace-character-model-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 32px;
  color: #666;
}

.replace-character-model-name {
  display: none;
}

.replace-character-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 0 4px;
}

.replace-character-pagination button {
  padding: 8px 12px;
  font-size: 8px;
}

.replace-character-page-text {
  color: #ffffff;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 8px;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  /* .replace-character-content padding removed to match desktop */
  
  .replace-character-preview-section {
    padding: 12px; /* Match desktop */
  }

  .replace-character-preview {
    max-width: 100%;
    height: 250px;
  }

  .replace-character-models-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
  }

  .replace-character-header {
    padding: 12px 16px;
  }

  .replace-character-btn-back {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    min-height: 46px !important;
    max-width: 46px !important;
    max-height: 46px !important;
    padding: 0;
    font-size: 24px;
  }

  .replace-character-btn-replace {
    padding: 8px 16px;
    font-size: 8px;
    min-width: 60px;
  }

  .preview-remix-buttons-container {
    bottom: 16px;
    right: 16px;
    gap: 10px;
  }
}

/* Portrait Mobile Specific */
@media (max-width: 768px) and (orientation: portrait) {
  .replace-character-preview-section {
    flex: 0 0 40%;
  }

  .replace-character-models-section {
    flex: 1;
    border-radius: 20px 20px 0 0;
  }

  .replace-character-models-panel {
    /* padding removed to match desktop style of edge-to-edge if desired, 
       but desktop has 12px padding in .replace-character-models-panel. 
       Let's check desktop. */
    padding: 12px;
  }
}