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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #e5cbe2 0%, #48398d 100%);
  min-height: 100vh;
  padding: 20px;
  color: #333;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  background: linear-gradient(135deg, #e9bfe5 0%, #808ca8 100%);
  color: white;
  padding: 40px 20px;
  text-align: center;
}

header h1 {
  font-size: 2.5em;
  margin-bottom: 10px;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
    margin-bottom: 8px;
}

/* Header decoration images */
.header-images {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
    margin-bottom: -30px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.header-img {
    height: 30px;
    width: auto;
    object-fit: contain;
    opacity: 0.85;
    transition: opacity 0.3s ease;
    animation: sharpBounce 1.0s ease-in-out infinite;
}

.header-img:hover {
    opacity: 1;
}

/* Stagger animation delays for each image to bounce separately */
.header-img:nth-child(1) { animation-delay: 0s; }
.header-img:nth-child(2) { animation-delay: 0.2s; }
.header-img:nth-child(3) { animation-delay: 0.4s; }
.header-img:nth-child(4) { animation-delay: 0.6s; }
.header-img:nth-child(5) { animation-delay: 0.4s; }
.header-img:nth-child(6) { animation-delay: 0.2s; }

@keyframes sharpBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

main {
    flex: 1;
    padding: 40px 20px;
}/* Upload Section */
.upload-section {
  margin-bottom: 40px;
}

.upload-area {
  border: 3px dashed #667eea;
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  background: #f9f9f9;
}

.upload-area:hover {
  background: #f0f0ff;
  border-color: #110a36;
}

.upload-area.dragover {
  background: #e6e6ff;
  border-color: #161151;
  transform: scale(1.02);
}

.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  cursor: pointer;
}

.upload-icon {
  font-size: 3em;
}

.upload-text {
  font-size: 1.2em;
  font-weight: 600;
  color: #333;
}

.upload-hint {
  font-size: 0.9em;
  color: #666;
}

/* Controls Section */
.controls-section {
  background: #f9f9f9;
  padding: 30px;
  border-radius: 8px;
  margin-bottom: 30px;
  border: 1px solid #e0e0e0;
}

.control-group {
  margin-bottom: 20px;
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

.input-group {
  display: flex;
  gap: 15px;
  align-items: center;
}

input[type="range"] {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #ddd;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  transition: background 0.3s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: #261d8c;
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  border: none;
  transition: background 0.3s;
}

input[type="range"]::-moz-range-thumb:hover {
  background: #1a0e5b;
}

input[type="number"],
input[type="text"],
select {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1em;
  transition: border-color 0.3s;
}

input[type="number"] {
  width: 80px;
}

input[type="text"] {
  width: 100%;
}

select {
  width: 100%;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.hint {
  display: block;
  margin-top: 4px;
  font-size: 0.85em;
  color: #666;
}

input[type="checkbox"] {
  margin-right: 8px;
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: #667eea;
}

/* Buttons */
.btn-primary,
.btn-secondary {
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-block;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  width: 100%;
  margin-top: 15px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: white;
  color: #667eea;
  border: 2px solid #667eea;
  margin-right: 10px;
  margin-bottom: 10px;
}

.btn-secondary:hover {
  background: #f0f0ff;
  transform: translateY(-2px);
}

/* Preview Section */
.preview-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

.preview-container {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.preview-container h2 {
  margin-bottom: 15px;
  color: #333;
  font-size: 1.1em;
}

#previewImage {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  max-height: 400px;
}

/* ASCII 输出区域：默认无背景，使用 .ascii-bg 类显示深色背景 */
#asciiOutput {
  background: transparent;
  color: #111111;
  padding: 15px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.75em;
  line-height: 1.2;
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
}

.ascii-bg {
  background: #ffffff;
  color: #ffffff;
}

/* Actions Section */
.actions-section {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
}

/* Footer */
footer {
  background: #f9f9f9;
  padding: 20px;
  text-align: center;
  border-top: 1px solid #e0e0e0;
  color: #666;
}

footer a {
  color: #667eea;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
  header h1 {
    font-size: 1.8em;
  }

  main {
    padding: 20px;
  }

  .controls-section {
    padding: 20px;
  }

  .preview-section {
    grid-template-columns: 1fr;
  }

  .input-group {
    flex-direction: column;
  }

  input[type="number"] {
    width: 100%;
  }

  .btn-secondary {
    width: 100%;
    margin-right: 0;
    margin-bottom: 10px;
  }

  #asciiOutput {
    font-size: 0.6em;
  }
}

/* Loading State */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

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

