* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  padding: 20px;
  background-color: #f5f5f5;
}

.app {
  max-width: 1000px;
  margin: 0 auto;
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow-y: hidden;
}

h1 {
  text-align: center;
  margin-bottom: 20px;
  color: #333;
}

.editor-container {
  display: flex;
  gap: 20px;
  justify-content: space-between;
}

.toolbar {
  width: 300px;
  background: #f9f9f9;
  padding: 15px;
  border-radius: 8px;
  overflow-y: auto;
  max-height: 80vh;
}

.tool-section {
  margin-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.tool-section h3 {
  margin: 0;
  padding: 10px 0;
  color: #4a6fa5;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-section h3 i {
  font-size: 14px;
  width: 16px;
  text-align: center;
}

.section-content {
  padding: 10px 0;
}

input[type="text"],
input[type="range"],
input[type="color"] {
  width: 100%;
  padding: 8px;
  margin-bottom: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

button {
  background: #4a6fa5;
  color: white;
  border: none;
  padding: 10px 12px;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button:hover {
  background: #3a5a8f;
}

.canvas-container {
  flex: 1;
}

#canvas {
  width: 500px;
  height: 500px;
  border: 1px solid #ddd;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.template-item {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 5px;
  margin-bottom: 10px;
  cursor: pointer;
}

.template-item img {
  width: 100%;
  height: 80px;
  object-fit: cover;
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.sticker-item {
  font-size: 24px;
  text-align: center;
  padding: 10px;
  cursor: pointer;
  border: 1px solid #eee;
  border-radius: 4px;
  background: white;
}

.sticker-item:hover {
  background: #f0f0f0;
}

.watermark-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.delete-btn {
  background: #f44336;
  margin-top: 10px;
}

.export-btn {
  background: #4a6fa5;
}

.canvas-tip {
  text-align: center;
  margin-top: 10px;
  color: #666;
  font-size: 14px;
}

@media (max-width: 768px) {
  .editor-container {
    flex-direction: column;
  }

  .toolbar {
    width: 100%;
    max-height: none;
    order: 2;
  }
  #toolbar{
    display: none;
  }
  #mobileToolbar{
    display: block !important;
  }
  .app {
    width: 100vw;
    padding: 0 !important;
  }

  body {
    padding: 0 !important;
  }
}

.canvas-container {
  position: relative;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
  /* 防止内容溢出 */
}

#canvas {
  width: 100% !important;
  /* 强制宽度为100% */
  height: auto !important;
  /* 高度自动调整 */
  max-width: 500px;
  /* 桌面端最大宽度 */
  max-height: 500px;
  /* 桌面端最大高度 */
  display: block;
  margin: 0 auto;
  touch-action: none;
  /* 防止触摸干扰 */
  background-color: #f0f0f0;
  border: 1px solid #ddd;
}

.canvas-tip {
  margin-top: 10px;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 4px;
  font-size: 14px;
  color: #666;
}

@media (max-width: 768px) {

  #canvas,
  .upper-canvas {
    max-width: 100% !important;
    /* 移动端填满宽度 */
    width: 100vw !important;
    /* 移动端填满宽度 */
    max-height: 80vh !important;
    /* 移动端最大高度 */
  }

  .canvas-tip {
    font-size: 12px;
    /* 移动端小字号 */
  }
}

/* 基础按钮样式 */
.template-btn {
  display: block;
  width: 100%;
  padding: 8px 12px;
  margin: 4px 0;
  background: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  color: black;
  text-align: center;
}

.template-btn:hover {
  background: #e9ecef;
}

.template-btn.active {
  background: #007bff;
  color: white;
  border-color: #007bff;
}

.template-btn.active:hover {
  background: #0069d9;
}

/* 全局滚动条样式 */
* {
  scrollbar-width: thin;
  /* Firefox */
  scrollbar-color: #c1c1c1 #f1f1f1;
  /* Firefox */
}

/* Chrome/Edge/Safari */
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

*::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 10px;
  border: 2px solid #f1f1f1;
}

*::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 针对特定元素的滚动条 */
.scrollable-container {
  scrollbar-width: thin;
  scrollbar-color: #4285f4 #f1f1f1;
}

.scrollable-container::-webkit-scrollbar-thumb {
  background: #4285f4;
}

.emoji {
  display: inline-block;
  animation: bounce 1s infinite alternate;
}

@keyframes bounce {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-10px);
  }
}

.meme-title {
  color: black;
  text-shadow:
    0 1px 0 #ccc,
    0 2px 0 #c9c9c9,
    0 3px 0 #bbb,
    0 4px 0 #b9b9b9,
    0 5px 0 #aaa,
    0 6px 1px rgba(0, 0, 0, .1),
    0 0 5px rgba(0, 0, 0, .1),
    0 1px 3px rgba(0, 0, 0, .3),
    0 3px 5px rgba(0, 0, 0, .2),
    0 5px 10px rgba(0, 0, 0, .25);
}

.change-image-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
  background-color: #4a6fa5;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s;
  width: 60%;
  margin: 10px 0;
}

.change-image-btn:hover {
  background-color: #4a6fa5;
  width: 80%;
}

.change-image-btn i {
  transition: transform 0.5s ease;
}

.change-image-btn:hover i {
  transform: rotate(360deg);
}

/* 头部样式 */
.app-header {
  background-color: black;
  color: white;
  padding: 1rem 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  /* position: sticky;
  top: 0;
  z-index: 1000; */
}

.header-container {
  max-width: 100vw;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  height: 40px;
  width: auto;
  background-color: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
}

.app-name {
  font-size: 1.5rem;
  margin: 0;
  color: #fff;
}

.main-nav ul {
  display: flex;
  list-style: none;
  gap: 20px;
  margin: 0;
  padding: 0;
}

.main-nav a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.main-nav a:hover,
.main-nav a.active {
  background-color: #555;
}

.main-nav a i {
  margin-right: 5px;
}

.user-actions {
  display: flex;
  gap: 10px;
}

.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s;
}

.login-btn {
  background-color: transparent;
  color: white;
  border: 1px solid white;
}

.login-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.register-btn {
  background-color: #ff6b6b;
  color: white;
}

.register-btn:hover {
  background-color: #ff5252;
}

/* 页脚样式 */
.app-footer {
  background-color: #222;
  color: #ddd;
  padding: 2rem 0 0;
  margin-top: 2rem;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  padding: 0 20px;
}

.footer-section h3 {
  color: white;
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.footer-section ul {
  list-style: none;
  padding: 0;
}

.footer-section ul li {
  margin-bottom: 0.5rem;
}

.footer-section ul li i {
  margin-right: 8px;
  width: 20px;
  text-align: center;
}

.footer-section a {
  color: #ddd;
  text-decoration: none;
  transition: color 0.3s;
}

.footer-section a:hover {
  color: white;
}

.social-media {
  display: flex;
  gap: 15px;
  margin-top: 1rem;
}

.social-media a {
  font-size: 1.5rem;
  color: #aaa;
  transition: color 0.3s;
}

.social-media a:hover {
  color: white;
}

.footer-bottom {
  background-color: #111;
  padding: 1rem 0;
  margin-top: 2rem;
  text-align: center;
}

.footer-bottom p {
  margin: 0;
  color: #aaa;
  font-size: 0.9rem;
}

.legal-links {
  margin-top: 0.5rem;
}

.legal-links a {
  color: #aaa;
  text-decoration: none;
  margin: 0 10px;
  font-size: 0.8rem;
}

.legal-links a:hover {
  color: white;
}

#mobileToolbar {
  position: fixed;
  left: 0;
  top: 10%;
  width: 10%;
  z-index: 1000;
  background: #02132e36;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  font-size: 10px;
  border-radius: 2px;
  border: 3px solid #02132e36;
  display: none;
}
#mobileToolbar::before{
  content: "...";
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 12px;
  font-weight: bold;
}
#mobileToolbar .tool-section {
  margin: 0;
  border-bottom: 1px solid transparent;
}
#mobileToolbar button{
  margin-bottom: 5px !important; /* 移动端按钮间距 */
  background-color: #3a5b8f7e;
}
/* 选中第一个 .tool-section */
#mobileToolbar .tool-section:first-child {
  margin-top: 10px; /* 顶部边距 */
}

/* 选中最后一个 .tool-section */
#mobileToolbar .tool-section:last-child {
  border-bottom:none; /* 去掉底部边框 */
}
.mobiletool-section {
  width: 100vw;
  height: 50vh;
  overflow-x: hidden;
  overflow-y: hidden;
  position: fixed;
  bottom: -50vh;
  left: 0;
  background: white;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
  transition: transform 0.3s ease;
  z-index: 1000;
  padding: 15px;
}
.mobiletool-section {
  width: 100vw;
  height: 50vh;
  overflow-x: hidden;
  overflow-y: hidden;
  position: fixed;
  /* bottom: -50vh; */
  left: 0;
  background: white;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
  transition: transform 0.3s ease;
  z-index: 1000;
  padding: 15px;
}
.mobile-panel {
  position: fixed;
  left: 0;
  width: 100%;
  background: white;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
  z-index: 1000;
  transition: transform 0.3s ease-out;
  /* 初始位置：完全隐藏 */
  transform: translateY(100%);
  
}
/* 旋转按钮动画 */
.fa-redo {
  transition: transform 0.3s ease;
}
.tool-btn:active .fa-redo {
  transform: rotate(90deg);
}
.select-pattern::after{
  content: "选择模式";
  color: #080808;
  position: absolute;
  top: 55%;
  right: 10px;
  font-size: 10px;
  text-shadow: 0 0 5px white;
  font-weight: bold;
}
.paintingBrush-pattern::after{
  content: "画笔模式";
  color: #080808;
  position: absolute;
  top: 55%;
  right: 10px;
  font-size: 10px;
  text-shadow: 0 0 5px white;
  font-weight: bold;
}