:root {
  --bg: #f6f2ea;
  --card: #ffffff;
  --ink: #2a2834;
  --muted: #7a7584;
  --line: #e8e1d4;
  --primary: #4b55c8;
  --primary-soft: #eceefe;
  --accent: #e67e33;
  --accent-soft: #fdf0e4;
  --ok: #2e9d6a;
  --danger: #d14848;
  --danger-soft: #fdeeee;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(60, 45, 20, .06), 0 1px 2px rgba(60, 45, 20, .05);
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--primary); }
[v-cloak] { display: none; }

/* ---------- 基础组件 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 16px; cursor: pointer; transition: .15s; white-space: nowrap; }
.btn:hover { border-color: #cfc6b5; background: #fffdf8; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--danger); border-color: #f0c9c9; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.04); }
.btn.sm { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn.lg { padding: 12px 26px; font-size: 16px; border-radius: 12px; }
.btn.block { width: 100%; }
.input, .textarea, .select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: #fff; outline: none; transition: .15s; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.textarea.code { font-family: "Cascadia Mono", Consolas, "Microsoft YaHei", monospace; font-size: 13px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid #efe9de; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); white-space: nowrap; }
.tag.orange { background: var(--accent-soft); color: #b85d1c; }
.tag.gray { background: #f0ede7; color: var(--muted); }
.tag.red { background: var(--danger-soft); color: var(--danger); }
.tag.green { background: #e6f5ed; color: var(--ok); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.pre { white-space: pre-wrap; }
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; overflow: hidden; flex-shrink: 0; color: #fff; font-weight: 600; user-select: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.persona { font-family: "STKaiti", "KaiTi", "楷体", serif; font-weight: 700; }
.chip { border: 1px solid var(--line); background: #fff; padding: 5px 14px; border-radius: 99px; cursor: pointer; font-size: 14px; transition: .15s; }
.chip:hover { border-color: #cfc6b5; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

.toast-host { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 9px 18px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.18); font-size: 14px; animation: pop .2s; max-width: 90vw; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes pop { from { transform: translateY(-8px); opacity: 0; } }

.modal-mask { position: fixed; inset: 0; background: rgba(30, 25, 20, .42); display: flex; align-items: center; justify-content: center; z-index: 500; padding: 16px; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; padding: 22px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 860px; }
.modal h3 { margin: 0 0 6px; }

/* ---------- 学生端：欢迎 & 登录 ---------- */
.welcome { max-width: 1080px; margin: 0 auto; padding: 40px 20px 60px; }
.hero { text-align: center; margin-bottom: 30px; }
.hero .logo { width: 84px; height: 84px; margin: 0 auto 10px; }
.hero h1 { font-size: 34px; margin: 0; letter-spacing: 2px; }
.hero p { color: var(--muted); margin: 6px 0 0; font-size: 16px; }
.welcome-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 22px; align-items: start; }
.welcome-grid .card { padding: 22px 24px; }
.welcome-grid h2 { font-size: 18px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.intro-text { white-space: pre-wrap; line-height: 1.85; }
.privacy-box { white-space: pre-wrap; font-size: 13.5px; line-height: 1.8; background: #faf8f3; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; max-height: 210px; overflow: auto; color: #4d4a55; }
.agree { display: flex; gap: 8px; align-items: flex-start; margin: 14px 0; font-size: 14px; cursor: pointer; }
.agree input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--primary); }
.teacher-strip { display: flex; gap: 10px; margin: 16px 0 4px; flex-wrap: wrap; }
.teacher-strip .t { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); width: 58px; }

/* ---------- 学生端：通用布局 ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(246, 242, 234, .9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1120px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; cursor: pointer; white-space: nowrap; }
.me-btn span { white-space: nowrap; }
.brand svg { width: 30px; height: 30px; }
.me-btn { display: flex; align-items: center; gap: 8px; border: none; background: none; cursor: pointer; padding: 4px 8px; border-radius: 99px; }
.me-btn:hover { background: rgba(0,0,0,.05); }
.page { max-width: 1120px; margin: 0 auto; padding: 24px 20px 120px; }
.page h2.title { font-size: 22px; margin: 0 0 4px; }
.demo-banner { background: var(--accent-soft); color: #9b4f17; border: 1px solid #f5d6b8; padding: 9px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 18px; }

.start-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 18px 0 30px; }
.start-card { padding: 24px; cursor: pointer; transition: .2s; display: flex; gap: 18px; align-items: center; }
.start-card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(60,45,20,.1); }
.start-card .icon { width: 64px; height: 64px; border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 32px; flex-shrink: 0; }
.start-card h3 { margin: 0 0 4px; font-size: 18px; }
.start-card p { margin: 0; color: var(--muted); font-size: 14px; }

.room-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.room-item { padding: 14px 16px; cursor: pointer; display: flex; gap: 12px; align-items: center; transition: .15s; }
.room-item:hover { border-color: #d9cfbd; }
.room-item .stack { display: flex; }
.room-item .stack .avatar + .avatar { margin-left: -12px; }
.room-item .info { flex: 1; min-width: 0; }
.room-item .info .t { font-weight: 600; }
.room-item .info .l { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 学生端：圆桌配置 ---------- */
.step { padding: 20px 22px; margin-bottom: 16px; }
.step-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.step-head .num { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; transform: translateY(-2px); }
.step-head h3 { margin: 0; font-size: 17px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters .sep { width: 1px; background: var(--line); margin: 0 4px; }
.teacher-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
.teacher-card { position: relative; border: 2px solid var(--line); border-radius: 14px; padding: 16px 12px 12px; text-align: center; cursor: pointer; transition: .18s; background: #fff; }
.teacher-card:hover { transform: translateY(-2px); border-color: #d6ccb9; }
.teacher-card.on { border-color: var(--primary); background: var(--primary-soft); }
.teacher-card .name { font-weight: 700; font-size: 16px; margin-top: 8px; }
.teacher-card .desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-top: 4px; min-height: 38px; }
.teacher-card .tags { display: flex; gap: 4px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }
.teacher-card .badge { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.teacher-card .quote { font-size: 12px; color: #8b6a3e; margin-top: 6px; font-style: italic; }
.option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.option { border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; transition: .15s; background: #fff; }
.option:hover { border-color: #d6ccb9; }
.option.on { border-color: var(--primary); background: var(--primary-soft); }
.option .t { font-weight: 600; }
.option .d { font-size: 13px; color: var(--muted); line-height: 1.5; margin-top: 2px; }
.peer-option { display: flex; gap: 10px; align-items: center; }
.rec-banner { background: linear-gradient(120deg, #eef0ff, #fff3e6); border: 1px solid #dfe2fb; border-radius: 14px; padding: 14px 18px; margin-bottom: 16px; display: flex; gap: 12px; align-items: flex-start; }
.bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.95); backdrop-filter: blur(10px); border-top: 1px solid var(--line); z-index: 60; }
.bottom-bar-inner { max-width: 1120px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 12px; }
.bottom-bar .summary { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 对话（小圆 & 圆桌） ---------- */
.chat-page { max-width: 920px; margin: 0 auto; height: calc(100vh - 57px); height: calc(100dvh - 57px); display: flex; flex-direction: column; padding: 0 16px; }
.chat-head { padding: 12px 0 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chat-head .t { font-weight: 700; font-size: 17px; }
.messages { flex: 1; overflow-y: auto; padding: 10px 2px 16px; }
.msg { display: flex; gap: 10px; margin: 14px 0; align-items: flex-start; animation: pop .25s; }
.msg .body { max-width: min(78%, 620px); }
.msg .who { font-size: 12.5px; color: var(--muted); margin-bottom: 3px; display: flex; gap: 6px; align-items: center; }
.msg .bubble { background: #fff; border: 1px solid #ece5d8; border-radius: 4px 16px 16px 16px; padding: 10px 14px; white-space: pre-wrap; word-break: break-word; line-height: 1.75; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.msg.teacher .bubble { border-left: 3px solid var(--c, var(--primary)); }
.msg.peer .bubble { background: #fbfaf7; }
.msg.mine { flex-direction: row-reverse; }
.msg.mine .who { justify-content: flex-end; }
.msg.mine .bubble { background: var(--primary); color: #fff; border-color: var(--primary); border-radius: 16px 4px 16px 16px; }
.msg.classmate .bubble { background: #eef7f1; border-color: #d5ebdd; }
.typing::after { content: '▍'; animation: blink 1s infinite; color: var(--muted); margin-left: 2px; }
.dots span { display: inline-block; width: 6px; height: 6px; margin: 0 2px; background: #bbb; border-radius: 50%; animation: bounce 1.2s infinite; }
.dots span:nth-child(2) { animation-delay: .15s; } .dots span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }
.composer { padding: 10px 0 14px; }
.composer-box { display: flex; gap: 8px; align-items: flex-end; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 8px 8px 8px 14px; box-shadow: var(--shadow); }
.composer-box textarea { flex: 1; border: none; outline: none; resize: none; max-height: 140px; min-height: 24px; padding: 6px 0; background: transparent; line-height: 1.6; }
.composer .hint { font-size: 12px; color: var(--muted); margin-top: 6px; text-align: center; }
.risk-banner { background: var(--danger-soft); border: 1px solid #f3cccc; color: #8f2d2d; border-radius: 12px; padding: 10px 14px; font-size: 13.5px; margin: 6px 0; }
.rec-card { background: linear-gradient(135deg, #f3f4ff, #fff7ee); border: 1px solid #e0e3fb; border-radius: 16px; padding: 18px; margin: 14px 0; animation: pop .3s; }
.rec-card .teachers { display: flex; gap: 16px; margin: 10px 0; flex-wrap: wrap; }
.rec-card .teachers .t { display: flex; align-items: center; gap: 8px; font-weight: 600; }

/* 圆桌 */
.table-wrap { position: relative; height: 250px; margin: 4px 0 6px; flex-shrink: 0; }
.round-table { position: absolute; left: 50%; top: 50%; width: 58%; height: 46%; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(ellipse at 40% 35%, #d9ae78 0%, #b98550 55%, #9a6a3a 100%); box-shadow: inset 0 -6px 14px rgba(0,0,0,.18), 0 14px 26px rgba(90,60,25,.25), 0 0 0 7px #8a5d31; }
.round-table .center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; color: #fff8ee; text-shadow: 0 1px 2px rgba(0,0,0,.3); font-size: 13px; text-align: center; padding: 0 30px; }
.round-table .center b { font-size: 15px; letter-spacing: 2px; }
.seat { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 2px; transition: .2s; cursor: default; z-index: 2; }
.seat.clickable { cursor: pointer; }
.seat.clickable:hover { transform: translate(-50%, -50%) scale(1.06); }
.seat .nm { font-size: 12.5px; font-weight: 600; background: rgba(255,255,255,.92); padding: 0 8px; border-radius: 99px; white-space: nowrap; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seat .rl { font-size: 11px; color: var(--muted); }
.seat.speaking .avatar { animation: speak 1.1s infinite; }
@keyframes speak { 0%, 100% { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--c, var(--primary)); } 50% { box-shadow: 0 0 0 3px #fff, 0 0 0 10px color-mix(in srgb, var(--c, var(--primary)) 35%, transparent); } }
.speech-dot { position: absolute; top: -6px; right: -10px; background: #fff; border-radius: 10px; padding: 1px 5px; box-shadow: 0 1px 4px rgba(0,0,0,.15); }

/* 个人设置 */
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji-grid button { font-size: 24px; border: 2px solid transparent; background: #faf7f1; border-radius: 12px; padding: 4px 0; cursor: pointer; }
.emoji-grid button.on { border-color: var(--primary); background: var(--primary-soft); }
.tabs { display: flex; gap: 4px; background: #f2eee6; padding: 4px; border-radius: 10px; margin: 10px 0; }
.tabs button { flex: 1; border: none; background: none; padding: 6px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.tabs button.on { background: #fff; box-shadow: var(--shadow); font-weight: 600; }

/* ---------- 管理后台 ---------- */
.admin { display: flex; min-height: 100vh; }
.side { width: 220px; background: #26243a; color: #d6d4e6; flex-shrink: 0; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.side .brand { color: #fff; padding: 4px 8px 18px; }
.side .grp { font-size: 11.5px; color: #8885a3; margin: 14px 10px 6px; letter-spacing: 1px; }
.side a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 9px; color: inherit; text-decoration: none; font-size: 14.5px; cursor: pointer; }
.side a:hover { background: rgba(255,255,255,.06); }
.side a.on { background: #4b55c8; color: #fff; }
.main { flex: 1; min-width: 0; padding: 26px 30px 60px; }
.main h2 { margin: 0 0 4px; font-size: 22px; }
.main .sub { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { padding: 16px 18px; }
.stat .v { font-size: 28px; font-weight: 700; }
.stat .k { color: var(--muted); font-size: 13px; }
.tbl { width: 100%; border-collapse: collapse; background: #fff; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #f0ebe1; font-size: 14px; vertical-align: middle; }
.tbl th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: #fbf9f5; }
.tbl tr:hover td { background: #fdfcf9; }
.tbl-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid #efe9de; box-shadow: var(--shadow); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.setting-block { padding: 18px 20px; margin-bottom: 14px; }
.setting-block h4 { margin: 0; font-size: 15px; }
.setting-block .help { font-size: 13px; color: var(--muted); margin: 2px 0 8px; }
.provider-card { padding: 16px 18px; margin-bottom: 12px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.provider-card.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.transcript .msg .bubble { font-size: 14px; }
.bar { height: 8px; border-radius: 4px; background: var(--primary); }
.switch { position: relative; width: 38px; height: 22px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d5cfc4; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(16px); }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; padding: 30px; }

/* ---------- 手机适配 ---------- */
@media (max-width: 820px) {
  .welcome { padding: 24px 16px 40px; }
  .hero h1 { font-size: 26px; }
  .welcome-grid, .start-grid { grid-template-columns: 1fr; }
  .page { padding: 18px 16px 120px; }
  .topbar-inner { padding: 8px 16px; }
  .teacher-grid { grid-template-columns: repeat(2, 1fr); }
  .msg .body { max-width: 84%; }
  .table-wrap { height: 200px; }
  .round-table { width: 64%; height: 40%; }
  .room-list { grid-template-columns: 1fr; }
  .admin { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; }
  .side .grp { display: none; }
  .side .brand { width: 100%; padding-bottom: 6px; }
  .main { padding: 18px 16px 40px; }
  .form-grid { grid-template-columns: 1fr; }
  .emoji-grid { grid-template-columns: repeat(6, 1fr); }
}
