/* =====================================================
   五行命格 · 墨金主题（Premium dark + gold，参照 colors.csv #4）
   --bg 墨纸 #17140F / --gold 金 #C9A227 / 五行各按本色
   ===================================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #17140F;
  --card: #201B12;
  --card-border: rgba(201, 162, 39, 0.22);
  --ink: #EFE7D6;
  --ink-dim: #A2957A;
  --ink-faint: #6E6350;
  --gold: #C9A227;
  --gold-2: #E7CE7B;
  --gap: 14px;
  --radius: 20px;
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  --accent: var(--gold);
  --text-dim: var(--ink-dim);
  --line: rgba(201, 162, 39, 0.25);
}

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(201, 162, 39, 0.08), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Segoe UI", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

#app { max-width: 640px; margin: 0 auto; padding: 28px 18px 40px; }

.screen { display: none; }
.screen.active { display: block; animation: screenIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.bento { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); }

.tile {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
}

/* ---------- 首页 ---------- */
.tile-hero { grid-column: 1 / -1; text-align: center; margin-bottom: var(--gap); }
.tile-hero .hero-emoji { font-size: 58px; line-height: 1.15; filter: drop-shadow(0 4px 18px rgba(201, 162, 39, 0.3)); }
.tile-hero h1 { font-size: 36px; margin: 10px 0 8px; font-weight: 800; line-height: 1.25; letter-spacing: 0.02em; }
.accent-text {
  background: linear-gradient(100deg, var(--gold), var(--gold-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tile-hero .sub { color: var(--ink-dim); font-size: 15px; line-height: 1.7; margin-bottom: 18px; }
.tile-stat { text-align: center; display: flex; flex-direction: column; justify-content: center; }
.stat-num { font-size: 34px; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: 12.5px; color: var(--ink-dim); line-height: 1.55; margin-top: 6px; }
.tile-note { grid-column: 1 / -1; text-align: center; font-size: 12.5px; color: var(--ink-dim); line-height: 1.8; }

/* ---------- 合盘横幅 ---------- */
.cmp-banner { grid-column: 1 / -1; border-color: rgba(201, 162, 39, 0.45); }
.cmp-banner.tone-good { border-color: rgba(95, 184, 148, 0.5); }
.cmp-banner.tone-duel { border-color: rgba(176, 58, 46, 0.55); }
.cmp-cards { display: flex; gap: 10px; align-items: center; justify-content: center; margin-bottom: 10px; }
.cmp-el { font-size: 20px; font-weight: 700; }
.cmp-x { color: var(--gold); font-weight: 700; }
.cmp-head { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.cmp-body { font-size: 13.5px; color: var(--ink-dim); margin-bottom: 10px; }
.tiny { font-size: 12px; color: var(--ink-faint); }
.accent-link { color: var(--gold); font-weight: 700; background: none; border: 0; cursor: pointer; font: inherit; }
.accent-link:hover { text-decoration: underline; }

/* ---------- 续答 ---------- */
.resume-banner { grid-column: 1 / -1; }
.resume-actions { display: flex; gap: 10px; margin-top: 10px; }

/* ---------- 按钮 ---------- */
.btn-primary, .btn-ghost {
  font: inherit; cursor: pointer; border-radius: 14px;
  padding: 13px 20px; font-size: 15px; font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn-primary {
  background: linear-gradient(100deg, var(--gold), var(--gold-2));
  color: #1C1917; border: 0;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(201, 162, 39, 0.25); }
.btn-ghost { background: transparent; color: var(--ink-dim); border: 1px solid var(--card-border); }
.btn-ghost:hover { color: var(--ink); border-color: var(--gold); }
.btn-small { padding: 9px 14px; font-size: 13.5px; border-radius: 11px; }
.link-btn { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; }
.link-btn:hover { color: var(--gold); }

/* ---------- 答题 ---------- */
.quiz-wrap { display: flex; flex-direction: column; gap: 16px; }
.progress-area { display: flex; flex-direction: column; gap: 8px; }
.progress-info { font-size: 13px; color: var(--ink-dim); text-align: right; }
.progress-bar { height: 6px; border-radius: 3px; background: rgba(201, 162, 39, 0.15); overflow: hidden; }
#progress-fill { height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width 0.3s ease; }
.question-tile h2 { font-size: 18px; line-height: 1.5; margin-bottom: 16px; }
.options { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 560px) { .options { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.option {
  text-align: left; font: inherit; cursor: pointer;
  background: rgba(201, 162, 39, 0.05); border: 1.5px solid var(--card-border);
  border-radius: 14px; padding: 14px 16px; font-size: 14.5px; line-height: 1.55; color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.option:hover { border-color: var(--gold); background: rgba(201, 162, 39, 0.1); transform: translateY(-1px); }
.option.picked { border-color: var(--gold); background: rgba(201, 162, 39, 0.16); }
.quiz-footer { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kbd-hint { font-size: 11.5px; color: var(--ink-faint); }

/* ---------- 结果 ---------- */
.result-wrap { display: flex; flex-direction: column; gap: var(--gap); }
.result-eyebrow { text-align: center; color: var(--ink-dim); font-size: 14px; letter-spacing: 0.08em; margin-bottom: 2px; }
.result-card { text-align: center; padding: 30px 22px; }
.result-emoji { font-size: 64px; line-height: 1.15; filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.5)); }
.result-name { font-size: 34px; font-weight: 800; margin: 8px 0 10px; line-height: 1.15;
  background: linear-gradient(100deg, var(--p1, var(--gold)), var(--p2, var(--gold-2)));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.result-tagline { font-size: 15.5px; color: var(--gold-2); margin-bottom: 14px; }
.result-desc { text-align: left; font-size: 14.5px; line-height: 1.8; color: var(--ink); margin-bottom: 14px; }
.classical { text-align: left; font-size: 12.5px; color: var(--ink-faint); line-height: 1.7;
  border-left: 2px solid var(--line); padding-left: 12px; margin-bottom: 14px; }
.result-traits { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.trait { font-size: 12.5px; padding: 5px 12px; border-radius: 999px;
  background: rgba(201, 162, 39, 0.1); border: 1px solid var(--card-border); color: var(--ink); }

h3 { font-size: 15px; color: var(--gold-2); font-weight: 700; margin-bottom: 12px; }

/* 生克关系 */
.rel-row { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(201, 162, 39, 0.12); }
.rel-row:last-child { border-bottom: 0; }
.rel-emoji { font-size: 24px; line-height: 1.3; }
.rel-row b { font-size: 14px; display: block; margin-bottom: 3px; }
.rel-row p { font-size: 13px; color: var(--ink-dim); line-height: 1.65; }

/* 旺季 */
.season-line { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.season-chip, .wuchang-chip { font-size: 12.5px; padding: 4px 12px; border-radius: 999px;
  background: rgba(201, 162, 39, 0.12); border: 1px solid var(--card-border); }
.season-tile p { font-size: 13.5px; color: var(--ink); line-height: 1.75; }
.watch-line { margin-top: 10px; font-size: 13px; color: var(--ink-dim);
  border-top: 1px dashed var(--line); padding-top: 10px; }

/* 平衡条 */
.bar-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 44px; align-items: center; gap: 10px; margin-bottom: 12px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-label { font-size: 13px; white-space: nowrap; }
.bar-emoji { margin-right: 4px; }
.bar-track { height: 12px; border-radius: 6px; background: rgba(201, 162, 39, 0.12); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; transform: scaleX(0); transform-origin: left;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
.bar-pct { text-align: right; font-size: 12.5px; color: var(--ink-dim); }

/* 分享 */
.share-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 6px 0; }
.share-card-area { text-align: center; }
.share-card-area canvas { border-radius: 18px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  margin: 0 auto 16px; display: block; max-width: 100%; }
.read-tile a { color: var(--gold-2); font-weight: 600; text-decoration: none; font-size: 14px; }
.read-tile a:hover { text-decoration: underline; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 20px);
  background: rgba(32, 27, 18, 0.96); color: var(--ink);
  border: 1px solid var(--card-border); border-radius: 12px;
  padding: 11px 18px; font-size: 13.5px; opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease; z-index: 60;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 页脚 */
.footer { text-align: center; font-size: 12px; color: var(--ink-faint);
  padding: 22px 18px 30px; line-height: 2.1; max-width: 760px; margin: 0 auto; }
.footer a { color: var(--ink-dim); text-decoration: none; }
.footer a:hover { color: var(--gold); }

/* 弹窗 */
.method-dialog { background: var(--card); color: var(--ink); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 24px; max-width: 560px; width: calc(100% - 36px); }
.method-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.method-dialog h3 { font-size: 17px; margin-bottom: 12px; }
.method-dialog ol { padding-left: 20px; }
.method-dialog li { font-size: 13.5px; line-height: 1.75; margin-bottom: 8px; color: var(--ink); }
.method-dialog b { color: var(--gold-2); }
.method-dialog .btn-ghost { margin-top: 12px; }

@media (min-width: 560px) {
  #app { max-width: 860px; }
  .tile-hero { padding: 44px 30px; }
  .tile-stat { min-height: 120px; }
  .bar-row { grid-template-columns: 120px minmax(0, 1fr) 48px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- 双语切换 ---------- */
html[lang="en"] .lang-zh { display: none !important; }
html:not([lang="en"]) .lang-en { display: none !important; }
.lang-toggle {
  border: 1px solid var(--card-border); background: transparent; cursor: pointer;
  font: inherit; font-size: 12.5px; padding: 5px 12px; border-radius: 999px;
  color: var(--ink-dim);
}
.lang-toggle[aria-pressed="true"] { background: var(--gold); color: #1C1917; border-color: var(--gold); }
.lang-toggle-group { display: inline-flex; gap: 4px; align-items: center; }

/* 契合度条 */
.concentration { position: relative; height: 14px; border-radius: 7px;
  background: rgba(201, 162, 39, 0.14); overflow: hidden; margin: 6px 0 14px; }
.con-fill { height: 100%; width: 0; border-radius: 7px;
  background: linear-gradient(90deg, var(--p1, var(--gold)), var(--p2, var(--gold-2)));
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1); }
.concentration span { position: absolute; inset: 0; font-size: 11px; line-height: 14px;
  color: #1C1917; font-weight: 700; letter-spacing: 0.04em; }

/* =====================================================
   人机功效 · 无声的关心（与平台 tokens.css 同源副本）
   ===================================================== */
body { -webkit-tap-highlight-color: transparent; }
a, button, input, select, textarea, label, [role="button"], summary {
  touch-action: manipulation;
}
@media (hover: none) {
  *:hover { transform: none !important; }
}
::selection { background: color-mix(in srgb, var(--accent, #C9A227) 22%, transparent); }
input, textarea { caret-color: var(--accent, #C9A227); }
body { text-autospace: normal; line-break: strict; overflow-wrap: break-word; }
@media (pointer: coarse) {
  input, textarea { font-size: max(16px, 1em); }
}
html { scrollbar-gutter: stable; }

/* =====================================================
   交互打磨 · 入场与反馈（各 app 副本共用）
   全部纯 CSS、动画短促且 reduced-motion 由全局规则兜底。
   ===================================================== */
/* 页面首帧：极短抬升淡入，遮住字体回退与排版微调瞬间 */
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
body { animation: pageIn 0.28s var(--ease, ease-out) both; }

/* 页面内锚点滚动丝滑 */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* 选项选中：推进前的轻微弹跳——「已收到」的触觉化确认 */
@keyframes pickPulse { 0% { transform: scale(1); } 45% { transform: scale(1.03); } 100% { transform: scale(1); } }
.option.picked { animation: pickPulse 0.26s var(--ease, ease-out); }

/* 结果区逐项入场：emoji 弹入 → 名称 → 标签行 → 描述/引用 → 特质 chips 阶梯 */
@keyframes popIn { 0% { opacity: 0; transform: scale(0.5); } 55% { opacity: 1; transform: scale(1.08); } 100% { opacity: 1; transform: scale(1); } }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.result-emoji, #r-emoji { animation: popIn 0.5s var(--ease, ease-out) 0.08s both; }
.result-name, #r-name { animation: riseIn 0.4s var(--ease, ease-out) 0.2s both; }
.result-tagline, #r-tagline { animation: riseIn 0.4s var(--ease, ease-out) 0.3s both; }
.result-desc, .result-quote, .classical, #r-desc, #r-quote { animation: riseIn 0.45s var(--ease, ease-out) 0.4s both; }
.trait { animation: riseIn 0.35s var(--ease, ease-out) 0.45s both; }
.trait:nth-child(2) { animation-delay: 0.52s; }
.trait:nth-child(3) { animation-delay: 0.59s; }
.trait:nth-child(4) { animation-delay: 0.66s; }
.trait:nth-child(n+5) { animation-delay: 0.7s; }
.tile-read, #r-read { animation: riseIn 0.4s var(--ease, ease-out) 0.72s both; }

/* 卡片/链接按压反馈：tap-highlight 已关，:active 是触屏唯一的「按到了」信号 */
.app-card:active, .acard:active, .btn-ghost:active { transform: scale(0.98); }

/* 跨页导航默认交叉淡入淡出（渐进增强，不支持的浏览器自动忽略） */
@view-transition { navigation: auto; }

/* 分享卡渲染后浮出（display:none→block 时动画自动播放） */
#share-card-area { animation: riseIn 0.4s var(--ease, ease-out) both; }
