/* Font Face Declarations */
@font-face {
  font-family: 'ProphecyType';
  src: url('../fonts/PROPHECYTYPE.ttf') format('truetype');
  font-display: swap;
}

@font-face {
  font-family: 'DTMSans';
  src: url('../fonts/DTM-Sans.otf') format('opentype');
  font-display: swap;
}

/* Global Box Model */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Base Styles */
html, body {
  margin: 0; 
  padding: 0;
  font-family: 'DTMSans', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: white;
  background: black;
  overflow-x: hidden;
}

/* Text Container Styles */
#textContainer {
  width: 75vw;
  max-width: 425px;
  margin-top: 20px;
  margin-bottom: 10px;
  text-align: center;
  font-family: 'ProphecyType', serif;
  font-size: 32px;
  line-height: 1;
  color: transparent;
  background-size: 256px 256px;
  -webkit-background-clip: text;
  background-clip: text;
  mix-blend-mode: screen;
  animation: scrollBg 30s linear infinite;
  background-repeat: repeat;
}

#textContainerRed {
  position: absolute;
  top: 0;
  left: 50;
  width: 75vw;
  max-width: 425px;
  margin-top: 20px;
  margin-bottom: 10px;
  text-align: center;
  font-family: 'ProphecyType', serif;
  font-size: 32px;
  line-height: 1;
  color: transparent;
  background-size: 256px 256px;
  -webkit-background-clip: text;
  background-clip: text;
  mix-blend-mode: screen;
  animation: scrollBg 30s linear infinite, pulseFinalRed 2s infinite;
  background-repeat: repeat;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
}

/* Animations */
@keyframes scrollBg {
  0% { background-position: 0 0; }
  100% { background-position: 512px 512px; }
}

@keyframes pulseFinalRed {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

@keyframes pulseFinalGhost1 {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.4; }
}

@keyframes pulseFinalGhost2 {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.2; }
}

@keyframes pulseFinalBG {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.5; }
}

/* Output Container */
#output {
  position: relative;
  width: 90vw;
  max-width: 512px;
  aspect-ratio: 2 / 1;
  max-height: 256px;
}

/* Canvas Styles */
canvas {
  position: absolute;
  width: 90vw;
  max-width: 512px;
  height: auto;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-optimize-contrast;
  background: transparent;
}

#ghostIcon {
  z-index: 1;
  opacity: 0.4;
  pointer-events: none;
  top: -50px;
}

#ghostIcon2 {
  z-index: 1;
  opacity: 0.2;
  pointer-events: none;
  top: -50px;
}

/* Final theme ghost animations */
body.final-theme #ghostIcon {
  animation: pulseFinalGhost1 2s infinite 1s;
}

body.final-theme #ghostIcon2 {
  animation: pulseFinalGhost2 2s infinite 1s;
}

body.final-theme #background {
  animation: pulseFinalBG 2s infinite 1s;
}

#panel {
  z-index: 2;
  top: -50px;
}

/* Red overlay canvases */
#ghostIconRed {
  z-index: 11;
  pointer-events: none;
  top: -50px;
  opacity: 0;
  animation: pulseFinalGhost1 2s infinite;
}

#ghostIcon2Red {
  z-index: 11;
  pointer-events: none;
  top: -50px;
  opacity: 0;
  animation: pulseFinalGhost2 2s infinite;
}

#panelRed {
  z-index: 12;
  top: -50px;
  pointer-events: none;
  opacity: 0;
  animation: pulseFinalRed 2s infinite;
}

#backgroundRed {
  position: absolute;
  width: 90vw;
  max-width: 512px;
  height: auto;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5; 
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-optimize-contrast;
  opacity: 0;
  pointer-events: none;
  animation: pulseFinalBG 2s infinite;
  filter: blur(1.5px);
}

#background {
  position: absolute;
  width: 90vw;
  max-width: 512px;
  height: auto;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 0; 
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-optimize-contrast;
  opacity: 0.5;
  filter: blur(1.5px);
}

body.susie-theme #background {
  opacity: 0.5;
}

/* Form Elements */
input[type="file"], input[type="text"], textarea {
  margin-top: 10px;
  padding: 5px;
  width: 75vw;
  max-width: 512px;
}

.checkbox-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  text-align: center;
  width: 100%;
}

h1 {
  margin-top: 15px;
  margin-bottom: 20px;
  text-align: center;
  font-size: 48px;
}

footer {
  margin-top: 20px;
  padding: 10px;
  color: #fff;
  font-size: 14px;
  text-align: center;
  width: 100%;
  max-width: 512px;
}

.alt-font {
  font-family: 'ProphecyType', serif;
}

/* Range Input Styles */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 125px;
  max-width: 512px;
  height: 10px;
  background: transparent; 
  margin-top: 10px;
  padding: 0;
  border-radius: 0px;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.2); 
  border-radius: 0px;
}

input[type="range"]::-moz-range-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 0px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  background: white;
  border: 0px;
  margin-top: -4px; 
  cursor: pointer;
  box-shadow: 0 0 2px rgba(0,0,0,0.5);
}

input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  background: white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 2px rgba(0,0,0,0.5);
}

#directions {
  max-width: 512px;
  text-align: center;
  color: #fff;
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.4;
}

/* Text Input Styles */
input[type="text"], textarea {
  font-family: 'DTMSans', sans-serif;
  background-color: black;
  color: white;
  border: 2px solid white;
  padding: 5px 10px;
  outline: none;
  border-radius: 0px; 
  box-sizing: border-box;
}

input[type="text"]:focus, textarea:focus {
  outline: none;
  border-color: #fff; 
  box-shadow: 0 0 5px white; 
}

/* Custom File Upload Button */
.custom-file-upload {
  display: inline-block;
  font-family: 'DTMSans', sans-serif;
  background-color: black;
  color: white;
  border: 2px solid white;
  padding: 5px 10px;
  cursor: pointer;
  border-radius: 0px;
  user-select: none;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-file-upload:hover {
  background-color: #222;
  border-color: #fff;
}

.custom-file-upload:active {
  background-color: #111;
}

#sineWrapper {
  will-change: transform;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Select Dropdown */
select#styleSelect {
  font-family: 'DTMSans', sans-serif;
  background-color: black;
  color: white;
  border: 2px solid white;
  padding: 5px 10px;
  border-radius: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  text-align: center;
  margin-top: 10px;
  width: 200px;
  max-width: 512px;
}

select#styleSelect:hover {
  background-color: #222;
  border-color: #fff;
}

select#styleSelect:focus {
  outline: none;
  border-color: #fff;
  box-shadow: 0 0 5px white;
}

#overlayWrapper {
  position: relative;
  width: 100%;
  max-width: 512px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: black;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

/* Advanced Settings */
#advancedSettings {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
}

#advancedGrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 12px;
  background: black;
  border: 2px solid white;
  text-align: center;
  max-width: 400px;
}

.advancedCell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.previewBox {
  width: 96px;
  height: 96px;
  border: 2px solid white;
  background-color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 36px;
  margin-bottom: 8px;
  image-rendering: pixelated;
  object-fit: contain;
  overflow: hidden;
}

.fileLabel {
  font-family: 'DTMSans', sans-serif;
  font-size: 12px;
  margin-bottom: 4px;
  color: white;
}

.custom-file-upload.small {
  display: inline-block;
  font-family: 'DTMSans', sans-serif;
  background-color: black;
  color: white;
  border: 2px solid white;
  padding: 3px 6px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 0px;
  user-select: none;
  text-align: center;
  margin-top: 4px;
}

.custom-file-upload.small:hover {
  background-color: #222;
  border-color: #fff;
}

.custom-file-upload.small:active {
  background-color: #111;
}

.sliderWrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 80px;
  width: 125px;
  margin-top: 2px;
  gap: 4px;
  user-select: none;
  grid-column: span 2;
  justify-self: center;
}

#fontScale {
  -webkit-appearance: none;
  appearance: none;
  width: 125px;
  height: 10px;
  background: transparent;
  cursor: pointer;
  margin: 0;
  align-self: center;
}

#fontScale::-webkit-slider-runnable-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 0px;
}

#fontScale::-moz-range-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 0px;
}

#fontScale::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  background: white;
  border: none;
  margin-top: -2px;
  box-shadow: 0 0 2px rgba(0,0,0,0.5);
  cursor: pointer;
}

#fontScale::-moz-range-thumb {
  width: 15px;
  height: 15px;
  background: white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 2px rgba(0,0,0,0.5);
}

.sliderWrapper > .fileLabel:first-child {
  margin-bottom: auto;
}

.sliderWrapper > #fontScaleValue {
  margin-top: auto;
}

#fontPreviewText {
  transition: font-size 0.1s ease;
}

/* Navigation Styles */
.main-nav {
  width: 100%;
  max-width: 1200px;
  margin: 20px 0;
  position: relative;
}

.nav-container {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.nav-toggle {
  display: none;
  background: black;
  border: 2px solid white;
  color: white;
  padding: 10px;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  min-width: 44px;
  min-height: 44px;
  transition: background-color 0.3s ease;
}

.nav-toggle:hover {
  background-color: #222;
}

.hamburger-line {
  width: 20px;
  height: 2px;
  background-color: white;
  transition: all 0.3s ease;
  transform-origin: center;
}

.nav-toggle.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.nav-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

.nav-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
}

.nav-menu a {
  color: white;
  text-decoration: none;
  padding: 8px 15px;
  border: 2px solid white;
  background: black;
  transition: background-color 0.3s;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.nav-menu a:hover {
  background-color: #222;
}

/* Content Section Styles */
.content-section {
  max-width: 1000px;
  margin: 30px auto;
  padding: 25px 20px;
  text-align: left;
  line-height: 1.6;
  border-bottom: 1px solid #333;
}

.content-section:last-of-type {
  border-bottom: none;
}

.content-section h2 {
  color: white;
  font-family: 'DTMSans', sans-serif;
  font-size: 28px;
  margin: 30px 0 15px 0;
  text-align: center;
}

.content-section h3 {
  color: white;
  font-family: 'DTMSans', sans-serif;
  font-size: 22px;
  margin: 25px 0 12px 0;
}

.content-section p {
  color: #e0e0e0;
  font-size: 16px;
  margin-bottom: 15px;
}

.content-section ul {
  color: #e0e0e0;
  padding-left: 20px;
}

.content-section li {
  margin-bottom: 8px;
}

/* Hero Section */
.hero-section {
  max-width: 1000px;
  margin: 20px auto;
  padding: 25px 20px;
  text-align: center;
  border-bottom: 1px solid #333;
}

.hero-description {
  max-width: 700px;
  margin: 30px auto;
  text-align: center;
  font-size: 18px;
  line-height: 1.6;
  color: #e0e0e0;
}

.faq-item {
  margin-bottom: 25px;
}

.faq-question {
  font-weight: bold;
  color: white;
  font-size: 18px;
  margin-bottom: 8px;
}

.faq-answer {
  color: #e0e0e0;
  margin-left: 15px;
}

/* Generator section wrapper */
.generator-section {
  max-width: 1000px;
  margin: 30px auto;
  padding: 25px 20px;
  text-align: center;
  border-bottom: 1px solid #333;
}

/* Generator container for left-right layout */
.generator-container {
  display: flex;
  flex-direction: row;
  gap: 40px;
  max-width: 1200px;
  margin: 30px auto;
  align-items: flex-start;
  justify-content: center;
  text-align: left;
  padding: 0 20px;
}

/* Left side - Controls */
.generator-left {
  flex: 0 0 400px;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Right side - Preview */
.generator-right {
  flex: 1;
  min-width: 512px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Generator controls layout */
.generator-controls {
  max-width: 400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

/* 表单标签样式 */
.form-label {
  color: white;
  font-family: 'DTMSans', sans-serif;
  font-size: 16px;
  font-weight: 500;
  text-align: center;
  min-width: 100px;
  flex-shrink: 0;
}

/* 控件容器样式 */
.control-input {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 预言文本框样式 */
.prophecy-textarea {
  font-family: 'DTMSans', sans-serif;
  background-color: black;
  color: white;
  border: 2px solid white;
  padding: 8px 12px;
  outline: none;
  border-radius: 0px;
  box-sizing: border-box;
  width: 100%;
  max-width: 350px;
  resize: none;
  font-size: 14px;
  line-height: 1.4;
  min-height: 60px;
  max-height: 60px;
}

.prophecy-textarea:focus {
  outline: none;
  border-color: #fff;
  box-shadow: 0 0 5px white;
}

/* Generator output section */
.generator-output {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

/* Download buttons */
.download-buttons {
  display: flex;
  gap: 15px;
  margin-top: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Download buttons in left layout */
.generator-left .download-buttons {
  margin-top: 30px;
  flex-direction: column;
  gap: 10px;
}

.download-buttons button {
  min-width: 120px;
  position: relative;
}

.download-buttons button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: #333;
}

.loading-text {
  display: none;
}

.download-buttons button.loading .loading-text {
  display: inline;
}

.download-buttons button.loading::after {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border: 2px solid transparent;
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: translateY(-50%) rotate(0deg); }
  100% { transform: translateY(-50%) rotate(360deg); }
}

/* Section dividers */
.section-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #333, transparent);
  margin: 20px 0;
}

/* Improved spacing for directions */
#directions {
  max-width: 600px;
  text-align: center;
  color: #ccc;
  margin: 20px auto 0;
  font-size: 14px;
  line-height: 1.5;
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #333;
}

/* Responsive Styles */
/* 大平板到小桌面 */
@media (max-width: 1200px) {
  .generator-container {
    gap: 30px;
    padding: 0 15px;
  }
  
  .generator-left {
    flex: 0 0 380px;
    max-width: 380px;
  }
  
  .generator-right {
    min-width: 450px;
  }
}

/* 平板横屏 */
@media (max-width: 1024px) {
  .generator-container {
    gap: 25px;
    padding: 0 15px;
  }
  
  .generator-left {
    flex: 0 0 350px;
    max-width: 350px;
  }
  
  .generator-right {
    min-width: 400px;
  }
}

/* 平板竖屏 - 切换到垂直布局 */
@media (max-width: 900px) {
  .generator-container {
    flex-direction: column;
    gap: 30px;
    align-items: center;
    max-width: 700px;
    padding: 0 20px;
  }
  
  .generator-left {
    flex: none;
    max-width: 600px;
    width: 100%;
    order: 1;
  }
  
  .generator-right {
    flex: none;
    min-width: auto;
    width: 100%;
    max-width: 600px;
    order: 2;
  }
  
  .generator-controls {
    max-width: 600px;
    gap: 20px;
  }
  
  .control-row {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    align-items: center;
  }
  
  .form-label {
    min-width: 120px;
    text-align: center;
    font-size: 15px;
  }
  
  .control-input {
    min-width: 250px;
  }
  
  .prophecy-textarea {
    width: 100%;
    max-width: 400px;
  }
}

@media (max-width: 768px) {
  .main-nav {
    margin: 15px 0;
  }
  
  .nav-toggle {
    display: flex;
    position: absolute;
    top: 0;
    right: 20px;
    z-index: 1001;
  }
  
  .nav-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: black;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 30px;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    z-index: 1000;
    padding: 0;
    margin: 0;
  }
  
  .nav-menu.active {
    transform: translateX(0);
  }
  
  .nav-menu li {
    margin: 0;
  }
  
  .nav-menu a {
    min-width: 250px;
    padding: 15px 25px;
    font-size: 18px;
    font-weight: 500;
    text-align: center;
    border: 2px solid white;
    background: black;
    transition: all 0.3s ease;
  }
  
  .nav-menu a:hover {
    background-color: #333;
    transform: scale(1.05);
  }
  
  .content-section {
    padding: 15px 15px;
    margin: 20px auto;
  }
  
  .content-section h2 {
    font-size: 24px;
  }
  
  h1 {
    font-size: 36px;
  }
  
  .generator-section {
    padding: 15px 15px;
    margin: 20px auto;
  }
  
  .hero-section {
    padding: 15px 15px;
    margin: 15px auto;
  }
  
  /* Mobile: Switch back to vertical layout */
  /* 移动端布局调整 */
  .generator-container {
    flex-direction: column;
    gap: 25px;
    align-items: center;
    padding: 0 15px;
    max-width: 500px;
  }
  
  .generator-left {
    flex: none;
    max-width: 100%;
    width: 100%;
    order: 1;
  }
  
  .generator-right {
    flex: none;
    min-width: auto;
    width: 100%;
    order: 2;
  }
  
  .generator-controls {
    max-width: 100%;
    gap: 20px;
  }
  
  .control-row {
    flex-direction: column;
    gap: 8px;
    width: 100%;
    align-items: center;
  }
  
  .form-label {
    font-size: 16px;
    font-weight: 600;
    color: white;
    text-align: center;
    margin-bottom: 5px;
    min-width: auto;
  }
  
  .control-input {
    width: 100%;
    min-width: auto;
    align-items: center;
  }
  
  /* 移动端滑块优化 */
  .control-row input[type="range"] {
    width: 280px;
    height: 14px;
    background: transparent;
    cursor: pointer;
  }
  
  .control-row input[type="range"]::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
    margin-top: -7px;
    cursor: pointer;
  }
  
  .control-row input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    cursor: pointer;
    border: none;
  }
  
  /* 移动端选择框优化 */
  .control-row select {
    width: 320px;
    max-width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    border: 2px solid white;
    background: black;
    color: white;
    cursor: pointer;
  }
  
  /* 移动端文本框优化 */
  .prophecy-textarea {
    width: 100%;
    max-width: 100%;
    padding: 14px;
    font-size: 16px;
    line-height: 1.4;
    border: 2px solid white;
    background: black;
    color: white;
    resize: none;
    min-height: 80px;
    max-height: 80px;
  }
  
  /* 移动端按钮优化 */
  .custom-file-upload {
    padding: 14px 24px;
    font-size: 16px;
    min-width: 180px;
    min-height: 48px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .custom-file-upload:active {
    transform: scale(0.98);
  }
  
  .download-buttons {
    flex-direction: row;
    gap: 15px;
    width: 100%;
    margin-top: 20px;
    justify-content: center;
  }
  
  .download-buttons button {
    min-width: 140px;
    min-height: 52px;
    padding: 16px 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    max-width: 160px;
  }
  
  .download-buttons button:active {
    transform: scale(0.98);
  }
  
  /* 移动端高级设置优化 */
  #advancedGrid {
    grid-template-columns: 1fr;
    gap: 25px;
    padding: 20px;
    max-width: 100%;
    border: 2px solid white;
    background: black;
  }
  
  .advancedCell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  
  .previewBox {
    width: 120px;
    height: 120px;
    font-size: 42px;
    border: 2px solid white;
    background: #111;
  }
  
  .custom-file-upload.small {
    padding: 10px 18px;
    font-size: 14px;
    min-width: 140px;
    min-height: 40px;
    cursor: pointer;
  }
  
  .sliderWrapper {
    width: 100%;
    max-width: 280px;
    grid-column: span 1;
    gap: 8px;
  }
  
  .sliderWrapper input[type="range"] {
    width: 240px;
    height: 14px;
  }
  
  .sliderWrapper input[type="range"]::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
    margin-top: -7px;
  }
  
  .sliderWrapper input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
  }
  
  /* 移动端画布和预览优化 */
  #output {
    width: 95vw;
    max-width: 450px;
    margin: 0 auto;
  }
  
  canvas {
    width: 95vw;
    max-width: 450px;
  }
  
  #textContainer {
    width: 85vw;
    max-width: 380px;
    font-size: 26px;
    margin-top: 18px;
    margin-bottom: 12px;
    line-height: 1.1;
  }
  
  #textContainerRed {
    width: 85vw;
    max-width: 380px;
    font-size: 26px;
    margin-top: 18px;
    margin-bottom: 12px;
    line-height: 1.1;
  }
  
  .generator-output {
    gap: 15px;
    width: 100%;
  }
  
  #overlayWrapper {
    max-width: 450px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.3);
  }
  
  #sineWrapper {
    width: 100%;
  }
}

/* 超小屏幕移动设备 */
@media (max-width: 480px) {
  /* 导航优化 */
  .nav-menu a {
    min-width: 220px;
    padding: 12px 20px;
    font-size: 16px;
  }
  
  /* 标题和内容优化 */
  h1 {
    font-size: 24px;
    margin-top: 10px;
    margin-bottom: 15px;
    padding: 0 10px;
    line-height: 1.2;
  }
  
  .hero-description {
    font-size: 14px;
    padding: 0 15px;
    line-height: 1.5;
  }
  
  .content-section {
    padding: 15px 10px;
    margin: 15px auto;
  }
  
  .content-section h2 {
    font-size: 18px;
  }
  
  /* 生成器容器优化 */
  .generator-container {
    padding: 0 10px;
    gap: 20px;
    max-width: 380px;
  }
  
  /* 画布和预览优化 */
  #output {
    width: 98vw;
    max-width: 360px;
  }
  
  canvas {
    width: 98vw;
    max-width: 360px;
  }
  
  #textContainer {
    width: 90vw;
    max-width: 320px;
    font-size: 22px;
    margin-top: 15px;
    margin-bottom: 10px;
  }
  
  #textContainerRed {
    width: 90vw;
    max-width: 320px;
    font-size: 22px;
    margin-top: 15px;
    margin-bottom: 10px;
  }
  
  /* 控件优化 */
  .control-row input[type="range"] {
    width: 240px;
  }
  
  .control-row select {
    width: 280px;
    max-width: 100%;
  }
  
  .prophecy-textarea {
    max-width: 100%;
    padding: 12px;
    font-size: 15px;
  }
  
  .custom-file-upload {
    min-width: 180px;
    padding: 12px 18px;
    font-size: 15px;
  }
  
  .download-buttons {
    flex-direction: row;
    gap: 12px;
    justify-content: center;
  }
  
  .download-buttons button {
    min-width: 120px;
    padding: 14px 16px;
    font-size: 14px;
    flex: 1;
    max-width: 140px;
  }
  
  /* 高级设置优化 */
  #advancedGrid {
    max-width: 100%;
    padding: 15px;
    gap: 20px;
  }
  
  .previewBox {
    width: 100px;
    height: 100px;
    font-size: 32px;
  }
  
  .custom-file-upload.small {
    min-width: 120px;
    padding: 8px 12px;
    font-size: 13px;
  }
  
  .sliderWrapper {
    max-width: 240px;
  }
  
  .sliderWrapper input[type="range"] {
    width: 200px;
  }
}