* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --neon-pink: #ff2d95;
  --neon-cyan: #2de5ff;
  --neon-green: #2dffa0;
  --neon-amber: #ffc24d;
  --bg: #05060d;
  --panel: rgba(10, 12, 26, .92);
  --line: rgba(45, 229, 255, .25);
}
html, body { height: 100%; overflow: hidden; background: var(--bg); color: #e8ecff;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; }
#scene { position: fixed; inset: 0; display: block; }
.hidden { display: none !important; }

/* ---------- 顶栏 ---------- */
#topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 18px; background: linear-gradient(to bottom, rgba(5,6,13,.85), transparent); }
.tb-title { font-weight: 700; letter-spacing: 2px; color: var(--neon-cyan);
  text-shadow: 0 0 12px rgba(45,229,255,.7); margin-right: 14px; }
.tb-chapter { font-size: 13px; color: #9aa3c7; }
.tb-right { display: flex; align-items: center; gap: 10px; }
.tb-clock { font-family: "Courier New", monospace; font-size: 20px; font-weight: 700;
  color: var(--neon-pink); text-shadow: 0 0 10px rgba(255,45,149,.8); margin-right: 6px; }
.tb-btn { background: rgba(45,229,255,.08); border: 1px solid var(--line); color: #cfeaff;
  padding: 6px 14px; border-radius: 18px; cursor: pointer; font-size: 13px; }
.tb-btn:hover { background: rgba(45,229,255,.2); }
.tb-btn em { font-style: normal; color: var(--neon-amber); }

.tb-role { font-size: 13px; color: var(--neon-amber); margin-left: 10px;
  border: 1px solid rgba(255,194,77,.4); padding: 2px 10px; border-radius: 12px; }

/* ---------- 选择角色 ---------- */
.role-box { width: min(920px, 94vw); max-height: 92vh; overflow-y: auto; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px;
  box-shadow: 0 0 60px rgba(45,229,255,.12); }
.role-box h2 { font-size: 24px; letter-spacing: 5px; color: #fff;
  text-shadow: 0 0 16px rgba(255,45,149,.6); }
.role-sub { margin: 12px 0 6px; color: #9aa3c7; font-size: 14px; line-height: 1.8; }
.role-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 18px 0 8px; }
.role-card { cursor: pointer; background: #0a0d20; border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px; padding: 10px; transition: all .22s; }
.role-card img { width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: 8px; }
.role-card .r-name { margin-top: 8px; font-size: 15px; color: #e8ecff; }
.role-card .r-title { font-size: 11px; color: #7a82a8; margin-top: 2px; }
.role-card .r-line { font-size: 11px; color: #8a92b8; line-height: 1.6; margin-top: 6px; }
.role-card:hover { border-color: var(--neon-cyan); transform: translateY(-3px); }
.role-card.sel { border-color: var(--neon-amber); transform: translateY(-5px);
  box-shadow: 0 8px 26px rgba(255,194,77,.35); }
.role-card.sel .r-name { color: var(--neon-amber); }
#roleGo:disabled { opacity: .35; cursor: not-allowed; }
@media (max-width: 700px) { .role-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- 碎片栏 ---------- */
#fragbar { position: fixed; left: 18px; bottom: 18px; z-index: 20; display: flex; gap: 8px; }
.frag { width: 38px; height: 38px; border-radius: 8px; display: flex; align-items: center;
  justify-content: center; font-size: 17px; border: 1px solid rgba(255,255,255,.12);
  color: #3a4060; background: rgba(8,10,22,.7); transition: all .4s; }
.frag.got { color: var(--neon-amber); border-color: var(--neon-amber);
  box-shadow: 0 0 12px rgba(255,194,77,.45); }

#fader { position: fixed; inset: 0; z-index: 40; background: #000; opacity: 0;
  pointer-events: none; transition: opacity .3s; }

/* ---------- toast / hint ---------- */
#toast { position: fixed; top: 64px; left: 50%; transform: translateX(-50%) translateY(-8px);
  z-index: 60; background: var(--panel); border: 1px solid var(--neon-amber); color: #ffe8c0;
  padding: 10px 22px; border-radius: 24px; font-size: 14px; opacity: 0; pointer-events: none;
  transition: all .35s; box-shadow: 0 0 20px rgba(255,194,77,.25); max-width: 80vw; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#hint { position: fixed; bottom: 78px; left: 50%; transform: translateX(-50%); z-index: 15;
  color: #cfeaff; font-size: 14px; background: rgba(8,10,22,.65); padding: 8px 20px;
  border-radius: 20px; border: 1px solid var(--line); animation: pulse 2s infinite; }
#ctrlHelp { position: fixed; right: 14px; bottom: 14px; z-index: 15; color: #8a92b8;
  font-size: 12px; background: rgba(8,10,22,.55); padding: 6px 14px; border-radius: 16px;
  border: 1px solid rgba(255,255,255,.08); pointer-events: none; letter-spacing: .5px; }
@media (max-width: 700px) { #ctrlHelp { display: none; } }
@keyframes pulse { 50% { opacity: .55; } }

/* ---------- 移动端虚拟控制 ---------- */
#mobileCtl { position: fixed; inset: 0; z-index: 18; pointer-events: none; }
#joy { position: absolute; left: 18px; bottom: 66px; width: 112px; height: 112px; border-radius: 50%;
  background: rgba(20,24,48,.35); border: 1px solid rgba(45,229,255,.35);
  pointer-events: auto; touch-action: none; }
#joyKnob { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; border-radius: 50%;
  background: rgba(45,229,255,.3); border: 1px solid rgba(45,229,255,.7);
  transform: translate(-50%, -50%); transition: background .15s; }
#joy.active #joyKnob { background: rgba(45,229,255,.55); }
#elevBtns { position: absolute; right: 14px; bottom: 72px; display: flex; flex-direction: column;
  gap: 12px; pointer-events: auto; }
#elevBtns button { width: 54px; height: 54px; border-radius: 50%; background: rgba(20,24,48,.45);
  border: 1px solid rgba(255,194,77,.5); color: #ffc24d; font-size: 18px; touch-action: none; }
#elevBtns button:active { background: rgba(255,194,77,.3); }

/* ---------- 窄屏排版 ---------- */
@media (max-width: 700px) {
  #topbar { padding: 6px 8px; }
  .tb-title { font-size: 13px; letter-spacing: 1px; margin-right: 6px; }
  .tb-chapter { font-size: 11px; }
  .tb-role { font-size: 11px; padding: 1px 7px; margin-left: 4px; }
  .tb-clock { font-size: 15px; margin-right: 2px; }
  .tb-btn { padding: 4px 9px; font-size: 12px; }
  #hint { bottom: 196px; font-size: 13px; max-width: 86vw; text-align: center; }
  #fragbar { bottom: 14px; left: 14px; gap: 6px; }
  .frag { width: 32px; height: 32px; font-size: 14px; }
  .p-input { width: min(260px, 76vw); }
  .vote-opts { flex-wrap: wrap; }
  .puzzle-box, .story-box { padding: 14px; }
}

/* ---------- 开始页 ---------- */
#startScreen { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center;
  justify-content: center; background: radial-gradient(ellipse at 50% 30%, #141a3d 0%, #05060d 70%); }
.start-inner { text-align: center; max-width: 760px; padding: 24px; }
.start-inner h1 { font-size: 52px; letter-spacing: 8px; color: #fff;
  text-shadow: 0 0 18px var(--neon-pink), 0 0 50px rgba(255,45,149,.5); }
.start-inner h1 span { color: var(--neon-cyan); text-shadow: 0 0 18px var(--neon-cyan); }
.start-sub { margin: 22px 0 28px; color: #aab2d8; line-height: 2; font-size: 15px; }
.start-cast { display: flex; justify-content: center; gap: 12px; margin-bottom: 32px; }
.start-cast img { width: 86px; height: 108px; object-fit: cover; border-radius: 10px;
  border: 1px solid rgba(255,255,255,.15); filter: saturate(.85);
  transition: all .3s; }
.start-cast img:hover { transform: translateY(-6px); border-color: var(--neon-cyan);
  box-shadow: 0 8px 24px rgba(45,229,255,.35); }
#btnStart { font-size: 18px; letter-spacing: 6px; padding: 14px 54px; cursor: pointer;
  color: #fff; background: transparent; border: 1px solid var(--neon-pink); border-radius: 30px;
  box-shadow: 0 0 18px rgba(255,45,149,.4), inset 0 0 18px rgba(255,45,149,.15);
  transition: all .3s; }
#btnStart:hover { background: rgba(255,45,149,.18); box-shadow: 0 0 34px rgba(255,45,149,.7); }
.start-tip { margin-top: 20px; font-size: 12px; color: #5a6288; letter-spacing: 2px; }

/* ---------- 通用浮层 ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center;
  justify-content: center; background: rgba(3,4,10,.72); backdrop-filter: blur(6px); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel-head h2 { font-size: 18px; color: var(--neon-cyan); letter-spacing: 3px; }
.close { background: none; border: 1px solid rgba(255,255,255,.2); color: #aab; width: 30px;
  height: 30px; border-radius: 50%; cursor: pointer; }
.close:hover { border-color: var(--neon-pink); color: var(--neon-pink); }

/* ---------- 剧情面板 ---------- */
.story-box { width: min(860px, 94vw); max-height: 92vh; background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex;
  flex-direction: column; gap: 14px; box-shadow: 0 0 60px rgba(45,229,255,.12); }
.story-imgwrap { border-radius: 10px; overflow: hidden; max-height: 52vh; display:flex; justify-content:center; background:#000; }
.story-imgwrap img { width: 100%; max-height: 52vh; object-fit: contain; }
.story-text { line-height: 1.9; font-size: 15px; color: #dfe5ff; white-space: pre-line;
  max-height: 24vh; overflow-y: auto; padding: 0 4px; }
.story-foot { display: flex; justify-content: space-between; align-items: center; }
.story-foot span { font-size: 12px; color: #5a6288; }
#storyNext, .btn-main { background: linear-gradient(135deg, rgba(255,45,149,.85), rgba(150,45,255,.85));
  color: #fff; border: none; padding: 10px 30px; border-radius: 22px; font-size: 15px;
  cursor: pointer; letter-spacing: 2px; box-shadow: 0 4px 18px rgba(255,45,149,.35); }
#storyNext:hover, .btn-main:hover { filter: brightness(1.2); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: #cfeaff;
  padding: 10px 24px; border-radius: 22px; font-size: 14px; cursor: pointer; }
.btn-ghost:hover { background: rgba(45,229,255,.12); }

/* ---------- 谜题面板 ---------- */
.puzzle-box { width: min(820px, 94vw); max-height: 92vh; overflow-y: auto; background: var(--panel);
  border: 1px solid var(--neon-pink); border-radius: 16px; padding: 26px;
  box-shadow: 0 0 60px rgba(255,45,149,.18); }
.puzzle-box h2 { color: var(--neon-pink); letter-spacing: 3px; font-size: 19px; margin-bottom: 6px; }
.puzzle-box .p-sub { color: #9aa3c7; font-size: 13px; margin-bottom: 18px; line-height: 1.8; }
.p-row { display: flex; gap: 10px; justify-content: center; align-items: center; margin: 16px 0; flex-wrap: wrap; }
.p-input { background: #0a0d20; border: 1px solid var(--line); color: #fff; font-size: 20px;
  letter-spacing: 6px; text-align: center; padding: 12px 16px; border-radius: 10px; width: 260px; }
.p-input:focus { outline: none; border-color: var(--neon-cyan); box-shadow: 0 0 14px rgba(45,229,255,.3); }
.p-error { color: #ff6b6b; font-size: 13px; text-align: center; min-height: 18px; margin-top: 6px; }

/* 序章卡片 */
.tail-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 14px 0; }
.tail-card { background: #0a0d20; border: 1px solid rgba(255,255,255,.1); border-radius: 10px;
  padding: 10px; text-align: center; }
.tail-card img { width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: 6px; }
.tail-card .tno { color: var(--neon-amber); font-size: 15px; margin: 6px 0 2px; }
.tail-card .tname { font-size: 13px; color: #cfeaff; margin-bottom: 6px; }
.tail-card .ttail { font-size: 12px; color: #9aa3c7; line-height: 1.6; }
.tail-card .ttail b { color: var(--neon-cyan); font-size: 14px; }

/* L1 海报扫描 */
.poster-wrap { position: relative; width: min(520px, 86vw); margin: 12px auto; aspect-ratio: 3/4;
  border-radius: 10px; overflow: hidden; cursor: none; background: #12121e;
  border: 1px solid rgba(255,255,255,.12); }
.poster-base, .poster-hidden { position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; }
.poster-base { background: linear-gradient(160deg, #1c1430, #251a3f 60%, #14101f); }
.poster-base h3 { font-size: 34px; letter-spacing: 6px; color: #ffd9ec;
  text-shadow: 0 0 16px rgba(255,45,149,.8); }
.poster-base .strike { font-size: 26px; color: #6b6480; text-decoration: line-through 3px #443c5c; letter-spacing: 4px; }
.poster-base p { color: #8d84ad; font-size: 13px; letter-spacing: 2px; }
.poster-hidden { background: linear-gradient(160deg, #031d22, #06303a 60%, #02161c);
  clip-path: circle(0px at 50% 50%); }
.poster-hidden h3 { font-size: 34px; letter-spacing: 6px; color: var(--neon-green);
  text-shadow: 0 0 18px rgba(45,255,160,.9); }
.poster-hidden .strike { font-size: 30px; color: var(--neon-green); letter-spacing: 4px;
  text-shadow: 0 0 18px rgba(45,255,160,.9); }
.poster-hidden p { color: #9be8c4; font-size: 13px; letter-spacing: 1px; max-width: 80%; text-align: center; line-height: 1.8; }
.lens-tip { text-align: center; color: #9aa3c7; font-size: 13px; }

/* 绿洲配方 */
.recipe-pool, .recipe-slots { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 12px 0; }
.recipe-card { background: #0a0d20; border: 1px solid rgba(255,255,255,.14); border-radius: 10px;
  padding: 10px 14px; cursor: pointer; text-align: center; transition: all .2s; min-width: 110px; }
.recipe-card:hover { border-color: var(--neon-green); box-shadow: 0 0 12px rgba(45,255,160,.3); }
.recipe-card.used { opacity: .25; pointer-events: none; }
.recipe-card .r-owner { font-size: 11px; color: #7a82a8; }
.recipe-card .r-name { font-size: 15px; color: #e8ecff; margin: 4px 0; }
.recipe-card .r-num { font-size: 18px; color: var(--neon-amber); font-weight: 700; }
.recipe-slot { width: 64px; height: 64px; border: 1px dashed rgba(45,255,160,.5); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 24px; color: var(--neon-green);
  background: rgba(45,255,160,.05); cursor: pointer; }
.recipe-slot .s-label { position: absolute; transform: translateY(46px); font-size: 11px; color: #7a82a8; }
.recipe-slot-wrap { position: relative; display: flex; flex-direction: column; align-items: center; }

/* KEZEE 监控 */
.clip-pool { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 14px 0; }
.clip-card { background: #0a0d20; border: 1px solid rgba(255,255,255,.14); border-radius: 10px;
  padding: 12px 10px; cursor: pointer; transition: all .2s; position: relative; }
.clip-card:hover { border-color: var(--neon-cyan); }
.clip-card.picked { opacity: .3; pointer-events: none; }
.clip-card .c-id { font-size: 18px; color: var(--neon-pink); font-weight: 700; }
.clip-card .c-light { font-size: 13px; color: var(--neon-cyan); margin: 6px 0; }
.clip-card .c-desc { font-size: 12px; color: #9aa3c7; line-height: 1.6; }
.clip-card .c-time { font-size: 11px; color: #555d80; margin-top: 6px; font-family: monospace; }
.clip-seq { text-align: center; font-size: 26px; letter-spacing: 12px; color: var(--neon-amber);
  min-height: 40px; font-family: monospace; }

/* 抉择 */
.choice-row { display: flex; gap: 16px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.choice-card { flex: 1; min-width: 220px; max-width: 320px; background: #0a0d20; border-radius: 14px;
  padding: 20px; cursor: pointer; border: 1px solid rgba(255,255,255,.12); transition: all .25s; }
.choice-card:hover { transform: translateY(-4px); }
.choice-card.warm:hover { border-color: var(--neon-amber); box-shadow: 0 8px 30px rgba(255,194,77,.25); }
.choice-card.cold:hover { border-color: #6b7bff; box-shadow: 0 8px 30px rgba(107,123,255,.25); }
.choice-card h3 { font-size: 17px; margin-bottom: 8px; color: #fff; }
.choice-card p { font-size: 13px; color: #9aa3c7; line-height: 1.8; }

/* friends 照片 */
.photo-wrap { position: relative; width: min(560px, 88vw); margin: 10px auto; border-radius: 10px; overflow: hidden; }
.photo-wrap img { width: 100%; display: block; }
.photo-clock { position: absolute; top: 10px; right: 12px; background: rgba(0,0,0,.65);
  border: 1px solid var(--neon-pink); color: var(--neon-pink); font-family: monospace;
  font-size: 22px; padding: 4px 12px; border-radius: 8px; text-shadow: 0 0 12px rgba(255,45,149,.9);
  animation: flicker 3s infinite; }
@keyframes flicker { 0%,93%,100%{opacity:1} 94%,96%{opacity:.4} }
video { width: 100%; border-radius: 10px; background: #000; max-height: 50vh; }

/* 终章 */
.vote-opts { display: flex; gap: 14px; justify-content: center; margin-top: 16px; }
.dialog-line { background: rgba(255,255,255,.04); border-left: 3px solid var(--neon-cyan);
  padding: 10px 14px; margin: 8px 0; border-radius: 0 8px 8px 0; font-size: 14px; line-height: 1.8; }
.dialog-line b { color: var(--neon-cyan); margin-right: 8px; }
.evi-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; max-height: 40vh; overflow-y: auto; }
.evi-item { display: flex; gap: 10px; align-items: flex-start; background: #0a0d20;
  border: 1px solid rgba(255,255,255,.12); border-radius: 10px; padding: 10px 14px; cursor: pointer; }
.evi-item.sel { border-color: var(--neon-amber); background: rgba(255,194,77,.08); }
.evi-item .e-title { font-size: 14px; color: #ffe8c0; }
.evi-item .e-body { font-size: 12px; color: #9aa3c7; margin-top: 4px; line-height: 1.6; }

/* ---------- 人物面板 ---------- */
.char-box, .journal-box { width: min(880px, 94vw); max-height: 88vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.char-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.char-grid .cg-item { cursor: pointer; text-align: center; }
.char-grid img { width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12); transition: all .25s; }
.char-grid .cg-item:hover img { border-color: var(--neon-cyan); transform: translateY(-4px); }
.char-grid .cg-name { margin-top: 8px; font-size: 14px; color: #cfeaff; }
.char-grid .cg-title { font-size: 11px; color: #7a82a8; }
.char-detail { margin-top: 18px; border-top: 1px solid rgba(255,255,255,.1); padding-top: 16px; }
.char-detail h3 { color: var(--neon-amber); margin-bottom: 8px; }
.char-detail p { font-size: 14px; line-height: 1.9; color: #cfd5f2; margin-bottom: 10px; }
.char-detail .cd-label { font-size: 12px; color: var(--neon-cyan); letter-spacing: 2px; }
.char-detail .locked { color: #555d80; font-style: italic; }

/* ---------- 线索手册 ---------- */
.journal-list { display: flex; flex-direction: column; gap: 10px; }
.j-item { background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px; padding: 12px 16px; }
.j-item .j-title { font-size: 14px; color: #ffe8c0; }
.j-item .j-body { font-size: 13px; color: #9aa3c7; margin-top: 6px; line-height: 1.8; }
.j-item.frag-item { border-color: rgba(255,194,77,.4); }
.j-empty { color: #555d80; text-align: center; padding: 30px; }

/* ---------- 结局 ---------- */
#endingPanel { background: rgba(3,4,10,.94); }
.ending-box { width: min(760px, 94vw); max-height: 94vh; overflow-y: auto; text-align: center; padding: 20px; }
.ending-box h1 { font-size: 32px; letter-spacing: 4px; margin-bottom: 18px;
  text-shadow: 0 0 24px rgba(255,194,77,.6); }
.ending-box video { max-height: 56vh; }
.ending-box p { margin: 18px auto; max-width: 620px; line-height: 2; color: #dfe5ff; font-size: 15px; }
.ending-epilogue { color: #9aa3c7 !important; font-size: 13px !important; }
#btnReplay { margin-top: 10px; background: transparent; border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan); padding: 12px 40px; border-radius: 26px; font-size: 15px;
  letter-spacing: 3px; cursor: pointer; }
#btnReplay:hover { background: rgba(45,229,255,.15); }

@media (max-width: 700px) {
  .tail-cards, .clip-pool { grid-template-columns: repeat(2, 1fr); }
  .char-grid { grid-template-columns: repeat(3, 1fr); }
  .start-inner h1 { font-size: 34px; }
  .start-cast img { width: 56px; height: 72px; }
}
