/* ==========================================================================
   Natural Organic 共享样式系统
   大地色系 / 有机形状 / 纸纹质感 / 缓慢生长式动效
   ========================================================================== */

:root {
  --no-cream: #faf6f1;
  --no-paper: #fffdf9;
  --no-bark: #5c4033;
  --no-bark-soft: #7a5a49;
  --no-sage: #8b9d77;
  --no-sage-deep: #6f8160;
  --no-tan: #d4a373;
  --no-clay: #e8ded2;
  --no-ink: #3a2f27;
  --no-muted: #6b5d51;
  --no-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--no-cream);
  color: var(--no-ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  position: relative;
  min-height: 100vh;
}

/* 纸张 / 织物纹理 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.28'/%3E%3C/svg%3E");
}

.font-serif,
h1,
h2,
h3,
h4 {
  font-family: Georgia, "Songti SC", "Noto Serif SC", "Source Han Serif SC", serif;
  letter-spacing: -0.01em;
}

/* ------------------------------- 有机形状装饰 ------------------------------ */
.organic-blob {
  position: absolute;
  border-radius: 46% 54% 60% 40% / 52% 44% 56% 48%;
  filter: blur(2px);
  opacity: 0.5;
  pointer-events: none;
  animation: organic-morph 26s var(--no-ease) infinite;
}

.organic-leaf {
  border-radius: 60% 8% 60% 8%;
}

@keyframes organic-morph {
  0%, 100% { border-radius: 46% 54% 60% 40% / 52% 44% 56% 48%; }
  34% { border-radius: 58% 42% 44% 56% / 44% 58% 42% 56%; }
  67% { border-radius: 42% 58% 52% 48% / 58% 46% 54% 42%; }
}

@keyframes gentle-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.rise-in {
  animation: gentle-rise 600ms var(--no-ease) both;
}

/* --------------------------------- 滚动条 -------------------------------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--no-clay);
  border-radius: 999px;
  border: 2px solid var(--no-cream);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--no-tan);
}

/* --------------------------------- 提示条 -------------------------------- */
.ui-toast-box {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.ui-toast {
  padding: 12px 24px;
  border-radius: 999px;
  background: rgba(92, 64, 51, 0.94);
  color: var(--no-cream);
  font-size: 13px;
  border: 1px solid rgba(250, 246, 241, 0.2);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 500ms var(--no-ease), transform 500ms var(--no-ease);
  max-width: 70vw;
}

.ui-toast.is-error {
  background: rgba(140, 74, 52, 0.94);
}

.ui-toast.is-ok {
  background: rgba(111, 129, 96, 0.95);
}

.ui-toast.is-in {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------- 确认框 -------------------------------- */
.ui-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(58, 47, 39, 0.34);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9500;
  opacity: 0;
  transition: opacity 300ms var(--no-ease);
  padding: 24px;
}

.ui-confirm-overlay.is-in {
  opacity: 1;
}

.ui-confirm-card {
  background: var(--no-paper);
  border: 1px solid var(--no-clay);
  border-radius: 2rem;
  padding: 28px 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 8px 24px -18px rgba(92, 64, 51, 0.45);
  transform: translateY(8px);
  transition: transform 400ms var(--no-ease);
}

.ui-confirm-overlay.is-in .ui-confirm-card {
  transform: translateY(0);
}

/* --------------------------------- 通用卡片 ------------------------------- */
.paper-card {
  background: var(--no-paper);
  border: 1px solid var(--no-clay);
  border-radius: 2rem;
}

/* Tailwind 未覆盖时的兜底焦点环 */
:focus-visible {
  outline: 2px solid var(--no-sage);
  outline-offset: 2px;
}

/* ------------------------------ 无障碍与动效 ------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   通用组件（画布页 / 资产库页 / API 登录页共用）
   ========================================================================== */

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; }

.brand-mark {
  width: 38px;
  height: 38px;
  background-color: var(--no-sage);
  border-radius: 60% 8% 60% 8%;
  display: inline-block;
  flex-shrink: 0;
}

.brand-text h1 { font-size: 18px; margin: 0; line-height: 1.2; color: var(--no-bark); }
.brand-text p { margin: 0; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--no-sage); }

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--no-clay);
  background: var(--no-paper);
  color: var(--no-bark);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 500ms var(--no-ease);
}

.tool-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.tool-btn:hover { background: #f2ece3; color: var(--no-sage-deep); }
.tool-btn:active { transform: translateY(2px); }
.tool-btn.icon-only { padding: 8px; width: 40px; justify-content: center; }
.tool-btn.is-active { background: var(--no-sage); border-color: var(--no-sage); color: var(--no-cream); }
.tool-btn[disabled] { opacity: 0.42; cursor: not-allowed; }
.tool-btn[disabled]:hover { background: var(--no-paper); color: var(--no-bark); }

.mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  border-radius: 999px;
  border: 1px solid var(--no-clay);
  background: var(--no-paper);
  color: var(--no-bark);
  cursor: pointer;
  transition: all 400ms var(--no-ease);
}
.mini-btn svg { width: 15px; height: 15px; }
.mini-btn:hover { background: #f2ece3; color: var(--no-sage-deep); }
.mini-btn:active { transform: translateY(2px); }

.no-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 999px;
  border: none;
  background: var(--no-bark);
  color: var(--no-cream);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 500ms var(--no-ease);
}
.no-btn-primary svg { width: 16px; height: 16px; }
.no-btn-primary:hover { background: var(--no-sage-deep); }
.no-btn-primary:active { transform: translateY(2px); }
.no-btn-primary[disabled] { opacity: 0.5; cursor: not-allowed; }

.no-btn-soft {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--no-tan);
  color: var(--no-bark);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 500ms var(--no-ease);
}
.no-btn-soft:hover { background: #f2ece3; }
.no-btn-soft:active { transform: translateY(2px); }

.no-input {
  width: 100%;
  padding: 11px 18px;
  background: var(--no-paper);
  border: 1px solid var(--no-clay);
  border-radius: 999px;
  color: var(--no-ink);
  font-family: inherit;
  font-size: 13px;
  transition: all 300ms var(--no-ease);
}
.no-input::placeholder { color: #b5a79a; }
.no-input:focus {
  outline: none;
  border-color: var(--no-tan);
  box-shadow: 0 0 0 3px rgba(139, 157, 119, 0.18);
}

textarea.no-input { border-radius: 1.4rem; resize: vertical; line-height: 1.7; }

.no-field { display: flex; flex-direction: column; gap: 6px; }
.no-label { font-size: 12px; color: var(--no-muted); padding-left: 6px; }

.no-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(58, 47, 39, 0.34);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 400ms var(--no-ease);
}
.no-modal.is-in { opacity: 1; }

.no-modal-card {
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  border-radius: 2rem;
  padding: 24px;
  box-shadow: 0 8px 24px -18px rgba(92, 64, 51, 0.45);
  transform: translateY(10px);
  transition: transform 500ms var(--no-ease);
}
.no-modal.is-in .no-modal-card { transform: translateY(0); }

.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 20px; color: var(--no-bark); }
.modal-body { flex: 1; overflow-y: auto; min-height: 80px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 12px; margin-top: 18px; }

.chip {
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--no-clay);
  background: var(--no-paper);
  color: var(--no-muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 400ms var(--no-ease);
}
.chip:hover { background: #f2ece3; }
.chip.is-active { background: var(--no-sage); border-color: var(--no-sage); color: var(--no-cream); }

.empty-tip { text-align: center; color: #a3937f; font-size: 13px; padding: 28px 0; }
