* { box-sizing: border-box; }
body { margin:0; font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif; background:#f4f6fa; color:#222; }
#app { min-height:100vh; }
.muted { color:#8a93a6; font-size:13px; }
button { cursor:pointer; border-radius:8px; border:1px solid #d4d9e2; background:#fff; padding:9px 16px; font-size:14px; }
button.primary { background:#3b6ef5; color:#fff; border-color:#3b6ef5; }
button.primary:hover { background:#2f5cd8; }
button.ghost { background:#fff; }
button.mini { padding:3px 9px; font-size:12px; border-radius:6px; }
button.danger { color:#d94545; border-color:#f0c0c0; }
input,textarea,select { font:inherit; padding:9px 11px; border:1px solid #d4d9e2; border-radius:8px; width:100%; }
textarea { resize:vertical; font-family:inherit; }
input:focus,textarea:focus,select:focus { outline:2px solid #b9ccff; border-color:#3b6ef5; }

/* 登录 */
.auth-wrap { max-width:360px; margin:8vh auto; background:#fff; padding:34px 30px; border-radius:16px; box-shadow:0 10px 40px rgba(40,60,100,.10); display:flex; flex-direction:column; gap:10px; }
.auth-wrap h1 { font-size:21px; margin:0; }
.auth-wrap label { font-size:13px; color:#666; margin-top:6px; }
.auth-wrap .switch { margin-top:8px; text-align:center; font-size:13px; color:#3b6ef5; text-decoration:none; }

/* 页面 */
.page { max-width:1000px; margin:0 auto; padding:20px 18px 60px; }
.bar { display:flex; align-items:center; gap:14px; margin-bottom:18px; }
.bar-title { display:flex; align-items:baseline; gap:8px; font-size:18px; }
.card { background:#fff; border-radius:14px; padding:18px 20px; box-shadow:0 2px 12px rgba(40,60,100,.06); margin-bottom:18px; }
.card h3 { margin:14px 0 8px; font-size:15px; }
.card h3:first-child { margin-top:0; }
.row { display:flex; gap:10px; align-items:center; margin:8px 0; flex-wrap:wrap; }
.row input[type=number] { width:90px; }
.new-class { display:flex; gap:10px; align-items:center; flex-wrap:wrap; background:#fff; padding:14px 18px; border-radius:14px; margin-bottom:16px; box-shadow:0 2px 12px rgba(40,60,100,.06); }
.new-class input[type=text] { flex:1; min-width:180px; }
.new-class input[type=number] { width:100px; }

/* 班级卡片 */
.card-list { display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:14px; }
.class-card { background:#fff; border-radius:14px; padding:18px; box-shadow:0 2px 12px rgba(40,60,100,.06); transition:transform .12s, box-shadow .12s; display:flex; flex-direction:column; gap:12px; }
.class-card:hover { transform:translateY(-2px); box-shadow:0 8px 22px rgba(40,60,100,.12); }
.class-info { flex:1; }
.class-actions { display:flex; gap:8px; }
.class-actions .primary { flex:1; }
.class-actions .ghost { flex:0 0 auto; }
/* 删除班级：弱色小字号，只在管理页 */
button.danger-text { color:#c08484; border-color:transparent; background:transparent; font-size:12px; padding:2px 8px; }
button.danger-text:hover { color:#b03a3a; background:#fdf3f3; }
.class-name { font-size:17px; font-weight:600; margin-bottom:6px; }
.class-meta { font-size:13px; color:#8a93a6; }

/* 分组 */
.group-card { background:#fff; border-radius:14px; padding:14px 16px; margin-bottom:14px; box-shadow:0 2px 12px rgba(40,60,100,.06); }
.group-card.pool { background:#fbfbfd; border:1px dashed #d4d9e2; box-shadow:none; }
.group-head { display:flex; align-items:center; gap:10px; margin-bottom:8px; }
.grp-name { font-size:16px; font-weight:600; width:auto; flex:0 1 200px; border:none; background:transparent; padding:4px 6px; }
.grp-name:focus { background:#fff; border:1px solid #3b6ef5; }
.tag { background:#eef3ff; color:#3b6ef5; font-size:12px; padding:2px 9px; border-radius:20px; }
.member-list { list-style:none; margin:0; padding:0; }
.member { display:flex; align-items:center; gap:10px; padding:6px 4px; border-bottom:1px solid #f2f4f8; font-size:14px; }
.member:last-child { border-bottom:none; }
.member .sid { color:#8a93a6; font-size:12px; min-width:78px; }
.member .sname { font-weight:500; }
.member .spacer { flex:1; }
.member select { width:auto; padding:5px 8px; font-size:13px; }

/* toast */
.toast { position:fixed; left:50%; bottom:34px; transform:translateX(-50%); background:#333; color:#fff; padding:11px 22px; border-radius:10px; font-size:14px; box-shadow:0 6px 24px rgba(0,0,0,.25); z-index:200; animation:pop .2s; }
.toast.err { background:#d94545; }
.toast.ok { background:#2e9e5b; }
@keyframes pop { from { opacity:0; transform:translate(-50%,10px); } to { opacity:1; transform:translate(-50%,0); } }

/* v1.3: 弹窗 */
.modal-overlay { position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,.4); z-index:100; display:flex; align-items:center; justify-content:center; }
.modal { background:#fff; border-radius:16px; padding:28px 24px; max-width:420px; width:90%; max-height:80vh; overflow-y:auto; position:relative; box-shadow:0 12px 48px rgba(40,60,100,.2); }
.modal h3 { margin:0 0 12px; font-size:16px; }
.modal label { display:block; font-size:13px; color:#666; margin:8px 0 4px; }
.modal-close { position:absolute; top:12px; right:12px; border:none; background:transparent; font-size:18px; cursor:pointer; color:#999; padding:4px 8px; }
.modal-close:hover { color:#333; }
/* v1.4: 冷宫样式 */
.trash-section { margin-top:24px; padding:16px; background:#fafafa; border:1px dashed #ccc; border-radius:12px; }
.trash-header { margin-bottom:12px; font-size:14px; display:flex; align-items:center; gap:6px; }
.trash-item { display:flex; align-items:center; gap:12px; padding:10px 12px; background:#fff; border-radius:8px; margin-bottom:8px; border:1px solid #eee; flex-wrap:wrap; }
.trash-name { font-weight:600; font-size:14px; min-width:100px; }
.trash-remain { font-size:12px; color:#e67700; background:#fff8e1; padding:2px 8px; border-radius:4px; }
.settings-section { border-top:1px solid #eee; padding-top:16px; margin-top:16px; }
.settings-section:first-child { border-top:none; padding-top:0; margin-top:0; }

/* v1.3: 认证页链接 */
.auth-links { display:flex; justify-content:space-between; margin-top:8px; }
.auth-links .switch { font-size:13px; color:#3b6ef5; text-decoration:none; }

/* v1.3: 删除按钮 */
button.danger { color:#d94545; border-color:#f0c0c0; }
button.danger:hover { background:#fef0f0; }
/* 批4修补：弱样式重置PIN按钮 + PIN状态标记 */
button.mini.weak { color:#8a93a6; border-color:#e2e6ed; background:transparent; font-size:11px; padding:2px 8px; }
button.mini.weak:hover { color:#3b6ef5; border-color:#b9ccff; background:#f5f8ff; }
.pin-badge { font-size:11px; color:#8a93a6; padding:2px 6px; border-radius:4px; background:#f1f3f7; margin-right:4px; }
.spacer { flex:1; }

/* ============================================================
   批2: 课堂游戏视图
   ============================================================ */
.room-page { min-height: 100vh; }
.room-bar { position: sticky; top: 0; z-index: 30; gap: 10px; }
.bar-title { display: flex; flex-direction: column; gap: 2px; }
.big-touch { min-height: 44px; }
.room-board { display: flex; gap: 18px; padding: 22px 28px; align-items: flex-start; }
.room-main { flex: 1; min-width: 0; }
.rank-aside { width: 280px; flex: none; background: #fff; border: 1px solid #e7e2f5; border-radius: 16px; padding: 14px; box-shadow: 0 6px 20px rgba(74, 46, 124, .06); }
.rank-aside h3 { margin: 4px 0 10px; color: #4a2e7c; }
.rank-row { display: flex; align-items: center; gap: 8px; padding: 9px 6px; border-bottom: 1px dashed #eee6fa; }
.rank-no { width: 26px; height: 26px; flex: none; border-radius: 50%; background: #e7e2f5; color: #4a2e7c; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.rank-no.rank-1 { background: #ffd34e; color: #7a5400; }
.rank-no.rank-2 { background: #cfd8e3; color: #3a4656; }
.rank-no.rank-3 { background: #e8b98a; color: #6b3f17; }
.rank-body { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.rank-name { font-weight: 700; color: #2d1b4a; }
.rank-stat { font-weight: 800; color: #4a2e7c; white-space: nowrap; }
.rank-full { font-size: .82rem; color: #2b9e96; white-space: nowrap; }

.room-ctl { display: flex; gap: 18px; justify-content: center; margin-bottom: 16px; flex-wrap: wrap; }
.huge { font-size: 1.25rem; font-weight: 800; padding: 20px 34px; border-radius: 16px; border: none; cursor: pointer; box-shadow: 0 8px 22px rgba(74, 46, 124, .18); transition: transform .08s, box-shadow .08s; }
.huge:active { transform: translateY(2px); box-shadow: 0 3px 10px rgba(74, 46, 124, .18); }
.pick-random { background: linear-gradient(135deg, #7a5cff, #5b3fd6); color: #fff; }
.pick-manual { background: linear-gradient(135deg, #2bb6a3, #1d9584); color: #fff; }
.judge-correct { background: linear-gradient(135deg, #35c46f, #21a356); color: #fff; }
.judge-wrong { background: linear-gradient(135deg, #ff6b6b, #e0484f); color: #fff; }

.room-hint { text-align: center; min-height: 26px; margin-bottom: 14px; font-size: .95rem; }
.hint-student { font-weight: 800; color: #4a2e7c; margin-right: 8px; }
.hint-busy { color: #9a90b5; }

.bottle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.bottle-card { background: #fff; border: 2px solid #e7e2f5; border-radius: 18px; padding: 14px; text-align: center; box-shadow: 0 6px 18px rgba(74,46,124,.06); }
.bottle-card.neg { border-color: #ffb3b5; background: #fff6f6; }
.bottle-name { font-weight: 800; color: #4a2e7c; margin-bottom: 8px; }
.bottle-stage { position: relative; height: 150px; width: 84px; margin: 0 auto 8px; border: 3px solid #8d7fb8; border-radius: 14px 14px 20px 20px; background: #f7f4ff; overflow: hidden; display: flex; align-items: flex-end; }
.bottle-fill { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(180deg, #56c8f0, #2b9ed8); transition: height .5s ease; }
.bottle-num { position: relative; z-index: 2; width: 100%; text-align: center; font-size: 1.9rem; font-weight: 900; color: #2d1b4a; text-shadow: 0 1px 2px rgba(255,255,255,.7); padding-bottom: 52px; }
.bottle-card.neg .bottle-num { color: #c0392b; }
.bottle-meta { display: flex; flex-direction: column; gap: 3px; font-size: .8rem; color: #6b5f8a; }
.full-badge { color: #2b9e96; font-weight: 700; }
.round-tag { color: #8d7fb8; }

/* 抽盒流程浮层 */
.flow-overlay { position: fixed; inset: 0; background: rgba(30, 18, 54, .58); display: flex; align-items: center; justify-content: center; z-index: 150; padding: 24px; }
.flow-card { background: #fff; border-radius: 24px; padding: 32px 40px; min-width: 420px; max-width: 720px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.flow-student { font-size: 1.15rem; font-weight: 800; color: #4a2e7c; margin-bottom: 18px; }
.flow-q { font-size: 1.5rem; font-weight: 800; color: #2d1b4a; margin-bottom: 24px; }
.flow-actions { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }
.target-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.target-self { background: linear-gradient(135deg, #7a5cff, #5b3fd6); color: #fff; }
.target-other { background: linear-gradient(135deg, #ff9d5c, #f0762f); color: #fff; border: none; border-radius: 14px; padding: 16px; font-size: 1.05rem; font-weight: 800; cursor: pointer; }
.tg-sub { font-size: .82rem; font-weight: 600; opacity: .9; margin-top: 4px; }
.box-shake { font-size: 4.5rem; animation: boxshake .5s infinite; }
.box-open { font-size: 4.5rem; animation: popin .4s ease; }
@keyframes boxshake { 0%,100% { transform: rotate(-8deg) scale(1); } 50% { transform: rotate(8deg) scale(1.08); } }
@keyframes popin { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
.score-fly { font-size: 4rem; font-weight: 900; margin: 8px 0; animation: scorefly .7s ease; }
.score-fly.pos { color: #21a356; }
.score-fly.neg { color: #e0484f; }
.score-fly.zero { color: #8d7fb8; }
@keyframes scorefly { 0% { transform: translateY(30px) scale(.4); opacity: 0; } 60% { transform: translateY(-6px) scale(1.1); } 100% { transform: translateY(0) scale(1); opacity: 1; } }
.flow-detail { color: #4a3a6a; margin: 12px 0; display: flex; flex-direction: column; gap: 6px; }
.celebrate-text { font-size: 1.3rem; font-weight: 800; color: #d8841a; margin: 10px 0; }
.advance-text { font-size: 1.15rem; font-weight: 800; color: #7a5cff; margin: 8px 0; }

/* 人工抢答弹窗 */
.manual-modal { max-width: 520px; width: 92vw; max-height: 80vh; overflow: hidden; display: flex; flex-direction: column; }
.manual-list { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 6px; }
.manual-group { font-weight: 800; color: #7a5cff; margin-top: 10px; border-bottom: 2px solid #eee6fa; padding-bottom: 4px; }
.manual-item { text-align: left; background: #f7f4ff; border: 1px solid #e7e2f5; border-radius: 10px; padding: 12px 14px; font-size: 1.05rem; cursor: pointer; }
.manual-item:focus, .manual-item:hover { background: #ece4ff; outline: 2px solid #7a5cff; }

/* 彩带 */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 300; overflow: hidden; }
.confetti { position: absolute; top: -12px; width: 10px; height: 16px; border-radius: 2px; animation: confall 2.4s linear forwards; }
@keyframes confall { 0% { transform: translateY(-20px) rotate(0); opacity: 1; } 100% { transform: translateY(105vh) rotate(720deg); opacity: .9; } }

/* ============================================================
   批2: 投影大屏
   ============================================================ */
.projector-body { background: #140b2e; }
.projector { min-height: 100vh; color: #f2eeff; padding: 28px 40px; display: flex; flex-direction: column; gap: 20px; }
.pj-title { font-size: 2.6rem; font-weight: 900; text-align: center; color: #ffd34e; }
.pj-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 26px; flex: 1; align-content: center; }
.pj-card { background: #241650; border: 3px solid #4a3389; border-radius: 26px; padding: 22px; text-align: center; }
.pj-card.neg { border-color: #c0525a; background: #3a1630; }
.pj-gname { font-size: 2.4rem; font-weight: 900; color: #cbb8ff; margin-bottom: 14px; }
.pj-bottle-wrap { position: relative; height: 300px; width: 150px; margin: 0 auto 14px; border: 5px solid #6b54a8; border-radius: 22px; background: #1c1140; overflow: hidden; display: flex; align-items: flex-end; }
.pj-bottle-fill { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(180deg, #56c8f0, #2b9ed8); transition: height .6s ease; }
.pj-bottle-num { position: relative; z-index: 2; width: 100%; text-align: center; font-size: 4rem; font-weight: 900; color: #fff; padding-bottom: 110px; text-shadow: 0 2px 6px rgba(0,0,0,.5); }
.pj-meta { font-size: 1.4rem; font-weight: 700; color: #9a86d8; }
.pj-rank { display: flex; gap: 26px; justify-content: center; flex-wrap: wrap; font-size: 1.7rem; font-weight: 800; color: #ffd34e; }
.pj-rank-item { background: #241650; padding: 10px 22px; border-radius: 999px; }
.pj-banner { position: fixed; top: 40%; left: 0; right: 0; text-align: center; font-size: 4rem; font-weight: 900; color: #ffd34e; opacity: 0; pointer-events: none; transition: opacity .3s; text-shadow: 0 4px 20px rgba(0,0,0,.6); }
.pj-banner.flash { opacity: 1; animation: bannerpulse 2.4s ease forwards; }
@keyframes bannerpulse { 0% { opacity: 0; transform: scale(.6); } 20% { opacity: 1; transform: scale(1.05); } 80% { opacity: 1; } 100% { opacity: 0; } }

/* 批2: 开始抢答按钮 */
.grab-answer { background: linear-gradient(135deg, #ff9500, #e67e00); color: #fff; }
.hint-grabbing { color: #ff9500; font-weight: 700; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

/* 批3: 报表页 */
.report-page .card { margin: 12px 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
.tbl th, .tbl td { border: 1px solid #e3e3ee; padding: 6px 10px; text-align: left; }
.tbl th { background: #f5f4fb; }
.tbl.mt { margin-top: 18px; }
.tbl tr.revoked td { color: #aaa; text-decoration: line-through; background: #fafafa; }
.pos { color: #1a9e57; }
.neg { color: #d33; }
.bar-chart { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.bar-item { display: flex; align-items: center; gap: 8px; }
.bar-label { width: 90px; font-size: 13px; text-align: right; flex: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bar-label.wide { width: 160px; }
.bar-track { flex: 1; background: #f0eef8; border-radius: 6px; height: 20px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; min-width: 2px; transition: width .3s; }
.bar-fill.g { background: linear-gradient(90deg, #7b5cff, #9d86ff); }
.bar-fill.s { background: linear-gradient(90deg, #17a2b8, #5cc6d6); }
.bar-num { width: 36px; font-size: 13px; font-weight: 700; flex: none; }

/* 批4：学生手机加入卡 */
.join-card .join-row { display:flex; gap:24px; align-items:center; flex-wrap:wrap; }
.join-card .join-left { display:flex; flex-direction:column; align-items:center; gap:8px; }
.join-card .join-right { flex:1; min-width:240px; }
.join-card .join-qr { padding:8px; background:#fff; border:1px solid #e2e8f0; border-radius:10px; }
.join-code-line { font-size:14px; display:flex; align-items:center; }
/* 批4修补：投影大屏「扫码加入」按钮与浮层 */
.pj-qr-btn { position: fixed; bottom: 24px; right: 24px; padding: 12px 22px; font-size: 1.6rem; font-weight: 700; background: #ffd34e; color: #241650; border: none; border-radius: 999px; box-shadow: 0 6px 20px rgba(0,0,0,.4); z-index: 50; cursor: pointer; }
.pj-qr-btn:hover { background: #ffc200; }
.pj-qr-overlay { position: fixed; inset: 0; background: rgba(10, 5, 30, .85); display: flex; align-items: center; justify-content: center; z-index: 100; }
.pj-qr-overlay.hidden { display: none; }
.pj-qr-card { background: #fff; padding: 36px 48px; border-radius: 28px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
