/* ==========================================================================
   CSS 3D Pizza Box Simulator Styles
   Theme Variables & Layout Setup
   ========================================================================== */

:root {
  /* Common UI Colors */
  --bg-dark: #0f0e0d;
  --panel-bg: rgba(26, 24, 23, 0.75);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-main: #f3f0ec;
  --text-muted: #a59e95;
  --accent: #e74c3c;
  --accent-hover: #c0392b;
  --accent-glow: rgba(231, 76, 60, 0.4);
  --success: #2ecc71;
  
  /* Fonts */
  --font-main: 'Outfit', sans-serif;
  --font-hand: 'Caveat', cursive;

  /* Default Cardboard Theme Colors */
  --box-bg: #d7b889;          /* Classic Kraft Cardboard */
  --box-bg-darker: #c2a072;
  --box-bg-inner: #ebd3ad;
  --box-print-primary: #a33835; /* Retro Red Print */
  --box-print-secondary: #2f4d6d; /* Retro Blue Print */
  --box-shadow-color: rgba(0, 0, 0, 0.65);
}

/* Theme overrides */
body.theme-dark {
  --box-bg: #1f1f23;
  --box-bg-darker: #161619;
  --box-bg-inner: #2d2d33;
  --box-print-primary: #d4af37; /* Gold foil */
  --box-print-secondary: #ffffff; /* White ink */
  --box-shadow-color: rgba(0, 0, 0, 0.8);
}

body.theme-neon {
  --box-bg: #09090b;
  --box-bg-darker: #020203;
  --box-bg-inner: #15151c;
  --box-print-primary: #ff007f; /* Neon Pink */
  --box-print-secondary: #00f0ff; /* Neon Cyan */
  --box-shadow-color: rgba(255, 0, 127, 0.15);
}

body.theme-christmas {
  --box-bg: #a62424;
  --box-bg-darker: #821c1c;
  --box-bg-inner: #f2e6d8;
  --box-print-primary: #1e5631; /* Pine Green */
  --box-print-secondary: #f4c430; /* Gold */
  --box-shadow-color: rgba(0, 0, 0, 0.7);
}

/* Basic Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-user-select: none;
  user-select: none;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
}

/* App Container Layout */
.app-container {
  display: flex;
  width: 100%;
  height: 100%;
}

/* ==========================================================================
   Viewport (3D Scene Container)
   ========================================================================== */

.viewport-container {
  flex: 1;
  position: relative;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: radial-gradient(circle at center, #2c2520 0%, #0d0c0b 100%);
  cursor: grab;
}

.viewport-container:active {
  cursor: grabbing;
}

/* Instruction Overlay */
.instruction-overlay {
  position: absolute;
  bottom: 24px;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.05);
  pointer-events: none;
  z-index: 10;
  animation: fadeIn 0.8s ease;
}

.instruction-overlay svg {
  opacity: 0.8;
}

/* Steam Particle Canvas */
.steam-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* ==========================================================================
   3D Engine CSS Setup
   ========================================================================== */

.scene {
  perspective: 1200px;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pizza-box-wrapper {
  transform-style: preserve-3d;
  transform: rotateX(-20deg) rotateY(30deg);
  transition: transform 0.1s ease-out; /* Smooth dragging */
  width: 300px;
  height: 300px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pizza-box {
  position: relative;
  width: 300px;
  height: 300px;
  transform-style: preserve-3d;
}

/* Common Face Styling */
.face {
  position: absolute;
  backface-visibility: visible;
  transition: background-color 0.4s ease, border-color 0.4s ease;
  transform-style: preserve-3d; /* Prevent Safari/Chrome 3D layers clipping */
}

/* Hide other content but preserve face-image child */
.face.has-custom-image > *:not(.face-image) {
  display: none !important;
}

.face.has-custom-image {
  border: none !important;
}

/* ==========================================================================
   Box Base (Bottom Structure)
   ========================================================================== */

/* ==========================================================================
   Box Base (Bottom Structure)
   ========================================================================== */

.box-base {
  position: absolute;
  width: 300px;
  height: 300px;
  transform-style: preserve-3d;
}

/* Bottom interior (where pizza sits) */
.box-base .face.bottom-inner {
  width: 300px;
  height: 300px;
  top: 0;
  left: 0;
  background-color: var(--box-bg-inner);
  border: 2px solid var(--box-bg-darker);
  transform: translateY(19.8px) rotateX(90deg);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.15);
  transform-style: preserve-3d;
}

/* Bottom exterior (visible from underneath) */
.box-base .face.bottom-outer {
  width: 300px;
  height: 300px;
  top: 0;
  left: 0;
  background-color: var(--box-bg-darker);
  border: 2px solid var(--box-bg-darker);
  transform: translateY(20.2px) rotateX(270deg);
}

/* Base Walls (Height = 40px)
   Positioned centered vertically (top: 130px) so their center aligns with Y = 150px.
   When bottom face is at Y = 170px (translateY(20px)), and walls span from Y = 130px to 170px,
   the bottom sits perfectly at the bottom edge of the walls. */
.box-base .face.front {
  width: 300px;
  height: 40px;
  top: 130px;
  left: 0;
  background-color: var(--box-bg-darker);
  border: 1px solid rgba(0, 0, 0, 0.1);
  transform: translate3d(0, 0, 150px);
}

.box-base .face.back {
  width: 300px;
  height: 40px;
  top: 130px;
  left: 0;
  background-color: var(--box-bg-darker);
  border: 1px solid rgba(0, 0, 0, 0.1);
  transform: translate3d(0, 0, -150px) rotateY(180deg);
}

.box-base .face.left {
  width: 300px;
  height: 40px;
  top: 130px;
  left: 0;
  background-color: var(--box-bg);
  border: 1px solid rgba(0, 0, 0, 0.1);
  transform: translate3d(-150px, 0, 0) rotateY(-90deg);
}

.box-base .face.right {
  width: 300px;
  height: 40px;
  top: 130px;
  left: 0;
  background-color: var(--box-bg);
  border: 1px solid rgba(0, 0, 0, 0.1);
  transform: translate3d(150px, 0, 0) rotateY(90deg);
}

/* Shading effects for base walls to enhance 3D realism */
.box-base .face.left::after,
.box-base .face.right::after,
.box-base .face.front::after,
.box-base .face.back::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
}

.box-base .face.left::after { background: linear-gradient(to right, rgba(0,0,0,0.3), rgba(0,0,0,0.1)); }
.box-base .face.right::after { background: linear-gradient(to left, rgba(0,0,0,0.3), rgba(0,0,0,0.1)); }
.box-base .face.front::after { background: linear-gradient(to bottom, rgba(0,0,0,0.1), rgba(0,0,0,0.3)); }
.box-base .face.back::after { background: rgba(0, 0, 0, 0.4); }

/* Shadow cast on the floor underneath the box */
.box-base::before {
  content: '';
  position: absolute;
  width: 310px;
  height: 310px;
  background: var(--box-shadow-color);
  filter: blur(20px);
  transform: translate3d(-5px, 20px, -5px) rotateX(90deg);
  opacity: 0.85;
  transition: filter 0.4s ease, opacity 0.4s ease;
  pointer-events: none;
}

/* ==========================================================================
   Box Lid (Hinged Top part)
   ========================================================================== */

.box-lid {
  position: absolute;
  width: 300px;
  height: 300px;
  left: 0;
  top: 0;
  transform-style: preserve-3d;
  /* Hinge is at the back edge (local Y = 0) of the lid.
     When closed, the lid hinges at screen Y = 130px, screen Z = -150px.
     So we translate the hinge to that location, and rotateX(90deg) to lie flat. */
  transform-origin: center top;
  transform: translate3d(0, 130px, -150px) rotateX(calc(90deg + var(--lid-angle-deg, 0deg)));
  transition: transform 0.1s ease-out; /* Match drag physics or UI slider */
}

/* Lid Top Face (Outer) */
.box-lid .face.lid-top {
  width: 300px;
  height: 300px;
  top: 0;
  left: 0;
  background-color: var(--box-bg);
  border: 1px solid var(--box-bg-darker);
  transform: translateZ(0.5px); /* Facing up when lid is closed */
}

/* Lid Bottom Face (Inner) */
.box-lid .face.lid-bottom {
  width: 300px;
  height: 300px;
  top: 0;
  left: 0;
  background-color: var(--box-bg-inner);
  border: 1px solid var(--box-bg-darker);
  transform: translateZ(-0.5px) rotateY(180deg); /* Facing down when lid is closed */
  box-shadow: inset 0 0 50px rgba(0,0,0,0.1);
}

/* Lid Flaps (Folds down into/around the box base) */
.box-lid .face.lid-flap-front {
  width: 300px;
  height: 40px;
  top: 298px; /* Shifted 2px inwards (to Z = 148px) to slide inside the front wall when closed */
  left: 0;
  background-color: var(--box-bg-darker);
  transform: rotateX(-90deg); /* Folds down towards local negative Z (into the box when closed) */
  transform-origin: top center;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.box-lid .face.lid-flap-left {
  width: 40px;
  height: 300px;
  top: 0;
  left: -38px; /* Shifted 2px inwards (to X = -148px) to slide inside the left wall when closed */
  background-color: var(--box-bg);
  transform: rotateY(-90deg); /* Folds down towards local negative Z (into the box when closed) */
  transform-origin: right center;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.box-lid .face.lid-flap-right {
  width: 40px;
  height: 300px;
  top: 0;
  left: 298px; /* Shifted 2px inwards (to X = 148px) to slide inside the right wall when closed */
  background-color: var(--box-bg);
  transform: rotateY(90deg); /* Folds down towards local negative Z (into the box when closed) */
  transform-origin: left center;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Shading & Art on Outer Lid */
.lid-design {
  width: 100%;
  height: 100%;
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  border: 8px double var(--box-print-primary);
  margin: 0;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
}

.brand-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--box-print-primary);
}

.logo-svg {
  width: 60px;
  height: 60px;
  filter: drop-shadow(2px 2px 0px rgba(0,0,0,0.15));
}

.brand-name {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 3px;
  text-shadow: 1px 1px 0px rgba(0,0,0,0.15);
}

.lid-custom-text {
  font-family: var(--font-hand);
  font-size: 1.8rem;
  color: var(--box-print-secondary);
  text-align: center;
  white-space: nowrap;
  text-transform: uppercase;
  margin: 10px 0;
  line-height: 1;
}

.barcode {
  width: 120px;
  height: 20px;
  background: repeating-linear-gradient(90deg, 
    var(--box-print-primary), 
    var(--box-print-primary) 2px, 
    transparent 2px, 
    transparent 6px
  );
  opacity: 0.7;
}

/* Inner Lid design */
.inner-lid-content {
  width: 100%;
  height: 100%;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--box-print-primary);
  border: 4px dashed rgba(var(--box-print-primary), 0.3);
}

.inner-lid-content h3 {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.inner-lid-content p {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-bottom: 5px;
}

.inner-lid-content .social-tag {
  font-weight: 600;
  margin-top: 5px;
}

.inner-lid-content .recycle-logo {
  font-size: 2.2rem;
  margin-top: 15px;
  opacity: 0.6;
}

/* ==========================================================================
   Pizza inside the Box
   ========================================================================== */

.pizza-container {
  width: 280px;
  height: 280px;
  position: absolute;
  top: 8px;
  left: 8px;
  transform-style: preserve-3d;
}

.pizza {
  width: 280px;
  height: 280px;
  position: relative;
  transform-style: preserve-3d;
  /* Hover zoom effect */
  transition: transform 0.3s ease;
}

/* Pizza Slice structure */
.pizza-slice {
  position: absolute;
  width: 280px;
  height: 280px;
  top: 0;
  left: 0;
  transform-style: preserve-3d;
  cursor: pointer;
  /* Rotate slice by its dynamic index * 45deg */
  transform: rotate(calc(var(--slice-angle))) translateZ(0.5px);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
}

/* Slice hover: slides outward radially */
.pizza-slice:hover {
  transform: rotate(calc(var(--slice-angle))) translateX(12px) translateZ(1px);
}

/* When a slice is click-eaten */
.pizza-slice.eaten {
  opacity: 0;
  pointer-events: none;
  transform: rotate(calc(var(--slice-angle))) translateX(80px) scale(0.6) translateZ(0);
}

.slice-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Styling vectors inside pizza slice SVG */
.pizza-crust {
  fill: #e67e22;
  stroke: #d35400;
  stroke-width: 1.5;
}

.pizza-sauce {
  fill: #c0392b;
}

.pizza-cheese {
  fill: #f1c40f;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.topping-pep {
  fill: #962d22;
  stroke: #782118;
  stroke-width: 1;
}

.topping-pep-highlight {
  fill: #c0392b;
  opacity: 0.5;
}

.topping-mush-cap {
  fill: #ded6cb;
  stroke: #c2b4a3;
}

.topping-mush-stem {
  fill: #ece6dd;
}

.topping-olive-body {
  fill: #2c3e50;
  stroke: #1a252f;
  stroke-width: 0.5;
}

.topping-olive-hole {
  fill: #ebd3ad; /* Matches box inside base */
}

.topping-pepper-body {
  fill: #27ae60;
  stroke: #1e8449;
  stroke-width: 1;
}

/* Hide toppings dynamically if untoggled */
.topping-group {
  transition: opacity 0.25s ease;
  opacity: 0;
}

.topping-group.active {
  opacity: 1;
}

/* ==========================================================================
   Right Panel Controls (UI Glassmorphism)
   ========================================================================== */

.control-panel {
  width: 380px;
  height: 100%;
  background: var(--panel-bg);
  backdrop-filter: blur(25px);
  border-left: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 10;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.4);
  transition: width 0.3s ease;
}

.panel-header {
  padding: 30px 24px 20px;
  border-bottom: 1px solid var(--panel-border);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.pizza-emoji {
  font-size: 2.2rem;
  filter: drop-shadow(0 0 10px var(--accent-glow));
}

.panel-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #fff 0%, #a59e95 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
}

.panel-sections {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.panel-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.5px;
}

.section-title .icon {
  font-size: 1.1rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Slider Controls */
.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.custom-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  margin: 10px 0;
  transition: background 0.3s;
}

.custom-slider:hover {
  background: rgba(255, 255, 255, 0.15);
}

.custom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 0 10px var(--accent-glow);
  transition: transform 0.1s, background-color 0.2s;
}

.custom-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: #ff5e4d;
}

/* Theme Button Grid */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.theme-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
  color: var(--text-muted);
}

.theme-btn span {
  font-size: 0.85rem;
  font-weight: 500;
}

.theme-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.theme-btn.active {
  background: rgba(231, 76, 60, 0.1);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 12px rgba(231, 76, 60, 0.15);
}

.color-preview {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.2);
}

.color-preview.cardboard { background-color: #d7b889; }
.color-preview.dark { background-color: #1f1f23; }
.color-preview.neon { background-color: #09090b; border-color: #ff007f; }
.color-preview.christmas { background-color: #a62424; }

/* Buttons & Inputs */
.button-row {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.btn {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-full {
  width: 100%;
}

label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.custom-input {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 12px 14px;
  color: #fff;
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.20s;
}

.custom-input:focus {
  border-color: var(--accent);
}

/* Topping Selectors */
.topping-selectors {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.topping-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

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

.topping-btn.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.topping-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.topping-indicator.pepperoni { background-color: #962d22; }
.topping-indicator.mushroom { background-color: #ded6cb; }
.topping-indicator.olive { background-color: #2c3e50; }
.topping-indicator.pepper { background-color: #27ae60; }

/* Custom toggle switch */
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text-main);
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255,255,255,0.1);
  transition: .3s;
  border-radius: 24px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .switch-slider {
  background-color: var(--success);
}

input:checked + .switch-slider:before {
  transform: translateX(20px);
}

/* Tip text */
.tip-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 4px;
}

/* Panel Footer */
.panel-footer {
  padding: 24px;
  border-top: 1px solid var(--panel-border);
  text-align: center;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.15);
  letter-spacing: 0.5px;
}

/* ==========================================================================
   Animations & Responsive Scaling
   ========================================================================== */

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

/* Face Image overlay container inside 3D faces */
.face-image {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 2; /* Float above card text & borders */
  /* Bind flip scale (X, Y) and rotation degree from inline style variables.
     Add translate3d(-50%, -50%, 1px) to center it and prevent z-fighting. */
  transform: translate3d(-50%, -50%, 1px) scaleX(var(--flip-x, 1)) scaleY(var(--flip-y, 1)) rotate(var(--rot, 0deg));
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease, width 0.25s ease, height 0.25s ease;
  opacity: 0;
}

.face-image.active {
  opacity: 1;
}

/* Hide raw file inputs cleanly */
.upload-input {
  display: none !important;
}

/* Quick Bulk Apply Tools styling */
.bulk-tools {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bulk-tools .label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bulk-buttons {
  display: flex;
  gap: 6px;
  width: 100%;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 0.75rem;
  flex: 1;
}

/* Custom Image Upload Deck styles */
.upload-deck {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 5px;
}

.upload-deck::-webkit-scrollbar {
  width: 4px;
}
.upload-deck::-webkit-scrollbar-track {
  background: transparent;
}
.upload-deck::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.upload-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  transition: background-color 0.2s, border-color 0.2s;
}

.upload-card:hover {
  background: rgba(255, 255, 255, 0.04);
}

.card-info {
  display: flex;
  flex-direction: column;
}

.card-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-select {
  display: inline-block;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.2s;
  text-align: center;
}

.btn-select:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-select.has-image {
  background: rgba(46, 204, 113, 0.12);
  border-color: var(--success);
  color: var(--success);
}

.card-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-tools.hidden {
  display: none;
}

.btn-tool {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.15s;
}

.btn-tool:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-tool[data-action="delete"]:hover {
  background: rgba(231, 76, 60, 0.15);
  border-color: var(--accent);
}

/* Responsive constraints */
@media (max-width: 900px) {
  body {
    flex-direction: column;
    overflow-y: auto;
    height: auto;
  }
  .app-container {
    flex-direction: column;
    height: auto;
  }
  .viewport-container {
    height: 60vh;
    min-height: 400px;
  }
  .control-panel {
    width: 100%;
    height: auto;
    border-left: none;
    border-top: 1px solid var(--panel-border);
  }
}
