* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  overflow-y: scroll;
  overflow: hidden !important;
  /* 防止滾動條出現 */
  scroll-behavior: smooth;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.marquee-container {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999;
  padding: 5px 0;
}

.marquee-content {
  display: inline-block;
  white-space: nowrap;
  animation: marquee 20s linear infinite;
  color: #4CAF50;
  font-size: 1.1rem;
  text-shadow: 0 0 10px rgba(76, 175, 80, 0.5),
    0 0 20px rgba(76, 175, 80, 0.3),
    0 0 30px rgba(76, 175, 80, 0.2);
  padding-left: 100%;
  opacity: 1;
  transition: opacity 0.5s ease-in-out;
}

@keyframes marquee {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(-200%);
  }
}

body.dark-mode .marquee-container {
  background: rgba(0, 0, 0, 0.2);
}

/* Adjust language selector position to avoid overlap */
.language-selector-group {
  top: 40px;
  /* Increased to make room for marquee */
}

.magic-submit-effect {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: radial-gradient(circle at var(--x) var(--y),
      rgba(76, 175, 80, 0.2) 0%,
      transparent 60%);
  opacity: 0;
  transition: opacity 0.5s;
}

.magic-particles {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #4CAF50;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}

@keyframes magicParticle {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }

  100% {
    transform: translate(var(--tx), var(--ty)) scale(0);
    opacity: 0;
  }
}

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none !important;
}

.page-title {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.5rem;
  font-weight: bold;
  color: #4CAF50;
  text-align: center;
  width: 100%;
  text-shadow: 0 0 10px rgba(76, 175, 80, 0.5),
    0 0 20px rgba(76, 175, 80, 0.3),
    0 0 30px rgba(76, 175, 80, 0.2);
  z-index: 5;
}

@media screen and (max-width: 768px) {
  .page-title {
    font-size: 1rem;
    top: 60px;
  }

  #styleToggle {
    font-size: 12px;
  }

  #styleInput {
    font-size: 12px;
  }

  #storyOutline {
    font-size: 12px;
  }

  .floating-menu {
    padding: 2px;
  }

  .floating-menu a {
    padding: 8px 16px;
    /* 減小按鈕內的間距 */
    font-size: 1rem;
    /* 減小文字大小 */
  }
}

@media screen and (max-width: 480px) {
  .page-title {
    font-size: 1rem;
    top: 50px;
  }

  #styleToggle {
    font-size: 12px;
  }

  #styleInput {
    font-size: 12px;
  }

  #storyOutline {
    font-size: 12px;
  }

  .floating-menu {
    padding: 2px;
  }

  .floating-menu a {
    padding: 8px 16px;
    /* 減小按鈕內的間距 */
    font-size: 1rem;
    /* 減小文字大小 */
  }
}

.section {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.top-section {
  background: linear-gradient(120deg, #a1c4fd 0%, #c2e9fb 100%);
  position: relative;
  overflow: hidden;
  z-index: 2;
}

.section.bottom-section {
  display: flex;
  flex-direction: column;
  /* 垂直排列 */
  gap: 20px;
  /* 設定元素之間的間距 */
}

.container {
  display: flex;
  gap: 2.5rem;
  max-width: 1100px;
  width: 95%;
  background: rgba(255, 255, 255, 0.95);
  padding: 1.75rem;
  border-radius: 16px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.image-upload {
  width: 280px;
  height: 280px;
  border: 2px dashed #a1c4fd;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.5);
  margin-right: auto;
  margin-left: auto;
}

.image-upload:hover {
  border-color: #4CAF50;
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.image-upload img {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.style-conversion {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.style-input {
  padding: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  display: none;
  transition: all 0.3s ease;
}

.style-input:focus {
  border-color: #4CAF50;
  outline: none;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

button {
  padding: 0.75rem 1.25rem;
  background: linear-gradient(45deg, #4CAF50, #45a049);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

textarea {
  width: 100%;
  height: 150px;
  padding: 1rem;
  resize: vertical;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

textarea:focus {
  border-color: #4CAF50;
  outline: none;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.video-section {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 1rem;
  max-width: 1200px;
  width: 100%;
  position: relative;
  padding: 0 2rem;
  z-index: 1000;
}

.video-container {
  aspect-ratio: 16/9;
  width: 100%;
  position: relative;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
}

.language-selector-group {
  position: fixed;
  top: 40px;
  right: 20px;
  z-index: 1000;
  display: flex;
  gap: 10px;
  align-items: center;
}

/* 媒體查詢以適應小裝置 */
@media (max-width: 768px) {

  /* 根據需求調整最大寬度 */
  .language-selector-group {
    top: 100px;
    /* 向下移動，確保不會遮擋到標題 */
  }

  #countdownContainer {
    font-size: 8px;
    /* 在小裝置下進一步縮小字體 */
  }

}

.theme-toggle {
  position: static;
}

.theme-btn,
.language-btn {
  width: 40px;
  height: 40px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  color: var(--text-color-light);
}

/* 增加彩色跑馬燈效果 */
.language-btn::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 10px;
  padding: 2px;
  /* 控制邊框的厚度 */
  background: linear-gradient(270deg, #ff0080, #ff8c00, #40e0d0, #8a2be2, #ff0080);
  background-size: 400% 400%;
  z-index: -1;
  animation: rainbow-border 3s linear infinite;
}

/* 調整按鈕邊框樣式以保持美觀 */
.language-btn {
  box-shadow: 0 0 0 2px transparent;
  /* 透明邊框以保持一致的外觀 */
}

/* 定義跑馬燈效果動畫 */
@keyframes rainbow-border {
  0% {
    background-position: 0% 50%;
  }

  100% {
    background-position: 100% 50%;
  }
}

.theme-btn svg,
.language-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

body.dark-mode .theme-btn,
body.dark-mode .language-btn {
  background: var(--background-glass-dark);
  color: var(--icon-color-dark);
}

.language-options {
  position: absolute;
  top: 100%;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-top: 5px;
  display: none;
  flex-direction: column;
  width: 100%;
}

.language-options.show {
  display: flex;
}

.language-option {
  padding: 8px 15px;
  cursor: pointer;
  transition: background 0.3s;
}

.language-option:hover {
  background: rgba(0, 0, 0, 0.05);
}

@media screen and (max-width: 768px) {
  .container {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 90%;
    height: 80%;
    /* max-height: 60%; */
    padding: 1.25rem;
  }

  .image-upload {
    width: 200px;
    height: 200px;
  }

  .right-panel {
    width: 100%;
  }

  button {
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
  }

  textarea {
    height: 100px;
  }

  .video-section {
    grid-template-columns: repeat(2, 1fr);
    padding: 0 1rem;
    gap: 0.75rem;
  }

  .floating-menu {
    left: 10px;
    padding: 5px 10px;
  }

  .floating-menu a {
    font-size: 0.8rem;
  }

  .fairy {
    width: 15px;
    height: 15px;
  }

  .fairy::after {
    width: 20px;
    height: 20px;
  }
}

.floating-menu {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.95);
  padding: 15px 25px;
  border-radius: 50px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
  z-index: 2;
  transition: all 0.3s ease;
}

.floating-menu a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #4CAF50;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  text-shadow: 0 0 10px rgba(76, 175, 80, 0.5),
    0 0 20px rgba(76, 175, 80, 0.3),
    0 0 30px rgba(76, 175, 80, 0.2);
}

.floating-menu a svg {
  width: 20px;
  height: 20px;
  fill: #4CAF50;
  filter: drop-shadow(0 0 8px rgba(76, 175, 80, 0.5));
}

.floating-menu a:hover {
  color: #45a049;
  transform: translateY(-2px);
  text-shadow: 0 0 15px rgba(76, 175, 80, 0.8),
    0 0 25px rgba(76, 175, 80, 0.6),
    0 0 35px rgba(76, 175, 80, 0.4);
}

.floating-menu a:hover svg {
  fill: #45a049;
  filter: drop-shadow(0 0 12px rgba(76, 175, 80, 0.8));
}

/* Dark mode specific styles */
body.dark-mode .floating-menu a {
  color: #4CAF50;
  text-shadow: 0 0 10px rgba(76, 175, 80, 0.7),
    0 0 20px rgba(76, 175, 80, 0.5),
    0 0 30px rgba(76, 175, 80, 0.3);
}

body.dark-mode .floating-menu a:hover {
  color: #45a049;
  text-shadow: 0 0 15px rgba(76, 175, 80, 1),
    0 0 25px rgba(76, 175, 80, 0.8),
    0 0 35px rgba(76, 175, 80, 0.6);
}

body.dark-mode .floating-menu a svg {
  fill: #4CAF50;
  filter: drop-shadow(0 0 8px rgba(76, 175, 80, 0.7));
}

body.dark-mode .floating-menu a:hover svg {
  fill: #45a049;
  filter: drop-shadow(0 0 12px rgba(76, 175, 80, 1));
}

.fairy-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 200vh;
  pointer-events: none;
  z-index: 50;
}

.fairy {
  position: absolute;
  width: 20px;
  height: 20px;
  animation: float 20s linear infinite;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.6));
  opacity: 0.8;
}

.fairy::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 20px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform-origin: left;
  transform: rotate(-45deg);
  pointer-events: none;
  opacity: 0.6;
  animation: trail 2s linear infinite;
}

.fairy svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.8));
}

.fairy::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0) 70%);
  transform: translate(-50%, -50%);
  animation: sparkle 2s ease-in-out infinite;
}

@keyframes float {
  0% {
    transform: translate(var(--start-x, 0), var(--start-y, 0)) rotate(0deg) scale(1);
  }

  50% {
    transform: translate(var(--mid-x, 50vw), var(--mid-y, 50vh)) rotate(180deg) scale(0.8);
  }

  100% {
    transform: translate(var(--end-x, 100vw), var(--end-y, 100vh)) rotate(360deg) scale(1);
  }
}

@keyframes trail {

  0%,
  100% {
    opacity: 0;
  }

  50% {
    opacity: 0.6;
  }
}

@keyframes sparkle {

  0%,
  100% {
    opacity: 0;
  }

  50% {
    opacity: 1;
  }
}

/* Add media query for mobile devices */
@media screen and (max-width: 768px) {
  .fairy {
    width: 15px;
    height: 15px;
  }

  .fairy::after {
    width: 20px;
    height: 20px;
  }
}

:root {
  --background-gradient-light: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  --top-section-gradient-light: linear-gradient(120deg, #a1c4fd 0%, #c2e9fb 100%);
  --text-color-light: #333;
  --icon-color-light: #333;
  --background-glass-light: rgba(255, 255, 255, 0.95);

  --background-gradient-dark: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  --top-section-gradient-dark: linear-gradient(120deg, #374151 0%, #1f2937 100%);
  --text-color-dark: #fff;
  --icon-color-dark: #fff;
  --background-glass-dark: rgba(23, 23, 23, 0.95);
}

body.dark-mode {
  background: var(--background-gradient-dark);
  color: var(--text-color-dark);
}

body.dark-mode .top-section {
  background: var(--top-section-gradient-dark);
}

body.dark-mode .container,
body.dark-mode .language-btn,
body.dark-mode .language-options,
body.dark-mode .floating-menu {
  background: var(--background-glass-dark);
  color: var(--text-color-dark);
}

#storyOutline {
  resize: none;
  overflow-y: auto;
  /* 當內容超過高度時，會出現垂直滾動條 */
}

.format-selection {
  display: flex;
  gap: 20px;
  /* Reduced from any previous value */
  /* margin-bottom: 15px; */
  justify-content: center;
  /* Add this to center the radio buttons */
}

/* Adjust radio label styling for better appearance */
.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  position: relative;
  padding: 5px;
}

.radio-label input[type="radio"] {
  position: absolute;
  opacity: 0;
}

/* Make the radio buttons and text more compact */
.radio-custom {
  width: 20px;
  height: 20px;
  border: 2px solid #4CAF50;
  border-radius: 50%;
  display: inline-block;
  position: relative;
  transition: all 0.3s ease;
}

.radio-custom::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  background: #4CAF50;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.2s ease;
}

.radio-label input[type="radio"]:checked+.radio-custom::after {
  transform: translate(-50%, -50%) scale(1);
}

.radio-text {
  color: #4CAF50;
  font-size: 1rem;
  font-weight: 500;
  text-shadow: 0 0 10px rgba(76, 175, 80, 0.5),
    0 0 20px rgba(76, 175, 80, 0.3),
    0 0 30px rgba(76, 175, 80, 0.2);
}

/* Dark mode styles */
body.dark-mode .radio-label .radio-custom {
  border-color: #4CAF50;
}

body.dark-mode .radio-label .radio-custom::after {
  background: #4CAF50;
}

body.dark-mode .radio-text {
  color: #4CAF50;
}

#countdownContainer {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  height: 100vh;
  color: #4CAF50;
  text-shadow: 0 0 10px rgba(76, 175, 80, 0.5),
    0 0 20px rgba(76, 175, 80, 0.3),
    0 0 30px rgba(76, 175, 80, 0.2);
  font-weight: bold;
  font-size: 24px;
  text-align: center;
  z-index: 9999;
}

/* 顯示倒數時隱藏其他內容 */
#imageUpload,
#mainContent {
  display: none;
}

.ad-container {
  text-align: center;
  /* 使廣告居中 */
  margin: 20px 0;
  /* 給予廣告一些間隔 */
}

.youtube-btn {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  background: #ff0000;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}

.youtube-btn:hover {
  background: #cc0000;
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.youtube-icon {
  margin-right: 10px;
}

.btn-text {
  color: white;
  font-family: Arial, sans-serif;
  font-size: 18px;
  font-weight: bold;
}