:root {
    --primary: #3498db;
    --primary-hover: #2980b9;
  --bg-gradient: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
  --container-bg: rgba(255, 255, 255, 0.9);
  --text-color: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --card-bg: #ffffff;
  --card-hover: #f8fafc;
  --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
}
body.dark-mode {
    --bg-gradient: linear-gradient(135deg, #1d1e21 0%, #090d16 100%);
    --container-bg: rgb(29 29 30 / 90%);
    --text-color: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #444444;
    --card-bg: #252525;
    --card-hover: #242527;
    --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-gradient);
  color: var(--text-color);
  transition: background 0.4s ease, color 0.4s ease;
  position: relative;
}

/* 主题按钮绝对正圆 */
.theme-toggle-btn {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 999;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transition: all 0.25s ease;
}
.theme-toggle-btn:hover {
  transform: scale(1.08);
  border-color: var(--primary);
}

/* 视觉绝对居中的主容器：内部采用 Flex 居中，确保 textarea 稳居视觉中心 */
.container {
  background-color: var(--container-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'%3E%3Cpath fill='%239C92AC' fill-opacity='0.1' d='M1 3h1v1H1V3zm2-2h1v1H3V1z'%3E%3C/path%3E%3C/svg%3E");
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 36px;
  max-width: 900px;
  width: 90%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

h1 {
  color: var(--primary-hover);
  margin: 0 0 24px 0;
  height: 44px;
  line-height: 44px;
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
}

/* 导入编辑栏：替换 h1 位置，宽度与下方的 textarea 100% 一致 */
#editingBanner {
  display: none;
  width: 100%;
  height: 44px;
  background: var(--card-bg);
  border: 1px solid var(--primary);
  border-radius: 12px;
  padding: 0 16px;
  margin: 0 0 24px 0;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
  animation: fadeIn 0.2s ease;
}

.editing-icon {
  color: var(--primary);
  font-size: 16px;
  flex-shrink: 0;
}

#editingTitleInput {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-color);
  padding: 0;
  box-shadow: none !important;
}

.editing-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  box-shadow: none !important;
}
.editing-close-btn:hover {
  background: var(--card-hover);
  color: #ef4444;
}

/* 主编辑框 */
textarea {
  width: 100%;
  min-height: 360px;
  margin: 0 0 20px 0;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.5;
  resize: vertical;
  box-sizing: border-box;
  background-color: var(--card-bg);
  color: var(--text-color);
  transition: all 0.25s ease;
}
textarea:focus {
  outline: none;
  box-shadow: 0 0 4px 2px var(--primary);
}

.button-group {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
}

button {
  background:linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
button:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}
button:active { transform: translateY(0); }

/* 模态框与通用组件样式 */
.modal {
  display: none;
  position: fixed;
  z-index: 100;
  left: 0; top: 0; width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal-content {
  background-color: var(--card-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'%3E%3Cpath fill='%239C92AC' fill-opacity='0.08' d='M1 3h1v1H1V3zm2-2h1v1H3V1z'%3E%3C/path%3E%3C/svg%3E");
  border: 1px solid var(--border-color);
  padding: 24px 28px;
  border-radius: 20px;
  width: 92%;
  max-width: 580px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
  animation: scaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.modal-header h3 {
  margin: 0; font-size: 16px; font-weight: 600; color: var(--text-color);
  display: flex; align-items: center; gap: 8px;
}
.close-btn {
  font-size: 18px; color: var(--text-secondary); cursor: pointer;
  background: none; border: none; padding: 4px; border-radius: 6px;
  transition: background 0.2s;
}
.close-btn:hover {
  background: var(--card-hover); color: var(--text-color);
}

.share-list-container {
  overflow-y: auto; 
  display: flex; 
  flex-direction: column; 
  gap: 10px; 
  padding-right: 4px;
  box-sizing: border-box;
  max-height: 60vh;
}
.share-row {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 12px 14px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s ease;
}
.share-row:hover { border-color: var(--primary); }
.share-info {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px;
}
.share-row a {
  color: var(--primary); text-decoration: none; font-weight: 500; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.share-row a:hover { text-decoration: underline; }
.share-meta { font-size: 11px; color: var(--text-secondary); }
.share-actions { display: flex; gap: 6px; flex-shrink: 0; }
.share-actions button { padding: 6px 12px; font-size: 13px; border-radius: 6px; }
.btn-danger { background: #ef4444 !important; }
.btn-danger:hover { background: #dc2626 !important; }
.btn-secondary { background: #64748b !important; }

.spinner-box {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; min-height: 200px;
}
.cool-spinner {
  width: 42px; height: 42px; border: 3px solid var(--border-color);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

#toastContainer {
  position: fixed; top: 24px; right: 80px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  background: var(--card-bg); color: var(--text-color); border: 1px solid var(--border-color);
  padding: 12px 20px; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 10px; pointer-events: auto;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), toastOut 0.3s ease 2.2s forwards;
}
.toast.success i { color: #10b981; }
.toast.error i { color: #ef4444; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px) scale(0.95); display: none; } }

input[type="text"], input[type="password"], input[type="number"] {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border-color); border-radius: 10px;
  background: var(--card-bg); color: var(--text-color); font-size: 14px; box-sizing: border-box; transition: border-color 0.2s;
}
input:focus { outline: none; border-color: var(--primary); }

@media (max-width: 768px) {
  body { align-items: stretch; justify-content: flex-start; min-height: 100vh; min-height: 100dvh; }
  .container {
    width: 100% !important; max-width: 100% !important; min-height: 100vh;
    border-radius: 0 !important; border: none !important; padding: 20px 16px !important;
    box-shadow: none !important;
  }
  textarea {
    height: 55vh !important;
    min-height: 220px !important;
    max-height: 65vh !important;
    margin-bottom: 16px;
  }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleUp { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }