* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
}

header {
  background-color: #2c3e50;
  color: white;
  text-align: center;
  padding: 1.5rem 1rem; /* 减少padding，使header更紧凑 */
  margin-bottom: 2rem;
  position: fixed; /* 固定定位 */
  top: 0; /* 固定在顶部 */
  left: 0;
  width: 100%; /* 宽度100% */
  z-index: 1000; /* 确保在其他元素上方 */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 添加阴影增加层次感 */
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.header-title {
  text-align: left;
}

.shortcut-menu {
  display: flex;
  gap: 1rem;
}

.shortcut-menu a {
  color: white;
  text-decoration: none;
  padding: 0.5rem 0.8rem;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.shortcut-menu a:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

main {
  max-width: 1200px;
  margin: 10rem auto 0; /* 增加上边距，确保内容不会被header遮挡 */
  padding: 0 1rem;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

header p {
  font-size: 1.2rem;
  opacity: 0.9;
}

.tool-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.tool-card {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tool-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.tool-card h2 {
  color: #2c3e50;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.tool-card p {
  color: #7f8c8d;
  margin-bottom: 1.5rem;
}

.btn {
  display: inline-block;
  background-color: #3498db;
  color: white;
  padding: 0.8rem 1.5rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.btn:hover {
  background-color: #2980b9;
}

.tool-section {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  margin-bottom: 2rem;
}

.tool-section h2 {
  color: #2c3e50;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #ecf0f1;
  padding-bottom: 0.5rem;
}

textarea {
  width: 100%;
  min-height: 200px;
  padding: 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  resize: vertical;
  margin-bottom: 1rem;
}

.output {
  background-color: #f8f9fa;
  padding: 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: 'Courier New', Courier, monospace;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 150px;
}

.controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

.button-group button {
  padding: 8px 15px;
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.button-group button:hover {
  background-color: #2980b9;
}

.error {
  color: #e74c3c;
  margin-top: 10px;
}

.success {
  color: #27ae60;
  margin-top: 10px;
}

.download-btn {
  background-color: #27ae60;
}

.download-btn:hover {
  background-color: #229954;
}

footer {
  background-color: #2c3e50;
  color: white;
  text-align: center;
  padding: 2rem 1rem;
  margin-top: 3rem;
}

/* 汉堡菜单按钮 - 默认隐藏 */
.hamburger-menu {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 21px;
  cursor: pointer;
}

.hamburger-menu span {
  display: block;
  height: 3px;
  width: 100%;
  background-color: white;
  border-radius: 3px;
  transition: all 0.3s ease;
}

/* 弹框菜单 - 默认隐藏 */
.modal-menu {
  position: fixed;
  top: 0;
  right: -100%;
  width: 70%;
  max-width: 300px;
  height: 100vh;
  background-color: #2c3e50;
  z-index: 2000;
  padding: 2rem 1rem;
  transition: right 0.3s ease;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
}

/* 弹框菜单显示样式 */
.modal-menu.active {
  right: 0;
}

/* 弹框菜单关闭按钮 */
.close-menu {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
}

/* 弹框菜单链接样式 */
.modal-menu-links {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 3rem;
}

.modal-menu-links a {
  color: white;
  text-decoration: none;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* 遮罩层 */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1500;
  display: none;
}

.overlay.active {
  display: block;
}

@media (max-width: 768px) {
  .header-container {
    flex-direction: row !important;
  }

  header h1 {
    font-size: 1.2rem;
    text-align: left;
  }

  header p {
    font-size: .8rem;
    text-align: left;
  }

  .header-container {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .header-title {
    text-align: center;
    margin-bottom: 1rem;
  }

  .shortcut-menu {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  .shortcut-menu a {
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
  }

  .tool-container {
    grid-template-columns: 1fr;
  }

  .controls {
    flex-direction: column;
  }

  /* 显示汉堡菜单，隐藏常规菜单 */
  .hamburger-menu {
    display: flex;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
  }

  .shortcut-menu {
    display: none;
  }
}
