/* ============================================================
 * 人生模拟器 样式表
 * ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0b1026; }
body { font-family: "Microsoft YaHei", "PingFang SC", sans-serif; color: #e8e8f0; }

#game { position: absolute; inset: 0; }
#game canvas { display: block; }
#ui-root { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
#ui-root > * { pointer-events: auto; }

.hidden { display: none !important; }
.dim { color: #9aa0b5; font-size: 12px; }
hr { border: none; border-top: 1px solid #3a4157; margin: 8px 0; }
b { color: #ffd76a; }

/* ---------- HUD ---------- */
#hud { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; }
#hud > * { pointer-events: auto; }
.hud-card { background: rgba(15, 18, 32, 0.82); border: 1px solid #3a4157; border-radius: 10px; padding: 10px 12px; backdrop-filter: blur(6px); font-size: 13px; }
#hud-left { width: 300px; }
#hud-name { color: #ffd76a; margin-bottom: 6px; font-size: 12px; }
.bars .bar { display: flex; align-items: center; gap: 6px; margin: 3px 0; font-size: 12px; }
.bars .bar span { width: 32px; color: #9aa0b5; }
.track { flex: 1; height: 8px; background: #232941; border-radius: 4px; overflow: hidden; }
.fill { height: 100%; border-radius: 4px; transition: width .3s; }
.fill.mood { background: linear-gradient(90deg, #e84393, #fd79a8); }
.fill.energy { background: linear-gradient(90deg, #0984e3, #74b9ff); }
.fill.health { background: linear-gradient(90deg, #00b894, #55efc4); }
#hud-money { margin-top: 6px; font-weight: bold; color: #ffe08a; }
#hud-fame { color: #9aa0b5; font-size: 12px; }
#hud-clock { font-size: 15px; color: #fff; min-width: 150px; text-align: center; }
#hud-right { display: flex; flex-direction: column; gap: 5px; }

#hint-bar { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); background: rgba(15,18,32,.85); border: 1px solid #3a4157; padding: 8px 18px; border-radius: 20px; font-size: 14px; color: #ffe08a; }
#hint-bar:empty { display: none; }

#log-feed { position: absolute; right: 10px; top: 190px; width: 300px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
.log-line { background: rgba(15,18,32,.75); border-left: 3px solid #ffd76a; padding: 5px 8px; font-size: 12px; border-radius: 0 6px 6px 0; }

/* ---------- 按钮 ---------- */
.btn { background: #2a3350; color: #e8e8f0; border: 1px solid #4a5578; padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 14px; transition: all .15s; font-family: inherit; }
.btn:hover { background: #38426b; border-color: #6a78a8; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: #4361ee; border-color: #5a7bff; }
.btn.primary:hover { background: #5a7bff; }
.btn.danger { background: #6b2a35; border-color: #a84255; }
.btn.danger:hover { background: #8a3545; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.big { padding: 12px 28px; font-size: 16px; }

/* ---------- 模态 ---------- */
#modal-layer { position: absolute; inset: 0; background: rgba(5, 8, 18, .6); display: flex; align-items: center; justify-content: center; z-index: 50; pointer-events: auto; }
.modal-panel { background: linear-gradient(180deg, #171c30, #10141f); border: 1px solid #4a5578; border-radius: 14px; padding: 18px 22px; width: min(640px, 92vw); max-height: 86vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.modal-title { font-size: 17px; color: #ffd76a; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.modal-title .dim { font-size: 12px; font-weight: normal; }
.modal-body { font-size: 14px; line-height: 1.75; }
.modal-body p { margin: 4px 0; }
.modal-actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row { display: flex; gap: 12px; align-items: center; }
.center { text-align: center; }
.subtitle { font-size: 20px; color: #74b9ff; margin-bottom: 12px; }
.title-screen { font-size: 30px !important; justify-content: center; color: #ffd76a; text-shadow: 0 0 30px rgba(255, 215, 106, .4); }

.portrait { border-radius: 10px; border: 1px solid #4a5578; image-rendering: pixelated; vertical-align: middle; }

/* ---------- toast ---------- */
#toast-box { position: absolute; top: 120px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; z-index: 60; }
.toast { background: rgba(30, 36, 60, .95); border: 1px solid #5a7bff; padding: 8px 20px; border-radius: 20px; font-size: 14px; animation: pop .25s; transition: opacity .4s; }
.toast.out { opacity: 0; }
@keyframes pop { from { transform: scale(.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- 菜单 ---------- */
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.menu-btn { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 10px 14px; }
.menu-btn .dim { font-size: 11px; }

/* ---------- 人际/背包/商城 ---------- */
.rel-list, .shop-list { display: flex; flex-direction: column; gap: 8px; }
.rel-row, .inv-row { display: flex; align-items: center; gap: 10px; background: rgba(30, 36, 60, .5); border: 1px solid #3a4157; border-radius: 10px; padding: 8px 12px; }
.rel-info { flex: 1; font-size: 13px; line-height: 1.5; }
.att { color: #fd79a8; font-size: 13px; }
.tag { background: #2a3350; border-radius: 4px; padding: 1px 8px; font-size: 12px; color: #9aa0b5; }
.tag.gold { background: #6b5410; color: #ffd76a; }
.tag.price { background: #1d3a2a; color: #7bed9f; }
.rel-row .btn { flex-shrink: 0; }
.inv-row { align-items: flex-start; }
.inv-row .btn { margin-left: auto; }
.log-p { max-height: 55vh; overflow-y: auto; }

.npc-actions { grid-template-columns: 1fr 1fr; display: grid; }
.npc-actions .btn { margin: 0; }

/* ---------- 话题 ---------- */
.topic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.topic { text-align: left; padding: 8px 10px; font-size: 13px; line-height: 1.5; }
.topic:disabled { opacity: .35; }

/* ---------- 捏人 ---------- */
.crt-body { min-height: 220px; }
.crt-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.crt-row label { width: 60px; color: #9aa0b5; font-size: 13px; }
.crt-row input[type="text"], .crt-row input:not([type]) { flex: 0 0 160px; background: #1c2135; border: 1px solid #4a5578; color: #fff; padding: 7px 10px; border-radius: 8px; font-size: 14px; }
.crt-row input[type="range"] { flex: 0 0 180px; accent-color: #5a7bff; }
.st-v { width: 24px; text-align: center; font-size: 16px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 6px; border: 2px solid #4a5578; cursor: pointer; }
.swatch.sel { border-color: #ffd76a; box-shadow: 0 0 8px rgba(255, 215, 106, .6); }
.pill { background: #2a3350; border: 1px solid #4a5578; color: #e8e8f0; padding: 6px 14px; border-radius: 16px; cursor: pointer; font-size: 13px; font-family: inherit; }
.pill.sel { background: #4361ee; border-color: #5a7bff; }
.pill.wide { min-width: 150px; text-align: left; line-height: 1.4; }
.pill-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }

/* ---------- AI 聊天 ---------- */
.ai-chat-box { display: flex; flex-direction: column; gap: 8px; }
.ai-history { max-height: 200px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; background: rgba(20,25,42,.6); border: 1px solid #3a4157; border-radius: 10px; padding: 10px; }
.ai-msg { max-width: 85%; padding: 6px 10px; border-radius: 10px; font-size: 13px; line-height: 1.5; }
.ai-msg.npc { background: #2a3350; align-self: flex-start; }
.ai-msg.me { background: #4361ee; align-self: flex-end; }
.ai-msg .src { display: block; font-size: 10px; color: #9aa0b5; margin-top: 2px; }
.ai-input-row { display: flex; gap: 8px; }
.ai-input-row input { flex: 1; background: #1c2135; border: 1px solid #4a5578; color: #fff; padding: 8px 12px; border-radius: 8px; font-size: 14px; font-family: inherit; }

/* ---------- 模型横幅 ---------- */
#llm-banner { position: absolute; top: 0; left: 0; right: 0; background: #6b3a10; border-bottom: 1px solid #a86b2b; color: #ffd7a0; padding: 6px 16px; font-size: 13px; text-align: center; z-index: 40; }
#llm-banner a { color: #ffd76a; text-decoration: underline; cursor: pointer; }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #3a4157; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
