:root{
  --bg1:#0b1020;
  --bg2:#131b2e;
  --panel:#0f1629cc;
  --panel2:#101a33cc;
  --stroke:#2a3556;
  --text:#e9eefc;
  --muted:#b7c4ffcc;
  --muted2:#b7c4ff88;
  --danger:#ff5a6e;
  --good:#53ffa3;
  --warn:#ffd36e;
  --shadow: 0 18px 60px rgba(0,0,0,.45);
  --radius: 18px;
  --radius2: 14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color:var(--text);
  background: radial-gradient(1200px 600px at 15% 20%, #23356a55, transparent 60%),
              radial-gradient(900px 500px at 75% 10%, #6b2c8b33, transparent 60%),
              linear-gradient(180deg, var(--bg1), var(--bg2));
  overflow-x:hidden;
}

.bg{
  position:fixed;
  inset:-40px;
  background:
    radial-gradient(800px 300px at 40% 80%, #35ffb922, transparent 60%),
    radial-gradient(900px 500px at 80% 60%, #ffd36e1f, transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cpath d='M0 40 H120' stroke='%232a3556' stroke-width='1' opacity='.22'/%3E%3Cpath d='M0 80 H120' stroke='%232a3556' stroke-width='1' opacity='.18'/%3E%3Cpath d='M40 0 V120' stroke='%232a3556' stroke-width='1' opacity='.12'/%3E%3Cpath d='M80 0 V120' stroke='%232a3556' stroke-width='1' opacity='.09'/%3E%3C/svg%3E");
  pointer-events:none;
  filter: blur(.2px);
  opacity:.9;
}

.topbar{
  position:sticky;
  top:0;
  z-index:5;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 18px;
  backdrop-filter: blur(10px);
  background: linear-gradient(180deg, #0b1020dd, #0b1020aa);
  border-bottom:1px solid #1f2a49;
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
}
.logo{
  width:42px;height:42px;
  display:grid;
  place-items:center;
  border-radius:14px;
  background: linear-gradient(135deg, #1f2a49, #111a32);
  border:1px solid var(--stroke);
  box-shadow: var(--shadow);
  font-size:20px;
}
.title{font-weight:800; letter-spacing:.2px;}
.subtitle{color:var(--muted2); font-size:12px; margin-top:1px;}

.controls{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.control{
  display:flex; align-items:center; gap:8px;
  padding:8px 10px;
  border:1px solid var(--stroke);
  border-radius:14px;
  background: #0f1629aa;
}
.control span{font-size:12px; color:var(--muted2);}
select{
  background:transparent;
  color:var(--text);
  border:0;
  outline:none;
  font-weight:600;
}
button{
  border:1px solid var(--stroke);
  border-radius:14px;
  background:#0f1629aa;
  color:var(--text);
  padding:10px 12px;
  font-weight:700;
  cursor:pointer;
  transition: transform .06s ease, border-color .2s ease, background .2s ease;
}
button:hover{transform: translateY(-1px); border-color:#3b4a73;}
button:active{transform: translateY(0);}
button.primary{
  background: linear-gradient(135deg, #2a4bff66, #53ffa355);
  border-color:#3b5cff;
}
button.ghost{background:#0f162955;}
button.danger{
  border-color:#ff5a6e66;
  background: #ff5a6e22;
}
button.danger:hover{border-color:#ff5a6eaa;}

.layout{
  display:grid;
  grid-template-columns: 1.35fr .85fr;
  gap:16px;
  padding:16px 18px 28px;
  max-width: 1100px;
  margin: 0 auto;
}

.panel{
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.game{padding:14px;}
.side{padding:14px;}

.stats{
  display:flex;
  gap:12px;
  align-items:stretch;
  padding:10px;
  border-radius: var(--radius2);
  border:1px solid #1f2a49;
  background:#0c1224aa;
}
.stat{min-width: 150px;}
.stat.grow{flex:1;}
.statLabel{
  color:var(--muted2);
  font-size:12px;
  margin-bottom:8px;
}
.hearts{display:flex; gap:6px; align-items:center; min-height:26px;}
.heart{
  width:22px;height:22px;
  display:grid; place-items:center;
  border-radius:8px;
  border:1px solid #2a3556;
  background:#0f1629aa;
  font-size:14px;
}
.heart.full{border-color:#ff5a6e99; background:#ff5a6e22;}
.heart.empty{opacity:.35;}

.xpRow{display:flex; gap:10px; align-items:center;}
.xpBar{
  height:12px;
  flex:1;
  border-radius:999px;
  background:#0f1629;
  border:1px solid #2a3556;
  overflow:hidden;
}
.xpFill{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, #2a4bff, #53ffa3);
}
.xpText{
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
  font-family: var(--mono);
}
.pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid #2a3556;
  background:#0f162955;
  font-family: var(--mono);
}

.dialogue{
  margin-top:14px;
  padding:14px;
  border-radius: var(--radius2);
  border:1px solid #1f2a49;
  background:#0c1224aa;
}
.speakerRow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.speaker{
  font-weight:900;
  letter-spacing:.2px;
  font-size:14px;
}
.tag{
  font-family: var(--mono);
  font-size:12px;
  color:var(--muted);
  border:1px solid #2a3556;
  padding:6px 10px;
  border-radius:999px;
  background:#0f162955;
}
.line{
  margin-top:12px;
  font-size:18px;
  line-height:1.45;
  letter-spacing:.1px;
}
.hint{
  margin-top:10px;
  color:var(--muted);
  font-size:13px;
  line-height:1.4;
  border-left:3px solid #3b4a73;
  padding-left:10px;
}

.choices{
  margin-top:14px;
  display:grid;
  gap:10px;
}
.choiceBtn{
  text-align:left;
  padding:12px 12px;
  border-radius: 14px;
  border:1px solid #2a3556;
  background: #0f162955;
}
.choiceBtn .num{
  font-family: var(--mono);
  color: var(--muted2);
  margin-right:10px;
}
.choiceBtn .zh{
  display:block;
  margin-top:6px;
  color:var(--muted2);
  font-size:12px;
  line-height:1.3;
}

.choiceBtn:hover{border-color:#3b4a73; background:#111c3a88;}
.choiceBtn.good{border-color:#53ffa355;}
.choiceBtn.risky{border-color:#ffd36e55;}
.choiceBtn.bad{border-color:#ff5a6e55;}

.feedback{
  margin-top:14px;
  padding:12px;
  border-radius: 14px;
  border:1px dashed #2a3556;
  background: #0f162933;
}
.feedbackTitle{
  font-weight:900;
  font-size:13px;
}
.feedbackBody{
  margin-top:6px;
  color:var(--muted);
  line-height:1.45;
}
.loot{
  margin-top:10px;
  font-family: var(--mono);
  font-size:12px;
  color:#d9ffef;
  border:1px solid #53ffa344;
  background:#53ffa312;
  padding:8px 10px;
  border-radius: 12px;
}

.sideTitle{
  font-weight:900;
  font-size:13px;
  letter-spacing:.2px;
  color:#dfe7ff;
}
.questTitle{
  margin-top:8px;
  font-weight:900;
  font-size:16px;
}
.questBody{
  margin-top:6px;
  color:var(--muted);
  line-height:1.45;
}
.sideBlock{
  margin-top:14px;
  padding-top:14px;
  border-top:1px solid #1f2a49;
}
.bullets{
  margin:10px 0 0 18px;
  color:var(--muted);
  line-height:1.55;
}
.keys{
  margin-top:10px;
  color:var(--muted);
  line-height:1.7;
  font-family: var(--mono);
  font-size:12px;
}
kbd{
  display:inline-block;
  padding:3px 6px;
  border:1px solid #2a3556;
  border-bottom-color:#1b243f;
  border-radius:8px;
  background:#0f162955;
  margin-right:4px;
}
.footerNote{
  margin-top:14px;
  padding-top:14px;
  border-top:1px solid #1f2a49;
  color:var(--muted2);
  font-size:12px;
}

.modal{
  position:fixed;
  inset:0;
  display:grid;
  place-items:center;
  background: rgba(0,0,0,.55);
  z-index:50;
  padding:16px;
}
.modalCard{
  width:min(720px, 100%);
  border-radius: 18px;
  border:1px solid #2a3556;
  background: linear-gradient(180deg, #0f1629f0, #0b1020f0);
  box-shadow: var(--shadow);
  padding:16px;
}
.modalCard.wide{width:min(900px, 100%);}
.modalTitle{font-weight:1000; font-size:18px;}
.modalBody{margin-top:8px; color:var(--muted); line-height:1.45;}
.modalBody.subtle{color:var(--muted2); font-size:12px; margin-top:4px;}
.modalButtons{
  margin-top:14px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.modalButtons.right{justify-content:flex-end;}
.modalTop{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.notebookGrid{
  margin-top:14px;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}
.nbHeader{
  font-weight:900;
  font-size:13px;
  color:#dfe7ff;
  margin-bottom:10px;
}
.nbList{
  max-height: 340px;
  overflow:auto;
  padding-right:6px;
}
.nbItem{
  border:1px solid #2a3556;
  background:#0f162955;
  border-radius: 14px;
  padding:10px 10px;
  margin-bottom:10px;
}
.nbItem .en{font-weight:850;}
.nbItem .zh{margin-top:6px; color:var(--muted2); font-size:12px; line-height:1.3;}
.nbItem .meta{margin-top:8px; font-family: var(--mono); font-size:11px; color:var(--muted2);}

@media (max-width: 980px){
  .layout{grid-template-columns: 1fr; padding: 14px 14px 24px;}
  .stat{min-width: 120px;}
  .notebookGrid{grid-template-columns: 1fr;}
}
