:root {
  --bg-dark: #0f1117;
  --bg-card: #181b24;
  --bg-card-subtle: #1f232f;
  --border-color: #2b3245;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);
  --accent: #10b981;
  --danger: #ef4444;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.dark-theme {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header */
.app-header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

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

.brand-logo-wrap {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.header-rooster-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.badge {
  font-size: 10px;
  background-color: var(--primary);
  color: #fff;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* App Main Container */
.app-container {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 16px;
  padding: 12px 16px;
  flex: 1;
  max-width: 100%;
  margin: 0;
  width: 100%;
}

@media (max-width: 1080px) {
  .app-container {
    grid-template-columns: 1fr;
  }
}

/* Viewport Card (Left) */
.viewport-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
  height: calc(100vh - 84px);
  position: sticky;
  top: 8px;
}

@media (max-width: 1080px) {
  .viewport-card {
    height: 580px;
    position: relative;
    top: 0;
  }
}

.card-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.02);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
}

.live-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent);
}

.model-switch-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Canvas Area */
.canvas-wrapper {
  flex: 1;
  position: relative;
  background: radial-gradient(circle at center, #1e2230 0%, #0d0f14 100%);
  overflow: hidden;
  cursor: grab;
}

.canvas-wrapper:active {
  cursor: grabbing;
}

.canvas-wrapper canvas {
  width: 100% !important;
  height: 100% !important;
  outline: none;
}

.canvas-overlay-help {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  background: rgba(15, 17, 23, 0.75);
  backdrop-filter: blur(8px);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-muted);
  pointer-events: none;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Botones flotantes de Zoom 3D en el viewport */
.canvas-zoom-controls {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 9;
}

.btn-canvas-ctrl {
  width: 34px;
  height: 34px;
  background: rgba(18, 22, 34, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.18s ease;
  user-select: none;
}

.btn-canvas-ctrl:hover {
  background: var(--rooster-yellow, #f5b800);
  color: #111111;
  border-color: var(--rooster-yellow, #f5b800);
  transform: scale(1.08);
}

.btn-canvas-ctrl:active {
  transform: scale(0.95);
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 17, 23, 0.85);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  z-index: 10;
  transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Gauges */
.angle-gauges {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-card-subtle);
  border-top: 1px solid var(--border-color);
}

.gauge-item {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  text-align: center;
}

.gauge-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gauge-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin: 3px 0;
}

.gauge-desc {
  font-size: 11px;
  font-weight: 500;
  color: #e5e7eb;
}

/* Viewport Footer */
.viewport-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
}

.pulse-btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 0 15px var(--primary-glow);
}

/* Gallery Section (Right) */
.gallery-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  min-height: calc(100vh - 110px);
}

.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.gallery-title {
  font-size: 18px;
  font-weight: 700;
}

.gallery-status {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.gallery-toggles {
  display: flex;
  align-items: center;
  gap: 16px;
}

.toggle-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.toggle-container input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

/* Studio Demographic & Keyword Filter Bar */
.demographic-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill-btn {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.pill-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}

.search-input-box {
  display: flex;
  gap: 10px;
}

.search-input-box input {
  flex: 1;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
}

.search-input-box input:focus {
  border-color: var(--primary);
}

/* References Grid */
.references-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  flex: 1;
  align-content: start;
}

.reference-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

.reference-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  border-color: var(--primary);
}

.ref-img-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  background: #000;
  overflow: hidden;
}

.ref-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.reference-card:hover .ref-img-container img {
  transform: scale(1.05);
}

.ref-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(4px);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: #60a5fa;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ref-match-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(16, 185, 129, 0.9);
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
}

/* Watermark: Rooster Espacio de Arte (Discreto y no invasivo) */
.card-watermark {
  position: absolute;
  bottom: 6px;
  right: 6px;
  pointer-events: none;
  background: rgba(10, 12, 16, 0.4);
  backdrop-filter: blur(2px);
  padding: 2px 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.35;
  transition: opacity 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.reference-card:hover .card-watermark {
  opacity: 0.65;
}

.card-watermark-logo {
  height: 12px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.9));
}

.modal-watermark {
  position: absolute;
  bottom: 12px;
  right: 12px;
  pointer-events: none;
  background: rgba(10, 12, 16, 0.4);
  backdrop-filter: blur(4px);
  padding: 4px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.4;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-watermark-logo {
  height: 20px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.9));
}

.ref-info {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ref-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ref-author {
  font-size: 11px;
  color: var(--text-muted);
}

/* Empty state */
.no-results-box {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-card-subtle);
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border-color);
}

.no-results-box h4 {
  font-size: 16px;
  margin-bottom: 8px;
}

.no-results-box p {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-card-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #4b5563;
}

.btn-outline {
  background: transparent;
  color: #818cf8;
  border: 1px solid #4f46e5;
}

.btn-outline:hover {
  background: rgba(99, 102, 241, 0.15);
}

.form-select {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.form-select.sm {
  font-size: 12px;
  padding: 4px 8px;
}

/* Modal Lightbox */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 20px;
}

.modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 1000px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  z-index: 10;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: #fff;
  font-size: 26px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.modal-close:hover {
  background: var(--danger);
}

.modal-body {
  display: grid;
  grid-template-columns: 1fr 340px;
  max-height: 85vh;
}

@media (max-width: 768px) {
  .modal-body {
    grid-template-columns: 1fr;
  }
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 1180px;
  width: 100%;
  max-height: 94vh;
  overflow: hidden;
  z-index: 10;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.modal-body {
  display: grid;
  grid-template-columns: 1fr 340px;
  max-height: 90vh;
}

@media (max-width: 900px) {
  .modal-body {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
}

.modal-viewport-area {
  display: flex;
  flex-direction: column;
  background: #090a0f;
  position: relative;
  overflow: hidden;
}

.modal-image-wrapper {
  background: #090a0f;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  min-height: 480px;
  padding: 16px;
}

.modal-image-wrapper img {
  max-width: 95%;
  max-height: 72vh;
  object-fit: contain;
  transition: transform 0.15s ease, filter 0.15s ease;
  transform-origin: center center;
  user-select: none;
}

/* Perspective Grid Overlay for Artists */
.art-grid-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: 5;
}

.art-grid-overlay.active {
  display: block;
}

/* Bottom Artist Floating Controls Toolbar (Like AngleRef) */
.artist-toolbar {
  background: rgba(15, 17, 23, 0.95);
  border-top: 1px solid var(--border-color);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  z-index: 10;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-btn, .tool-btn-sm {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-btn-sm {
  padding: 3px 6px;
  font-size: 11px;
}

.tool-btn:hover, .tool-btn-sm:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
}

.tool-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  min-width: 44px;
  text-align: center;
}

.rotation-group {
  background: rgba(255, 255, 255, 0.03);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.rotation-group input[type="range"] {
  width: 90px;
  accent-color: var(--primary);
  cursor: pointer;
}

.toggle-tool-btn {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: #e5e7eb;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.toggle-tool-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.toggle-tool-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

/* Sidebar adjustments panel */
.modal-sidebar {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-card-subtle);
  border-left: 1px solid var(--border-color);
  overflow-y: auto;
}

.modal-sidebar h3 {
  font-size: 16px;
  color: #fff;
}

.image-adjustments-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.image-adjustments-panel h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.adj-control {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.adj-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.adj-header span {
  font-family: var(--font-mono);
  color: #e5e7eb;
}

.adj-control input[type="range"] {
  accent-color: var(--primary);
  width: 100%;
  cursor: pointer;
}

.modal-metadata {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
}

.modal-metadata strong {
  color: #fff;
}

.modal-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* ==========================================================================
   PRÁCTICA DE DIBUJO RÁPIDO CON TEMPORIZADOR (Gesture / Speed Drawing)
   ========================================================================== */

.btn-practice {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff !important;
  font-weight: 700;
  border: none;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.btn-practice:hover {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

/* Modal de Configuración */
.practice-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.practice-modal-backdrop.active {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

.practice-config-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.practice-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: var(--bg-card-subtle);
  border-bottom: 1px solid var(--border-color);
}

.practice-modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.practice-modal-title h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.practice-modal-title .icon {
  font-size: 1.5rem;
}

.practice-modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 75vh;
  overflow-y: auto;
}

.practice-intro-text {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #d1d5db;
}

.time-presets, .count-presets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 8px;
}

.preset-time-btn, .preset-count-btn {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.preset-time-btn small {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: normal;
}

.preset-time-btn:hover, .preset-count-btn:hover {
  background: #282f44;
  border-color: #4b5563;
}

.preset-time-btn.active, .preset-count-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 12px var(--primary-glow);
}

.preset-time-btn.active small {
  color: #e0e7ff;
}

.custom-time-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.custom-time-wrap input {
  width: 90px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.form-group-checkbox {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.practice-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  background: var(--bg-card-subtle);
  border-top: 1px solid var(--border-color);
}

.btn-start-practice {
  background: linear-gradient(135deg, #10b981, #059669);
  padding: 10px 24px;
  font-weight: 700;
  font-size: 1rem;
}

.btn-start-practice:hover {
  background: linear-gradient(135deg, #34d399, #10b981);
}

/* ==========================================================================
   PANTALLA DE SESIÓN ACTIVA (FULLSCREEN / THEATER VIEW)
   ========================================================================== */

.practice-screen {
  position: fixed;
  inset: 0;
  background: #090b10;
  z-index: 2000;
  display: none;
  flex-direction: column;
}

.practice-screen.active {
  display: flex;
}

.practice-screen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: rgba(15, 17, 23, 0.95);
  border-bottom: 1px solid var(--border-color);
  gap: 20px;
  z-index: 10;
}

.practice-progress-box {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 260px;
}

.practice-badge {
  background: var(--primary);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.practice-title {
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

/* Temporizador Central */
.practice-timer-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 180px;
}

.timer-display {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 800;
  color: #f59e0b;
  letter-spacing: 2px;
  line-height: 1;
}

.timer-display.danger {
  color: #ef4444;
  animation: pulseTimer 1s infinite;
}

@keyframes pulseTimer {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.timer-progress-bar-bg {
  width: 160px;
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
}

.timer-progress-bar {
  height: 100%;
  width: 100%;
  background: #f59e0b;
  transition: width 0.25s linear;
}

/* Controles de reproducción */
.practice-controls-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.practice-ctrl-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.practice-ctrl-btn:hover {
  background: #2a3145;
  border-color: #4b5563;
}

.practice-ctrl-btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  min-width: 50px;
}

.practice-ctrl-btn.primary:hover {
  background: var(--primary-hover);
}

.practice-ctrl-btn.danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
  font-size: 0.95rem;
}

.practice-ctrl-btn.danger:hover {
  background: var(--danger);
  color: #fff;
}

/* Viewport de Imagen */
.practice-image-viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  padding: 20px;
}

.practice-img-container {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.practice-img-container img#practiceImg {
  max-width: 90vw;
  max-height: 78vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  user-select: none;
  transition: filter 0.2s ease, transform 0.2s ease;
}

.practice-img-container img#practiceImg.flip-h {
  transform: scaleX(-1);
}

.practice-img-container img#practiceImg.grayscale {
  filter: grayscale(100%) contrast(110%);
}

.practice-img-container img#practiceImg.flip-h.grayscale {
  transform: scaleX(-1);
  filter: grayscale(100%) contrast(110%);
}

.practice-grid-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.25) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.25) 1px, transparent 1px);
  background-size: 33.333% 33.333%;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.practice-grid-overlay.active {
  display: block;
}

.practice-watermark {
  position: absolute;
  bottom: 16px;
  right: 16px;
  opacity: 0.35;
  pointer-events: none;
}

.practice-watermark img {
  height: 38px;
}

/* Barra inferior de herramientas */
.practice-tools-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(15, 17, 23, 0.9);
  border-top: 1px solid var(--border-color);
}

.practice-tool-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.practice-tool-pill:hover {
  background: #283044;
  color: var(--text-main);
}

.practice-tool-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Pantalla de Fin de Sesión */
.practice-complete-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 18, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.practice-complete-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  max-width: 480px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
}

.complete-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.practice-complete-card h2 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 10px;
}

.practice-complete-card p {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 28px;
}

.complete-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
}


/* User Access & Daily Limit Badges */
.user-access-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  transition: all 0.2s ease;
}

.user-access-badge.free {
  border-color: rgba(245, 184, 0, 0.35);
  background: rgba(245, 184, 0, 0.12);
  color: #f5b800;
}

.user-access-badge.student {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

.user-access-badge.limit-reached {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* ==========================================================================
   OPTIMIZACIÓN MOBILE Y CONTROLES TÁCTILES COMPACTOS
   ========================================================================== */

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

.header-presets-scroll {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.header-controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-angle-pill {
  display: none;
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  color: #e2e8f0;
  pointer-events: none;
  z-index: 5;
}

.btn-toggle-3d {
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.45);
  color: #c7d2fe;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-toggle-3d:hover {
  background: rgba(99, 102, 241, 0.32);
  color: #ffffff;
}

/* Estado colapsado del visor 3D */
.viewport-card.collapsed-3d {
  height: auto !important;
  min-height: auto !important;
}

.viewport-card.collapsed-3d .canvas-wrapper,
.viewport-card.collapsed-3d .angle-gauges,
.viewport-card.collapsed-3d .viewport-footer {
  display: none !important;
}

@media (max-width: 1080px) {
  .app-container {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .viewport-card,
  .gallery-card {
    min-width: 0;
    max-width: 100%;
  }
  .btn-toggle-3d {
    display: inline-flex;
  }
}

@media (max-width: 768px) {
  html, body.dark-theme {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .app-header {
    padding: 6px 8px;
    gap: 6px;
    width: 100%;
    max-width: 100vw;
  }

  /* Ocultar doble logo/título en móvil ya que está dentro de la web de Rooster */
  .brand-left {
    display: none !important;
  }

  .brand {
    width: 100%;
    justify-content: stretch;
  }

  .btn-practice {
    width: 100%;
    justify-content: center;
    padding: 7px 12px;
    font-size: 12px;
  }

  /* Cinta deslizable horizontal para los botones de ángulos */
  .header-presets-scroll {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    padding: 2px 0 4px;
    gap: 6px;
    scrollbar-width: none;
  }

  .header-presets-scroll::-webkit-scrollbar {
    display: none;
  }

  .header-presets-scroll .btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 6px 11px;
    font-size: 11.5px;
  }

  /* Contenedor principal sin desborde horizontal */
  .app-container {
    grid-template-columns: minmax(0, 1fr) !important;
    padding: 6px !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* Visor 3D ultra compacto en celulares (175px) para ver 3D + Galería al mismo tiempo */
  .viewport-card {
    height: auto !important;
    min-height: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    position: relative;
    top: 0;
  }

  .viewport-card .canvas-wrapper {
    height: 175px !important;
    min-height: 175px !important;
    width: 100% !important;
    flex: none !important;
  }

  /* Ocultar texto de mouse de PC y paneles grandes en móvil */
  .canvas-overlay-help,
  .angle-gauges,
  .viewport-footer {
    display: none !important;
  }

  .mobile-angle-pill {
    display: block;
  }

  .card-header {
    padding: 6px 8px;
    flex-wrap: nowrap;
    gap: 6px;
    width: 100%;
  }

  .card-title {
    font-size: 12px;
    white-space: nowrap;
  }

  .header-controls-right {
    gap: 6px;
    min-width: 0;
    flex: 1;
    justify-content: flex-end;
  }

  .model-switch-group {
    min-width: 0;
    flex: 1;
    display: flex;
    justify-content: flex-end;
  }

  .model-switch-group label {
    display: none;
  }

  .model-switch-group .form-select {
    font-size: 11px;
    padding: 4px 6px;
    width: 100%;
    max-width: 160px;
    text-overflow: ellipsis;
  }

  /* Galería en 2 columnas tipo grilla móvil */
  .gallery-card {
    padding: 8px;
    min-height: auto;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .gallery-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    width: 100%;
  }

  .gallery-title {
    font-size: 14px;
  }

  .gallery-status {
    font-size: 11px;
  }

  .gallery-toggles {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: wrap;
  }

  .toggle-label {
    font-size: 11px;
  }

  .gallery-toggles .form-select.sm {
    font-size: 11px;
    padding: 4px 6px;
    flex: 1;
    min-width: 120px;
    max-width: 100%;
  }

  /* Pastillas de filtros deslizables horizontalmente */
  .demographic-filter-bar {
    gap: 6px;
    margin-bottom: 8px;
    width: 100%;
    min-width: 0;
  }

  .filter-pills {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    padding-bottom: 4px;
    gap: 6px;
    scrollbar-width: none;
  }

  .filter-pills::-webkit-scrollbar {
    display: none;
  }

  .pill-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 5px 11px;
    font-size: 11px;
  }

  .search-input-box {
    width: 100%;
  }

  .search-input-box input {
    width: 100%;
    padding: 7px 10px;
    font-size: 12px;
  }

  .references-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100%;
  }

  .reference-card {
    border-radius: 8px;
    min-width: 0;
  }

  .ref-badge,
  .ref-match-badge {
    font-size: 9px !important;
    padding: 2px 5px !important;
  }

  .card-watermark-logo {
    height: 15px !important;
  }

  .ref-info {
    padding: 5px 7px;
  }

  .ref-title {
    font-size: 11px;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Modal Lightbox en celular */
  .modal-content {
    width: 96vw;
    max-height: 95vh;
    margin: 6px;
  }

  .modal-image-wrapper {
    min-height: 44vh;
    max-height: 55vh;
  }

  .artist-toolbar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
  }

  .toolbar-btn {
    padding: 5px 8px;
    font-size: 11px;
  }

  /* Modo Práctica en celular */
  .practice-screen-header {
    padding: 8px 10px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .practice-title {
    display: none;
  }

  .practice-timer-box {
    min-width: auto;
  }

  .timer-display {
    font-size: 1.45rem;
  }

  .timer-progress-bar-bg {
    width: 90px;
  }

  .practice-ctrl-btn {
    padding: 6px 10px;
    font-size: 0.9rem;
  }

  .practice-image-viewport {
    padding: 8px;
  }

  .practice-img-container img#practiceImg {
    max-width: 94vw;
    max-height: 70vh;
  }

  .practice-tools-bar {
    padding: 8px 10px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .practice-tool-pill {
    padding: 5px 10px;
    font-size: 0.75rem;
  }
}

