/**
 * Profile Page Styles - Family Portal
 * Emoji grid, photo upload, progress bar, responsive design
 * Uses CSS variables from main portal styles
 */

/* ============================================
   Skeleton Loader Base
   ============================================ */
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-base {
  background: linear-gradient(90deg, 
    var(--bg-card, #f7fafc) 25%, 
    var(--bg-card-hover, #edf2f7) 50%, 
    var(--bg-card, #f7fafc) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

/* Emoji grid skeleton */
.emoji-skeleton {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  background: linear-gradient(90deg, 
    var(--bg-card, #f7fafc) 25%, 
    var(--bg-card-hover, #edf2f7) 50%, 
    var(--bg-card, #f7fafc) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.emoji-grid-skeleton {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding: 1rem;
}

@media (max-width: 480px) {
  .emoji-grid-skeleton {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .emoji-skeleton {
    width: 60px;
    height: 60px;
  }
}

/* ============================================
   Profile Header
   ============================================ */
.profile-header {
  text-align: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 3px solid var(--border-primary, #4a90d9);
}

.profile-header h1 {
  margin: 0 0 8px;
  color: var(--text-heading, #2c5282);
  font-size: 1.5rem;
}

.user-name-display {
  color: var(--text-secondary, #4a5568);
  font-size: 1rem;
  margin: 0;
}

/* ============================================
   Profile Sections
   ============================================ */
.profile-section {
  background: var(--bg-card, #f7fafc);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px var(--shadow, rgba(0,0,0,0.1));
}

.profile-section h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
  color: var(--text-heading, #2c5282);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-light, #e2e8f0);
}

/* ============================================
   Emoji Grid - Fluid responsive with auto-fill
   ============================================ */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  padding: 12px;
}

.emoji-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 12px;
  background: var(--bg-container, #ffffff);
  border-radius: 12px;
  transition: transform 0.2s;
  border: 1px solid var(--border-light, #e2e8f0);
}

.emoji-item:hover {
  transform: scale(1.05);
}

.emoji-item img {
  width: 100%;
  max-width: 80px;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 8px;
}

/* Ensure images don't cause layout shift */
.emoji-item img[src] {
  height: auto;
}

.emoji-item.empty img,
.emoji-placeholder {
  width: 80px;
  height: 80px;
  aspect-ratio: 1;
  background: var(--border-light, #e2e8f0);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text-muted, #a0aec0);
  margin: 0 auto;
}

.emoji-label {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary, #4a5568);
  font-weight: 500;
}

/* ============================================
   Photo Upload Area
   ============================================ */
.photo-upload-area {
  border: 2px dashed var(--border-light, #e2e8f0);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-upload-area:hover,
.photo-upload-area:focus-within {
  border-color: var(--accent-color, #4a90d9);
  background: rgba(74, 144, 217, 0.05);
}

.photo-upload-area.has-photo {
  border-style: solid;
  border-color: var(--accent-color, #4a90d9);
  padding: 1rem;
}

.upload-placeholder {
  color: var(--text-secondary, #4a5568);
}

.upload-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 0.5rem;
}

.upload-hint {
  font-size: 0.75rem;
  color: var(--text-muted, #a0aec0);
  margin-top: 0.25rem;
}

.photo-preview {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  object-fit: contain;
}

/* ============================================
   Action Buttons
   ============================================ */
.action-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #4a90d9 0%, #2c5282 100%);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 144, 217, 0.4);
}

.btn-secondary {
  background: var(--bg-card, #edf2f7);
  color: var(--text-heading, #2c5282);
  border: 1px solid var(--border-light, #e2e8f0);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border-light, #e2e8f0);
}

/* ============================================
   Progress Bar
   ============================================ */
.progress-container {
  margin: 1rem 0;
}

.progress-bar {
  height: 8px;
  background: var(--border-light, #e2e8f0);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4a90d9, #2c5282);
  transition: width 0.3s ease;
  border-radius: 4px;
}

.progress-text {
  font-size: 0.875rem;
  color: var(--text-secondary, #4a5568);
  margin-top: 0.5rem;
  text-align: center;
}

/* ============================================
   Live Emoji Grid (during generation)
   ============================================ */
.live-grid {
  margin-top: 1.5rem;
}

.live-grid .emoji-item {
  opacity: 0.3;
  transition: opacity 0.3s;
}

.live-grid .emoji-item.completed {
  opacity: 1;
}

.live-grid .emoji-item.generating {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary, #4a5568);
}

.empty-state p {
  margin: 0.5rem 0;
}

/* ============================================
   Empty Photo State
   ============================================ */
.empty-photo-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary, #4a5568);
}

.empty-photo-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-photo-text {
  font-size: 1rem;
  margin: 0 0 0.5rem;
}

.empty-photo-hint {
  font-size: 0.875rem;
  margin: 0;
  opacity: 0.7;
}

/* ============================================
   Error & Auth Messages
   ============================================ */
.error-message {
  background: #fed7d7;
  color: #c53030;
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
  text-align: center;
}

/* Error with retry button */
.error-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.error-retry-btn {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background 0.2s, opacity 0.2s;
  white-space: nowrap;
}

.error-retry-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.error-retry-btn:active {
  opacity: 0.8;
}

.error-retry-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Error message that persists (has retry) */
.error-message.persistent {
  animation: none;
}

.auth-message {
  text-align: center;
  padding: 3rem;
  background: var(--bg-card, #f7fafc);
  border-radius: 12px;
}

.auth-message a {
  color: var(--accent-color, #4a90d9);
  text-decoration: underline;
}

/* ============================================
   Focus Visible for Keyboard Navigation
   ============================================ */
.emoji-item:focus-visible,
.btn:focus-visible,
button:focus-visible,
input:focus-visible,
.photo-upload-area:focus-visible {
  outline: 2px solid var(--primary, #4a90d9);
  outline-offset: 2px;
}

/* Remove default outline when not keyboard navigating */
.emoji-item:focus:not(:focus-visible),
.btn:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================
   Offline Banner
   ============================================ */
.offline-banner {
  background: var(--warning-bg, #fef3cd);
  color: var(--warning-text, #856404);
  padding: 10px 16px;
  text-align: center;
  font-size: 0.875rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--warning-border, #ffc107);
}

@media (prefers-color-scheme: dark) {
  .offline-banner {
    background: #4a3f00;
    color: #ffc107;
    border-color: #665800;
  }
}

[data-theme="dark"] .offline-banner {
  background: #4a3f00;
  color: #ffc107;
  border-color: #665800;
}

/* ============================================
   Utility Classes
   ============================================ */
.hidden {
  display: none !important;
}

/* ============================================
   Dark Mode Support
   ============================================ */
@media (prefers-color-scheme: dark) {
  .profile-section {
    background: var(--bg-card, #3d4a5c);
  }
  
  .emoji-item {
    background: var(--bg-container, #2d3748);
    border-color: var(--border-light, #4a5568);
  }
  
  .error-message {
    background: #742a2a;
    color: #fed7d7;
  }
  
  .photo-upload-area:hover,
  .photo-upload-area:focus-within {
    background: rgba(99, 179, 237, 0.1);
  }
}

/* Manual dark mode via data-theme attribute */
[data-theme="dark"] .profile-section {
  background: var(--bg-card, #3d4a5c);
}

[data-theme="dark"] .emoji-item {
  background: var(--bg-container, #2d3748);
  border-color: var(--border-light, #4a5568);
}

[data-theme="dark"] .error-message {
  background: #742a2a;
  color: #fed7d7;
}

[data-theme="dark"] .photo-upload-area:hover,
[data-theme="dark"] .photo-upload-area:focus-within {
  background: rgba(99, 179, 237, 0.1);
}

/* ============================================
   Mobile Responsive Tweaks
   ============================================ */
@media (max-width: 480px) {
  .profile-header h1 {
    font-size: 24px;
  }
  
  .profile-section {
    padding: 1rem;
  }
  
  .profile-section h2 {
    font-size: 1.1rem;
  }
  
  .photo-upload-area {
    padding: 1.5rem;
    min-height: 120px;
  }
  
  .upload-icon {
    font-size: 2.5rem;
  }
  
  .btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }
  
  /* Force 3-column grid on mobile for compact display */
  .emoji-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 8px;
  }
  
  .emoji-item {
    padding: 8px;
  }
  
  .emoji-item img,
  .emoji-placeholder {
    width: 60px;
    height: 60px;
  }
  
  .emoji-label {
    font-size: 0.75rem;
    margin-top: 4px;
  }
}

/* ============================================
   Prevent Horizontal Overflow
   ============================================ */
body {
  overflow-x: hidden;
}

.card,
.emoji-grid,
.upload-area,
.photo-upload-area {
  max-width: 100%;
  box-sizing: border-box;
}
/* NOTE: .container intentionally NOT overridden here - uses base 900px max-width */

/* Handle long text */
.emoji-mood,
.emoji-label,
.user-name,
.user-name-display {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Responsive images */
img {
  max-width: 100%;
  height: auto;
}

/* ============================================
   iOS Safe Area Support
   ============================================ */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .action-buttons {
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  
  .page-footer {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0));
  }
}

/* ============================================
   iPhone SE and very small screens (320px)
   ============================================ */
@media (max-width: 380px) {
  .emoji-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding: 6px;
  }
  
  .emoji-item {
    padding: 6px;
  }
  
  .emoji-item img,
  .emoji-placeholder {
    width: 55px;
    height: 55px;
    max-width: 70px;
  }
  
  .emoji-label {
    font-size: 0.7rem;
  }
  
  .action-buttons {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .action-buttons .btn {
    width: 100%;
  }
  
  .photo-upload-area {
    padding: 1.5rem 1rem;
  }
  
  .photo-preview {
    max-height: 200px;
  }
  
  h1 {
    font-size: 1.5rem;
  }
  
  h2 {
    font-size: 1.25rem;
  }
}

/* Avatar Selection */
.emoji-item {
    position: relative;
}

.emoji-item .set-avatar-btn {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 4px 8px;
    font-size: 11px;
    border: 1px solid var(--border-light, #ddd);
    border-radius: 4px;
    background: var(--bg-card, #fff);
    color: var(--text-secondary, #666);
    cursor: pointer;
    transition: all 0.2s ease;
}

.emoji-item .set-avatar-btn:hover {
    background: var(--border-primary, #007aff);
    color: white;
    border-color: var(--border-primary, #007aff);
}

.emoji-item.current-avatar .set-avatar-btn {
    background: var(--border-primary, #007aff);
    color: white;
    border-color: var(--border-primary, #007aff);
}

.emoji-item.current-avatar {
    border: 2px solid var(--border-primary, #007aff);
    border-radius: 12px;
    padding: 8px;
}

/* Success message */
.success-message {
    padding: 12px 16px;
    background: #d4edda;
    color: #155724;
    border-radius: 8px;
    text-align: center;
}

@media (prefers-color-scheme: dark) {
    .success-message {
        background: #1e3a25;
        color: #8fd19e;
    }
}

/* ============================================
   Character Studio UI (v12.2)
   ============================================ */

/* Tabs */
.studio-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border-light, #e2e8f0);
  padding-bottom: 2px;
}

.studio-tab {
  background: none;
  border: none;
  font-size: 16px;
  font-weight: 600;
  padding: 12px 24px;
  cursor: pointer;
  color: var(--text-secondary, #718096);
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  margin-bottom: -4px;
}

.studio-tab:hover {
  color: var(--text-primary, #2d3748);
}

.studio-tab.active {
  color: var(--border-primary, #4a90d9);
  border-bottom-color: var(--border-primary, #4a90d9);
}

/* Generation Type Selector */
.generation-type-selector {
  display: flex;
  flex-direction: row !important; /* Force row on all screens */
  gap: 12px; /* Slightly tighter gap for mobile */
  margin-bottom: 24px;
}

.type-option {
  flex: 1;
  cursor: pointer;
  position: relative;
  min-width: 0; /* Allow shrinking below content size */
}

.type-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.type-card {
  display: flex;
  flex-direction: column; /* Vertical layout (Icon Top, Text Bottom) */
  align-items: center;
  text-align: center;
  padding: 20px;
  background: var(--bg-card, #f7fafc);
  border: 2px solid var(--border-light, #e2e8f0);
  border-radius: 12px;
  transition: all 0.2s;
  height: 100%; /* Match heights */
}

.type-option input:checked + .type-card {
  border-color: var(--border-primary, #4a90d9);
  background: var(--bg-nav-hover, #bee3f8);
  box-shadow: 0 2px 8px var(--shadow, rgba(0,0,0,0.1));
}

.type-icon { 
  font-size: 32px; 
  margin-bottom: 8px; 
  margin-right: 0;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.type-name { 
  font-weight: 600; 
  font-size: 16px; 
  color: var(--text-heading); 
  margin-bottom: 4px;
  display: block;
}

.type-desc { 
  font-size: 13px; 
  color: var(--text-secondary); 
  margin-top: 0;
  line-height: 1.4;
  display: block;
}

/* Asset Gallery */
.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
  padding: 4px;
}

.asset-item {
  background: var(--bg-container, #fff);
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.asset-item.pressing {
  transform: scale(0.98);
}

.asset-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow, rgba(0,0,0,0.1));
}

.asset-item.active {
  border: 3px solid var(--border-primary, #4a90d9);
}

.asset-item.active::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--border-primary, #4a90d9);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.asset-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center center; /* Keep generated avatars visually centered */
  display: block;
}

.asset-footer {
  padding: 8px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--border-light);
  background: var(--bg-card);
}

/* Views */
.studio-view { display: none; animation: fadeIn 0.3s ease; }
.studio-view.active { display: block; }

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

@media (max-width: 480px) {
  .type-card { 
    padding: 12px; 
    min-height: 140px; /* Ensure equal height */
    justify-content: center;
  }
  .type-icon { 
    font-size: 28px; 
    width: 40px; 
    height: 40px; 
    margin-bottom: 6px;
  }
  .type-name { font-size: 14px; margin-bottom: 2px; }
  .type-desc { 
    font-size: 11px; 
    line-height: 1.2;
  }
  .studio-tab { padding: 12px 16px; font-size: 14px; }
}

/* =============================================================================
   Style Selection Modal
   ============================================================================= */
.style-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  box-sizing: border-box;
}

.style-modal.hidden {
  display: none;
}

.style-modal-content {
  background: var(--bg-container);
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.style-modal h3 {
  margin: 0 0 8px 0;
  font-size: 1.5rem;
  color: var(--text-primary);
}

.style-modal-subtitle {
  margin: 0 0 20px 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.style-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.style-option {
  background: var(--bg-secondary);
  border: 2px solid var(--border-light);
  border-radius: 12px;
  padding: 16px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.style-option:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.style-option.selected {
  border-color: var(--accent-primary);
  background: rgba(74, 144, 226, 0.15);
}

.style-option .style-icon {
  font-size: 2rem;
}

.style-option .style-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1rem;
}

.style-option .style-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

#styleConfirmBtn {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
}

/* =============================================================================
   Creation Wizard
   ============================================================================= */
.creation-wizard {
  margin-top: 20px;
}

.creation-wizard.hidden {
  display: none;
}

.wizard-step {
  animation: fadeIn 0.3s ease;
}

.wizard-step.hidden {
  display: none;
}

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

.wizard-prompt {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 1rem;
}

.wizard-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.wizard-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 16px;
  background: var(--bg-container);
  border: 2px solid var(--border-light);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 90px;
}

.wizard-btn:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.wizard-btn-icon {
  font-size: 2rem;
}

.wizard-btn-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Reset area */
.reset-area {
  margin-top: 16px;
  text-align: center;
}

.reset-area.hidden {
  display: none;
}

.btn-small {
  padding: 8px 16px;
  font-size: 0.85rem;
}

/* Subtle mood label under avatar thumbnails */
.mini-mood-item {
  position: relative;
}
.mini-mood-label {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 3px;
  font-size: 9px;
  line-height: 1.1;
  text-align: center;
  color: rgba(255,255,255,0.82);
  background: rgba(0,0,0,0.28);
  border-radius: 6px;
  padding: 1px 2px;
  pointer-events: none;
  text-shadow: 0 1px 1px rgba(0,0,0,0.45);
}

/* profile asset fullscreen viewer */
.profile-asset-viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 13000;
  opacity: 0;
  transition: opacity 220ms ease;
  -webkit-user-select: none;
  user-select: none;
}
.profile-asset-viewer-overlay.active { opacity: 1; }
.profile-asset-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 120% at 50% 10%, rgba(63,130,255,0.18), rgba(7,10,20,.96));
  backdrop-filter: blur(6px);
}
.profile-asset-viewer-shell {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}
.profile-asset-viewer-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 12px;
  min-width: 72px;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.16);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1;
  backdrop-filter: blur(6px);
}
.profile-asset-viewer-title {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  text-align: center;
  color: #fff;
  font-weight: 800;
  font-size: 24px;
  text-shadow: 0 2px 18px rgba(0,0,0,.35);
  pointer-events: none;
}
.profile-asset-viewer-stage-wrap {
  width: min(94vw, 760px);
  height: min(72vh, 760px);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-22px);
  transition: transform 180ms ease;
}
.profile-asset-viewer-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-asset-viewer-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 18px;
  box-shadow: 0 22px 60px rgba(0,0,0,.48);
}
.profile-asset-viewer-fallback {
  font-size: min(30vw, 160px);
  line-height: 1;
}
.profile-asset-viewer-meta {
  position: absolute;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.24), rgba(255,255,255,.12));
  border: 1px solid rgba(255,255,255,.32);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0,0,0,.32);
  pointer-events: none;
  white-space: nowrap;
  text-shadow: 0 1px 10px rgba(0,0,0,.35);
}
