/* ============================================================
 * 概念寓言 · 视觉系统（ticket 06）
 * 方向：深夜书房的点题仪式 —— 题款(概念名) + 印章(点题) + 画(寓言)
 * 纸张：月白天青（宋瓷单色深度）；强调：朱砂仅用于印章时刻
 * 依据：frontend-design（反模板）+ aesthetic-foundations（中式审美/倪瓒/宋瓷）
 * ============================================================ */

:root {
  /* 色（token） */
  --paper: #f2f4ef;      /* 月白天青纸 */
  --paper-deep: #e9ece4; /* 纸影 */
  --ink: #23262e;        /* 墨 */
  --muted: #5e6472;      /* 淡墨 */
  --line: #dfe3d9;       /* 纸纹 */
  --seal: #ae3a2f;       /* 朱砂 —— 只属于印章 */
  --seal-soft: #f6eae4;  /* 印泥晕 */
  --error: #b0432f;

  /* 字体 */
  --serif-zh: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  --serif-en: "Didot", "Bodoni MT", "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "PingFang SC", "Microsoft YaHei", -apple-system, system-ui, sans-serif;

  /* 节奏 */
  --step: 2rem;
  --measure: 38em;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.75;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

#app { max-width: 46rem; margin: 0 auto; padding: 2.5rem 1.5rem 6rem; position: relative; z-index: 1; }

/* ---- 氛围层：书房的灯影 + 纸纹 ---- */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(58% 42% at 50% -4%, rgba(174, 58, 47, .06), transparent 72%),
    radial-gradient(80% 60% at 50% 112%, rgba(35, 38, 46, .05), transparent 72%);
}
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- 背景线描：书房的静物（月 / 灯 / 远山） ---- */
.bg-art { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.bg-art svg { position: absolute; color: var(--ink); }
.bg-art path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.bg-art circle { fill: none; stroke: currentColor; stroke-width: 1.6; }
.bg-art .fill { fill: currentColor; stroke: none; }
.art-moon { top: 2rem; right: 1.5rem; width: 150px; opacity: .3; }
.art-lamp { bottom: 1.2rem; left: 1.2rem; width: 140px; opacity: .32; }
.art-hills { bottom: .6rem; right: .8rem; width: 260px; opacity: .28; }

/* ---- 入场 ---- */
@keyframes rise { from { opacity: 0; transform: translateY(.5rem); } to { opacity: 1; transform: none; } }
.tagline, .draw-btn, .concept { animation: rise .55s ease-out backwards; }
.draw-btn { animation-delay: .12s; }

/* ---- 顶栏：题款 ---- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: .75rem 1rem;
  margin-bottom: 5rem;
}
.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  font-size: .85rem; letter-spacing: .28em; color: var(--muted);
  font-family: var(--serif-zh);
}
.brand-dot {
  width: .5rem; height: .5rem; background: var(--seal); border-radius: 50%;
  flex: none;
}
.top-right { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.streak { font-size: .78rem; color: var(--muted); letter-spacing: .1em; }

/* ---- 按钮 ---- */
button {
  font: inherit; font-size: .95rem; padding: .6rem 1.4rem; border-radius: .4rem;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
button:hover { border-color: var(--ink); }
button.primary { border-color: var(--ink); background: var(--ink); color: var(--paper); }
button.primary:hover { background: #2c3038; }
button.link {
  border: none; background: none; color: var(--seal); padding: 0;
  text-decoration: underline; text-underline-offset: .2em; font-size: .82rem;
}
button.small { font-size: .8rem; padding: .3rem .9rem; }
button:focus-visible, button.link:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; }

.lang {
  font-size: .78rem; padding: .3rem .9rem; border-radius: 999px; color: var(--muted);
  letter-spacing: .12em;
}

/* ---- 舞台 ---- */
.stage { text-align: center; }

/* 抽题：一题款一印章钮（倪瓒式空） */
.tagline {
  font-family: var(--serif-zh); font-weight: 500;
  font-size: 1.35rem; line-height: 1.9; letter-spacing: .04em;
  color: var(--ink); margin: 0 0 4.5rem;
}
.draw-btn {
  display: inline-flex; align-items: center; gap: .7rem;
  font-family: var(--serif-zh); font-size: 1.1rem; letter-spacing: .3em; text-indent: .3em;
  padding: 1.1rem 2.6rem; border-radius: .5rem;
  border: 1.5px solid var(--seal); color: var(--seal); background: transparent;
  transition: background .2s, color .2s;
}
.draw-btn:hover { background: var(--seal); color: var(--paper); border-color: var(--seal); }
.draw-btn::before { content: "◆"; font-size: .6rem; letter-spacing: 0; }

/* ---- 概念名：题款 ---- */
.concept {
  font-family: var(--serif-zh); font-weight: 700;
  font-size: clamp(2.4rem, 7vw, 3.4rem);
  letter-spacing: .06em; line-height: 1.4;
  margin: 1rem 0 2rem;
}
.concept.small { font-size: 1.2rem; font-weight: 600; color: var(--muted); margin: 0 0 1.4rem; letter-spacing: .1em; }
.en {
  font-family: var(--serif-en); font-size: .48em; font-weight: 400;
  color: var(--muted); letter-spacing: .04em; margin-left: .4em;
}

/* 点题：印章落下 */
.concept.stamped {
  display: inline-block;
  color: var(--seal);
  padding: .5em 1em .4em;
  border: 3px solid var(--seal);
  border-radius: .35em;
  background: var(--seal-soft);
  box-shadow: inset 0 0 0 1px var(--seal-soft);
  animation: stamp .3s ease-out;
  margin-bottom: 1.6rem;
}
@keyframes stamp {
  0% { transform: scale(1.18); opacity: 0; }
  55% { transform: scale(.98); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.tag {
  display: inline-block; font-size: .72rem; padding: .1em .8em; border-radius: 999px;
  background: var(--seal-soft); color: var(--seal); margin-left: .6em;
  vertical-align: .35em; letter-spacing: .1em;
}

/* ---- 提示与说明 ---- */
.hint { color: var(--muted); font-size: .95rem; margin: 0 0 .75rem; }
.note { color: var(--muted); font-size: .82rem; margin: 0 0 2.2rem; line-height: 1.9; }
.privacy { margin-top: 2.5rem; }

/* ---- 动作行 ---- */
.actions { display: flex; gap: .9rem; justify-content: center; margin-top: 2.4rem; flex-wrap: wrap; }

/* ---- 闸门 ---- */
textarea {
  width: 100%; max-width: 32rem; min-height: 7rem; font: inherit; font-size: .95rem;
  padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: .4rem;
  background: rgba(255, 255, 255, .55); color: var(--ink); resize: vertical;
  text-align: left;
}
textarea:focus { outline: none; border-color: var(--ink); }

/* ---- 寓言：画 ---- */
.fable {
  font-family: var(--serif-zh); font-size: 1.05rem; line-height: 2.1;
  text-align: left; max-width: var(--measure); margin: 0 auto 2rem;
}
.fable p { margin: 0 0 1.4em; text-indent: 2em; }
.fable p.fresh { animation: para-in .45s ease-out; text-indent: 0; }
@keyframes para-in { from { opacity: 0; transform: translateY(.35rem); } to { opacity: 1; transform: none; } }
.fable-progress { color: var(--muted); font-size: .78rem; margin-bottom: 1.6rem; letter-spacing: .08em; }

/* ---- 对照表 ---- */
.legend {
  border-collapse: collapse; width: 100%; max-width: 34rem; margin: 1.6rem auto 0;
  font-size: .88rem; text-align: left;
}
.legend th, .legend td { border-bottom: 1px solid var(--line); padding: .8rem .9rem; vertical-align: top; }
.legend th { font-family: var(--serif-zh); font-weight: 600; color: var(--seal); letter-spacing: .12em; }
.legend td:first-child { color: var(--muted); }

/* ---- 深潜 ---- */
.deep-dive { text-align: left; max-width: var(--measure); margin: 0 auto; }
.deep-dive h3 {
  font-family: var(--serif-zh); font-size: .95rem; color: var(--ink);
  letter-spacing: .1em; margin: 2.4rem 0 .5rem;
  display: flex; align-items: baseline; gap: .6em;
}
.deep-dive h3::after { content: ""; flex: 1; border-bottom: 1px solid var(--line); transform: translateY(-.3em); }
.deep-dive p { margin: 0; font-size: .92rem; line-height: 1.9; }

/* ---- 概念集 ---- */
.col-list { list-style: none; margin: 0 auto; padding: 0; max-width: 34rem; text-align: left; display: flex; flex-direction: column; gap: .75rem; }
.col-item { border: 1px solid var(--line); border-radius: .4rem; padding: 1rem 1.2rem; background: rgba(255,255,255,.4); }
.col-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.col-head > span { font-family: var(--serif-zh); font-size: 1.05rem; }
.col-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin: .6rem 0 .25rem; }
button.active { border-color: var(--seal); color: var(--seal); background: var(--seal-soft); }
.col-section { margin-top: .9rem; border-top: 1px dashed var(--line); padding-top: .25rem; }
.col-sec-title { font-size: .8rem; color: var(--muted); letter-spacing: .14em; margin: .6rem 0 .5rem; }
.col-item .fable { margin: 0; font-size: .95rem; }
.col-item .legend { margin: 0; }
.col-item .deep-dive { margin: 0; }

/* ---- 错误 ---- */
.err { color: var(--error); font-size: .85rem; margin-top: 1.6rem; }

/* ---- 抽取乱码动画 ---- */
.drawing-label { margin-bottom: 3.5rem; }
.scramble {
  font-family: var(--serif-zh); font-weight: 700;
  font-size: clamp(2.4rem, 7vw, 3.4rem);
  letter-spacing: .08em; line-height: 1.5; margin: 0 0 1rem;
  min-height: 1.5em;
}
.scramble .roll { opacity: .25; }
.scramble .lock { color: var(--seal); }
.scramble.en {
  font-family: var(--serif-en); font-weight: 400;
  font-size: clamp(1.1rem, 4vw, 1.7rem); color: var(--muted);
  letter-spacing: .05em; margin-top: -.2rem;
}
.scramble.en .lock { color: var(--seal); }

/* ---- 仪式注脚 ---- */
.ritual-footer {
  margin-top: 5rem; padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  font-size: .78rem; color: var(--muted); letter-spacing: .1em;
  text-align: center;
}

/* ---- 响应式 ---- */
@media (max-width: 640px) {
  #app { padding-top: 1.75rem; }
  .topbar { margin-bottom: 3.5rem; }
  .tagline { font-size: 1.15rem; }
  .concept { font-size: clamp(1.9rem, 8.5vw, 2.4rem); }
  .fable { font-size: .98rem; }
  .stage { text-align: left; }
  .actions { justify-content: flex-start; }
  .draw-btn { margin-left: 0; }
  .art-moon { display: none; }
  .art-lamp, .art-hills { opacity: .18; }
}

/* ---- 动效克制 ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
