/* base.css — 变量、reset、排版、主题色、按钮与弹层基础 */

:root {
  --paper: #f3e4bb;
  --paper-deep: #e6d2a1;
  --ink: #4a3824;
  --ink-soft: #6b5638;
  --sea-deep: #1d5f7d;
  --sea-mid: #2d7d9e;
  --sea-light: #7fc2c9;
  --glass: rgba(202, 231, 227, 0.35);
  --glass-line: rgba(255, 255, 255, 0.55);
  --gold: #b8862f;
  --danger: #9c3b2e;
  --shadow: rgba(38, 30, 20, 0.35);
  --radius: 14px;
  --font-ui: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background: #f7eed6;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
}

textarea {
  font-family: inherit;
  resize: none;
}

/* 纸张纹理通用 */
.paper,
.letter,
.confirm,
.drawer {
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,0.35) 0, transparent 42%),
    radial-gradient(circle at 80% 85%, rgba(140,105,55,0.10) 0, transparent 45%),
    repeating-linear-gradient(0deg, rgba(120,90,45,0.035) 0 1px, transparent 1px 3px);
  border: 1px solid #d8c392;
  box-shadow: 0 12px 30px var(--shadow), inset 0 0 24px rgba(150,120,70,0.18);
  border-radius: var(--radius);
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid rgba(90, 65, 35, 0.4);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  box-shadow: 0 3px 8px rgba(60, 45, 25, 0.25);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.btn-primary {
  color: #3b2a16;
  background: linear-gradient(180deg, #f8e7b2, #e7c984);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #fbeebc, #edcf8c);
}

.btn-danger {
  color: #fff;
  background: linear-gradient(180deg, #bd5544, #8d3427);
  border-color: #6f2b21;
}

.btn-ghost {
  color: var(--ink-soft);
  background: rgba(255, 249, 228, 0.6);
}

/* 弹层基础 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 32, 36, 0.45);
  backdrop-filter: blur(2px);
}

.modal > section {
  position: relative;
  z-index: 1;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(74, 56, 36, 0.12);
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.modal-close:hover {
  background: rgba(74, 56, 36, 0.22);
}

.counter {
  color: var(--ink-soft);
  font-size: 13px;
  letter-spacing: 1px;
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%) translateY(20px);
  z-index: 80;
  max-width: 84vw;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(48, 40, 28, 0.9);
  color: #fff6df;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
/* 全局怀旧纸张颗粒 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 99;
  pointer-events: none;
  opacity: 0.04;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* 顶部按钮去除继承的文字阴影 */
.app-header .btn {
  text-shadow: none;
}

/* 偏好减少动效 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}