/* ==========================================
   表情包生成器 · 样式
   ========================================== */
:root {
  --c-primary: #ff6b9d;
  --c-primary-dark: #ee5a8a;
  --c-secondary: #ffc857;
  --c-accent: #6bcbef;
  --c-success: #52c41a;
  --c-error: #ff4d4f;
  --c-bg-1: #fff5f7;
  --c-bg-2: #fff4e0;
  --c-bg-3: #e3f2fd;
  --c-text: #2d2d2d;
  --c-text-light: #8b8b95;
  --c-card: #ffffff;
  --c-border: #f5e8ec;
  --shadow-sm: 0 2px 8px rgba(255, 107, 157, 0.08);
  --shadow-md: 0 8px 24px rgba(255, 107, 157, 0.12);
  --shadow-lg: 0 16px 48px rgba(255, 107, 157, 0.18);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --t-fast: 150ms cubic-bezier(.4, 0, .2, 1);
  --t-mid:  250ms cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Helvetica Neue", Arial, sans-serif;
  color: var(--c-text);
  background:
    radial-gradient(circle at 0% 0%, var(--c-bg-1) 0%, transparent 40%),
    radial-gradient(circle at 100% 0%, var(--c-bg-3) 0%, transparent 40%),
    radial-gradient(circle at 50% 100%, var(--c-bg-2) 0%, transparent 50%),
    linear-gradient(135deg, #fffafc 0%, #f5f7fa 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

/* ========== 背景装饰 ========== */
.bg-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-decor .emoji {
  position: absolute;
  font-size: 42px;
  opacity: 0.16;
  animation: float 20s infinite ease-in-out;
  filter: drop-shadow(0 4px 12px rgba(255, 107, 157, 0.15));
}

.emoji-1  { top:  4%;  left:  4%;  font-size: 56px; animation-delay:   0s; }
.emoji-2  { top: 10%;  right: 6%;  font-size: 48px; animation-delay:  -2s; }
.emoji-3  { top: 22%;  left: 10%;  font-size: 42px; animation-delay:  -4s; }
.emoji-4  { top: 35%;  right: 4%;  font-size: 60px; animation-delay:  -6s; }
.emoji-5  { top: 50%;  left:  5%;  font-size: 44px; animation-delay:  -8s; }
.emoji-6  { top: 62%;  right: 8%;  font-size: 52px; animation-delay: -10s; }
.emoji-7  { top: 76%;  left:  8%;  font-size: 46px; animation-delay: -12s; }
.emoji-8  { top: 86%;  right: 5%;  font-size: 40px; animation-delay: -14s; }
.emoji-9  { top:  2%;  left: 48%;  font-size: 36px; animation-delay:  -3s; }
.emoji-10 { top: 42%;  left: 50%;  font-size: 38px; animation-delay:  -7s; }
.emoji-11 { top: 18%;  left: 35%;  font-size: 44px; animation-delay:  -5s; }
.emoji-12 { top: 70%;  right: 35%; font-size: 50px; animation-delay: -11s; }

@keyframes float {
  0%, 100% { transform: translateY(0)     rotate(0deg); }
  25%      { transform: translateY(-28px) rotate(8deg); }
  50%      { transform: translateY(-12px) rotate(-4deg); }
  75%      { transform: translateY(-40px) rotate(6deg); }
}

/* ========== 头部 ========== */
.hero {
  text-align: center;
  margin-bottom: 36px;
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--c-border);
  border-radius: 100px;
  font-size: 13px;
  color: var(--c-text-light);
  margin-bottom: 16px;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
}

.hero-logo {
  width: 20px;
  height: 20px;
}

.hero-badge-text { font-weight: 500; }

.title {
  font-size: 56px;
  font-weight: 800;
  margin: 0 0 12px;
  background: linear-gradient(135deg, #ff6b9d 0%, #ffc857 50%, #6bcbef 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -1.5px;
  line-height: 1.1;
  text-shadow: 0 4px 24px rgba(255, 107, 157, 0.15);
}

.subtitle {
  font-size: 17px;
  color: var(--c-text-light);
  margin: 0;
  font-weight: 400;
}

/* ========== 网格布局 ========== */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  position: relative;
  z-index: 1;
}

@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
  .title { font-size: 40px; }
  .container { padding: 20px 16px; }
}

/* ========== 卡片 ========== */
.card {
  background: var(--c-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--c-border);
  transition: box-shadow var(--t-mid);
}

.card:hover { box-shadow: var(--shadow-lg); }

.card-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--c-text);
}

.card-emoji { font-size: 26px; }

/* ========== 表单 ========== */
.form-group { margin-bottom: 22px; }

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--c-text);
}

.label-required {
  color: var(--c-error);
  margin-left: 4px;
}

.label-hint {
  color: var(--c-text-light);
  font-weight: 400;
  font-size: 12px;
  margin-left: 4px;
}

.form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--c-border);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: inherit;
  background: #fafbfc;
  color: var(--c-text);
  transition: all var(--t-fast);
  resize: vertical;
  min-height: 84px;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 107, 157, 0.1);
}

.char-counter {
  text-align: right;
  font-size: 12px;
  color: var(--c-text-light);
  margin-top: 4px;
}

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.quick-tag {
  padding: 6px 12px;
  border-radius: 100px;
  border: 1px solid var(--c-border);
  background: #fff;
  font-size: 13px;
  color: var(--c-text);
  cursor: pointer;
  transition: all var(--t-fast);
  font-family: inherit;
}

.quick-tag:hover {
  border-color: var(--c-primary);
  background: #fff5f7;
  color: var(--c-primary);
  transform: translateY(-1px);
}

/* 上传区 */
.upload-area {
  position: relative;
  border: 2px dashed var(--c-primary);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #fff5f7 0%, #fff8f0 100%);
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t-fast);
  overflow: hidden;
  outline: none;
}

.upload-area:hover,
.upload-area:focus,
.upload-area.drag-over {
  background: linear-gradient(135deg, #ffe8ed 0%, #fff3e0 100%);
  border-color: var(--c-primary-dark);
  transform: translateY(-2px);
}

.upload-area.has-image .upload-placeholder { display: none; }

.upload-placeholder {
  text-align: center;
  color: var(--c-text-light);
  padding: 24px 16px;
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 8px;
  animation: bounce 2.5s infinite ease-in-out;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

.upload-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--c-text);
}

.upload-hint {
  font-size: 12px;
  color: var(--c-text-light);
  margin-top: 6px;
}

.image-preview {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  display: none;
}

.upload-area.has-image .image-preview { display: block; }

.upload-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  display: none;
  transition: all var(--t-fast);
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.upload-area.has-image .upload-remove { display: flex; }

.upload-remove:hover {
  background: var(--c-error);
  transform: scale(1.1) rotate(90deg);
}

/* 数量控制 */
.count-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.count-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--c-primary);
  background: #fff;
  color: var(--c-primary);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--t-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.count-btn:hover {
  background: var(--c-primary);
  color: #fff;
  transform: scale(1.05);
}

.count-input {
  width: 80px;
  text-align: center;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 18px;
  border: 2px solid var(--c-border);
  border-radius: var(--radius-md);
  background: #fafbfc;
  -moz-appearance: textfield;
  font-family: inherit;
  color: var(--c-text);
  transition: all var(--t-fast);
}

.count-input:focus {
  outline: none;
  border-color: var(--c-primary);
  background: #fff;
}

.count-input::-webkit-outer-spin-button,
.count-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.count-tip {
  margin-left: auto;
  font-size: 12px;
  color: var(--c-text-light);
}

/* 提交按钮 */
.submit-btn {
  width: 100%;
  padding: 16px 24px;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-dark) 100%);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--t-fast);
  box-shadow: 0 4px 16px rgba(255, 107, 157, 0.32);
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.submit-btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.submit-btn:hover:not(:disabled)::before { left: 100%; }

.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 107, 157, 0.42);
}

.submit-btn:active:not(:disabled) { transform: translateY(0); }

.submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-content,
.btn-loader {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 显式覆盖 HTML hidden 属性的默认 display:none（被上面 display:flex 盖掉了） */
.btn-content[hidden],
.btn-loader[hidden],
.quick-tag[hidden],
.image-preview[hidden] {
  display: none !important;
}

.btn-emoji { font-size: 20px; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 状态消息 */
.status {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  animation: slide-down var(--t-mid);
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.status.info    { background: #e6f7ff; color: #1890ff; border: 1px solid #91d5ff; }
.status.success { background: #f6ffed; color: var(--c-success); border: 1px solid #b7eb8f; }
.status.error   { background: #fff2f0; color: var(--c-error); border: 1px solid #ffccc7; }

/* ========== 结果区 ========== */
.result-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--c-text-light);
}

.empty-icon {
  font-size: 72px;
  margin-bottom: 12px;
  animation: float-y 3s infinite ease-in-out;
}

@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

.empty-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--c-text);
}

.empty-hint {
  font-size: 14px;
  margin-top: 4px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}

.meme-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #f5f5f5;
  box-shadow: var(--shadow-sm);
  transition: all var(--t-fast);
  cursor: pointer;
}

.meme-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-md);
}

.meme-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.meme-actions {
  position: absolute;
  inset: auto 0 0 0;
  padding: 8px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
  display: flex;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity var(--t-fast);
}

.meme-card:hover .meme-actions { opacity: 1; }

.meme-actions button {
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 15px;
  transition: all var(--t-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.meme-actions button:hover {
  background: #fff;
  transform: scale(1.15);
}

/* ========== 底部 ========== */
.footer {
  text-align: center;
  margin-top: 48px;
  font-size: 13px;
  color: var(--c-text-light);
  position: relative;
  z-index: 1;
}

.footer .dot { margin: 0 8px; opacity: 0.4; }

/* ========== Toast ========== */
.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  background: var(--c-error);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  animation: slide-in var(--t-mid);
  max-width: 360px;
  font-size: 14px;
  font-weight: 500;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* 响应式微调 */
@media (max-width: 600px) {
  .title { font-size: 36px; }
  .subtitle { font-size: 14px; }
  .card { padding: 20px; }
  .result-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
  .count-tip { display: none; }
}