/* ============================================
   谁是大诗豪 — 基础样式重置 & 排版
   ============================================ */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--ink-dark);
  background-color: var(--paper-white);
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(184,134,11,0.03) 0%, transparent 60%),
    linear-gradient(to bottom, var(--paper-white), var(--paper-warm));
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* 水墨纹理背景 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23b8860b' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

/* 链接 */
a {
  color: var(--accent-red);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--accent-gold); }
a:active { color: var(--ink-dark); }

/* 标题 */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink-black);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }

/* 按钮 */
button {
  font-family: var(--font-body);
  font-size: var(--text-base);
  cursor: pointer;
  border: none;
  background: none;
  transition: all var(--transition-fast);
}

button:active {
  transform: scale(0.97);
}

/* 输入框 */
input, textarea, select {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--ink-dark);
  border: 1px solid var(--ink-lighter);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  background: var(--paper-white);
  transition: border-color var(--transition-fast);
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--ink-dark);
  box-shadow: 0 0 0 3px rgba(44,44,44,0.1);
}

/* 列表 */
ul, ol { list-style: none; }

/* 图片 */
img { max-width: 100%; height: auto; }

/* 滚动条 */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--paper-warm);
}
::-webkit-scrollbar-thumb {
  background: var(--ink-lighter);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ink-light);
}

/* 选中 */
::selection {
  background: rgba(184,134,11,0.2);
  color: var(--ink-black);
}

/* 水墨印章效果 */
.seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 2px solid var(--accent-red);
  border-radius: var(--radius-sm);
  color: var(--accent-red);
  font-family: var(--font-title);
  font-size: var(--text-lg);
  font-weight: 900;
  transform: rotate(-8deg);
  user-select: none;
  position: relative;
}

.seal::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 1px solid rgba(192,57,43,0.3);
  border-radius: 6px;
}

/* 卷轴边框 */
.scroll-border {
  border: 2px solid var(--paper-dark);
  border-image: linear-gradient(
    to bottom,
    var(--paper-dark) 0%,
    var(--ink-lighter) 20%,
    var(--ink-lighter) 80%,
    var(--paper-dark) 100%
  ) 1;
  border-radius: var(--radius-md);
  background: var(--paper-white);
  box-shadow: inset 0 0 30px rgba(212,197,169,0.15);
}

/* 加载动画 */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg,
    var(--paper-warm) 25%,
    var(--paper-aged) 50%,
    var(--paper-warm) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

/* Toast 通知 */
.toast {
  position: fixed;
  top: var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  background: var(--ink-dark);
  color: var(--paper-white);
  font-size: var(--text-sm);
  z-index: var(--z-toast);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
  max-width: 90vw;
  text-align: center;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.toast.success { background: var(--success); }
.toast.error { background: var(--error); }
.toast.warning { background: var(--warning); }
