* { box-sizing: border-box; margin: 0; padding: 0; }
:root { --bg:#0f1220; --card:#1a1f35; --line:#2a3150; --txt:#e8ebf5; --muted:#9aa3c0; }
html,body { height:100%; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background:var(--bg); color:var(--txt); }

.overlay { position:fixed; inset:0; background:rgba(8,10,20,.92); display:flex; align-items:center; justify-content:center; z-index:50; }
.hidden { display:none !important; }
.lock-box, .setup-box { background:var(--card); border:1px solid var(--line); border-radius:18px; padding:32px; width:min(94vw,440px); text-align:center; max-height:92vh; overflow-y:auto; }
.lock-logo { font-size:48px; }
h1 { font-size:24px; margin:8px 0; }
h2 { font-size:20px; margin-bottom:10px; }
.muted { color:var(--muted); }
.tiny { font-size:12px; color:var(--muted); margin-top:6px; }
input, select, textarea { width:100%; padding:11px 12px; margin:6px 0 12px; border-radius:10px; border:1px solid var(--line); background:#0e1226; color:var(--txt); font-size:15px; font-family:inherit; }
label { text-align:left; display:block; font-size:13px; color:var(--muted); margin-top:4px; }
button { cursor:pointer; border:none; border-radius:10px; padding:11px 16px; font-size:15px; font-weight:600; background:#5b6cff; color:#fff; transition:.15s; }
button:hover { filter:brightness(1.1); }
button.ghost { background:transparent; border:1px solid var(--line); color:var(--muted); font-weight:500; }
button.mini { padding:6px 10px; font-size:12px; background:#2a3150; }
.adv { text-align:left; margin:8px 0; font-size:13px; color:var(--muted); }
.adv summary { cursor:pointer; }

#app { display:flex; flex-direction:column; height:100vh; }
header { display:flex; align-items:center; gap:14px; padding:12px 18px; background:var(--card); border-bottom:1px solid var(--line); }
.brand { font-weight:700; font-size:17px; }
.who { flex:1; color:var(--muted); font-size:14px; }

.layout { flex:1; display:flex; min-height:0; }
.sidebar { width:230px; padding:14px; background:#12162b; overflow-y:auto; border-right:1px solid var(--line); }
.group-title { font-size:12px; color:var(--muted); margin:14px 4px 8px; letter-spacing:1px; }
.agent { display:flex; align-items:center; gap:10px; width:100%; text-align:left; background:var(--card); border:1px solid var(--line); border-left:4px solid var(--c); border-radius:12px; padding:10px 12px; margin-bottom:8px; color:var(--txt); }
.agent:hover { border-color:var(--c); }
.agent.active { background:var(--c); }
.agent .emoji { font-size:22px; }
.agent b { font-size:14px; }
.agent i { font-size:11px; color:var(--muted); font-style:normal; }
.agent.active i { color:rgba(255,255,255,.85); }

.stage { flex:1; display:flex; min-width:0; }
.chat-wrap { flex:1; display:flex; flex-direction:column; min-width:0; }
.chat { flex:1; overflow-y:auto; padding:18px; display:flex; flex-direction:column; gap:12px; }
.msg { max-width:82%; padding:11px 14px; border-radius:14px; line-height:1.6; white-space:pre-wrap; word-break:break-word; }
.msg.user { align-self:flex-end; background:#5b6cff; color:#fff; border-bottom-right-radius:4px; }
.msg.bot { align-self:flex-start; background:var(--card); border:1px solid var(--line); border-bottom-left-radius:4px; }
.msg.bot.thinking { color:var(--muted); }
.chat-img { max-width:240px; border-radius:10px; margin-top:6px; display:block; border:1px solid var(--line); }
.msg .cap { font-size:12px; color:var(--muted); margin-top:4px; }

.composer { display:flex; gap:8px; padding:12px 16px; border-top:1px solid var(--line); background:var(--card); align-items:flex-end; flex-wrap:wrap; }
.composer textarea { flex:1; min-width:200px; resize:none; height:48px; margin:0; }
.icon-btn { padding:10px 12px; font-size:18px; background:#2a3150; }
.send-col { display:flex; flex-direction:column; gap:6px; }
.send-col button { white-space:nowrap; }
.thumb-box { width:100%; display:flex; gap:8px; flex-wrap:wrap; }
.thumb { position:relative; }
.thumb img { width:64px; height:64px; object-fit:cover; border-radius:8px; border:1px solid var(--line); }
.thumb .x { position:absolute; top:-6px; right:-6px; background:#e23b3b; border-radius:50%; width:18px; height:18px; font-size:11px; line-height:18px; text-align:center; cursor:pointer; }

.game { width:290px; padding:16px; background:#12162b; border-left:1px solid var(--line); overflow-y:auto; }
.tabs { display:flex; gap:6px; margin-bottom:12px; }
.tab { flex:1; padding:7px; font-size:13px; background:#1a1f35; color:var(--muted); border:1px solid var(--line); }
.tab.active { background:#5b6cff; color:#fff; }
.game-head { display:flex; justify-content:space-between; align-items:center; font-weight:700; margin-bottom:10px; }
.rank { background:var(--card); border:1px solid var(--line); border-radius:10px; padding:10px; margin-bottom:12px; font-size:14px; }
.frag-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:14px; }
.frag { border:2px dashed var(--line); border-radius:12px; padding:12px 8px; text-align:center; font-size:12px; color:var(--muted); position:relative; min-height:84px; }
.frag .ico { font-size:26px; display:block; margin-bottom:4px; filter:grayscale(1); opacity:.5; }
.frag.got { border-style:solid; color:var(--txt); }
.frag.got .ico { filter:none; opacity:1; }
.frag button { position:absolute; bottom:6px; left:50%; transform:translateX(-50%); padding:4px 10px; font-size:11px; }
.frag.got button { display:none; }
.ticket { background:linear-gradient(135deg,#3a2a00,#5a3d00); border:1px solid #d4a017; border-radius:10px; padding:10px; text-align:center; font-size:15px; margin-bottom:12px; }
.game-actions { display:flex; gap:8px; margin-bottom:8px; }

.timer-box { text-align:center; margin-bottom:10px; }
.time { font-size:34px; font-weight:700; font-variant-numeric:tabular-nums; }
.timer-btns { display:flex; gap:6px; justify-content:center; margin-top:6px; }
.super-tip { background:var(--card); border:1px solid var(--line); border-radius:10px; padding:9px; font-size:12px; color:var(--muted); margin-bottom:12px; }
.check-title { font-size:13px; font-weight:700; margin:6px 0; }
.check { display:flex; align-items:center; gap:8px; font-size:13px; color:var(--txt); margin:6px 0; }
.check input { width:auto; margin:0; }
.cam { width:100%; margin-top:8px; }
#camStatus { min-height:14px; }

.alert-box { background:var(--card); border:1px solid var(--line); border-radius:18px; padding:28px 32px; text-align:center; width:min(90vw,360px); }
#alertIcon { font-size:44px; }
#alertText { margin:12px 0 18px; font-size:16px; line-height:1.6; }

@media (max-width:820px){
  .sidebar{ width:64px; }
  .agent span:last-child{ display:none; }
  .game{ width:210px; }
}

/* ===== 儿童主题皮肤 ===== */
body.theme-commander { --bg:#190a2b; --card:#281047; --line:#46246b; --txt:#f8e9ff; --muted:#c6a3e8; --accent:#ff5fa2; --accent2:#a855f7; }
body.theme-guide    { --bg:#08131f; --card:#102132; --line:#1d3a4e; --txt:#eaf7ff; --muted:#9cc3d8; --accent:#ff7a18; --accent2:#00d4ff; }

/* 头部随主题变色 */
body.theme-commander header, body.theme-guide header { border-bottom:2px solid var(--accent); }
body.theme-commander .brand { color:var(--accent); }
body.theme-guide .brand { color:var(--accent); }

/* 角色英雄横幅 */
#hero { display:flex; align-items:center; gap:14px; padding:14px 18px; border-radius:16px; margin-bottom:12px; position:relative; overflow:hidden; box-shadow:0 6px 22px rgba(0,0,0,.35); }
body.theme-commander #hero { background:linear-gradient(120deg,#ff5fa2,#a855f7); }
body.theme-guide    #hero { background:linear-gradient(120deg,#ff7a18,#00d4ff); }
#hero::after { content:'✦'; position:absolute; right:-8px; top:-18px; font-size:120px; opacity:.18; transform:rotate(15deg); }
.hero-avatar { font-size:48px; filter:drop-shadow(0 0 12px rgba(255,255,255,.85)); animation:bob 2.6s ease-in-out infinite; }
@keyframes bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-7px)} }
.hero-info { color:#fff; }
.hero-name { font-size:21px; font-weight:800; letter-spacing:1px; }
.hero-sub { font-size:13px; opacity:.92; margin-top:2px; }
.hero-deco { margin-left:auto; font-size:26px; filter:drop-shadow(0 0 8px rgba(255,255,255,.6)); animation:spin 9s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* 聊天气泡主题色 */
body.theme-commander .msg.bot { border-color:var(--accent); }
body.theme-guide    .msg.bot { border-color:var(--accent); }
body.theme-commander .msg.user { background:linear-gradient(135deg,#ff5fa2,#a855f7); }
body.theme-guide    .msg.user { background:linear-gradient(135deg,#ff7a18,#00d4ff); }

/* 段位进度条 */
.rank-bar { height:10px; border-radius:6px; background:var(--line); overflow:hidden; margin:-4px 0 12px; }
.rank-fill { height:100%; width:0; border-radius:6px; background:linear-gradient(90deg,var(--accent),var(--accent2)); transition:width .5s ease; box-shadow:0 0 10px var(--accent); }

/* 碎片格子发光 + 领取按钮主题化 + 合成闪光 */
.frag { background:var(--card); transition:.2s; }
.frag .ico { animation:none; }
.frag.got { border-style:solid; border-color:var(--accent); color:var(--txt); box-shadow:0 0 18px var(--accent); background:linear-gradient(160deg, rgba(255,255,255,.08), transparent); }
.frag.got .ico { filter:none; opacity:1; animation:pop .5s ease; }
@keyframes pop { 0%{transform:scale(.4)} 70%{transform:scale(1.25)} 100%{transform:scale(1)} }
.frag button { background:var(--accent); color:#fff; border:none; }
.frag .lock { position:absolute; top:5px; right:8px; font-size:13px; opacity:.55; }
.frag-grid.flash { animation:glow .7s ease; }
@keyframes glow { 0%{filter:brightness(1)} 50%{filter:brightness(1.5) drop-shadow(0 0 14px var(--accent))} 100%{filter:brightness(1)} }

/* AI 创造券票券 */
.ticket { background:linear-gradient(135deg,var(--accent),var(--accent2)); color:#fff; border:none; font-weight:700; box-shadow:0 0 16px var(--accent); }
