:root {
  --ink: #11131a;
  --muted: #707681;
  --red: #d0192b;
  --red2: #f33a49;
  --blue: #0d3d78;
  --blue2: #1a6bd6;
  --green: #1b8f63;
  --paper: rgba(255,255,255,.74);
  --line: rgba(17,19,26,.09);
  --shadow: 0 24px 80px rgba(20,25,38,.14), 0 8px 24px rgba(20,25,38,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 48% 20%, #fff 0, #f7f8fb 42%, #edf0f5 100%);
  overflow-x: hidden;
}
button, a { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.aurora { position: fixed; border-radius: 999px; filter: blur(90px); opacity: .16; pointer-events: none; }
.aurora-a { width: 540px; height: 540px; left: -180px; top: -180px; background: #e81e36; animation: driftA 13s ease-in-out infinite alternate; }
.aurora-b { width: 620px; height: 620px; right: -210px; bottom: -260px; background: #1b64bd; animation: driftB 16s ease-in-out infinite alternate; }
.grain { position: fixed; inset: 0; pointer-events: none; opacity: .22; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.055'/%3E%3C/svg%3E"); }
@keyframes driftA { to { transform: translate(90px, 60px) scale(1.08); } }
@keyframes driftB { to { transform: translate(-70px, -45px) scale(.96); } }

.stage { position: relative; min-height: 100vh; display: flex; flex-direction: column; padding: 22px clamp(20px, 4vw, 64px) 18px; }
.glass { background: var(--paper); border: 1px solid rgba(255,255,255,.9); box-shadow: var(--shadow); backdrop-filter: blur(22px) saturate(140%); -webkit-backdrop-filter: blur(22px) saturate(140%); }
.topbar { min-height: 76px; border-radius: 22px; padding: 12px 16px 12px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand {
  display: block;
  height: 52px;
  width: auto;
  max-width: min(650px, 68vw);
  object-fit: contain;
}

/* 仅电脑/大屏放大 Logo，不改变顶部框的布局尺寸 */
@media (min-width: 721px) {
  .brand {
    transform: scale(2);
    transform-origin: left center;
  }
}
.top-actions { display: flex; align-items: center; gap: 12px; flex: none; }
.sync-chip { display: inline-flex; align-items: center; gap: 8px; color: #58606c; font-size: 13px; white-space: nowrap; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: #c5cad2; box-shadow: 0 0 0 4px rgba(197,202,210,.18); }
.sync-chip.online .sync-dot { background: #24a36f; box-shadow: 0 0 0 4px rgba(36,163,111,.13); }
.sync-chip.offline .sync-dot { background: #dc3545; box-shadow: 0 0 0 4px rgba(220,53,69,.13); }
.ghost-btn, .close-btn { border: 0; background: rgba(255,255,255,.72); color: #272b33; border-radius: 13px; cursor: pointer; transition: .2s ease; }
.ghost-btn { padding: 10px 14px; display: flex; gap: 7px; align-items: center; box-shadow: inset 0 0 0 1px rgba(17,19,26,.07); }
.ghost-btn:hover { transform: translateY(-1px); background: #fff; }
.icon-list { font-size: 18px; line-height: 1; }

.hero { width: min(980px, 100%); margin: auto; display: flex; flex-direction: column; align-items: center; padding: 34px 0 28px; }
.eyebrow { display: flex; align-items: center; gap: 10px; color: #6d7380; letter-spacing: .12em; font-size: 11px; font-weight: 700; }
.eyebrow i { display: block; width: 4px; height: 4px; border-radius: 50%; background: var(--red); }
h1 { margin: 10px 0 2px; font-size: clamp(34px, 5.2vw, 68px); letter-spacing: -.04em; line-height: 1.08; font-weight: 850; }
.subline { margin: 7px 0 28px; color: var(--muted); font-size: 15px; letter-spacing: .07em; }

.roll-card { width: min(820px, 100%); min-height: 400px; border-radius: 34px; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.roll-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--red), #ed6672 42%, var(--blue) 72%, #4d88cf); }
.roll-card::after { content: ""; position: absolute; width: 270px; height: 270px; border-radius: 50%; right: -130px; top: 72px; border: 1px solid rgba(13,61,120,.11); box-shadow: 0 0 0 38px rgba(13,61,120,.025), 0 0 0 76px rgba(13,61,120,.018); pointer-events: none; }
.corner-label { position: absolute; left: 26px; top: 24px; color: #979da7; font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.student-area { flex: 1; min-height: 265px; display: grid; place-items: center; padding: 68px 28px 28px; position: relative; z-index: 1; }
.idle-state { text-align: center; color: #666d79; }
.idle-orbit { width: 88px; height: 88px; margin: 0 auto 20px; position: relative; border: 1px solid rgba(18,28,45,.09); border-radius: 50%; }
.idle-orbit::before, .idle-orbit::after { content: ""; position: absolute; inset: 13px; border: 1px solid rgba(18,28,45,.07); border-radius: 50%; }
.idle-orbit::after { inset: 27px; }
.idle-orbit span { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--red); left: calc(50% - 4px); top: -4px; transform-origin: 4px 48px; animation: spin 3.8s linear infinite; }
.idle-orbit span:nth-child(2) { background: var(--blue); animation-duration: 5.2s; animation-direction: reverse; transform-origin: 4px 48px; }
.idle-orbit span:nth-child(3) { width: 5px; height: 5px; background: #a2a8b1; animation-duration: 7s; }
@keyframes spin { to { transform: rotate(360deg); } }
.idle-title { color: #2f343c; font-size: 20px; font-weight: 750; }
.idle-help { margin-top: 7px; font-size: 13px; }
.student-state { text-align: center; width: 100%; animation: pop .38s cubic-bezier(.2,.85,.25,1.25); }
.student-state.shuffle { filter: blur(1.1px); transform: scale(.98); opacity: .72; }
.hidden { display: none !important; }
@keyframes pop { from { transform: translateY(12px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.number-badge { width: max-content; margin: 0 auto 16px; padding: 6px 11px; border-radius: 999px; background: rgba(13,61,120,.07); color: var(--blue); font-size: 11px; letter-spacing: .08em; font-weight: 800; }
.student-name { font-size: clamp(58px, 8.4vw, 104px); font-weight: 860; line-height: .95; letter-spacing: .06em; text-shadow: 0 5px 30px rgba(17,19,26,.08); }
.student-pinyin { margin-top: 14px; font-size: clamp(14px, 2vw, 20px); line-height: 1.2; letter-spacing: .20em; font-weight: 650; color: #6e7580; }
.attendance-label { margin-top: 20px; font-size: 13px; color: #8b919b; letter-spacing: .08em; }
.attendance-label.success { color: var(--green); font-weight: 700; }
.attendance-label.danger { color: var(--red); font-weight: 700; }

.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 0 24px 24px; position: relative; z-index: 2; }
.status-btn { height: 78px; border: 0; border-radius: 20px; display: flex; align-items: center; justify-content: center; gap: 14px; cursor: pointer; transition: transform .17s ease, box-shadow .17s ease, opacity .17s ease; }
.status-btn:not(:disabled):hover { transform: translateY(-2px); }
.status-btn:not(:disabled):active { transform: translateY(1px) scale(.99); }
.status-btn:disabled { cursor: not-allowed; opacity: .38; filter: grayscale(.4); }
.status-btn.present { color: #126445; background: linear-gradient(135deg, rgba(48,187,132,.13), rgba(255,255,255,.8)); box-shadow: inset 0 0 0 1px rgba(27,143,99,.12); }
.status-btn.absent { color: #9f2430; background: linear-gradient(135deg, rgba(224,54,70,.10), rgba(255,255,255,.8)); box-shadow: inset 0 0 0 1px rgba(208,25,43,.11); }
.status-icon { font-size: 34px; line-height: 1; font-weight: 500; width: 36px; }
.status-btn span:last-child { display: grid; text-align: left; gap: 3px; }
.status-btn b { font-size: 16px; }
.status-btn small { font-size: 10px; opacity: .58; font-weight: 600; }
.card-footer { border-top: 1px solid var(--line); min-height: 48px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; color: #8b919a; font-size: 11px; letter-spacing: .03em; }
.history-count { font-weight: 700; color: #777e89; }

.draw-btn { margin-top: 22px; min-width: 248px; height: 62px; border: 0; border-radius: 19px; color: white; background: linear-gradient(120deg, #b91525, #e22638 54%, #bd1728); box-shadow: 0 17px 34px rgba(197,25,42,.24), inset 0 1px 0 rgba(255,255,255,.24); cursor: pointer; font-size: 16px; font-weight: 800; letter-spacing: .04em; display: inline-flex; align-items: center; justify-content: center; gap: 11px; position: relative; overflow: hidden; transition: .18s ease; }
.draw-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 20px 40px rgba(197,25,42,.3), inset 0 1px 0 rgba(255,255,255,.24); }
.draw-btn:active:not(:disabled) { transform: translateY(1px); }
.draw-btn:disabled { opacity: .52; cursor: not-allowed; box-shadow: none; }
.draw-shine { position: absolute; inset: -120% auto -120% -28%; width: 25%; background: rgba(255,255,255,.2); transform: rotate(18deg); animation: shine 3.8s ease-in-out infinite; }
@keyframes shine { 0%, 65% { left: -32%; } 100% { left: 132%; } }
.draw-icon { font-size: 19px; }
kbd { margin-left: 3px; border: 1px solid rgba(255,255,255,.27); border-bottom-width: 2px; border-radius: 7px; padding: 3px 7px; font-size: 9px; background: rgba(255,255,255,.10); font-weight: 650; }
.hint { margin-top: 10px; color: #9ba0aa; font-size: 11px; }
.footer-note { text-align: center; color: #a3a8b1; font-size: 9px; font-weight: 750; letter-spacing: .17em; }

.toast { position: fixed; left: 50%; bottom: 30px; z-index: 80; transform: translate(-50%, 20px); padding: 11px 16px; border-radius: 12px; color: white; background: rgba(17,19,26,.88); box-shadow: 0 10px 30px rgba(0,0,0,.2); font-size: 13px; opacity: 0; pointer-events: none; transition: .22s ease; backdrop-filter: blur(14px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.drawer { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.drawer.open { pointer-events: auto; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(17,19,26,.17); opacity: 0; transition: .28s ease; backdrop-filter: blur(3px); }
.drawer-panel { position: absolute; top: 12px; bottom: 12px; right: 12px; width: min(430px, calc(100vw - 24px)); border-radius: 28px; padding: 24px; transform: translateX(calc(100% + 30px)); transition: .34s cubic-bezier(.2,.8,.2,1); overflow: auto; }
.drawer.open .drawer-backdrop { opacity: 1; }
.drawer.open .drawer-panel { transform: none; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.drawer-kicker { color: var(--red); font-size: 9px; font-weight: 850; letter-spacing: .16em; }
.drawer h2 { margin: 5px 0 0; font-size: 28px; letter-spacing: -.03em; }
.close-btn { width: 38px; height: 38px; font-size: 25px; line-height: 1; }
.close-btn:hover { background: white; }
.stat-grid { margin: 22px 0 26px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.stat-grid > div { background: rgba(255,255,255,.66); border: 1px solid rgba(17,19,26,.06); border-radius: 17px; padding: 15px 13px; display: grid; gap: 4px; }
.stat-grid strong { font-size: 25px; letter-spacing: -.04em; }
.stat-grid span { font-size: 10px; color: #8d939d; }
.drawer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 10px; color: #6d7380; font-size: 12px; font-weight: 750; }
.export-link { color: var(--blue); text-decoration: none; font-size: 11px; }

.drawer-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.clear-btn { border: 0; border-radius: 999px; height: 32px; padding: 0 14px; cursor: pointer; font-size: 11px; font-weight: 800; color: white; background: linear-gradient(135deg, #a01523, #d91c2f); box-shadow: 0 10px 22px rgba(208,25,43,.16); transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease; }
.clear-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 26px rgba(208,25,43,.22); }
.clear-btn:active:not(:disabled) { transform: translateY(1px); }
.clear-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.history-list { display: grid; gap: 8px; }
.history-item { display: grid; grid-template-columns: auto 1fr auto; gap: 11px; align-items: center; background: rgba(255,255,255,.63); border: 1px solid rgba(17,19,26,.055); border-radius: 16px; padding: 12px 13px; }
.history-avatar { width: 37px; height: 37px; border-radius: 12px; display: grid; place-items: center; background: rgba(13,61,120,.07); color: var(--blue); font-size: 13px; font-weight: 850; }
.history-main b { display: block; font-size: 14px; }
.history-main small { color: #959ba4; font-size: 10px; }
.history-side { text-align: right; display: grid; gap: 4px; justify-items: end; }
.status-tag { width: max-content; padding: 4px 7px; border-radius: 999px; font-size: 9px; font-weight: 850; }
.status-tag.present { color: #147250; background: rgba(36,163,111,.11); }
.status-tag.absent { color: #a32834; background: rgba(208,25,43,.09); }
.history-time { color: #a4a9b1; font-size: 9px; }
.empty-history { text-align: center; padding: 40px 10px; color: #a0a5ae; font-size: 12px; }

.confetti { position: fixed; z-index: 100; width: 8px; height: 13px; border-radius: 2px; pointer-events: none; animation: confetti-fall 900ms cubic-bezier(.1,.65,.35,1) forwards; }
@keyframes confetti-fall { to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; } }

@media (max-width: 720px) {
  .drawer-toolbar { align-items: flex-start; flex-direction: column; }
  .drawer-actions { width: 100%; justify-content: flex-start; }
  .stage { padding: 12px 12px 14px; }
  .topbar { min-height: 64px; border-radius: 18px; padding: 10px 12px; }
  .brand { max-width: 80vw; height: 60px; transform: none; }
  .sync-chip { display: none; }
  .ghost-btn { padding: 9px 11px; }
  .hero { padding: 27px 0 20px; }
  .eyebrow { font-size: 9px; }
  .subline { margin-bottom: 20px; }
  .roll-card { min-height: 365px; border-radius: 26px; }
  .student-area { min-height: 238px; padding-top: 62px; }
  .action-row { gap: 9px; padding: 0 14px 15px; }
  .status-btn { height: 70px; border-radius: 17px; gap: 8px; }
  .status-icon { font-size: 28px; width: 28px; }
  .status-btn b { font-size: 14px; }
  .status-btn small { display: none; }
  .card-footer { padding: 0 16px; }
  .draw-btn { margin-top: 16px; height: 58px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}


/* --- Ambient side animations: neural network + multimodal orbit --- */
.ambient-visual {
  position: fixed;
  top: 145px;
  bottom: 74px;
  width: clamp(150px, calc((100vw - 900px) / 2), 360px);
  z-index: 0;
  pointer-events: none;
  opacity: .78;
  transition: opacity .35s ease, filter .35s ease, transform .55s cubic-bezier(.2,.8,.2,1);
}
.ambient-left { left: 24px; }
.ambient-right { right: 24px; display: grid; place-items: center; }
.ambient-caption {
  position: absolute;
  top: 2px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(74,82,96,.46);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .18em;
}
.ambient-caption span { width: 18px; height: 1px; background: currentColor; }
.ambient-right .ambient-caption { left: auto; right: 10px; }
#neuralCanvas { width: 100%; height: 100%; display: block; }
.scan-line {
  position: absolute;
  inset: 13% 8% auto 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(208,25,43,.36), transparent);
  box-shadow: 0 0 14px rgba(208,25,43,.18);
  animation: sideScan 6.4s ease-in-out infinite;
}
@keyframes sideScan { 0%,100% { transform: translateY(0); opacity: 0; } 12% { opacity: .8; } 78% { opacity: .42; } 92% { transform: translateY(430px); opacity: 0; } }

.modality-system {
  position: relative;
  width: min(300px, 92%);
  aspect-ratio: 1;
  border-radius: 50%;
  filter: drop-shadow(0 15px 45px rgba(13,61,120,.06));
}
.orbit-ring { position: absolute; border-radius: 50%; border: 1px solid rgba(13,61,120,.12); }
.orbit-ring::before, .orbit-ring::after { content:""; position:absolute; border-radius:50%; background:var(--blue2); box-shadow: 0 0 16px rgba(26,107,214,.38); }
.orbit-ring-a { inset: 12%; animation: orbitSpin 22s linear infinite; }
.orbit-ring-a::before { width:5px; height:5px; left: 22%; top:-3px; }
.orbit-ring-a::after { width:4px; height:4px; right: 9%; bottom: 21%; background:var(--red); }
.orbit-ring-b { inset: 27%; border-style: dashed; border-color: rgba(208,25,43,.12); animation: orbitSpin 16s linear infinite reverse; }
.orbit-ring-b::before { width:4px; height:4px; right:17%; top:-2px; background:var(--red); }
.orbit-ring-b::after { width:3px; height:3px; left:5%; bottom:29%; }
@keyframes orbitSpin { to { transform: rotate(360deg); } }
.core-chip {
  position:absolute; left:50%; top:50%; transform:translate(-50%,-50%);
  width:76px; height:76px; border-radius:24px;
  display:grid; place-content:center; text-align:center;
  background: linear-gradient(145deg, rgba(255,255,255,.92), rgba(239,244,252,.76));
  border: 1px solid rgba(13,61,120,.13);
  box-shadow: 0 18px 42px rgba(13,61,120,.09), inset 0 1px 0 rgba(255,255,255,.9);
}
.core-chip::after { content:""; position:absolute; inset:9px; border-radius:18px; border:1px solid rgba(208,25,43,.10); }
.core-chip b { position:relative; z-index:1; color:var(--blue); font-size:23px; letter-spacing:-.04em; }
.core-chip small { position:relative; z-index:1; margin-top:2px; color:var(--red); font-size:7px; font-weight:850; letter-spacing:.18em; }
.modality-node {
  position:absolute; width:54px; height:54px; border-radius:18px;
  display:grid; place-content:center; text-align:center;
  background:rgba(255,255,255,.68); border:1px solid rgba(13,61,120,.10);
  box-shadow:0 10px 28px rgba(13,61,120,.07); backdrop-filter:blur(12px);
  animation: nodeFloat 4.6s ease-in-out infinite;
}
.modality-node b { color:var(--blue); font-size:10px; letter-spacing:.05em; }
.modality-node small { color:#8c95a4; font-size:8px; margin-top:2px; }
.node-text { left: 7%; top: 15%; animation-delay:-1.2s; }
.node-image { right: 2%; top: 25%; animation-delay:-2.4s; }
.node-audio { left: 0; bottom: 22%; animation-delay:-3.1s; }
.node-video { right: 9%; bottom: 8%; animation-delay:-.7s; }
.node-code { left: 42%; top: -1%; animation-delay:-3.8s; }
@keyframes nodeFloat { 0%,100% { transform:translateY(0) rotate(0); } 50% { transform:translateY(-8px) rotate(1.5deg); } }
.data-pulse { position:absolute; width:6px; height:6px; border-radius:50%; background:var(--blue2); box-shadow:0 0 14px rgba(26,107,214,.55); opacity:0; }
.pulse-a { left:19%; top:28%; animation:dataPulseA 3.6s ease-in-out infinite; }
.pulse-b { right:21%; top:37%; background:var(--red); animation:dataPulseB 4.1s ease-in-out infinite 1.1s; }
.pulse-c { left:30%; bottom:25%; animation:dataPulseC 4.6s ease-in-out infinite 2s; }
@keyframes dataPulseA { 0%,22%{opacity:0;transform:translate(0,0) scale(.6)} 35%{opacity:1} 80%{opacity:.8} 100%{opacity:0;transform:translate(75px,58px) scale(1.2)} }
@keyframes dataPulseB { 0%,20%{opacity:0;transform:translate(0,0) scale(.6)} 34%{opacity:1} 100%{opacity:0;transform:translate(-62px,34px) scale(1.15)} }
@keyframes dataPulseC { 0%,18%{opacity:0;transform:translate(0,0) scale(.6)} 32%{opacity:1} 100%{opacity:0;transform:translate(58px,-58px) scale(1.1)} }

body.drawing .ambient-left { opacity:1; filter:saturate(1.28) brightness(1.04); transform:translateX(12px) scale(1.03); }
body.drawing .ambient-right { opacity:1; filter:saturate(1.26) brightness(1.03); transform:translateX(-12px) scale(1.03); }
body.drawing .orbit-ring-a { animation-duration:4.2s; }
body.drawing .orbit-ring-b { animation-duration:3.2s; }
body.drawing .modality-node { animation-duration:1.6s; }
body.drawing .core-chip { box-shadow:0 0 0 12px rgba(13,61,120,.035), 0 0 58px rgba(13,61,120,.18); }
body.feedback-present .ambient-visual { filter:saturate(1.3) brightness(1.06); }
body.feedback-absent .ambient-visual { filter:saturate(1.2) contrast(1.03); }

@media (max-width: 1180px) {
  .ambient-visual { display:none; }
}
@media (prefers-reduced-motion: reduce) {
  .orbit-ring, .modality-node, .data-pulse, .scan-line { animation:none !important; }
}