/* ==========================================
   OTWO — Virtual Dress Try-On
   Dark elegant theme with warm gold accents
   ========================================== */

:root {
  --bg-primary: #0c0b10;
  --bg-secondary: #151419;
  --bg-card: #1c1b22;
  --bg-card-hover: #24232c;
  --bg-input: rgba(255, 255, 255, 0.05);
  --bg-input-focus: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --border-accent: rgba(212, 175, 120, 0.3);

  --text-primary: rgba(255, 255, 255, 0.92);
  --text-secondary: rgba(255, 255, 255, 0.65);
  --text-muted: rgba(255, 255, 255, 0.40);

  --accent: #d4af78;
  --accent-hover: #e2c496;
  --accent-glow: rgba(212, 175, 120, 0.15);
  --accent-text: #1a1510;

  --danger: #e55b5b;
  --danger-hover: #f07070;
  --success: #4cce6b;
  --warning: #e5a84c;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);

  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;

  --transition: 0.2s ease;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-primary);
  background-image:
    radial-gradient(ellipse at 20% -5%, rgba(212, 175, 120, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 105%, rgba(212, 175, 120, 0.04) 0%, transparent 50%);
  color: var(--text-primary);
  font-family: var(--font);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================
   Header / Brand
   ========================================== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(12, 11, 16, 0.8);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  color: var(--accent);
  flex-shrink: 0;
  padding: 2px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.brand-name {
  font-family: var(--font);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.3;
}

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

.brand-tagline {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
  font-style: italic;
  max-width: 360px;
  text-align: right;
  line-height: 1.3;
  flex-shrink: 1;
  margin-right: 4px;
}

/* Status badge */
.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--transition);
}

.status-badge.connected .status-dot {
  background: var(--success);
  box-shadow: 0 0 8px rgba(76, 206, 107, 0.5);
}

.status-badge.connecting .status-dot {
  background: var(--warning);
  animation: pulse 1s infinite;
}

.status-badge.disconnected .status-dot {
  background: var(--text-muted);
}

.status-badge.error .status-dot {
  background: var(--danger);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ==========================================
   Mobile tab bar
   ========================================== */

.mobile-tabs {
  display: none;
  flex-shrink: 0;
  z-index: 99;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.mobile-tab {
  flex: 1;
  padding: 10px 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

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

.mobile-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ==========================================
   Main content
   ========================================== */

.main-content {
  max-width: 1800px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ==========================================
   Video section — 3-column portrait
   ========================================== */

.video-section {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.video-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

#panel-reference {
  position: relative;
}

.panel-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.video-wrapper {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.controls-section {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Clickable panels */
#panel-mirror .video-wrapper,
#panel-tryon .video-wrapper {
  cursor: pointer;
}

#panel-mirror .video-wrapper:hover,
#panel-tryon .video-wrapper:hover {
  border-color: var(--border-hover);
}

/* "Click to stop" overlay (shared by mirror + tryon panels) */
.stop-overlay {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 14px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  color: var(--text-muted);
  font-size: 0.72rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
}

#panel-tryon .video-wrapper:hover .stop-overlay,
#panel-mirror .video-wrapper:hover .stop-overlay {
  opacity: 1;
}

/* Fullscreen button */
.fullscreen-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  border: none;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--transition);
  z-index: 5;
}

#panel-tryon .video-wrapper:hover .fullscreen-btn {
  opacity: 1;
}

.fullscreen-btn:hover {
  background: rgba(0, 0, 0, 0.75);
  color: var(--accent);
}

.fullscreen-btn .fs-exit { display: none; }

:fullscreen .fullscreen-btn .fs-enter { display: none; }
:fullscreen .fullscreen-btn .fs-exit { display: block; }

/* Fullscreen state for try-on */
#panel-tryon .video-wrapper:fullscreen {
  border-radius: 0;
  background: black;
  border: none;
}

#panel-tryon .video-wrapper:fullscreen video {
  object-fit: contain;
}

#panel-tryon .video-wrapper:fullscreen .fullscreen-btn {
  opacity: 1;
  bottom: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
}

#panel-tryon .video-wrapper:fullscreen .stop-overlay {
  display: none;
}

#panel-tryon .video-wrapper:fullscreen .placeholder {
  background: black;
}

.video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Reference image (detail view) */
.reference-viewer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
  background: var(--bg-card);
}

.reference-viewer img.visible {
  display: block;
}

.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
}

.placeholder.hidden {
  display: none;
}

.placeholder-icon {
  font-size: 2.5rem;
  opacity: 0.5;
}

.placeholder-text {
  font-size: 0.8rem;
  text-align: center;
  padding: 0 16px;
}

/* ==========================================
   Reference panel — Library & Detail views
   ========================================== */

.ref-library-view {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 10px;
}

.ref-library-controls {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.ref-library-grid {
  display: grid;
  --thumb-size: 100px;
  grid-template-columns: repeat(auto-fill, minmax(var(--thumb-size), 1fr));
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 2px 8px;
  align-content: start;
  scrollbar-width: thin;
  scrollbar-color: var(--border-hover) transparent;
}

.ref-library-empty {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.ref-library-empty.hidden {
  display: none;
}

/* Gallery item — thumbnail + name + link */
.gallery-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  position: relative;
}

.gallery-img-wrap {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-secondary);
}

.gallery-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease, opacity 0.2s ease;
}

.gallery-item:hover .gallery-img-wrap img {
  transform: scale(1.04);
}

.gallery-img-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  transition: border-color var(--transition), box-shadow var(--transition);
  pointer-events: none;
}

.gallery-item.selected .gallery-img-wrap::after {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow), inset 0 0 12px var(--accent-glow);
}

/* Drag and drop */
.gallery-item.dragging {
  opacity: 0.3;
}

.gallery-item.drag-over-before::before,
.gallery-item.drag-over-after::after {
  content: '';
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: rgba(255, 255, 255, 0.85);
  z-index: 5;
  border-radius: 1px;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
  pointer-events: none;
}

.gallery-item.drag-over-before::before {
  left: -6px;
}

.gallery-item.drag-over-after::after {
  right: -6px;
}

.gallery-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  color: var(--text-muted);
  border: none;
  font-size: 0.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--transition);
  z-index: 2;
}

.gallery-item:hover .gallery-remove {
  opacity: 1;
}

.gallery-remove:hover {
  background: rgba(229, 91, 91, 0.5);
  color: white;
}

.gallery-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 2px;
  min-width: 0;
}

.gallery-name {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-link {
  font-size: 0.58rem;
  color: var(--text-muted);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--transition);
}

.gallery-link:hover {
  color: var(--accent);
}

/* Detail View — overlay on top of library */
.ref-detail-view {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: var(--radius);
  cursor: pointer;
  padding: 8px 0;
}

.ref-detail-view .video-wrapper {
  width: 92%;
  flex: 1;
  min-height: 0;
  aspect-ratio: unset;
  cursor: default;
  background: transparent;
  border: none;
}

.ref-detail-view .reference-viewer img {
  background: transparent;
}

@keyframes zoomUp {
  from { transform: scale(0.3); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.reference-viewer img.zoom-enter {
  animation: zoomUp 0.5s ease-out;
}

/* Detail info bar (name + link under zoomed image) */
.detail-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 10px;
  width: 92%;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  min-width: 0;
  cursor: default;
}

.detail-name {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-link {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--transition);
}

.detail-link:hover {
  color: var(--accent);
}

.detail-link:empty,
.detail-info:empty {
  display: none;
}

/* Detail navigation — e-commerce lightbox style */
.detail-btn {
  position: absolute;
  z-index: 10;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.75);
  transition: all 0.2s ease;
}

.detail-btn:hover {
  background: rgba(0, 0, 0, 0.65);
  color: var(--accent);
}

.detail-close-btn {
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  font-size: 0.85rem;
}

.detail-prev-btn,
.detail-next-btn {
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  font-size: 1.2rem;
}

.detail-prev-btn { left: 6px; }
.detail-next-btn { right: 6px; }

.detail-prev-btn:hover,
.detail-next-btn:hover {
  transform: translateY(-50%) scale(1.08);
}

/* Star button */
.gallery-star {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  color: var(--text-muted);
  border: none;
  font-size: 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  z-index: 2;
  line-height: 1;
}

.gallery-star:hover {
  background: rgba(0, 0, 0, 0.7);
  color: var(--accent);
}

.gallery-item[data-starred="true"] .gallery-star {
  color: var(--accent);
  text-shadow: 0 0 6px var(--accent-glow);
}

/* Sort select */
.sort-select {
  background: #1c1b22;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.68rem;
  padding: 4px 6px;
  cursor: pointer;
  transition: border-color var(--transition);
}

.sort-select option {
  background: #1c1b22;
  color: rgba(255, 255, 255, 0.65);
}

.sort-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Zoom controls */
.zoom-controls {
  display: flex;
  gap: 2px;
}

.zoom-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
}

.zoom-btn:hover {
  border-color: var(--border-hover);
  color: var(--accent);
  background: var(--bg-card-hover);
}

.zoom-btn:active {
  transform: scale(0.92);
  background: var(--bg-card-hover);
  transition: none;
}

/* URL input on its own row */
.ref-library-controls .url-input-group {
  flex-basis: 100%;
}

/* Hidden section (collapsible) */
.hidden-section {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  display: none;
}

.hidden-section.has-items {
  display: block;
}

.hidden-section-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.65rem;
  cursor: pointer;
  transition: color var(--transition);
}

.hidden-section-toggle:hover {
  color: var(--text-secondary);
}

.hidden-section-arrow {
  font-size: 0.5rem;
  transition: transform 0.2s ease;
  display: inline-block;
}

.hidden-section:not(.collapsed) .hidden-section-arrow {
  transform: rotate(90deg);
}

.hidden-section-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 120px;
  overflow-y: auto;
  padding: 2px 0 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-hover) transparent;
}

.hidden-section.collapsed .hidden-section-list {
  display: none;
}

.hidden-list-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.hidden-list-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.hidden-list-thumb {
  width: 24px;
  height: 32px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
}

.hidden-list-name {
  flex: 1;
  font-size: 0.6rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.hidden-list-btn {
  padding: 2px 6px;
  border-radius: 3px;
  border: none;
  font-family: var(--font);
  font-size: 0.55rem;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
}

.hidden-list-restore {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.hidden-list-restore:hover {
  background: rgba(255, 255, 255, 0.2);
}

.hidden-list-delete {
  background: rgba(229, 91, 91, 0.2);
  color: var(--danger);
}

.hidden-list-delete:hover {
  background: rgba(229, 91, 91, 0.35);
}

/* ==========================================
   Input fields
   ========================================== */

input[type="text"] {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.82rem;
  outline: none;
  transition: all var(--transition);
}

input[type="text"]:focus {
  border-color: var(--accent);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input[type="text"]::placeholder {
  color: var(--text-muted);
}

/* Upload button */
.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-hover);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.upload-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.upload-btn-sm {
  padding: 5px 10px;
  font-size: 0.75rem;
}

.upload-icon {
  font-size: 1rem;
  font-weight: 700;
}

.url-input-group {
  display: flex;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.url-input-group input {
  flex: 1;
  min-width: 0;
}

.url-input-sm input {
  padding: 5px 8px;
  font-size: 0.75rem;
}

/* ==========================================
   Controls (compact)
   ========================================== */

.controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.controls-row > input[type="text"] {
  flex: 1;
  min-width: 180px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

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

.btn-icon {
  font-size: 0.95rem;
}

.btn-secondary {
  background: transparent;
  border-color: var(--border);
}

.hidden {
  display: none !important;
}

/* Session info */
.session-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.session-divider {
  color: var(--border-hover);
}

/* ==========================================
   Error toast
   ========================================== */

.error-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 0.85rem;
  box-shadow: var(--shadow);
  z-index: 200;
  max-width: 500px;
  animation: slideUp 0.3s ease;
}

.error-toast.hidden {
  display: none;
}

.error-toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
}

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

/* ==========================================
   Loading spinner
   ========================================== */

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

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

/* ==========================================
   Responsive
   ========================================== */

@media (max-width: 960px) {
  .main-content {
    padding: 12px;
  }

  .mobile-tabs {
    display: flex;
  }

  .video-section {
    grid-template-columns: 1fr;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
  }

  .video-panel {
    display: none;
  }

  .video-panel.active {
    display: flex;
  }

  .topbar {
    padding: 10px 16px;
  }

  .brand-logo {
    width: 28px;
    height: 28px;
  }

  .brand-name {
    font-size: 1.15rem;
  }

  .brand-tagline,
  .brand-subtitle {
    display: none;
  }

  .brand {
    gap: 10px;
  }

  .controls-row {
    flex-direction: column;
  }

  .controls-row > input[type="text"] {
    width: 100%;
    min-width: unset;
  }

  .controls-row .btn {
    width: 100%;
    justify-content: center;
  }

  .session-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .session-divider {
    display: none;
  }

  .ref-library-controls {
    flex-direction: column;
  }

  .ref-library-grid {
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 10px;
    gap: 10px;
  }
}
