
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: #4a5e3a;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: "Noto Serif SC", "STSong", "SimSun", serif;
}
.game-wrap {
  position: relative;
  width: 360px;
  height: 640px;
  border: 2.5px solid #2a2a1e;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  overflow: hidden;
}
.top-panel {
  flex: 0 0 62%;
  background: #b8d49e;
  border-bottom: 2.5px solid #2a2a1e;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px 22px;
  overflow: hidden;
}
.top-panel.scene-bg {
  background:
    linear-gradient(rgba(184, 212, 158, 0.74), rgba(184, 212, 158, 0.74)),
    url("assets/scene-bg.jpg");
  background-size: cover;
  background-position: center;
}

.top-panel.title-bg {
  background:
    linear-gradient(rgba(255, 240, 200, 0.12), rgba(255, 240, 200, 0.12)),
    url("assets/title-bg.jpg");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
}

.top-panel.title-bg + .bottom-panel {
  background:
    linear-gradient(rgba(210, 235, 190, 0.18), rgba(210, 235, 190, 0.18)),
    url("assets/title-bg.jpg");
  background-size: cover;
  background-position: center bottom;
  background-repeat: no-repeat;
}
.top-panel.home-bg {
  background:
    linear-gradient(rgba(220, 245, 205, 0.60), rgba(220, 245, 205, 0.60)),
    url("assets/home-bg.jpg");
  background-size: cover;
  background-position: center;
}
.top-panel.scrollable { overflow-y: auto; }
.top-panel.scrollable::-webkit-scrollbar { width: 3px; }
.top-panel.scrollable::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); }

.bottom-panel {
  flex: 1;
  background: #d8ecbe;
  display: flex;
  flex-direction: column;
  padding: 14px 20px 16px;
  overflow-y: auto;
}
.bottom-panel::-webkit-scrollbar { width: 3px; }
.bottom-panel::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); }
.status-bar {
  display: none;
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 20;
  gap: 4px;
}
.status-bar.visible { display: flex; }
.status-btn {
  padding: 2px 6px;
  text-align: center;
  font-size: 12px;
  color: #0e2108;
  border: 1.2px solid #4b5a32;
  background: #eef5d8;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.5;
}
.status-btn:hover { background: #efe6bd; }

.popup-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99;
}
.popup-box {
  width: 300px;
  max-height: 460px;
  overflow-y: auto;
  background: #d8ecbe;
  border: 2px solid #2a2a1e;
  padding: 20px 22px;
  color: #0e2108;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}
.popup-box h3 {
  margin-bottom: 12px;
  font-size: 22px;
  letter-spacing: 2px;
}
.popup-content {
  font-size: 16px;
  line-height: 1.8;
  margin-bottom: 18px;
}
.popup-subtitle {
  font-weight: 700;
  margin-bottom: 4px;
}

.btn {
  border: 1.5px solid #4b5a32;
  background: transparent;
  color: #2f3f22;
  padding: 9px 22px;
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 1px;
}
.btn:hover { background: rgba(26,58,106,0.08); }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn-row { display: flex; justify-content: space-between; align-items: flex-end; margin-top: auto; }
.btn-row.single { justify-content: flex-end; }

/* colors */
.hl-gold {
  color: #f0b800;
  font-weight: 600;
}

.hl-blue {
  color: #9944dd;
  font-weight: 600;
}

.stat-gold {
  color: #dd2200;
  font-weight: 700;
}

.stat-blue {
  color: #00a8d8;
  font-weight: 700;
}

/* title */
.title-text { font-size: 28px; letter-spacing: 6px; color: #1e2e12; font-weight: 700; }
.loading-text { font-size: 22px; color: #1e2e12; letter-spacing: 3px; }

/* intro body */
.intro-body { font-size: 15px; line-height: 2; color: #1a2410; text-align: justify; width: 100%; }

/* name select */
.name-section-title { font-size: 14px; color: #1e2e12; margin-bottom: 6px; letter-spacing: 1px; }
.name-grid {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin-bottom: 10px; max-height: 80px; overflow-y: auto;
}
.name-grid::-webkit-scrollbar { width: 3px; }
.name-grid::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); }
.name-chip {
  border: 1px solid #3a5a2a; background: transparent;
  color: #1a2e0e; padding: 3px 9px; font-size: 13px;
  font-family: inherit; cursor: pointer; border-radius: 2px;
}
.name-chip.selected { background: #3a5a2a; color: #e8f5d8; }
.name-chip:hover:not(.selected) { background: rgba(58,90,42,0.1); }
.name-preview {
  border: 1px solid #2a4a1a; background: rgba(255,255,255,0.3);
  padding: 7px 12px; font-size: 17px; color: #1a2e0e;
  margin-bottom: 8px; min-height: 36px; letter-spacing: 2px;
}
.name-preview.conflict { color: #c02020; font-size: 13px; }
.manual-input-wrap { display: none; margin-bottom: 8px; }
.manual-input-wrap.visible { display: flex; gap: 8px; align-items: center; }
.manual-input {
  border: 1px solid #3a5a2a; background: rgba(255,255,255,0.5);
  padding: 6px 10px; font-size: 15px; font-family: inherit;
  color: #1a2e0e; flex: 1; outline: none;
}

/* char intro */
.char-intro { font-size: 15px; line-height: 2.1; color: #1a2410; text-align: justify; width: 100%; }
.attr-panel {
  background: rgba(255,255,255,0.25); border: 1px solid #3a5a2a;
  padding: 10px 14px; font-size: 14px; color: #1a2e0e; line-height: 1.9; width: 100%;
}


/* home exploration */
.map-title {
  position: absolute;
  left: 12px;
  top: 12px;
  max-width: 145px;
  font-size: 15px;
  line-height: 1.25;
  font-weight: 700;
  color: #10240c;
  white-space: normal;
}

.time-badge {
  position: absolute;
  right: 12px;
  top: 12px;
  max-width: 155px;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 700;
  color: #10240c;
  text-align: right;
  white-space: normal;
}
.map-desc { position:absolute; left:28px; top:72px; right:28px; font-size:16px; line-height:1.55; color:#10240c; }
.home-map { position:relative; width:100%; height:100%; min-height:240px; }
.map-svg { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; z-index:1; }
.map-line { stroke:#4b5a32; stroke-width:1.5; opacity:.85; }
.map-node, .npc-chip-map {
  position:absolute; transform:translate(-50%,-50%);
  min-width:74px; min-height:34px; padding:3px 10px;
  border:1.5px solid #4b5a32; background:#d8ecbe;
  color:#0e2108; font-family:inherit; font-size:18px; font-weight:600;
  cursor:pointer; z-index:2;
}
.npc-chip-map {
  background:#efe6bd;
  font-size:16px;
  min-height:30px;
  white-space:nowrap;
}

.npc-chip-map:hover {
  background:#f7efcd;
}
.map-node.active { background:#b7bca8; border-color:#4a5e3a; color:#1a2410; }
.map-node:hover, .npc-chip-map:hover { background:#edf6df; }
.home-log { width:100%; font-size:17px; line-height:1.8; color:#10240c; }
.home-log .warn { color:#ffaa00; font-weight:700; }
.home-actions { display:flex; gap:10px; flex-wrap:wrap; align-items:flex-end; margin-top:auto; }
.home-btn { border:1.5px solid #1a3a6a; background:transparent; color:#1a3a6a; padding:8px 16px; font-size:15px; font-family:inherit; cursor:pointer; }
.home-btn:hover {
  background: #eef5d8;
  border-color: #6f7f4f;
  color: #2f3a22;
}
.npc-card-title { font-size:18px; font-weight:700; margin-bottom:16px; }
.npc-card-body { font-size:16px; line-height:1.9; }



/* special mood */
.mood-chip {
  display: inline-block;
  border: 1px solid #b98520;
  background: #efe6bd;
  color: #6a3f00;
  padding: 1px 6px;
  margin: 0 4px 4px 0;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  cursor: pointer;
}
.mood-chip:hover { background: #fff1bf; }
.mood-empty { color: #607050; }
.special-mood-desc { line-height: 1.9; color: #10240c; }
.effect-plus { color: #ffaa00; font-weight: 700; }
.effect-minus { color: #c64a38; font-weight: 700; }
.panel-line { margin-bottom: 4px; }

.text-link {
  border: none;
  background: transparent;
  color: #1688ff;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  padding: 0;
}

.text-link:hover {
  text-decoration: underline;
}
/* palace map */
.palace-map-scene { position: relative; }
.palace-time-badge { right: 66px; }
.palace-map-desc { right: 58px; }
.palace-side-actions {
  position: absolute;
  right: 8px;
  top: 48px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 5;
}
.palace-side-btn {
  border: 1.5px solid #4b5a32;
  background: #eef5d8;
  color: #10240c;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  padding: 4px 6px;
  cursor: pointer;
  min-width: 42px;
}
.palace-side-btn:hover { background: #efe6bd; }
.palace-mini-map {
  position: absolute;
  width: 250px;
  height: 130px;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 2;
}
.palace-map-chip {
  border: 1.5px solid #4b5a32;
  background: #d8ecbe;
  color: #0e2108;
  font-family: inherit;
  font-size: 14px;
  padding: 4px 9px;
  cursor: pointer;
}
.palace-map-chip.active { background: #efe6bd; color: #1a3a6a; }
.palace-map-chip:hover { background: #edf6df; }
.palace-popup-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.palace-popup-btn {
  padding: 6px 10px;
  font-size: 14px;
}

.palace-header {
  position: absolute;
  left: 0px;
  right: 78px;
  top: 15px;
  text-align: left;
  color: #10240c;
  font-weight: 400;
  line-height: 1.45;
  z-index: 3;
}

.palace-date {
  font-size: 15px;
  font-weight: 400;
}

.palace-place {
  font-size: 15px;
  font-weight: 400;
  margin-top: 2px;
}

.palace-mini-map .map-node {
  min-width: 52px;
  min-height: 30px;
  padding: 2px 6px;
  font-size: 14px;
}

.palace-mini-map .map-line {
  stroke-width: 0.7;
  opacity: 0.65;
}

.hl-outfit {
  color: #58b4df;
  font-weight: 600;
}



.top-panel.title-bg {
  border-bottom: 0 !important;
}

.top-panel.title-bg + .bottom-panel {
  border-top: 0 !important;
}

.top-panel.title-bg + .bottom-panel .btn {
  background: rgba(218, 238, 194, 0.88);
  color: #20361f;
  border: 2px solid #314728;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(20, 40, 18, 0.22);
}

.top-panel.title-bg + .bottom-panel .btn:hover {
  background: rgba(236, 248, 220, 0.95);
}


.item-chip {
  border: 1px solid #9a6f2d;
  background: rgba(239, 226, 180, 0.55);
  color: #5a3b12;
  padding: 2px 8px;
  margin: 0 4px 4px 0;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  cursor: pointer;
}

.item-chip:hover {
  background: rgba(255, 241, 191, 0.85);
}

.item-category {
  color: #607050;
  font-size: 13px;
}

.item-tag {
  display: inline-block;
  border: 1px solid #b6a56a;
  background: rgba(245, 238, 200, 0.55);
  color: #6a4c18;
  padding: 1px 6px;
  margin: 0 4px 4px 0;
  font-size: 12px;
}


.bottom-panel {
  position: relative;
  overflow: visible;
}

.bust-avatar {
  position: absolute;
  right: 26px;
  top: -125px;
  width: 170px;
  pointer-events: none;
  z-index: 5;
}

.game-wrap {
  position: relative;
}

.fixed-bust-avatar {
  position: absolute;
  right: 28px;
  top: 520px; /* 先用这个，之后按你屏幕微调 */
  width: 155px;
  pointer-events: none;
  z-index: 8;
}

.fixed-bust-avatar.hidden {
  display: none;
}


.bottom-panel {
  position: relative;
  overflow: hidden;
}

.game-wrap.avatar-on .bottom-panel::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: 2px;
  width: 180px;
  height: 180px;
  background-image: url("assets/avatar-girl.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: right bottom;
  pointer-events: none;
  z-index: 2;
}

.bottom-panel .home-log,
.bottom-panel .home-actions,
.bottom-panel .btn-row {
  position: relative;
  z-index: 3;
}