/* ===== 变量与基础 ===== */
:root {
  --bg: #F5F0E8;
  --title: #4A6B7D;
  --text: #416071;
  --text-light: #6B8A9A;
  --accent: #7BA3B5;
  --accent-soft: rgba(74, 107, 125, 0.12);
  --card-bg: rgba(255, 255, 255, 0.55);
  --card-border: rgba(74, 107, 125, 0.1);
  --shadow: 0 4px 24px rgba(74, 107, 125, 0.08);
  --shadow-hover: 0 8px 32px rgba(74, 107, 125, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --font-serif: 'Cormorant Garamond', 'Noto Serif SC', serif;
  --font-body: 'Noto Serif SC', serif;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== 背景装饰 ===== */
.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(123, 163, 181, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 85% 80%, rgba(180, 160, 140, 0.1) 0%, transparent 55%),
    var(--bg);
}

/* ===== 头部 ===== */
.header {
  position: relative;
  padding: 3rem 1.5rem 2.5rem;
  text-align: center;
  color: var(--title);
}

.header-tag {
  font-family: var(--font-serif);
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: 0.75rem;
}

.header-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
}

.header-desc {
  font-size: 0.875rem;
  font-weight: 300;
  color: var(--text-light);
  max-width: 280px;
  margin: 0 auto;
  line-height: 1.8;
}

.header-wave {
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  color: var(--bg);
  opacity: 0.5;
  pointer-events: none;
}

.header-wave svg {
  display: block;
  width: 100%;
  height: 40px;
}

/* ===== 主内容 ===== */
.main {
  padding: 0 1.25rem 2rem;
  max-width: 480px;
  margin: 0 auto;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--title);
  margin-bottom: 0.35rem;
}

.section-desc {
  font-size: 0.8125rem;
  color: var(--text-light);
  margin-bottom: 1.25rem;
  font-weight: 300;
}

/* ===== 上传区域 ===== */
.upload-section {
  margin-bottom: 2.5rem;
}

.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  border: 1.5px dashed var(--accent);
  border-radius: var(--radius);
  background: var(--card-bg);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: var(--transition);
  -webkit-backdrop-filter: blur(8px);
}

.upload-zone:hover,
.upload-zone:focus-visible {
  border-color: var(--title);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  outline: none;
}

.upload-zone.dragover {
  border-color: var(--title);
  background: var(--accent-soft);
  transform: scale(1.01);
}

.upload-icon {
  color: var(--accent);
  margin-bottom: 0.75rem;
  transition: transform var(--transition);
}

.upload-zone:hover .upload-icon {
  transform: scale(1.08);
}

.upload-text {
  font-size: 0.9375rem;
  color: var(--title);
  font-weight: 400;
}

.upload-hint {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* ===== 预览面板 ===== */
.preview-panel {
  margin-top: 1.5rem;
  animation: fadeUp 0.5s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.preview-image-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.preview-image-wrap img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: cover;
}

.palette-section {
  margin-bottom: 1.25rem;
}

.palette-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--title);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.palette-colors {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.palette-swatch {
  flex: 1;
  height: 48px;
  border-radius: var(--radius-sm);
  position: relative;
  cursor: pointer;
  transition: transform var(--transition);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.palette-swatch:hover {
  transform: translateY(-2px);
}

.palette-swatch::after {
  content: attr(data-hex);
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity var(--transition);
}

.palette-swatch:hover::after {
  opacity: 1;
}

.palette-mood {
  font-size: 0.8125rem;
  color: var(--text-light);
  font-style: italic;
  font-family: var(--font-serif);
}

/* ===== 表单 ===== */
.work-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-label {
  font-size: 0.8125rem;
  color: var(--title);
  font-weight: 500;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.6);
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text);
  transition: border-color var(--transition);
  resize: none;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.85);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-light);
  opacity: 0.6;
}

.btn-primary {
  padding: 0.85rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--title);
  color: var(--bg);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

.btn-primary:hover {
  background: #3A5A6D;
  box-shadow: var(--shadow);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-ghost {
  padding: 0.65rem;
  border: none;
  background: transparent;
  color: var(--text-light);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: color var(--transition);
}

.btn-ghost:hover {
  color: var(--title);
}

/* ===== 筛选标签 ===== */
.filter-section {
  margin-bottom: 1.25rem;
}

.filter-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar {
  display: none;
}

.filter-tab {
  flex-shrink: 0;
  padding: 0.45rem 1rem;
  border: 1px solid var(--card-border);
  border-radius: 2rem;
  background: var(--card-bg);
  color: var(--text-light);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(4px);
}

.filter-tab:hover {
  border-color: var(--accent);
  color: var(--title);
}

.filter-tab.active {
  background: var(--title);
  color: var(--bg);
  border-color: var(--title);
}

/* ===== 画廊 ===== */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.875rem;
}

.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-light);
}

.empty-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  opacity: 0.6;
}

.empty-hint {
  font-size: 0.75rem;
  margin-top: 0.35rem;
  opacity: 0.7;
}

.gallery-card {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card-bg);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
  animation: fadeUp 0.5s ease backwards;
}

.gallery-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.gallery-card-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.gallery-card-body {
  padding: 0.65rem 0.75rem 0.75rem;
}

.gallery-card-title {
  font-family: var(--font-serif);
  font-size: 0.875rem;
  color: var(--title);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-card-palette {
  display: flex;
  gap: 3px;
  margin-top: 0.5rem;
}

.gallery-card-palette span {
  flex: 1;
  height: 6px;
  border-radius: 3px;
}

.gallery-card-mood {
  font-size: 0.6875rem;
  color: var(--text-light);
  margin-top: 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== 页脚 ===== */
.footer {
  text-align: center;
  padding: 2.5rem 1.5rem 3rem;
  color: var(--text-light);
}

.footer-quote {
  font-family: var(--font-serif);
  font-size: 0.9375rem;
  font-style: italic;
  color: var(--title);
  opacity: 0.7;
  margin-bottom: 0.25rem;
}

.footer-author {
  font-size: 0.75rem;
  margin-bottom: 1.5rem;
}

.footer-copy {
  font-size: 0.6875rem;
  opacity: 0.5;
}

/* ===== 弹窗 ===== */
.modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100dvh;
  width: 100%;
  height: 100%;
}

.modal::backdrop {
  background: rgba(65, 96, 113, 0.35);
  backdrop-filter: blur(6px);
}

.modal-content {
  position: relative;
  margin: auto;
  max-width: 420px;
  width: calc(100% - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  animation: fadeUp 0.4s ease;
  margin-top: 1rem;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  color: var(--title);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  line-height: 1;
}

.modal-close:hover {
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-image {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  display: block;
  border-radius: var(--radius) var(--radius) 0 0;
}

.modal-body {
  padding: 1.25rem;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--title);
  margin-bottom: 0.5rem;
}

.modal-desc {
  font-size: 0.875rem;
  color: var(--text);
  margin-bottom: 1rem;
  line-height: 1.8;
}

.modal-palette {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.modal-palette .palette-swatch {
  height: 40px;
}

.modal-mood {
  font-family: var(--font-serif);
  font-size: 0.875rem;
  font-style: italic;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.modal-date {
  font-size: 0.75rem;
  color: var(--text-light);
  opacity: 0.6;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  padding: 0.65rem 1.25rem;
  background: var(--title);
  color: var(--bg);
  border-radius: 2rem;
  font-size: 0.8125rem;
  z-index: 1000;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== 响应式微调 ===== */
@media (min-width: 480px) {
  .header-title {
    font-size: 2.5rem;
  }

  .gallery {
    gap: 1rem;
  }
}
