* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: linear-gradient(135deg, #eef2ff, #f8fafc);
  color: #111827;
  -webkit-text-size-adjust: 100%;
}

/* MAIN LAYOUT */

.app {
  display: flex;
  gap: 25px;
  padding: max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  min-height: 100vh;
}

/* PANELS */

.panel {
  background: white;
  border-radius: 14px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.08);
  padding: 24px;
  display: flex;
  flex-direction: column;
}

/* UPLOAD PANEL */

.upload-panel {
  width: 400px;
}

.upload-panel h3 {
  margin: 0 0 15px;
}

/* UPLOAD BOX */

.upload-box {
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: 0.2s;
  margin-top: 10px;
  font-weight: 500;
}

.upload-box:hover {
  background: #f1f5f9;
}

.upload-box input {
  display: none;
}

/* BUTTON */

button {
  margin-top: 16px;
  padding: 12px 14px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  min-height: 44px;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
}

/* VIDEO PANEL */

.preview-panel {
  flex: 1;
}

.preview-panel h3 {
  margin-top: 0;
}

.video-box {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  /* background: #f8fafc; */
  border-radius: 10px;
  overflow: hidden;
  min-height: 260px;
  max-height: min(70vh, 640px);
  aspect-ratio: 16 / 9;
}

.video-box video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* VIEWER PANEL */

.viewer-panel {
  flex: 1;
}

.viewer-panel h3 {
  margin-top: 0;
}

.viewer {
  width: 100%;
  height: auto;
  /* background: #f8fafc; */
  border-radius: 10px;
  overflow: hidden;
  min-height: 260px;
  max-height: min(70vh, 640px);
  aspect-ratio: 1 / 1;
}

.viewer-caption {
  margin-top: 12px;
  text-align: center;
  font-size: 14px;
  color: #475569;
  font-weight: 500;
  background: #f1f5f9;
  padding: 8px 12px;
  border-radius: 6px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

/* IMAGE VIEWER */

.image-box {
  width: 100%;
  height: 100%;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.image-box:active {
  cursor: grabbing;
}

.image-box img {
  width: 100%;
  user-select: none;
  pointer-events: none;
}

/* PLACEHOLDER */

.viewer-placeholder {
  width: 100%;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 15px;
  min-height: 260px;
  max-height: min(70vh, 640px);
  padding: 18px;
  text-align: center;
  aspect-ratio: 16 / 9;
}

/* STATUS */

#status {
  margin-top: 20px;
  font-size: 14px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  cursor: pointer;
}

/* MOBILE RESPONSIVE */

@media (max-width: 1100px) {
  .app {
    flex-direction: column;
    gap: 18px;
  }

  .upload-panel {
    width: 100%;
  }

  .viewer,
  .viewer-placeholder,
  .video-box {
    max-height: min(60vh, 520px);
  }
}

@media (max-width: 900px) {
  .panel {
    padding: 18px;
  }
}

@media (max-width: 600px) {
  .app {
    gap: 14px;
  }

  .viewer,
  .viewer-placeholder,
  .video-box {
    max-height: min(56vh, 460px);
    min-height: 220px;
  }

  .upload-box {
    padding: 16px;
  }

  button {
    width: 100%;
    padding: 12px 14px;
  }
}
