/* 引气诀 · 纸与墨 */
*, *::before, *::after { box-sizing: border-box; }

:root{
  --paper:   #f6f1e6;
  --paper-2: #efe7d6;
  --ink:     #2a251f;
  --ink-2:   #5a5145;
  --ink-3:   #8b806d;
  --line:    #ddd2bd;
  --line-2:  #e8e0cd;
  --red:     #9c342b;
  --red-2:   #b8554a;
  --gold:    #96702a;
  --green:   #4a6b4f;
  --shadow:  0 1px 2px rgba(64,48,24,.06), 0 8px 28px -16px rgba(64,48,24,.35);
}

[hidden]{ display:none !important; }

html, body{
  margin:0; padding:0;
  height:100%;
  -webkit-text-size-adjust:100%;
}

body{
  background:
    radial-gradient(120% 80% at 15% -10%, #fdfaf3 0%, rgba(253,250,243,0) 55%),
    radial-gradient(100% 70% at 92% 108%, #eee5d2 0%, rgba(238,229,210,0) 60%),
    var(--paper);
  color: var(--ink);
  font-family: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "SimSun", "STSong", Georgia, serif;
  font-size: 16px;
  line-height: 1.85;
  letter-spacing: .01em;
  overflow: hidden;
  overscroll-behavior: none;
}

/* 纸张纤维 */
body::before{
  content:"";
  position:fixed; inset:0; pointer-events:none; z-index:0;
  opacity:.5;
  background-image:
    repeating-linear-gradient(94deg, rgba(140,118,80,.028) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(4deg,  rgba(140,118,80,.022) 0 1px, transparent 1px 4px);
}

.frame{
  position:relative; z-index:1;
  height:100dvh; height:100vh;
  max-width: 660px;
  margin: 0 auto;
  display:flex;
  flex-direction:column;
  padding: 0 20px;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

/* ---------------- 顶部 ---------------- */
.hud{
  flex:none;
  padding: calc(14px + env(safe-area-inset-top)) 0 12px;
  border-bottom:1px solid var(--line-2);
  background: linear-gradient(to bottom, rgba(246,241,230,.96), rgba(246,241,230,.86));
}
.hud-line{ display:flex; align-items:center; gap:8px; }
.hud-line + .hud-line{ margin-top:7px; }
.grow{ flex:1; }
.sep{ color:var(--ink-3); font-size:12px; }

.who{
  font: inherit; font-size:14px;
  color:var(--ink); background:none; border:0; padding:0;
  border-bottom:1px dotted var(--line);
  cursor:pointer; max-width:9em;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.who:active{ color:var(--red); }

.day{ font-size:12.5px; color:var(--ink-3); letter-spacing:.06em; }

.stone{ font-size:12.5px; color:var(--ink-2); display:inline-flex; align-items:center; gap:5px; }
.stone .dot{
  width:6px; height:6px; border-radius:50%;
  background: var(--gold); opacity:.75;
  box-shadow: 0 0 0 3px rgba(150,112,42,.1);
}
.stone b{ font-weight:600; font-variant-numeric: tabular-nums; }
.stone em{ font-style:normal; color:var(--ink-3); font-size:11.5px; }

.q{
  font: inherit; font-size:11px;
  width:18px; height:18px; line-height:1;
  display:flex; align-items:center; justify-content:center;
  color:var(--ink-3);
  background:none; border:1px solid var(--line);
  border-radius:50%; padding:0; cursor:pointer;
  margin-left:2px;
}
.q:active{ color:var(--red); border-color:#d9bdb6; }

.realm-line{ gap:10px; }
.realm{ font-size:14.5px; letter-spacing:.08em; flex:none; }
.xp{
  flex:1; height:4px; border-radius:2px;
  background: var(--paper-2);
  box-shadow: inset 0 0 0 1px rgba(120,100,66,.07);
  overflow:hidden;
}
.xp i{
  display:block; height:100%; width:0;
  border-radius:2px;
  background: linear-gradient(90deg, #6d6353, #35302a);
  transition: width .45s cubic-bezier(.3,.8,.3,1);
}
.xpnum{ font-size:11.5px; color:var(--ink-3); flex:none; font-variant-numeric: tabular-nums; }

.stats{ gap:14px; font-size:12px; color:var(--ink-3); letter-spacing:.04em; flex-wrap:wrap; }
.stats span{ white-space:nowrap; }
.stats .up{ color: var(--green); }
.stats .down{ color: var(--red); }

/* ---------------- 正文流 ---------------- */
.stream{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  padding: 22px 2px 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.stream::-webkit-scrollbar{ width:3px; }
.stream::-webkit-scrollbar-thumb{ background: var(--line); border-radius:2px; }

.stream p{
  margin: 0 0 1.05em;
  font-size:16.5px;
  line-height:1.95;
  color:var(--ink);
  text-align: justify;
  word-break: break-word;
  animation: rise .42s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes rise{
  from{ opacity:0; transform: translateY(7px); }
  to  { opacity:1; transform:none; }
}

.stream p.quieter{ color:var(--ink-2); }
.stream p.whisper{ color:var(--ink-3); font-size:14.5px; }
.stream p.echo{ color:var(--ink-3); font-size:15px; font-style: normal; }

.stream .divider{
  margin: 1.6em 0 1.5em;
  text-align:center;
  color:var(--ink-3);
  font-size:11.5px;
  letter-spacing:.5em;
  animation: rise .4s both;
}

.stream .note{
  margin: .9em 0 1.15em;
  padding: 9px 0 9px 12px;
  border-left: 2px solid var(--line);
  font-size: 14px;
  color: var(--ink-2);
  line-height:1.8;
  animation: rise .4s both;
}
.stream .note b{ font-weight:600; color:var(--ink); }
.stream .note .plus{ color:var(--green); }
.stream .note .minus{ color:var(--red); }
.stream .note .whisper{ color:var(--ink-3); font-size:12.5px; }
.stream .note .dot-sep{ color:var(--line); }

.stream .omen{
  margin: 1em 0 1.2em;
  padding: 12px 14px;
  border:1px solid var(--line);
  border-radius:2px;
  background: rgba(255,252,245,.6);
  font-size:15px;
  color:var(--ink-2);
  font-style: normal;
  animation: rise .45s both;
}
.stream .omen::first-line{ color:var(--ink); }

.stream .big{
  text-align:center;
  font-size: 19px;
  letter-spacing:.22em;
  color:var(--ink);
  margin: 1.5em 0 1.3em;
  animation: rise .6s both;
}

/* ---------------- 底部选项 ---------------- */
.bar{
  flex:none;
  padding: 12px 0 calc(14px + env(safe-area-inset-bottom));
  border-top:1px solid var(--line-2);
  background: linear-gradient(to top, rgba(246,241,230,.98) 60%, rgba(246,241,230,.9));
  display:flex;
  flex-direction:column;
  gap:7px;
  max-height: 52dvh;
  overflow-y:auto;
  scrollbar-width:none;
}
.bar::-webkit-scrollbar{ display:none; }

.opt{
  display:flex; align-items:baseline; gap:10px;
  width:100%;
  font: inherit;
  font-size:15.5px;
  line-height:1.6;
  text-align:left;
  color:var(--ink);
  background: rgba(255,253,247,.72);
  border:1px solid var(--line);
  border-radius:2px;
  padding: 11px 13px;
  cursor:pointer;
  transition: background .16s, border-color .16s, transform .12s;
  -webkit-tap-highlight-color: transparent;
  animation: rise .3s both;
}
.opt:nth-child(1){ animation-delay:.02s }
.opt:nth-child(2){ animation-delay:.06s }
.opt:nth-child(3){ animation-delay:.1s }
.opt:nth-child(4){ animation-delay:.14s }
.opt:nth-child(5){ animation-delay:.18s }

.opt:active{ transform: scale(.994); background: rgba(240,232,214,.95); }
@media (hover:hover){
  .opt:hover{ background:#fffdf7; border-color:#c9bda5; }
}

.opt .k{
  flex:none;
  font-size:12px;
  color:var(--ink-3);
  letter-spacing:.08em;
  min-width:1.1em;
}
.opt .t{ flex:1; min-width:0; }
.opt .h{
  flex:none;
  font-size:11px;
  color:#83765f;
  letter-spacing:.02em;
  white-space:nowrap;
}

.opt.key{ border-color:#c4b393; }
.opt.key .t{ font-weight:600; }
.opt.key .k{ color: var(--red); }

.opt.dim{ color:var(--ink-2); }
.opt.dim .t{ font-size:14.5px; }

.bar .hint{
  font-size:12px; color:var(--ink-3);
  text-align:center; letter-spacing:.05em;
  padding:2px 0 0;
}

.bar .ask{ display:flex; gap:8px; }
.bar input[type=text]{
  flex:1; min-width:0;
  font: inherit; font-size:16px;
  color:var(--ink);
  background: rgba(255,253,247,.9);
  border:1px solid var(--line);
  border-radius:2px;
  padding: 10px 12px;
  outline:none;
}
.bar input[type=text]:focus{ border-color:#b8a888; background:#fffdf7; }
.bar input[type=text]::placeholder{ color:var(--ink-3); }

.bar .go{
  flex:none;
  font: inherit; font-size:15px;
  color:#fbf7ee;
  background: var(--ink);
  border:1px solid var(--ink);
  border-radius:2px;
  padding: 10px 18px;
  cursor:pointer;
  letter-spacing:.1em;
  -webkit-tap-highlight-color: transparent;
}
.bar .go:active{ opacity:.84; }

/* ---------------- 弹层 ---------------- */
.sheet{
  position:fixed; inset:0; z-index:50;
  background: rgba(42,37,31,.34);
  display:flex; align-items:center; justify-content:center;
  padding: 24px;
  animation: fade .2s both;
  backdrop-filter: blur(2px);
}
@keyframes fade{ from{opacity:0} to{opacity:1} }

.sheet-card{
  width:100%; max-width: 400px;
  max-height: 76dvh;
  overflow-y:auto;
  background: var(--paper);
  border:1px solid var(--line);
  border-radius:3px;
  box-shadow: var(--shadow);
  padding: 22px 20px 16px;
  animation: pop .26s cubic-bezier(.2,.8,.3,1) both;
}
@keyframes pop{
  from{ opacity:0; transform: translateY(10px) scale(.985); }
  to  { opacity:1; transform:none; }
}

.sheet-card h3{
  margin:0 0 3px;
  font-size:15px; font-weight:600; letter-spacing:.14em;
}
.sheet-card .sub{
  font-size:12px; color:var(--ink-3);
  letter-spacing:.04em; margin-bottom:16px;
}
.sheet-card .row{
  display:flex; align-items:center; justify-content:space-between;
  padding: 10px 0;
  border-top:1px solid var(--line-2);
  font-size:14.5px;
}
.sheet-card .row .rk{ color:var(--ink-3); font-size:12px; margin-right:8px; font-variant-numeric:tabular-nums; }
.sheet-card .row .nm{ flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sheet-card .row .vl{ color:var(--ink-2); font-size:12.5px; letter-spacing:.03em; }
.sheet-card .row.me{ color:var(--red); }
.sheet-card .row.me .vl{ color:var(--red-2); }

.sheet-card .acts{ display:flex; gap:8px; margin-top:16px; }
.sheet-card .acts button{
  flex:1;
  font: inherit; font-size:14px;
  padding: 10px 0;
  border:1px solid var(--line);
  background: rgba(255,253,247,.8);
  color:var(--ink);
  border-radius:2px; cursor:pointer;
  letter-spacing:.08em;
}
.sheet-card .acts button:active{ background:var(--paper-2); }
.sheet-card .acts button.warn{ color:var(--red); border-color:#d9bdb6; }
.sheet-card .acts button:disabled{ opacity:.45; }

.sheet-card .empty{
  text-align:center; color:var(--ink-3);
  font-size:13px; padding: 22px 0;
}

.sheet-card .tip{
  font-size:13.5px; line-height:1.9;
  color:var(--ink-2);
  margin:0 0 11px;
  padding-left:11px;
  border-left:2px solid var(--line);
}
.sheet-card .tip b{ color:var(--ink); font-weight:600; }

/* 移动端收紧 */
@media (max-width: 480px){
  .frame{ padding:0 16px; padding-left:max(16px,env(safe-area-inset-left)); padding-right:max(16px,env(safe-area-inset-right)); }
  .stream p{ font-size:16px; line-height:1.92; }
  .bar{ gap:6px; }
  .opt{ font-size:15px; padding:10px 12px; gap:8px; }
  .opt .h{ font-size:10.5px; letter-spacing:0; color:#8a7d66; }
  .stats{ gap:11px; font-size:11.5px; }
}

@media (min-width: 700px){
  .frame{ padding: 0 28px; }
  .stream{ padding-top:30px; }
  .stream p{ font-size:17px; }
}
