* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #FF6B6B 0%, #95E1D3 35%, #F9F871 70%, #FF6B6B 100%);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.container {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 24px;
  padding: 30px;
  max-width: 1400px;
  width: 100%;
  max-height: 95vh;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  backdrop-filter: blur(10px);
  animation: fadeIn 0.6s ease-out;
  display: flex;
  flex-direction: row;
  gap: 30px;
  overflow: hidden;
}

main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

header {
  text-align: center;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.left-panel {
  display: flex;
  flex-direction: column;
  min-width: 300px;
  max-width: 350px;
  gap: 20px;
}

h1 {
  color: #6B3FA0;
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.subtitle {
  color: #666;
  font-size: 1rem;
  font-weight: 500;
}

.upload-section {
  text-align: center;
  margin-bottom: 15px;
  flex-shrink: 0;
}

.file-input-wrapper {
  position: relative;
  display: inline-block;
}

input[type="file"] {
  display: none;
}

.upload-btn {
  background: linear-gradient(135deg, #6B3FA0 0%, #8B5FC9 100%);
  color: white;
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(107, 63, 160, 0.4);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.upload-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(107, 63, 160, 0.6);
}

.upload-btn:active {
  transform: translateY(0);
}

.canvas-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  min-height: 0;
  margin: 10px 0;
}

canvas {
  border: 4px solid #6B3FA0;
  border-radius: 16px;
  cursor: grab;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

canvas:active {
  cursor: grabbing;
}

.controls {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 10px;
  flex-shrink: 0;
}

.control-btn {
  background: white;
  color: #6B3FA0;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  border: 3px solid #6B3FA0;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.control-btn:hover {
  background: #6B3FA0;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(107, 63, 160, 0.4);
}

.control-btn.download {
  background: linear-gradient(135deg, #FF6B6B 0%, #FF8E8E 100%);
  color: white;
  border: none;
}

.control-btn.download:hover {
  background: linear-gradient(135deg, #FF5252 0%, #FF7575 100%);
}

.instructions {
  background: linear-gradient(135deg, rgba(149, 225, 211, 0.3), rgba(249, 248, 113, 0.3));
  border-left: 5px solid #95E1D3;
  padding: 20px;
  border-radius: 12px;
  flex: 1;
  overflow-y: auto;
}

.instructions h3 {
  color: #6B3FA0;
  margin-bottom: 12px;
  font-size: 1.2rem;
}

.instructions ul {
  list-style: none;
  padding-left: 0;
}

.instructions li {
  padding: 6px 0;
  color: #444;
  font-size: 0.95rem;
}

.instructions li:before {
  content: "→ ";
  color: #6B3FA0;
  font-weight: bold;
  margin-right: 8px;
}

.privacy-notice {
  background: linear-gradient(135deg, rgba(107, 63, 160, 0.1), rgba(139, 95, 201, 0.1));
  border-left: 5px solid #6B3FA0;
  padding: 20px;
  border-radius: 12px;
  flex: 1;
  overflow-y: auto;
}

.privacy-notice h3 {
  color: #6B3FA0;
  margin-bottom: 12px;
  font-size: 1.2rem;
}

.privacy-notice p {
  color: #444;
  line-height: 1.5;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.privacy-notice strong {
  color: #6B3FA0;
}

.small-text {
  font-size: 0.85rem;
  color: #666;
  margin-top: 8px;
}

footer {
  text-align: center;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 2px solid #eee;
  color: #666;
  font-size: 0.85rem;
  flex-shrink: 0;
}

footer a {
  color: #6B3FA0;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

footer a:hover {
  color: #8B5FC9;
  text-decoration: underline;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.6);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background-color: white;
  margin: 3% auto;
  padding: 30px;
  border-radius: 20px;
  width: 90%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: slideIn 0.3s ease;
}

@media (max-width: 768px) {
  .modal-content {
    padding: 20px;
    margin: 5% auto;
    width: 95%;
    max-height: 85vh;
  }
  
  .modal-content h2 {
    font-size: 1.4rem;
  }
  
  .modal-content h3 {
    font-size: 1.1rem;
  }
  
  .modal-content p,
  .modal-content li {
    font-size: 0.9rem;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.close {
  color: #aaa;
  float: right;
  font-size: 32px;
  font-weight: bold;
  line-height: 20px;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close:hover,
.close:focus {
  color: #6B3FA0;
}

.modal-content h2 {
  color: #6B3FA0;
  margin-bottom: 20px;
  font-size: 2rem;
}

.modal-content h3 {
  color: #6B3FA0;
  margin-top: 25px;
  margin-bottom: 12px;
  font-size: 1.3rem;
}

.modal-content p {
  line-height: 1.6;
  margin-bottom: 15px;
  color: #444;
}

.modal-content ul {
  margin: 15px 0;
  padding-left: 20px;
}

.modal-content li {
  margin-bottom: 10px;
  line-height: 1.6;
  color: #444;
}

/* Responsive */
@media (max-width: 1024px) {
  .container {
    flex-direction: column;
    gap: 20px;
  }
  
  .left-panel {
    max-width: 100%;
    min-width: 100%;
  }
  
  .instructions,
  .privacy-notice {
    display: none;
  }
}

@media (max-width: 768px) {
  body {
    padding: 10px;
    height: 100vh;
  }
  
  .container {
    padding: 15px;
    border-radius: 16px;
    max-height: 98vh;
    flex-direction: column;
    gap: 15px;
  }
  
  .left-panel {
    gap: 15px;
  }
  
  h1 {
    font-size: 1.5rem;
    letter-spacing: 1px;
    margin-bottom: 3px;
  }
  
  .subtitle {
    font-size: 0.85rem;
  }
  
  .upload-btn {
    padding: 10px 20px;
    font-size: 14px;
  }
  
  canvas {
    max-width: 100%;
    max-height: 100%;
    border-width: 3px;
  }
  
  .controls {
    gap: 8px;
    margin-top: 8px;
  }
  
  .control-btn {
    padding: 8px 16px;
    font-size: 12px;
    flex: 1;
    min-width: 100px;
  }
  
  footer {
    font-size: 0.75rem;
    margin-top: 10px;
    padding-top: 10px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.3rem;
  }
  
  .subtitle {
    font-size: 0.8rem;
  }
  
  .upload-btn {
    padding: 10px 18px;
    font-size: 13px;
  }
  
  .control-btn {
    min-width: 90px;
    padding: 8px 12px;
    font-size: 11px;
  }
  
  .btn-icon {
    font-size: 16px;
  }
}