/* ============================================================
 * 《油尽之日》 css/style.css
 * ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  background: #04050a; color: #cfc9b8;
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif;
  user-select: none; -webkit-user-select: none;
}
#c { position: fixed; inset: 0; display: block; }

/* ---------------- 暗角与颗粒 ---------------- */
#vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(0,0,0,.55) 78%, rgba(0,0,0,.9) 100%);
}
#vignette.chase { animation: chasePulse 0.9s infinite; }
@keyframes chasePulse {
  0%, 100% { background: radial-gradient(ellipse at center, transparent 46%, rgba(20,0,0,.5) 80%, rgba(10,0,0,.92) 100%); }
  50% { background: radial-gradient(ellipse at center, transparent 38%, rgba(46,4,0,.66) 72%, rgba(12,0,0,.96) 100%); }
}
#grain {
  position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3;
  opacity: .09; image-rendering: pixelated; mix-blend-mode: overlay;
}

/* ---------------- 开机加载 ---------------- */
#boot {
  position: fixed; inset: 0; z-index: 60; background: #04050a;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  transition: opacity .6s; font-size: 13px; letter-spacing: 2px; color: #8a8676;
}
#boot:not(.on) { opacity: 0; pointer-events: none; }
#boot-bar-wrap { width: 240px; height: 3px; background: #16181f; }
#boot-bar { width: 0%; height: 100%; background: #9c6b2f; transition: width .15s; }
#boot h1 { font-size: 15px; letter-spacing: 8px; color: #6d6a5e; font-weight: normal; }

/* ---------------- 标题屏 ---------------- */
#title {
  position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 26px;
  background: linear-gradient(rgba(4,5,10,.2), rgba(4,5,10,.72));
  opacity: 0; pointer-events: none; transition: opacity 1s;
}
#title.on { opacity: 1; pointer-events: auto; }
.t-name {
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  font-size: clamp(54px, 9vw, 108px); letter-spacing: .28em; color: #d8cdb2;
  text-shadow: 0 0 34px rgba(156, 107, 47, .35), 0 2px 0 #000;
  animation: tBreath 4s ease-in-out infinite;
}
@keyframes tBreath { 0%,100% { opacity: .92; } 50% { opacity: 1; text-shadow: 0 0 50px rgba(196,140,60,.5), 0 2px 0 #000; } }
.t-sub { letter-spacing: .5em; color: #6f6a5a; font-size: 14px; }
#btn-start {
  margin-top: 10px; padding: 13px 64px; font-size: 18px; letter-spacing: .4em;
  background: transparent; color: #cfc4a6; border: 1px solid #5c523a; cursor: pointer;
  transition: all .25s; font-family: inherit;
}
#btn-start:hover { background: #1a1710; border-color: #9c6b2f; color: #f0e6c8; box-shadow: 0 0 24px rgba(156,107,47,.25); }
.t-controls { display: grid; grid-template-columns: auto auto; gap: 4px 18px; font-size: 12.5px; color: #7d7866; }
.t-controls b { color: #b3a887; font-weight: normal; }
#t-endings { font-size: 13px; letter-spacing: 3px; color: #8f6f3a; }
.t-foot { position: absolute; bottom: 18px; font-size: 11px; color: #514e42; text-align: center; line-height: 1.8; }
.t-warn { display: none; color: #9c5b3a; font-size: 13px; letter-spacing: 2px; }
@media (pointer: coarse) { .t-warn { display: block; } }

/* ---------------- 信件 ---------------- */
#letter {
  position: fixed; inset: 0; z-index: 15; display: flex; align-items: center; justify-content: center;
  background: rgba(2,3,6,.82); opacity: 0; pointer-events: none; transition: opacity .5s;
}
#letter.on { opacity: 1; pointer-events: auto; }
.letter-paper, .note-paper {
  width: min(600px, 88vw); max-height: 82vh; overflow-y: auto;
  background: #201d17; background-image: var(--paperImg);
  background-repeat: no-repeat; background-size: 100% 100%;
  color: #2c2820; padding: 44px 48px; transform: rotate(-.5deg);
  box-shadow: 0 22px 70px rgba(0,0,0,.8); border: 1px solid #15130e;
  font-size: 16.5px; line-height: 2.05; letter-spacing: .5px;
}
.letter-paper { font-family: "Noto Serif SC", "Songti SC", "SimSun", serif; }
.letter-paper .caret { display: inline-block; width: 9px; height: 18px; background: #2c2820; vertical-align: -3px; animation: caret .7s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
#letter-hint { position: absolute; bottom: 7%; left: 50%; transform: translateX(-50%); color: #8a8676; font-size: 13px; letter-spacing: 3px; opacity: 0; transition: opacity .8s; }
.keyline { margin-top: 18px; font-size: 13.5px; color: #5c543c; display: flex; align-items: center; gap: 8px; }
.keyline svg { flex: none; }

/* ---------------- HUD ---------------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; opacity: 0; transition: opacity .8s; }
body.playing #hud { opacity: 1; }
#objective {
  position: absolute; top: 26px; left: 30px; max-width: 46vw;
  font-size: 14px; letter-spacing: 2px; color: #b7ad8d; text-shadow: 0 1px 3px #000;
  transition: opacity .4s; line-height: 1.7;
}
#objective::before { content: "▸ "; color: #9c6b2f; }
#pips { position: absolute; top: 58px; left: 31px; letter-spacing: 9px; font-size: 13px; }
#pips .pip { color: #3c3a30; text-shadow: 0 1px 2px #000; }
#pips .pip.on { color: #c9973f; }
#battery-wrap {
  position: absolute; top: 26px; right: 30px; width: 74px; height: 7px;
  border: 1px solid #4c4a3e; padding: 1px; background: rgba(0,0,0,.4);
}
#battery { height: 100%; width: 100%; background: #7fa06a; transition: width .3s; }
#battery.low { background: #b0482f; }
.batt-icon { position: absolute; top: 24px; right: 110px; font-size: 11px; color: #7d7866; letter-spacing: 1px; }
#stamina-wrap {
  position: absolute; left: 30px; bottom: 30px; width: 110px; height: 4px;
  background: rgba(20,20,16,.7); border: 1px solid #34322a; padding: 1px; opacity: .85;
}
#stamina-bar { height: 100%; width: 100%; background: #8d8468; transition: width .1s linear; }
#hint-keys { position: absolute; right: 30px; bottom: 26px; font-size: 11px; color: #565340; letter-spacing: 2px; }
#subtitle {
  position: absolute; bottom: 13%; left: 50%; transform: translateX(-50%);
  max-width: 74vw; text-align: center; font-size: 17px; line-height: 1.9; letter-spacing: 1.5px;
  color: #d6ccae; text-shadow: 0 2px 6px #000, 0 0 20px rgba(0,0,0,.9);
  opacity: 0; transition: opacity .5s; font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
}
#subtitle.on { opacity: 1; }
#prompt {
  position: absolute; bottom: 24%; left: 50%; transform: translateX(-50%);
  padding: 7px 20px; font-size: 15px; letter-spacing: 2px; color: #e8dcb4;
  background: rgba(8,8,6,.66); border: 1px solid rgba(156,107,47,.4);
  opacity: 0; transition: opacity .18s; white-space: nowrap;
}
#crosshair {
  position: absolute; top: 50%; left: 50%; width: 4px; height: 4px; margin: -2px;
  background: rgba(220,210,180,.75); border-radius: 50%;
}
#crosshair.hit { background: transparent; width: 10px; height: 10px; margin: -5px; border: 1.5px solid #d8b45a; border-radius: 0; transform: rotate(45deg); }

/* ---------------- 纸条 ---------------- */
#note {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  background: rgba(2,3,6,.78); opacity: 0; pointer-events: none; transition: opacity .3s;
}
#note.on { opacity: 1; pointer-events: auto; }
.note-paper { transform: rotate(.6deg); cursor: default; }
#note-title {
  font-size: 19px; font-weight: bold; letter-spacing: 4px; margin-bottom: 4px; color: #26221a;
  border-bottom: 1px solid rgba(60,50,30,.35); padding-bottom: 10px;
}
#note-body { white-space: normal; word-break: break-word; }
.note-close { text-align: center; margin-top: 22px; font-size: 12px; color: #7a705a; letter-spacing: 3px; }

/* ---------------- 手机 ---------------- */
#phone {
  position: fixed; z-index: 21; right: 4vw; top: 50%; transform: translateY(-50%) scale(.97);
  width: 300px; height: 520px; background: #07090c; border: 2px solid #1c2128; border-radius: 26px;
  box-shadow: 0 30px 90px rgba(0,0,0,.85), inset 0 0 24px #000; padding: 20px 16px;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
#phone.on { opacity: 1; pointer-events: auto; transform: translateY(-50%) scale(1); }
.p-head { display: flex; justify-content: space-between; font-size: 12px; color: #6f7d6f; letter-spacing: 2px; border-bottom: 1px solid #131a15; padding-bottom: 10px; }
.p-head .sig { color: #54413a; }
#p-batt { color: #7fa06a; } #p-batt.low { color: #b0482f; }
#p-list { height: 400px; overflow-y: auto; margin-top: 12px; font-size: 13.5px; }
.p-row { padding: 9px 8px; color: #9aa08e; border-bottom: 1px solid #0d1110; line-height: 1.5; }
.p-row.p-h { color: #4c5548; letter-spacing: 4px; font-size: 11.5px; }
.p-row.item { color: #c2c8ae; cursor: pointer; }
.p-row.item:hover { background: #0d130d; color: #e4e6cf; }
.p-row.item b { color: #8f6f3a; font-weight: normal; margin-right: 4px; }
.p-row.item i { font-style: normal; color: #5e6b52; float: right; font-size: 12px; }
.p-row.lock { color: #3c4238; } .p-row.lock i { font-style: normal; color: #39413a; float: right; font-size: 12px; }
.p-foot { text-align: center; color: #3a4038; font-size: 11px; letter-spacing: 2px; margin-top: 8px; }
#p-list::-webkit-scrollbar, .letter-paper::-webkit-scrollbar, .note-paper::-webkit-scrollbar { width: 5px; }
#p-list::-webkit-scrollbar-thumb, .letter-paper::-webkit-scrollbar-thumb, .note-paper::-webkit-scrollbar-thumb { background: #3c3c30; }

/* ---------------- 推送 ---------------- */
#push {
  position: fixed; top: 12%; left: 50%; transform: translate(-50%, -12px); z-index: 22;
  max-width: 76vw; padding: 12px 22px; background: rgba(12,16,12,.92);
  border: 1px solid #2e4430; color: #a8c8a0; font-size: 13.5px; letter-spacing: 1px;
  opacity: 0; pointer-events: none; transition: all .4s;
}
#push.on { opacity: 1; transform: translate(-50%, 0); }
#push::before { content: "推送 · 灰岭通"; color: #5c7a58; margin-right: 10px; font-size: 11px; }

/* ---------------- 暂停 / 重试 ---------------- */
.panel {
  position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center;
  background: rgba(2,3,6,.86); opacity: 0; pointer-events: none; transition: opacity .3s;
}
.panel.on { opacity: 1; pointer-events: auto; }
.panel-in {
  width: min(420px, 90vw); background: #0b0d12; border: 1px solid #262b33; padding: 36px 40px;
  text-align: center;
}
.panel-in h2 { font-size: 20px; letter-spacing: 6px; color: #cfc4a6; font-weight: normal; margin-bottom: 24px; }
.panel-btn {
  display: block; width: 100%; margin: 10px 0; padding: 12px; background: #11141b;
  border: 1px solid #2b313b; color: #b7ad8d; font-size: 15px; letter-spacing: 3px; cursor: pointer;
  transition: all .2s; font-family: inherit;
}
.panel-btn:hover { background: #1a1f29; color: #e8dcb4; border-color: #9c6b2f; }
.vol-row { margin-top: 18px; font-size: 12px; color: #6f6a5a; letter-spacing: 2px; }
#vol-slider { width: 100%; margin-top: 8px; accent-color: #9c6b2f; }
#retry { z-index: 32; }
#retry-text { font-size: 15px; color: #c9a98a; line-height: 2; margin-bottom: 18px; letter-spacing: 1px; }

/* ---------------- 结局 ---------------- */
#ending {
  position: fixed; inset: 0; z-index: 40; background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 1.2s;
}
#ending.on { opacity: 1; pointer-events: auto; }
#ending.dawn { background: linear-gradient(#3a4a56, #74838c 55%, #a9a894); }
#end-lines { max-width: 76vw; text-align: center; }
#end-lines p {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%);
  width: max-content; max-width: 76vw; font-size: clamp(17px, 2.3vw, 24px); line-height: 2.2; letter-spacing: 3px;
  color: #cfc5a8; opacity: 0; transition: opacity .7s; text-shadow: 0 2px 10px #000;
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
}
#ending.dawn #end-lines p { color: #2c2f2c; text-shadow: 0 1px 8px rgba(255,255,255,.35); }
#end-lines p.on { opacity: 1; }
#end-card { text-align: center; opacity: 0; transition: opacity 1s; }
#end-card.on { opacity: 1; }
#end-title {
  font-size: clamp(34px, 5vw, 56px); letter-spacing: .3em; margin-bottom: 18px;
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
}
#end-title.stay { color: #a8483a; text-shadow: 0 0 30px rgba(120, 20, 10, .5); }
#end-title.escape { color: #e6e2cf; text-shadow: 0 0 30px rgba(230,220,180,.4); }
#ending.dawn #end-title.escape { color: #23261f; text-shadow: none; }
#end-stats { font-size: 14px; letter-spacing: 3px; color: #8a8676; margin-bottom: 34px; }
#ending.dawn #end-stats { color: #3c4038; }
#end-card .panel-btn { display: inline-block; width: auto; padding: 12px 54px; background: transparent; }

/* ---------------- 调试条 ---------------- */
#debug {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 55; display: none; gap: 6px;
  padding: 6px 10px; background: rgba(8,10,8,.85); flex-wrap: wrap; font-size: 11px;
}
#debug button {
  background: #141814; color: #9ab08a; border: 1px solid #2c362c; padding: 4px 9px;
  cursor: pointer; font-size: 11px; font-family: inherit;
}
#debug button:hover { background: #1e261e; }
#debug .dbg-note { color: #56604f; align-self: center; }

/* ---------------- 入场动画 ---------------- */
#intro-ui { position: fixed; inset: 0; z-index: 9; pointer-events: none; display: none; }
#intro-ui.on { display: block; }
#intro-card {
  position: absolute; top: 36%; left: 0; width: 100%; transform: translateY(-50%);
  text-align: center; opacity: 0; transition: opacity .55s;
}
#intro-card.on { opacity: 1; }
#intro-card .ic-main {
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  font-size: clamp(28px, 5.2vw, 60px); letter-spacing: .3em; color: #f4f2ea;
  text-shadow: 0 0 34px rgba(240,235,210,.32), 0 2px 8px #000;
}
#intro-card .ic-sub {
  margin-top: 15px; font-size: clamp(11px, 1.5vw, 15px); letter-spacing: .34em;
  color: #c9c6ba; text-shadow: 0 1px 4px #000;
}
#intro-skip {
  position: absolute; right: 28px; bottom: 24px; pointer-events: auto;
  background: rgba(8,8,6,.5); color: #8f8a78; border: 1px solid #3c3a30;
  padding: 8px 20px; font-size: 12px; letter-spacing: 4px; cursor: pointer;
  font-family: inherit; opacity: .7; transition: all .25s;
}
#intro-skip:hover { color: #e8dcb4; border-color: #9c6b2f; opacity: 1; }

/* ---------------- 全屏黑场 ---------------- */
#fade {
  position: fixed; inset: 0; z-index: 50; background: #000; opacity: 1;
  pointer-events: none; transition: opacity 1.6s;
}
