* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  min-height: 100vh;
  background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 50%, #ffffff 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  position: relative;
}

.container {
  background: rgba(255, 255, 255, 0.95);
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 123, 181, 0.1),
              0 1px 8px rgba(0, 123, 181, 0.2);
  width: 95%;
  max-width: 1000px;
  backdrop-filter: blur(10px);
}

h1 {
  color: #007bb5;
  margin-bottom: 30px;
  font-size: 2.5em;
  text-align: center; /* 僅將<h1>置中 */
  text-transform: uppercase;
  letter-spacing: 2px;
  position: relative;
}

h1::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: #007bb5;
  margin: 15px auto;
  border-radius: 2px;
}

h2 {
  color: #007bb5;
  margin: 25px 0;
  font-size: 1.8em;
  text-align: center;
}

textarea {
  width: 100%;
  height: 300px;
  padding: 20px;
  border: 2px solid rgba(0, 123, 181, 0.2);
  border-radius: 15px;
  resize: vertical;
  font-size: 16px;
  font-family: 'Courier New', Courier, monospace;
  margin-bottom: 25px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  line-height: 1.6;
}

textarea:focus {
  outline: none;
  border-color: #007bb5;
  box-shadow: 0 0 0 3px rgba(0, 123, 181, 0.1);
}

.button-group, .download-group {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 20px 0;
  flex-wrap: wrap;
}

button {
  background-color: #007bb5;
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
  min-width: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button:hover {
  background-color: #005f8a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 123, 181, 0.2);
}

button:active {
  transform: translateY(0);
}

/* 隱藏的檔案上傳按鈕 */
#uploadBtn {
  display: none;
}

/* 觸發上傳按鈕的樣式 */
#uploadTriggerBtn {
  background-color: #28a745; /* 綠色 */
}

#uploadTriggerBtn:hover {
  background-color: #218838;
}

#uploadTriggerBtn:active {
  transform: translateY(0);
}

#preview {
  border: 2px solid rgba(0, 123, 181, 0.2);
  padding: 30px;
  border-radius: 15px;
  background-color: #ffffff;
  margin: 20px 0;
  max-height: 400px; /* 高度減少100px */
  overflow-y: auto;
  text-align: left; /* 其他內容左對齊 */
  line-height: 1.6;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

#preview::-webkit-scrollbar {
  width: 8px;
}

#preview::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

#preview::-webkit-scrollbar-thumb {
  background: #007bb5;
  border-radius: 4px;
}

.hidden {
  display: none;
}

.footer {
  position: fixed;
  right: 20px;
  bottom: 20px;
  font-size: 14px;
  color: #555;
  background: rgba(255, 255, 255, 0.9);
  padding: 8px 15px;
  border-radius: 20px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.footer a {
  color: #007bb5;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

.footer a:hover {
  color: #005f8a;
}

.custom-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 20px 0;
}

.custom-title label {
  margin-bottom: 5px;
  font-weight: 600;
  color: #007bb5;
}

.custom-title input {
  width: 100%;
  max-width: 500px;
  padding: 10px 15px;
  border: 2px solid rgba(0, 123, 181, 0.2);
  border-radius: 10px;
  font-size: 16px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.custom-title input:focus {
  outline: none;
  border-color: #007bb5;
  box-shadow: 0 0 0 3px rgba(0, 123, 181, 0.1);
}

@media (max-width: 768px) {
  .container {
    padding: 20px;
  }

  h1 {
    font-size: 2em;
  }

  button {
    width: 100%;
    min-width: unset;
  }

  .footer {
    position: static;
    text-align: center;
    margin-top: 20px;
  }

  .custom-title input {
    max-width: 100%;
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

#previewSection {
  animation: fadeIn 0.5s ease-out;
}

/* 為轉換後的內容添加的樣式 */
.markdown-content {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.markdown-content h1, 
.markdown-content h2, 
.markdown-content h3, 
.markdown-content h4, 
.markdown-content h5, 
.markdown-content h6 {
  color: #007bb5;
  margin: 1em 0 0.5em;
  line-height: 1.3;
}

.markdown-content h1 { font-size: 2em; }
.markdown-content h2 { font-size: 1.8em; }
.markdown-content h3 { font-size: 1.6em; }
.markdown-content h4 { font-size: 1.4em; }
.markdown-content h5 { font-size: 1.2em; }
.markdown-content h6 { font-size: 1.1em; }

.markdown-content p {
  margin: 1em 0;
}

.markdown-content a {
  color: #007bb5;
  text-decoration: none;
}

.markdown-content a:hover {
  text-decoration: underline;
}

.markdown-content ul, 
.markdown-content ol {
  margin: 1em 0;
  padding-left: 2em;
}

.markdown-content li {
  margin: 0.5em 0;
}

.markdown-content blockquote {
  border-left: 4px solid #007bb5;
  margin: 1em 0;
  padding-left: 1em;
  color: #666;
}

.markdown-content code {
  background-color: #f5f5f5;
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-family: 'Courier New', Courier, monospace;
}

.markdown-content pre {
  position: relative;
  background-color: #f5f5f5;
  padding: 1em;
  border-radius: 5px;
  overflow-x: auto;
}

.markdown-content pre code {
  background-color: transparent;
  padding: 0;
}

.markdown-content img {
  max-width: 100%;
  height: auto;
  border-radius: 5px;
  margin: 1em 0;
}

.markdown-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
}

.markdown-content th, 
.markdown-content td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
}

.markdown-content th {
  background-color: #f5f5f5;
}

.markdown-content tr:nth-child(even) {
  background-color: #f9f9f9;
}

.copy-code {
  color: red;
  cursor: pointer;
  margin-top: 5px;
  font-size: 14px;
  text-decoration: underline;
  display: inline-block;
}
